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
commit8de8030009e91ea54bae162d0b92c7bdc1321f0f (patch)
treefcbf2b3da91c8aba6879903f0bf21fc7283809da /Library
parenta9ee841619c748495c6e11eaf77cf3ed3cf299d8 (diff)
downloadhomebrew-8de8030009e91ea54bae162d0b92c7bdc1321f0f.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