From 553b1a0dbba3b80c9dc33348186abb8c85e222a5 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Mon, 24 Jun 2013 10:39:00 -0500 Subject: [PATCH] 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. --- Library/Homebrew/requirement.rb | 4 +++- Library/Homebrew/test/test_requirement.rb | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/requirement.rb b/Library/Homebrew/requirement.rb index 9540f09675..d4da0255a0 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 5d89defb05..042aa922df 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