From 56124f5963686be214b8dd6c02628c5ddbd37154 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 12 Nov 2016 12:11:55 +0000 Subject: [PATCH] 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. --- Library/Homebrew/cmd/reinstall.rb | 1 + Library/Homebrew/cmd/upgrade.rb | 1 + Library/Homebrew/formula_installer.rb | 1 + 3 files changed, 3 insertions(+) diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index 618835d744..5982865626 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 40805b4ca6..f92832aa22 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 c257020591..049af071c8 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?