aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharlie Sharpsteen2011-11-14 10:44:18 -0800
committerCharlie Sharpsteen2011-11-14 10:44:18 -0800
commit16b8267f4a77a5e1bb8307636e2e5510a2d1886c (patch)
tree872e73e482c926298250966ab6b24580c6fc9269
parente59cc08809239e6e752c26113321b63822525c8e (diff)
downloadhomebrew-16b8267f4a77a5e1bb8307636e2e5510a2d1886c.tar.bz2
Add --fresh option to brew install
When invoked, this option will ensure brew doesn't re-use any options from previous installs of a formula.
-rw-r--r--Library/Contributions/brew_bash_completion.sh2
-rw-r--r--Library/Contributions/manpages/brew.1.md5
-rw-r--r--Library/Homebrew/formula_installer.rb23
-rw-r--r--share/man/man1/brew.15
4 files changed, 26 insertions, 9 deletions
diff --git a/Library/Contributions/brew_bash_completion.sh b/Library/Contributions/brew_bash_completion.sh
index 3488dc6f2..6fe0c1af4 100644
--- a/Library/Contributions/brew_bash_completion.sh
+++ b/Library/Contributions/brew_bash_completion.sh
@@ -127,7 +127,7 @@ _brew_to_completion()
local opts=$(
local opts=(--force --verbose --debug --use-clang --use-gcc
--use-llvm --ignore-dependencies --build-from-source --HEAD
- --interactive $(brew options --compact "$prev"))
+ --interactive --fresh $(brew options --compact "$prev"))
# options that make sense with '--interactive'
if [[ "${COMP_WORDS[*]}" =~ "--interactive" ]]; then
diff --git a/Library/Contributions/manpages/brew.1.md b/Library/Contributions/manpages/brew.1.md
index 806762a94..9ad08c1bf 100644
--- a/Library/Contributions/manpages/brew.1.md
+++ b/Library/Contributions/manpages/brew.1.md
@@ -135,7 +135,7 @@ For the full command list, see the COMMANDS section.
* `info` <URL>:
Print the name and version that will be detected for <URL>.
- * `install [--force] [--debug] [--ignore-dependencies] [--use-clang] [--use-gcc] [--use-llvm] [--build-from-source] [--HEAD]` <formula>:
+ * `install [--force] [--debug] [--ignore-dependencies] [--fresh] [--use-clang] [--use-gcc] [--use-llvm] [--build-from-source] [--HEAD]` <formula>:
Install <formula>.
<formula> is usually the name of the formula to install, but may also be
@@ -152,6 +152,9 @@ For the full command list, see the COMMANDS section.
any kind. If they are not already present, the formula will probably fail
to install.
+ If `--fresh` is passed, the installation process will not re-use any
+ options from previous installs.
+
If `--use-clang` is passed, attempt to compile using clang.
If `--use-gcc` is passed, attempt to compile using GCC. This is useful for
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index 689c4ff68..97292d984 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -245,8 +245,9 @@ class FormulaInstaller
# This method gives us a chance to pre-process command line arguments before the
# installer forks and `Formula.install` kicks in.
def filtered_args
- # Did the user actually pass the formula this installer is considering on
- # the command line?
+ # Returns true if the formula attached to this installer was explicitly
+ # passed on the command line by the user as opposed to being automatically
+ # added to satisfy a dependency.
def explicitly_requested?
# `ARGV.formulae` will throw an exception if it comes up with an empty
# list.
@@ -257,13 +258,23 @@ class FormulaInstaller
return false if ARGV.named.empty?
ARGV.formulae.include? f
end
- previous_install = Tab.for_formula f
args = ARGV.clone
- args.concat previous_install.used_options
- args.uniq! # Just in case some dupes were added
- %w[--HEAD --verbose -v --debug -d --interactive -i].each {|f| args.delete f} unless explicitly_requested?
+ %w[
+ --debug -d
+ --fresh
+ --HEAD
+ --interactive -i
+ --verbose -v
+ ].each {|flag| args.delete flag} unless explicitly_requested?
+
+ unless args.include? '--fresh'
+ previous_install = Tab.for_formula f
+ args.concat previous_install.used_options
+ end
+
+ args.uniq! # Just in case some dupes slipped by
return args
end
diff --git a/share/man/man1/brew.1 b/share/man/man1/brew.1
index af6c637fb..484b4b118 100644
--- a/share/man/man1/brew.1
+++ b/share/man/man1/brew.1
@@ -158,7 +158,7 @@ To view formula history locally: \fBbrew log \-p <formula>\fR\.
Print the name and version that will be detected for \fIURL\fR\.
.
.TP
-\fBinstall [\-\-force] [\-\-debug] [\-\-ignore\-dependencies] [\-\-use\-clang] [\-\-use\-gcc] [\-\-use\-llvm] [\-\-build\-from\-source] [\-\-HEAD]\fR \fIformula\fR
+\fBinstall [\-\-force] [\-\-debug] [\-\-ignore\-dependencies] [\-\-fresh] [\-\-use\-clang] [\-\-use\-gcc] [\-\-use\-llvm] [\-\-build\-from\-source] [\-\-HEAD]\fR \fIformula\fR
Install \fIformula\fR\.
.
.IP
@@ -174,6 +174,9 @@ If \fB\-\-debug\fR is passed and brewing fails, open a shell inside the temporar
If \fB\-\-ignore\-dependencies\fR is passed, skip installing any dependencies of any kind\. If they are not already present, the formula will probably fail to install\.
.
.IP
+If \fB\-\-fresh\fR is passed, the installation process will not re\-use any options from previous installs\.
+.
+.IP
If \fB\-\-use\-clang\fR is passed, attempt to compile using clang\.
.
.IP