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)
|
fetch_formula(f.bottle)
|
||||||
else
|
else
|
||||||
fetch_formula(f)
|
fetch_formula(f)
|
||||||
f.resources.each do |r|
|
f.resources.each { |r| fetch_resource(r) }
|
||||||
fetch_resource(r)
|
f.patchlist.select(&:external?).each { |p| fetch_patch(p) }
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -51,6 +50,13 @@ module Homebrew extend self
|
|||||||
opoo "Formula reports different #{e.hash_type}: #{e.expected}"
|
opoo "Formula reports different #{e.hash_type}: #{e.expected}"
|
||||||
end
|
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
|
private
|
||||||
|
|
||||||
def retry_fetch? f
|
def retry_fetch? f
|
||||||
|
|||||||
@ -117,6 +117,10 @@ class Formula
|
|||||||
active_spec.clear_cache
|
active_spec.clear_cache
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def patchlist
|
||||||
|
active_spec.patches
|
||||||
|
end
|
||||||
|
|
||||||
# if the dir is there, but it's empty we consider it not installed
|
# if the dir is there, but it's empty we consider it not installed
|
||||||
def installed?
|
def installed?
|
||||||
(dir = installed_prefix).directory? && dir.children.length > 0
|
(dir = installed_prefix).directory? && dir.children.length > 0
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
require 'resource'
|
require 'resource'
|
||||||
require 'stringio'
|
require 'stringio'
|
||||||
require 'erb'
|
require 'erb'
|
||||||
|
require 'forwardable'
|
||||||
|
|
||||||
class Patch
|
class Patch
|
||||||
def self.create(strip, io=nil, &block)
|
def self.create(strip, io=nil, &block)
|
||||||
@ -80,8 +81,13 @@ class IOPatch < Patch
|
|||||||
end
|
end
|
||||||
|
|
||||||
class ExternalPatch < Patch
|
class ExternalPatch < Patch
|
||||||
|
extend Forwardable
|
||||||
|
|
||||||
attr_reader :resource, :strip
|
attr_reader :resource, :strip
|
||||||
|
|
||||||
|
def_delegators :@resource, :fetch, :verify_download_integrity,
|
||||||
|
:cached_download, :clear_cache
|
||||||
|
|
||||||
def initialize(strip, &block)
|
def initialize(strip, &block)
|
||||||
@strip = strip
|
@strip = strip
|
||||||
@resource = Resource.new(&block)
|
@resource = Resource.new(&block)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user