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.
This commit is contained in:
Mike McQuaid 2016-11-12 12:11:55 +00:00
parent c4519b030e
commit 56124f5963
3 changed files with 3 additions and 0 deletions

View File

@ -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?

View File

@ -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?

View File

@ -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?