155 Commits

Author SHA1 Message Date
Issy Long
0e27dc2564
Fix RuboCop Style/ArrayIntersect offenses 2024-01-18 14:11:43 +00:00
Douglas Eichelberger
ffd761d2e9 Create dedicated Attrable mixin for attr_ methods 2023-12-28 11:46:27 -08:00
Bo Anderson
489879ff72
Enable Ruby 3 for all users 2023-11-29 15:30:17 +00:00
Branch Vincent
e58ed46195
formula: add PIP_CACHE_DIR to build env 2023-11-22 13:53:05 -08:00
Bo Anderson
5c819100fe
cleanup: smarter gem handling 2023-11-07 22:28:03 +00:00
Bo Anderson
4ec450823c
Portable Ruby 3.1.4 (opt-in beta) 2023-10-27 15:58:43 +01:00
Carlo Cabrera
43b6d79a4c
cleanup: handle GitHub Actions artifacts
Implemented based on feedback from #15440.
2023-05-17 21:11:16 +08:00
Markus Reiter
a3231a03fa
Implement cask renames. 2023-05-12 21:17:30 +02:00
Bo Anderson
0daa4d98cf
cleanup: fix version error for cache items without a version 2023-05-11 13:44:26 +01:00
Bo Anderson
44f058edb5
Refactor formula, cask and Ruby source downloads to use shared code 2023-04-27 23:23:07 +01:00
Douglas Eichelberger
08af78a2a5 brew style --fix 2023-04-25 09:26:24 -07:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
Douglas Eichelberger
a7b80532bf Code review changes 2023-03-27 09:28:27 -07:00
Douglas Eichelberger
eaeceda31e Enable typing in Homebrew::Cleanup 2023-03-25 13:16:11 -07:00
Issy Long
e9d994622e
rubocop: Drop "f" from Naming/MethodParameterName allowlist
- This either stands for "file" but more often than not "formula".
2023-03-11 00:17:27 +00:00
Douglas Eichelberger
f9f73f3ef6 Tidy up 2023-02-27 21:42:47 -08:00
Douglas Eichelberger
1ab278f74c Fix style/type violations 2023-02-27 20:34:07 -08:00
Douglas Eichelberger
0eccc0e987 git grep -l Utils::Inflection | xargs gsed -i 's|Utils::Inflection|Utils|g' 2023-02-27 20:18:27 -08:00
Douglas Eichelberger
2400c6daed brew style --fix 2023-02-27 20:17:33 -08:00
Douglas Eichelberger
37015b6b08 Change to pluralize, port more call sites 2023-02-27 20:17:33 -08:00
Douglas Eichelberger
24e7c2c5bd Remove active_support Time extensions 2023-02-04 13:51:35 -08:00
Mike McQuaid
6a25229567
brew style --fix 2023-01-02 19:18:51 +00:00
apainintheneck
d69326c8d0 Move ::Cleanup check to extend/os 2022-11-23 20:38:40 -08:00
apainintheneck
f068f74f55 Move autoremove code to util and add tests 2022-09-13 23:23:48 -07:00
Carlo Cabrera
55f27b932a
Merge pull request #13715 from carlocab/python-site-packages
cleanup: handle Python `site-packages` directories
2022-08-31 21:08:14 +08:00
Carlo Cabrera
155f4d7394
Fix collection of unused_pyc_files. 2022-08-31 16:04:21 +08:00
apainintheneck
98e6e6e31f Ignore HOMEBREW_NO_CLEANUP_FORMULAE deps in brew autoremove 2022-08-22 20:10:14 -07:00
Carlo Cabrera
7384bd2b3f
cleanup: use cleanup_path more consistently
`cleanup_path` already handles the dry-run logic, and also includes
those paths in the summary of space freed by `brew cleanup`.

Before this change:

    ❯ brew cleanup --dry-run
    Would remove: /Users/carlocab/Library/Caches/Homebrew/bootsnap (2,401 files, 41.9MB)

After this change:

    ❯ brew cleanup --dry-run
    Would remove: /Users/carlocab/Library/Caches/Homebrew/bootsnap (2,401 files, 41.9MB)
    ==> This operation would free approximately 41.9MB of disk space.
