aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-06-24 10:39:00 -0500
committerJack Nagel2013-06-24 10:42:43 -0500
commit553b1a0dbba3b80c9dc33348186abb8c85e222a5 (patch)
tree806f0aafd500e4f42a7472ce434028c129dd843d /Library
parent371c1acfe436b04f95b89b8ecfed4484f81286a6 (diff)
downloadbrew-553b1a0dbba3b80c9dc33348186abb8c85e222a5.tar.bz2
Requirement: callers are responsible for invoking #satisfied?
This hack was necessary since requirements were not checked again in the forked build process, but now they are, and calling it again after the build environment has been set up can produce incorrect results. In fact, if it happens to return false the second time, the env modification will be skipped altogether.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/requirement.rb4
-rw-r--r--Library/Homebrew/test/test_requirement.rb1
2 files changed, 4 insertions, 1 deletions
diff --git a/Library/Homebrew/requirement.rb b/Library/Homebrew/requirement.rb
index 9540f0967..d4da0255a 100644
--- a/Library/Homebrew/requirement.rb
+++ b/Library/Homebrew/requirement.rb
@@ -43,8 +43,10 @@ class Requirement
# Overriding #modify_build_environment is deprecated.
# Pass a block to the the env DSL method instead.
+ # Note: #satisfied? should be called before invoking this method
+ # as the env modifications may depend on its side effects.
def modify_build_environment
- satisfied? and env.modify_build_environment(self)
+ env.modify_build_environment(self)
end
def env
diff --git a/Library/Homebrew/test/test_requirement.rb b/Library/Homebrew/test/test_requirement.rb
index 5d89defb0..042aa922d 100644
--- a/Library/Homebrew/test/test_requirement.rb
+++ b/Library/Homebrew/test/test_requirement.rb
@@ -81,6 +81,7 @@ class RequirementTests < Test::Unit::TestCase
ENV.expects(:userpaths!)
ENV.expects(:append).with("PATH", which_path.parent, ":")
+ req.satisfied?
req.modify_build_environment
end