Split out prepare_patches and fetch_patches methods.

The new `fetch_patches` method wasn't exclusively fetching so shouldn't
have been skipped when it was.

Fixes #7558.
This commit is contained in:
Mike McQuaid 2020-05-13 11:49:17 +01:00
parent 41b1faccb1
commit a7475a2946
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
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)