aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2016-11-12 12:11:55 +0000
committerMike McQuaid2016-11-12 12:11:55 +0000
commit56124f5963686be214b8dd6c02628c5ddbd37154 (patch)
tree66eb8c342567d0ff02bb7ec161dac3e2b01aff27 /Library
parentc4519b030ec2c689cdd2a760a8d4f18926c7bed1 (diff)
downloadbrew-56124f5963686be214b8dd6c02628c5ddbd37154.tar.bz2
Filter formula build options based on those that exist.
If `--with-foo` is provided to a formula through a tab or through another formula depending on it and this option does not exist it should be filtered. If it is not (the prior behaviour) then this can prevent bottles being used unnecessarily. Fixes #1399.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/reinstall.rb1
-rw-r--r--Library/Homebrew/cmd/upgrade.rb1
-rw-r--r--Library/Homebrew/formula_installer.rb1
3 files changed, 3 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb
index 618835d74..598286562 100644
--- a/Library/Homebrew/cmd/reinstall.rb
+++ b/Library/Homebrew/cmd/reinstall.rb
@@ -22,6 +22,7 @@ module Homebrew
def reinstall_formula(f)
options = BuildOptions.new(Options.create(ARGV.flags_only), f.options).used_options
options |= f.build.used_options
+ options &= f.options
notice = "Reinstalling #{f.full_name}"
notice += " with #{options * ", "}" unless options.empty?
diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb
index 40805b4ca..f92832aa2 100644
--- a/Library/Homebrew/cmd/upgrade.rb
+++ b/Library/Homebrew/cmd/upgrade.rb
@@ -96,6 +96,7 @@ module Homebrew
fi = FormulaInstaller.new(f)
fi.options = f.build.used_options
+ fi.options &= f.options
fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && f.build.build_bottle?)
fi.build_from_source = ARGV.build_from_source? || ARGV.build_all_from_source?
fi.verbose = ARGV.verbose?
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index c25702059..049af071c 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -457,6 +457,7 @@ class FormulaInstaller
fi.options |= tab.used_options
fi.options |= Tab.remap_deprecated_options(df.deprecated_options, dep.options)
fi.options |= inherited_options
+ fi.options &= df.options
fi.build_from_source = ARGV.build_formula_from_source?(df)
fi.verbose = verbose? && !quieter?
fi.debug = debug?