Merge pull request #6232 from MikeMcQuaid/resource-fetch-default
Resource#fetch: verify downloads by default.
This commit is contained in:
commit
fddf5b16bd
@ -133,7 +133,7 @@ module Homebrew
|
||||
already_fetched = f.cached_download.exist?
|
||||
|
||||
begin
|
||||
download = f.fetch
|
||||
download = f.fetch(verify_download_integrity: false)
|
||||
rescue DownloadError
|
||||
retry if retry_fetch? f
|
||||
raise
|
||||
|
||||
@ -47,7 +47,6 @@ module Homebrew
|
||||
downloader = f.downloader
|
||||
|
||||
downloader.fetch
|
||||
f.verify_download_integrity(downloader.cached_location)
|
||||
|
||||
filename = downloader.basename
|
||||
|
||||
|
||||
@ -1688,8 +1688,8 @@ class Formula
|
||||
end
|
||||
|
||||
# @private
|
||||
def fetch
|
||||
active_spec.fetch
|
||||
def fetch(verify_download_integrity: true)
|
||||
active_spec.fetch(verify_download_integrity: verify_download_integrity)
|
||||
end
|
||||
|
||||
# @private
|
||||
@ -2057,10 +2057,7 @@ class Formula
|
||||
active_spec.add_legacy_patches(patches) if respond_to?(:patches)
|
||||
|
||||
patchlist.grep(DATAPatch) { |p| p.path = path }
|
||||
|
||||
patchlist.each do |patch|
|
||||
patch.verify_download_integrity(patch.fetch) if patch.external?
|
||||
end
|
||||
patchlist.select(&:external?).each(&:fetch)
|
||||
end
|
||||
|
||||
# The methods below define the formula DSL.
|
||||
|
||||
@ -948,8 +948,9 @@ class FormulaInstaller
|
||||
downloader = LocalBottleDownloadStrategy.new(bottle_path)
|
||||
else
|
||||
downloader = formula.bottle
|
||||
downloader.verify_download_integrity(downloader.fetch)
|
||||
downloader.fetch
|
||||
end
|
||||
|
||||
HOMEBREW_CELLAR.cd do
|
||||
downloader.stage
|
||||
end
|
||||
|
||||
@ -70,17 +70,14 @@ class Resource
|
||||
def stage(target = nil, &block)
|
||||
raise ArgumentError, "target directory or block is required" unless target || block
|
||||
|
||||
verify_download_integrity(fetch)
|
||||
fetch
|
||||
prepare_patches
|
||||
unpack(target, &block)
|
||||
end
|
||||
|
||||
def prepare_patches
|
||||
patches.grep(DATAPatch) { |p| p.path = owner.owner.path }
|
||||
|
||||
patches.each do |patch|
|
||||
patch.verify_download_integrity(patch.fetch) if patch.external?
|
||||
end
|
||||
patches.select(&:external?).each(&:fetch)
|
||||
end
|
||||
|
||||
def apply_patches
|
||||
@ -114,7 +111,7 @@ class Resource
|
||||
Partial.new(self, files)
|
||||
end
|
||||
|
||||
def fetch
|
||||
def fetch(verify_download_integrity: true)
|
||||
HOMEBREW_CACHE.mkpath
|
||||
|
||||
begin
|
||||
@ -123,7 +120,9 @@ class Resource
|
||||
raise DownloadError.new(self, e)
|
||||
end
|
||||
|
||||
cached_download
|
||||
download = cached_download
|
||||
verify_download_integrity(download) if verify_download_integrity
|
||||
download
|
||||
end
|
||||
|
||||
def verify_download_integrity(fn)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user