add formula cleanup to install and reinstall
This commit is contained in:
parent
18f8adbd5c
commit
51ca60d6d5
@ -73,6 +73,9 @@
|
||||
#:
|
||||
#: If `--git` (or `-g`) is passed, Homebrew will create a Git repository, useful for
|
||||
#: creating patches to the software.
|
||||
#:
|
||||
#: If `HOMEBREW_INSTALL_CLEANUP` is set then remove previously installed versions
|
||||
#: of upgraded <formulae>.
|
||||
|
||||
require "missing_formula"
|
||||
require "formula_installer"
|
||||
@ -254,6 +257,7 @@ module Homebrew
|
||||
formulae.each do |f|
|
||||
Migrator.migrate_if_needed(f)
|
||||
install_formula(f)
|
||||
Cleanup.new.cleanup_formula(f) if ENV["HOMEBREW_INSTALL_CLEANUP"]
|
||||
end
|
||||
Homebrew.messages.display_messages
|
||||
rescue FormulaUnreadableError, FormulaClassUnavailableError,
|
||||
|
||||
@ -3,6 +3,9 @@
|
||||
#:
|
||||
#: If `--display-times` is passed, install times for each formula are printed
|
||||
#: at the end of the run.
|
||||
#:
|
||||
#: If `HOMEBREW_INSTALL_CLEANUP` is set then remove previously installed versions
|
||||
#: of upgraded <formulae>.
|
||||
|
||||
require "formula_installer"
|
||||
require "development_tools"
|
||||
@ -24,6 +27,7 @@ module Homebrew
|
||||
end
|
||||
Migrator.migrate_if_needed(f)
|
||||
reinstall_formula(f)
|
||||
Cleanup.new.cleanup_formula(f) if ENV["HOMEBREW_INSTALL_CLEANUP"]
|
||||
end
|
||||
Homebrew.messages.display_messages
|
||||
end
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
#:
|
||||
#: Options for the `install` command are also valid here.
|
||||
#:
|
||||
#: If `--cleanup` is specified, `HOMEBREW_INSTALL_CLEANUP` or `HOMEBREW_UPGRADE_CLEANUP` is set then remove
|
||||
#: If `--cleanup` is specified or `HOMEBREW_INSTALL_CLEANUP` is set then remove
|
||||
#: previously installed version(s) of upgraded <formulae>.
|
||||
#:
|
||||
#: If `--fetch-HEAD` is passed, fetch the upstream repository to detect if
|
||||
|
||||
@ -17,17 +17,4 @@ describe "brew upgrade", :integration_test do
|
||||
expect(HOMEBREW_CELLAR/"testball/0.1").to be_a_directory
|
||||
expect(HOMEBREW_CELLAR/"testball/0.0.1").not_to exist
|
||||
end
|
||||
|
||||
it "upgrades a Formula and cleans up old versions when `HOMEBREW_INSTALL_CLEANUP` is set" do
|
||||
setup_test_formula "testball"
|
||||
# allow(ENV).to receive(:[]).and_call_original
|
||||
# allow(ENV).to receive(:[]).with("HOMEBREW_INSTALL_CLEANUP").and_return("1")
|
||||
ENV["HOMEBREW_INSTALL_CLEANUP"] = "1"
|
||||
(HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
|
||||
|
||||
expect { brew "upgrade" }.to be_a_success
|
||||
|
||||
expect(HOMEBREW_CELLAR/"testball/0.1").to be_a_directory
|
||||
expect(HOMEBREW_CELLAR/"testball/0.0.1").not_to exist
|
||||
end
|
||||
end
|
||||
|
||||
@ -1243,11 +1243,10 @@ Note that environment variables must have a value set to be detected. For exampl
|
||||
This issue typically occurs when using FileVault or custom SSD
|
||||
configurations.
|
||||
|
||||
* `HOMEBREW_UPGRADE_CLEANUP`:
|
||||
If set, `brew upgrade` always assumes `--cleanup` has been passed.
|
||||
|
||||
* `HOMEBREW_INSTALL_CLEANUP`:
|
||||
If set, `brew upgrade` always assumes `--cleanup` has been passed.
|
||||
Additionally, `brew install` and `brew reinstall` will clean up associated
|
||||
formulae.
|
||||
|
||||
* `HOMEBREW_VERBOSE`:
|
||||
If set, Homebrew always assumes `--verbose` when running commands.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user