Add HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS environment variable

This allows customisation of how often the periodic cleanups are done.
This commit is contained in:
Mike McQuaid 2020-12-09 10:36:02 +00:00
parent e831b197ff
commit 5757777a6e
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
4 changed files with 25 additions and 4 deletions

View File

@ -2,6 +2,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require "utils/bottles" require "utils/bottles"
require "utils/gems" require "utils/gems"
require "formula" require "formula"
require "cask/cask_loader" require "cask/cask_loader"
@ -12,7 +13,7 @@ module Homebrew
# #
# @api private # @api private
class Cleanup class Cleanup
CLEANUP_DEFAULT_DAYS = 30 CLEANUP_DEFAULT_DAYS = Homebrew::EnvConfig.cleanup_periodic_full_days.to_i.freeze
private_constant :CLEANUP_DEFAULT_DAYS private_constant :CLEANUP_DEFAULT_DAYS
# {Pathname} refinement with helper functions for cleaning up files. # {Pathname} refinement with helper functions for cleaning up files.

View File

@ -68,6 +68,11 @@ module Homebrew
"`~/.profile`, `~/.bash_profile`, or `~/.zshenv`:\n\n" \ "`~/.profile`, `~/.bash_profile`, or `~/.zshenv`:\n\n" \
' `export HOMEBREW_CASK_OPTS="--appdir=~/Applications --fontdir=/Library/Fonts"`', ' `export HOMEBREW_CASK_OPTS="--appdir=~/Applications --fontdir=/Library/Fonts"`',
}, },
HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS: {
description: "If set, `brew install`, `brew upgrade` and `brew reinstall` will cleanup all formulae " \
"when this number of days has passed.",
default: 30,
},
HOMEBREW_CLEANUP_MAX_AGE_DAYS: { HOMEBREW_CLEANUP_MAX_AGE_DAYS: {
description: "Cleanup all cached files older than this many days.", description: "Cleanup all cached files older than this many days.",
default: 120, default: 120,
@ -243,7 +248,8 @@ module Homebrew
}, },
HOMEBREW_NO_INSTALL_CLEANUP: { HOMEBREW_NO_INSTALL_CLEANUP: {
description: "If set, `brew install`, `brew upgrade` and `brew reinstall` will never automatically " \ description: "If set, `brew install`, `brew upgrade` and `brew reinstall` will never automatically " \
"cleanup installed/upgraded/reinstalled formulae or all formulae every 30 days.", "cleanup installed/upgraded/reinstalled formulae or all formulae every " \
"HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS days.",
boolean: true, boolean: true,
}, },
HOMEBREW_PRY: { HOMEBREW_PRY: {

View File

@ -1683,6 +1683,11 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
`export HOMEBREW_CASK_OPTS="--appdir=~/Applications --fontdir=/Library/Fonts"` `export HOMEBREW_CASK_OPTS="--appdir=~/Applications --fontdir=/Library/Fonts"`
- `HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS`
<br>If set, `brew install`, `brew upgrade` and `brew reinstall` will cleanup all formulae when this number of days has passed.
*Default:* `30`.
- `HOMEBREW_CLEANUP_MAX_AGE_DAYS` - `HOMEBREW_CLEANUP_MAX_AGE_DAYS`
<br>Cleanup all cached files older than this many days. <br>Cleanup all cached files older than this many days.
@ -1819,7 +1824,7 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
*Note:* While ensuring your downloads are fully secure, this is likely to cause from-source SourceForge, some GNU & GNOME-hosted formulae to fail to download. *Note:* While ensuring your downloads are fully secure, this is likely to cause from-source SourceForge, some GNU & GNOME-hosted formulae to fail to download.
- `HOMEBREW_NO_INSTALL_CLEANUP` - `HOMEBREW_NO_INSTALL_CLEANUP`
<br>If set, `brew install`, `brew upgrade` and `brew reinstall` will never automatically cleanup installed/upgraded/reinstalled formulae or all formulae every 30 days. <br>If set, `brew install`, `brew upgrade` and `brew reinstall` will never automatically cleanup installed/upgraded/reinstalled formulae or all formulae every HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS days.
- `HOMEBREW_PRY` - `HOMEBREW_PRY`
<br>If set, use Pry for the `brew irb` command. <br>If set, use Pry for the `brew irb` command.

View File

@ -2356,6 +2356,15 @@ Append these options to all \fBcask\fR commands\. All \fB\-\-*dir\fR options, \f
\fBexport HOMEBREW_CASK_OPTS="\-\-appdir=~/Applications \-\-fontdir=/Library/Fonts"\fR \fBexport HOMEBREW_CASK_OPTS="\-\-appdir=~/Applications \-\-fontdir=/Library/Fonts"\fR
. .
.TP .TP
\fBHOMEBREW_CLEANUP_PERIODIC_FULL_DAYS\fR
.
.br
If set, \fBbrew install\fR, \fBbrew upgrade\fR and \fBbrew reinstall\fR will cleanup all formulae when this number of days has passed\.
.
.IP
\fIDefault:\fR \fB30\fR\.
.
.TP
\fBHOMEBREW_CLEANUP_MAX_AGE_DAYS\fR \fBHOMEBREW_CLEANUP_MAX_AGE_DAYS\fR
. .
.br .br
@ -2614,7 +2623,7 @@ If set, forbid redirects from secure HTTPS to insecure HTTP\.
\fBHOMEBREW_NO_INSTALL_CLEANUP\fR \fBHOMEBREW_NO_INSTALL_CLEANUP\fR
. .
.br .br
If set, \fBbrew install\fR, \fBbrew upgrade\fR and \fBbrew reinstall\fR will never automatically cleanup installed/upgraded/reinstalled formulae or all formulae every 30 days\. If set, \fBbrew install\fR, \fBbrew upgrade\fR and \fBbrew reinstall\fR will never automatically cleanup installed/upgraded/reinstalled formulae or all formulae every HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS days\.
. .
.TP .TP
\fBHOMEBREW_PRY\fR \fBHOMEBREW_PRY\fR