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.
This commit is contained in:
Jack Nagel 2013-06-24 10:39:00 -05:00
parent 371c1acfe4
commit 553b1a0dbb
2 changed files with 4 additions and 1 deletions

View File

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

View File

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