aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2013-12-09 14:36:10 -0600
committerJack Nagel2013-12-09 14:36:10 -0600
commit08055e1776c166d26bdce0995ee16cfabec392f0 (patch)
treedae99dc2463cf899f2eb8d05df217b1be64b9d77
parent901902b53b7b47ed9e941f585738e17b034c98c2 (diff)
downloadbrew-08055e1776c166d26bdce0995ee16cfabec392f0.tar.bz2
Ensure option names are consistent for default formula requirements
-rwxr-xr-xLibrary/Homebrew/build.rb4
-rw-r--r--Library/Homebrew/build_options.rb8
-rw-r--r--Library/Homebrew/dependency.rb6
-rw-r--r--Library/Homebrew/formula_installer.rb4
-rw-r--r--Library/Homebrew/requirement.rb6
5 files changed, 18 insertions, 10 deletions
diff --git a/Library/Homebrew/build.rb b/Library/Homebrew/build.rb
index eb0677a59..7db2235ed 100755
--- a/Library/Homebrew/build.rb
+++ b/Library/Homebrew/build.rb
@@ -81,7 +81,7 @@ class Build
def expand_reqs
f.recursive_requirements do |dependent, req|
- if (req.optional? || req.recommended?) && dependent.build.without?(req.name)
+ if (req.optional? || req.recommended?) && dependent.build.without?(req)
Requirement.prune
elsif req.build? && dependent != f
Requirement.prune
@@ -94,7 +94,7 @@ class Build
def expand_deps
f.recursive_dependencies do |dependent, dep|
- if (dep.optional? || dep.recommended?) && dependent.build.without?(dep.name)
+ if (dep.optional? || dep.recommended?) && dependent.build.without?(dep)
Dependency.prune
elsif dep.build? && dependent != f
Dependency.prune
diff --git a/Library/Homebrew/build_options.rb b/Library/Homebrew/build_options.rb
index f35295758..1c410bf6f 100644
--- a/Library/Homebrew/build_options.rb
+++ b/Library/Homebrew/build_options.rb
@@ -61,7 +61,13 @@ class BuildOptions
args.include? '--' + name
end
- def with? name
+ def with? val
+ if val.respond_to?(:option_name)
+ name = val.option_name
+ else
+ name = val
+ end
+
if has_option? "with-#{name}"
include? "with-#{name}"
elsif has_option? "without-#{name}"
diff --git a/Library/Homebrew/dependency.rb b/Library/Homebrew/dependency.rb
index f492b9a6e..e2a810cfe 100644
--- a/Library/Homebrew/dependency.rb
+++ b/Library/Homebrew/dependency.rb
@@ -5,10 +5,10 @@ class Dependency
include Dependable
attr_reader :name, :tags
- attr_accessor :env_proc
+ attr_accessor :env_proc, :option_name
def initialize(name, tags=[])
- @name = name
+ @name = @option_name = name
@tags = tags
end
@@ -97,7 +97,7 @@ class Dependency
if block_given?
yield dependent, dep
elsif dep.optional? || dep.recommended?
- prune unless dependent.build.with?(dep.name)
+ prune unless dependent.build.with?(dep)
end
end
end
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index b838f2d54..1baa93c1e 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -180,7 +180,7 @@ class FormulaInstaller
def check_requirements
unsatisfied = ARGV.filter_for_dependencies do
f.recursive_requirements do |dependent, req|
- if (req.optional? || req.recommended?) && dependent.build.without?(req.name)
+ if (req.optional? || req.recommended?) && dependent.build.without?(req)
Requirement.prune
elsif req.build? && install_bottle?(dependent)
Requirement.prune
@@ -208,7 +208,7 @@ class FormulaInstaller
Dependency.expand(f, deps) do |dependent, dep|
dep.universal! if f.build.universal? && !dep.build?
- if (dep.optional? || dep.recommended?) && dependent.build.without?(dep.name)
+ if (dep.optional? || dep.recommended?) && dependent.build.without?(dep)
Dependency.prune
elsif dep.build? && dependent == f && pour_bottle
Dependency.prune
diff --git a/Library/Homebrew/requirement.rb b/Library/Homebrew/requirement.rb
index 58b8e57e4..9062d2d13 100644
--- a/Library/Homebrew/requirement.rb
+++ b/Library/Homebrew/requirement.rb
@@ -10,12 +10,13 @@ class Requirement
include Dependable
extend BuildEnvironmentDSL
- attr_reader :tags, :name
+ attr_reader :tags, :name, :option_name
def initialize(tags=[])
@tags = tags
@tags << :build if self.class.build
@name ||= infer_name
+ @option_name = @name
end
# The message to show when the requirement is not met.
@@ -70,6 +71,7 @@ class Requirement
f = self.class.default_formula
raise "No default formula defined for #{inspect}" if f.nil?
dep = Dependency.new(f, tags)
+ dep.option_name = name
dep.env_proc = method(:modify_build_environment)
dep
end
@@ -174,7 +176,7 @@ class Requirement
if block_given?
yield dependent, req
elsif req.optional? || req.recommended?
- prune unless dependent.build.with?(req.name)
+ prune unless dependent.build.with?(req)
end
end
end