diff --git a/Library/Contributions/cmd/brew-unpack.rb b/Library/Contributions/cmd/brew-unpack.rb index c1ca264749..b5023f1a25 100755 --- a/Library/Contributions/cmd/brew-unpack.rb +++ b/Library/Contributions/cmd/brew-unpack.rb @@ -28,6 +28,7 @@ module UnpackPatch return unless ARGV.flag? "--patch" begin + # Silence complaints about re-setting constants. old_verbose = $VERBOSE $VERBOSE = nil Formula.const_set "DATA", ScriptDataReader.load(path) @@ -35,6 +36,14 @@ module UnpackPatch $VERBOSE = old_verbose end + # Legacy patches are fixed by setting Formula::DATA. + # Now, handle instances of IOPatch. + patchlist.select{|p| p.is_a? IOPatch}.each do |patch| + if patch.instance_variable_get(:@io) == :DATA + patch.instance_variable_set :@io, ScriptDataReader.load(path) + end + end + super end end