Pass args correctly in brew fetch.

This commit is contained in:
Markus Reiter 2020-07-31 19:14:25 +02:00
parent 096377abf2
commit 0ac6939a91

View File

@ -66,7 +66,7 @@ module Homebrew
fetched_bottle = false fetched_bottle = false
if fetch_bottle?(f, args: args) if fetch_bottle?(f, args: args)
begin begin
fetch_formula(f.bottle) fetch_formula(f.bottle, args: args)
rescue Interrupt rescue Interrupt
raise raise
rescue => e rescue => e
@ -82,40 +82,40 @@ module Homebrew
next if fetched_bottle next if fetched_bottle
fetch_formula(f) fetch_formula(f, args: args)
f.resources.each do |r| f.resources.each do |r|
fetch_resource(r) fetch_resource(r, args: args)
r.patches.each { |p| fetch_patch(p) if p.external? } r.patches.each { |p| fetch_patch(p, args: args) if p.external? }
end end
f.patchlist.each { |p| fetch_patch(p) if p.external? } f.patchlist.each { |p| fetch_patch(p, args: args) if p.external? }
end end
end end
def fetch_resource(r) def fetch_resource(r, args:)
puts "Resource: #{r.name}" puts "Resource: #{r.name}"
fetch_fetchable r fetch_fetchable r, args: args
rescue ChecksumMismatchError => e rescue ChecksumMismatchError => e
retry if retry_fetch? r retry if retry_fetch?(r, args: args)
opoo "Resource #{r.name} reports different #{e.hash_type}: #{e.expected}" opoo "Resource #{r.name} reports different #{e.hash_type}: #{e.expected}"
end end
def fetch_formula(f) def fetch_formula(f, args:)
fetch_fetchable f fetch_fetchable f, args: args
rescue ChecksumMismatchError => e rescue ChecksumMismatchError => e
retry if retry_fetch? f retry if retry_fetch?(f, args: args)
opoo "Formula reports different #{e.hash_type}: #{e.expected}" opoo "Formula reports different #{e.hash_type}: #{e.expected}"
end end
def fetch_patch(p) def fetch_patch(p, args:)
fetch_fetchable p fetch_fetchable p, args: args
rescue ChecksumMismatchError => e rescue ChecksumMismatchError => e
Homebrew.failed = true Homebrew.failed = true
opoo "Patch reports different #{e.hash_type}: #{e.expected}" opoo "Patch reports different #{e.hash_type}: #{e.expected}"
end end
def retry_fetch?(f) def retry_fetch?(f, args:)
@fetch_failed ||= Set.new @fetch_failed ||= Set.new
if args.retry? && @fetch_failed.add?(f) if args.retry? && @fetch_failed.add?(f)
ohai "Retrying download" ohai "Retrying download"
@ -127,7 +127,7 @@ module Homebrew
end end
end end
def fetch_fetchable(f) def fetch_fetchable(f, args:)
f.clear_cache if args.force? f.clear_cache if args.force?
already_fetched = f.cached_download.exist? already_fetched = f.cached_download.exist?
@ -135,7 +135,7 @@ module Homebrew
begin begin
download = f.fetch(verify_download_integrity: false) download = f.fetch(verify_download_integrity: false)
rescue DownloadError rescue DownloadError
retry if retry_fetch? f retry if retry_fetch?(f, args: args)
raise raise
end end