Merge pull request #7563 from MikeMcQuaid/prepare_patches

Split out prepare_patches and fetch_patches methods.
This commit is contained in:
Mike McQuaid 2020-05-13 12:12:18 +01:00 committed by GitHub
commit 390778f2a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View File

@ -1165,6 +1165,8 @@ class Formula
active_spec.fetch if fetch
stage do |staging|
staging.retain! if Homebrew.args.keep_tmp?
prepare_patches
fetch_patches if fetch
begin
@ -2082,14 +2084,16 @@ class Formula
end
def fetch_patches
active_spec.add_legacy_patches(patches) if respond_to?(:patches)
patchlist.grep(DATAPatch) { |p| p.path = path }
patchlist.select(&:external?).each(&:fetch)
end
private
def prepare_patches
active_spec.add_legacy_patches(patches) if respond_to?(:patches)
patchlist.grep(DATAPatch) { |p| p.path = path }
end
# Returns the prefix for a given formula version number.
# @private
def versioned_prefix(v)

View File

@ -74,14 +74,18 @@ class Resource
def stage(target = nil, &block)
raise ArgumentError, "target directory or block is required" if target.blank? && block.blank?
prepare_patches
fetch_patches(skip_downloaded: true)
fetch unless downloaded?
unpack(target, &block)
end
def fetch_patches(skip_downloaded: false)
def prepare_patches
patches.grep(DATAPatch) { |p| p.path = owner.owner.path }
end
def fetch_patches(skip_downloaded: false)
patches.select!(&:external?)
patches.reject!(&:downloaded?) if skip_downloaded
patches.each(&:fetch)