2022-08-18 21:28:51 +08:00
Carlo Cabrera
0b48261f79
cleanup: handle Python site-packages directories
Inside a given `site-packages` directory, *.pyc files live in
`__pycache__` directories. These are created by the Python interpreter
when a module is imported in order to speed up future access to the
imported module.

These can be left behind when formulae are uninstalled, which results in
erroneous success in importing the modules they were originally compiled
for.

Let's fix that by cleaning these up. In the top-level `__pycache__`
directory, we use the `Pathname#prune?` extension in order to determine
whether a `*.pyc` file is old enough to clean up. In other directories,
we clean them up when they are all that remains in a given module's
tree.

Removing these `*.pyc` files will make `python3` regenerate them when
required, so deleting them is relatively safe. The worst consequence is
slightly slower module import times.

Closes #13701.
2022-08-18 21:09:12 +08:00
fn ⌃ ⌥
dce57eaad6 Always print install cleanup disable message for periodic clean 2022-08-04 07:46:31 -07:00
fn ⌃ ⌥
71ab2f6e7a Run periodic cleanup after installing all packages 2022-08-04 07:46:31 -07:00
apainintheneck
cb91f8b665 Add tests for retrieving formula based on dependents
Also, made sure to clear formula cache before
and after autoremoving packages.
2022-07-17 00:39:23 -07:00
apainintheneck
fe83500617 Moved autoremove logic into cleanup.rb and formula.rb
Cleanup.rb:
- Added #autoremove method
- #autoremove is called in clean when HOMEBREW_AUTOREMOVE is set

Formula.rb:
- Added #unused_formulae_with_no_dependents and helpers

Removed old autoremove.rb module.
2022-07-14 13:16:26 -07:00
Bo Anderson
02164a35db
Use ORIGINAL_PATHS over envs; reject nil PATH 2022-06-17 19:47:57 +01:00
Émilia Decaudin
6642801b04 Show total disk space freed on cleanup. 2022-03-07 12:25:27 -05:00
Mike McQuaid
5ebf3acc94
Revert "cleanup: check if symlinks are readable." 2022-01-25 12:10:50 +00:00
Mike McQuaid
f3619134c2
cleanup: check if symlinks are readable. 2022-01-20 12:21:56 +00:00
Mike McQuaid
6913c7c84e
Output environment variable hints.
Output hints for disabling automatic `brew update`, `brew cleanup` and
`brew upgrade`/`brew reinstall` of dependents. Also provide a
`HOMEBREW_NO_ENV_HINTS` to disable this messaging.
2021-11-26 13:14:10 +00:00
Mike McQuaid
11c5f8f05a
Improve discovery of some environment variables
There's a few bits of functionality that Homebrew has changed over the
years, makes sense as a sensible default but some people find really
annoying:

- automatically running `brew update`
- automatically running `brew cleanup`
- automatically upgrading outdated dependents
- automatically reinstalling broken dependents

For each of these: let's improve the documentation of the commands
whose behaviour is changed and the environment variables themselves.
2021-11-25 09:10:59 +00:00
Kaito Udagawa
6b5f912a3a Catch ENOTEMPTY in cleanup_keg
#11904
2021-10-19 23:39:58 +09:00
EricFromCanada
c234d1ea03
upgrade: list upgradeable dependencies/migrations/cleanups on dry run 2021-08-31 12:27:14 -04:00
Carlo Cabrera
a7133d2a8d
cleanup: allow users to specify formulae to skip cleaning
This allows users to set `HOMEBREW_NO_CLEANUP_FORMULAE` to a
comma-separated list of formulae that `brew` will refuse to clean with
`brew cleanup`.

We currently allow a less granular version of this with
`HOMEBREW_NO_INSTALL_CLEANUP`. All this changes is how much control
users have over what is and isn't cleaned.

Fixes #11924.
2021-08-27 18:21:19 +08:00
John Bampton
1691e615fe Fix spelling 2021-05-08 11:20:01 +10:00
Mike McQuaid
1cb082db94
cleanup: ignore DS_Store access failures.
Fixes #10988.
2021-04-23 14:49:12 +01:00
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