111 Commits

Author SHA1 Message Date
Mike McQuaid
d8a2cf9efc
Write tabs to bottle JSON, optionally not bottle
- Write a subset of the tab required for bottles as an annotation.
- Add option on new bottle creation to skip writing tab into bottle
  and instead add it (and other useful metadata) to bottle JSON.
- Read formula information and tab from bottle JSON.
- Write prettier JSON to disk.
- Don't write `HEAD` to tab; this duplicates `HOMEBREW_VERSION`.
- Allow `brew bottle` to use `--json` to generate JSON files from a
  local bottle file.
2021-03-31 09:43:37 +01:00
Bo Anderson
450bc4ab33
Fix brew style 2021-03-26 14:11:03 +00:00
Bo Anderson
1fba9b9b53
Prevent loading all non-Bundler gems 2021-02-26 18:23:48 +00:00
nandahkrishna
8e5451df2f
style: use parentheses for assignment in conditions 2021-02-12 18:33:37 +05:30
Mike McQuaid
36c292f278
cleanup: cleanup bootsnap files. 2021-02-02 12:34:15 +00:00
Mike McQuaid
15761a283d
cleanup: raise failures and handle later.
These are already handled and outputted as a group in `cmd/cleanup.rb`.

Fixes https://github.com/Homebrew/brew/issues/10379
2021-01-21 13:03:52 +00:00
Michka Popoff
5e91802470 checksum: simplify, use only sha256
We use only one sha type right now.

Needed for https://github.com/Homebrew/brew/pull/10186
2021-01-07 20:46:13 +01:00
Mike McQuaid
0d76400a80
cleanup: don't do stale check when passing --prune.
This speeds up `--prune` fairly considerably.

Before:
```
$ hyperfine --warmup 3 'brew cleanup --prune=365'
Benchmark #1: brew cleanup --prune=365
  Time (mean ± σ):     33.352 s ±  0.654 s    [User: 21.684 s, System: 6.458 s]
  Range (min … max):   31.901 s … 34.096 s    10 runs
```

After:
```
$ hyperfine --warmup 3 'brew cleanup --prune=365'
Benchmark #1: brew cleanup --prune=365
  Time (mean ± σ):      6.821 s ±  0.186 s    [User: 2.225 s, System: 3.926 s]
  Range (min … max):    6.578 s …  7.178 s    10 runs
```

Closes https://github.com/Homebrew/brew/pull/10177/
Fixes https://github.com/Homebrew/brew/issues/10172
2020-12-31 14:00:12 +00:00
Mike McQuaid
4f438f6e45
Merge pull request #9477 from MikeMcQuaid/cleanup_periodic_full_days
Add HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS environment variable
2020-12-10 12:57:08 +00:00
Mike McQuaid
adab0fbb41
cleanup: fix portable Ruby behaviour.
Better match the macOS behaviour in `ruby.sh`.

Fixes #9469
2020-12-09 11:50:45 +00:00
Mike McQuaid
5757777a6e
Add HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS environment variable
This allows customisation of how often the periodic cleanups are done.
2020-12-09 10:36:02 +00:00
Mike McQuaid
9216d8abe6
rubocop-rails: make fixes. 2020-12-02 10:43:04 +00:00
EricFromCanada
19a382570c cleanup.rb: ensure cache exists before touching .cleaned 2020-11-14 10:48:10 -05:00
Jonathan Chang
500908ee6f rubocop: fix Lint/NoReturnInBeginEndBlocks 2020-11-10 23:28:31 +11:00
EricFromCanada
3768b7a6e9 apidoc: update comment wording, punctuation, formatting 2020-11-06 00:21:02 -05:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Mike McQuaid
3d436d3664 Improve linkage cache linkage_cache_performance
- Use reference counting so nested `CacheStoreDatabase.use` share the
  same underlying database (rather than rereading it every time).
- Only write out the cache database file when it has changed.
- Cleanup cache database entries on formula or full `brew cleanup`.

Fixes #8690
2020-09-11 12:57:15 +01:00
Maxim Belkin
896c93b819 cleanup.rb: quiet down Ruby test 2020-09-03 17:24:25 +00:00
Maxim Belkin
a6d29894d9 cleanup: fix and reuse portable ruby logic.
Align the logic in `cleanup_portable_ruby` with that in `ruby.sh`.

