diff options
| author | Charlie Sharpsteen | 2014-04-29 10:35:49 -0700 |
|---|---|---|
| committer | Charlie Sharpsteen | 2014-04-29 10:46:02 -0700 |
| commit | 69573ba7a23a56906e3bfcad4077cee999400f95 (patch) | |
| tree | 619fb6167b84a4e95b8cd4e9bd0aecb0add17815 /Library | |
| parent | 953f6c1ead39c9a68566ae2057e00f93e178ead9 (diff) | |
| download | brew-69573ba7a23a56906e3bfcad4077cee999400f95.tar.bz2 | |
brew-unpack: Handle new style :DATA patches
Instances of `IOPatch` created by `patch :DATA` are not affected by re-setting
the `DATA` constant of the `Formula` instance. For these patches, we iterate
through the `patchlist` and use `instance_variable_set` to attach data.
A bit hacky, but `patchlist` has no write accessors so there isn't a clean way
to modify patch contents.
Diffstat (limited to 'Library')
| -rwxr-xr-x | Library/Contributions/cmd/brew-unpack.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Library/Contributions/cmd/brew-unpack.rb b/Library/Contributions/cmd/brew-unpack.rb index c1ca26474..b5023f1a2 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 |
