resource: fix patching when patch already fetched

This inappropriately modified the shared `patches` variable, meaning an
already fetched patch would be removed and therefore not be applied when
the resource was staged.
This commit is contained in:
Jonathan Chang 2020-05-14 20:08:01 +10:00
parent 0723df3f86
commit 2ffb87cb03

View File

@ -86,9 +86,12 @@ class Resource
end
def fetch_patches(skip_downloaded: false)
patches.select!(&:external?)
patches.reject!(&:downloaded?) if skip_downloaded
patches.each(&:fetch)
patches.each do |p|
next unless p.external?
next if p.downloaded? && skip_downloaded
p.fetch
end
end
def apply_patches