diff options
| -rw-r--r-- | Library/Homebrew/cmd/fetch.rb | 12 | ||||
| -rw-r--r-- | Library/Homebrew/formula.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/patch.rb | 6 |
3 files changed, 19 insertions, 3 deletions
diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb index 9b3a88a15..9f485e667 100644 --- a/Library/Homebrew/cmd/fetch.rb +++ b/Library/Homebrew/cmd/fetch.rb @@ -21,9 +21,8 @@ module Homebrew extend self fetch_formula(f.bottle) else fetch_formula(f) - f.resources.each do |r| - fetch_resource(r) - end + f.resources.each { |r| fetch_resource(r) } + f.patchlist.select(&:external?).each { |p| fetch_patch(p) } end end end @@ -51,6 +50,13 @@ module Homebrew extend self opoo "Formula reports different #{e.hash_type}: #{e.expected}" end + def fetch_patch p + fetch_fetchable p + rescue ChecksumMismatchError => e + Homebrew.failed = true + opoo "Patch reports different #{e.hash_type}: #{e.expected}" + end + private def retry_fetch? f diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 3031da721..1f9c645d5 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -117,6 +117,10 @@ class Formula active_spec.clear_cache end + def patchlist + active_spec.patches + end + # if the dir is there, but it's empty we consider it not installed def installed? (dir = installed_prefix).directory? && dir.children.length > 0 diff --git a/Library/Homebrew/patch.rb b/Library/Homebrew/patch.rb index 64325e78d..27ce2d9c3 100644 --- a/Library/Homebrew/patch.rb +++ b/Library/Homebrew/patch.rb @@ -1,6 +1,7 @@ require 'resource' require 'stringio' require 'erb' +require 'forwardable' class Patch def self.create(strip, io=nil, &block) @@ -80,8 +81,13 @@ class IOPatch < Patch end class ExternalPatch < Patch + extend Forwardable + attr_reader :resource, :strip + def_delegators :@resource, :fetch, :verify_download_integrity, + :cached_download, :clear_cache + def initialize(strip, &block) @strip = strip @resource = Resource.new(&block) |
