Teach fetch to download patches
This commit is contained in:
parent
665b14c4a4
commit
86cdd812a2
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user