Co-authored-by: Maxim Belkin <maxim.belkin@gmail.com>
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2020-09-03 09:43:41 +01:00
Mike McQuaid
8b97c27c21 brew style manual fixes 2020-09-01 14:26:45 +01:00
Mike McQuaid
3a91c37e66
Fix RuboCop checks. 2020-08-19 17:12:32 +01:00
Markus Reiter
5402500635 Refactor and document Cleanup. 2020-08-17 19:11:31 +02:00
Bo Anderson
3205ace13e cleanup: clean go_mod_cache 2020-07-20 15:30:33 +01:00
Mike McQuaid
4816e8320d
cleanup: check path exists before cleanup.
It may have been already cleaned up by an earlier step.
2020-07-10 09:32:27 +01:00
Mike McQuaid
f951ea83d4
Fix brew style. 2020-07-07 12:23:29 +01:00
Mike McQuaid
aa81982aba
brew style --fix 2020-06-02 09:49:23 +01:00
Mike McQuaid
4f75a77b08
Update deprecations
Add more deprecations, disable deprecations and remove disabled code.
2020-05-18 13:50:46 +01:00
Mike McQuaid
4da5c09c25
cleanup: tweak missing clean file behaviour.
Instead of cleaning every time if the file is missing: don't clean this
time, touch the file and clean when it's next needed.

Now that this feature has been around for longer this makes more sense
for existing installations and stops the first `brew install` run on a
new/test installation without this file always running a `brew cleanup`.

Also, fix up the use of a compat/deprecated method hit by tests by
this change.
2020-05-07 11:01:09 +01:00
Mike McQuaid
701c1811d5
cleanup: all configuring max age days.
Fixes #7320
2020-04-20 10:33:15 +01:00
Mike McQuaid
3381cbf5c7
Use Homebrew::EnvConfig. 2020-04-07 09:58:26 +01:00
Mike McQuaid
f59c596e4b
cleanup: fix portable ruby bundler removal logic.
Need to ensure portable rubies are removed last and pass more paramaters to
git clean.
2020-01-16 16:06:22 +00:00
Roger Hu
d27c5fb2cb Catalina upgrades causes Homebrew to break when you run brew cleanup. Catalina has Ruby 2.6 installed, so the portable Ruby version is not needed.
If you have /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby (for older OS X versions), then the cleanup tool will nuke everything in usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby. You will need to brew update-reset to get back the old packages.
2020-01-15 23:56:28 -08:00
Mike McQuaid
95a1c8570a
cleanup: rescue more cask errors.
This will avoid a wider degree of failures.
2019-11-06 15:25:29 +00:00
Issy Long
1f6168fe8a
Change regexp.match?(string) to string.match?(regexp) everywhere
- Only try to call `.match?` on strings that aren't nil.
2019-10-13 23:22:51 +01:00
Issy Long
b78028b9c2
Auto-fix Performance/RegexpMatch offenses 2019-10-13 16:04:26 +01:00
Mike McQuaid
ea0e7f6d62
cleanup: some speedup optimisations.
- avoid calling `rm_ds_store` multiple times when unnecessary
- use native Ruby method to remove `.DS_Store` files as it saves
  shelling out to `find` and is a bit quicker.
2019-09-19 08:42:03 +01:00
Mike McQuaid
c4f72312ce
Fixup brew style failures. 2019-04-30 09:19:18 +01:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Mike McQuaid
d1ea6f38d3
Fix mutable constants violations. 2019-04-19 21:46:20 +09:00
Mike McQuaid
640234caa1
Merge pull request #6030 from MikeMcQuaid/ruby-no-threads
Remove usage of Thread.new
2019-04-18 16:03:18 +09:00
Mike McQuaid
7fbfb02625
Remove usage of Thread.new
I benchmarked these both locally and neither use of `Thread.new`
provides any measurable speedup (and in the `readall` case appears to
slow things down) on my 8 core machine.
2019-04-18 14:46:40 +09:00
Mike McQuaid
0b272ad26e
cleanup: don’t cleanup periodic clean file.
Cleaning up this file means that cleanup will run again prematurely.
2019-04-17 21:06:47 +09:00
Chase Stubblefield
2c95d733c2 cleanup: fix for formula/cask name collision
When a formula and cask share the same name, a download can be
incorrectly considered stale. Only check for if a download is a stale
formula or stale cask, but not both.
2019-03-05 19:55:19 -08:00
Mike McQuaid
17f3ee1957
Improve Bundler cleanup
Rather than trying to be smart and doing this ourselves in `brew cleanup` let’s just installed Bundler somewhere it doesn’t try to clean itself up and use `bundle install --cleanup` when we need cleanup done.

Also, use `ohai` and `odie` when possible as they look nicer.
2019-02-27 14:02:46 +00:00
Mike McQuaid
1dd8b82c6b
cleanup: run bundle clean. 2019-02-21 16:34:20 +00:00
Mike McQuaid
e095da4d01
rubocop: enable Layout/EmptyLineAfterGuardClause. 2019-02-21 12:55:49 +00:00
Mike McQuaid
d64429a736
rubocop: enable Style/IfUnlessModifier. 2019-02-21 12:55:49 +00:00
Mike McQuaid
ede9891bf2
cleanup: don't remove portable ruby on periodic cleanups.
Otherwise we end up deleting the running Ruby version.

Fixes #5707.
2019-02-13 12:56:36 +00:00
tueksta
4abacfd85d
style 2019-02-06 23:19:25 +01:00
tueksta
9abd7d31bd
Fix dry run 2019-02-06 22:50:17 +01:00