Pass verbose? to Formula#verify_download_integrity.
This commit is contained in:
parent
6c964d4a78
commit
bace9ecc34
@ -139,7 +139,13 @@ class Build
|
|||||||
|
|
||||||
formula.update_head_version
|
formula.update_head_version
|
||||||
|
|
||||||
formula.brew(fetch: false, keep_tmp: args.keep_tmp?, interactive: args.interactive?, debug: args.debug?) do
|
formula.brew(
|
||||||
|
fetch: false,
|
||||||
|
keep_tmp: args.keep_tmp?,
|
||||||
|
interactive: args.interactive?,
|
||||||
|
debug: args.debug?,
|
||||||
|
verbose: args.verbose?,
|
||||||
|
) do
|
||||||
# For head builds, HOMEBREW_FORMULA_PREFIX should include the commit,
|
# For head builds, HOMEBREW_FORMULA_PREFIX should include the commit,
|
||||||
# which is not known until after the formula has been staged.
|
# which is not known until after the formula has been staged.
|
||||||
ENV["HOMEBREW_FORMULA_PREFIX"] = formula.prefix
|
ENV["HOMEBREW_FORMULA_PREFIX"] = formula.prefix
|
||||||
|
|||||||
@ -133,7 +133,7 @@ module Homebrew
|
|||||||
already_fetched = f.cached_download.exist?
|
already_fetched = f.cached_download.exist?
|
||||||
|
|
||||||
begin
|
begin
|
||||||
download = f.fetch(verify_download_integrity: false)
|
download = f.fetch(verify_download_integrity: false, verbose: args.verbose?)
|
||||||
rescue DownloadError
|
rescue DownloadError
|
||||||
retry if retry_fetch?(f, args: args)
|
retry if retry_fetch?(f, args: args)
|
||||||
raise
|
raise
|
||||||
@ -144,6 +144,6 @@ module Homebrew
|
|||||||
puts "Downloaded to: #{download}" unless already_fetched
|
puts "Downloaded to: #{download}" unless already_fetched
|
||||||
puts Checksum::TYPES.map { |t| "#{t.to_s.upcase}: #{download.send(t)}" }
|
puts Checksum::TYPES.map { |t| "#{t.to_s.upcase}: #{download.send(t)}" }
|
||||||
|
|
||||||
f.verify_download_integrity(download)
|
f.verify_download_integrity(download, verbose: args.verbose?)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -57,6 +57,7 @@ class Formula
|
|||||||
extend Enumerable
|
extend Enumerable
|
||||||
extend Forwardable
|
extend Forwardable
|
||||||
extend Cachable
|
extend Cachable
|
||||||
|
extend Predicable
|
||||||
|
|
||||||
# @!method inreplace(paths, before = nil, after = nil)
|
# @!method inreplace(paths, before = nil, after = nil)
|
||||||
# Actually implemented in {Utils::Inreplace.inreplace}.
|
# Actually implemented in {Utils::Inreplace.inreplace}.
|
||||||
@ -1167,17 +1168,22 @@ class Formula
|
|||||||
patchlist.each(&:apply)
|
patchlist.each(&:apply)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @private
|
||||||
|
attr_predicate :debug?, :verbose?
|
||||||
|
|
||||||
# yields |self,staging| with current working directory set to the uncompressed tarball
|
# yields |self,staging| with current working directory set to the uncompressed tarball
|
||||||
# where staging is a Mktemp staging context
|
# where staging is a Mktemp staging context
|
||||||
# @private
|
# @private
|
||||||
def brew(fetch: true, keep_tmp: false, interactive: false, debug: false)
|
def brew(fetch: true, keep_tmp: false, interactive: false, debug: false, verbose: false)
|
||||||
|
@debug = debug
|
||||||
|
@verbose = verbose
|
||||||
@prefix_returns_versioned_prefix = true
|
@prefix_returns_versioned_prefix = true
|
||||||
active_spec.fetch if fetch
|
active_spec.fetch if fetch
|
||||||
stage(interactive: interactive) do |staging|
|
stage(interactive: interactive) do |staging|
|
||||||
staging.retain! if keep_tmp
|
staging.retain! if keep_tmp
|
||||||
|
|
||||||
prepare_patches
|
prepare_patches
|
||||||
fetch_patches if fetch
|
fetch_patches(verbose: verbose) if fetch
|
||||||
|
|
||||||
begin
|
begin
|
||||||
yield self, staging
|
yield self, staging
|
||||||
@ -1189,6 +1195,8 @@ class Formula
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
ensure
|
ensure
|
||||||
|
@debug = nil
|
||||||
|
@verbose = nil
|
||||||
@prefix_returns_versioned_prefix = false
|
@prefix_returns_versioned_prefix = false
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1793,17 +1801,19 @@ class Formula
|
|||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
def fetch(verify_download_integrity: true)
|
def fetch(verify_download_integrity: true, verbose: false)
|
||||||
active_spec.fetch(verify_download_integrity: verify_download_integrity)
|
active_spec.fetch(verify_download_integrity: verify_download_integrity, verbose: verbose)
|
||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
def verify_download_integrity(fn)
|
def verify_download_integrity(fn, verbose: false)
|
||||||
active_spec.verify_download_integrity(fn)
|
active_spec.verify_download_integrity(fn, verbose: verbose)
|
||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
def run_test(keep_tmp: false, debug: false)
|
def run_test(keep_tmp: false, debug: false, verbose: false)
|
||||||
|
@debug = debug
|
||||||
|
@verbose = verbose
|
||||||
@prefix_returns_versioned_prefix = true
|
@prefix_returns_versioned_prefix = true
|
||||||
|
|
||||||
test_env = {
|
test_env = {
|
||||||
@ -1836,8 +1846,10 @@ class Formula
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
ensure
|
ensure
|
||||||
@testpath = nil
|
@debug = nil
|
||||||
|
@verbose = nil
|
||||||
@prefix_returns_versioned_prefix = false
|
@prefix_returns_versioned_prefix = false
|
||||||
|
@testpath = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
@ -1927,13 +1939,12 @@ class Formula
|
|||||||
# # If there is a "make", "install" available, please use it!
|
# # If there is a "make", "install" available, please use it!
|
||||||
# system "make", "install"</pre>
|
# system "make", "install"</pre>
|
||||||
def system(cmd, *args)
|
def system(cmd, *args)
|
||||||
verbose = Homebrew.args.verbose?
|
|
||||||
verbose_using_dots = Homebrew::EnvConfig.verbose_using_dots?
|
verbose_using_dots = Homebrew::EnvConfig.verbose_using_dots?
|
||||||
|
|
||||||
# remove "boring" arguments so that the important ones are more likely to
|
# remove "boring" arguments so that the important ones are more likely to
|
||||||
# be shown considering that we trim long ohai lines to the terminal width
|
# be shown considering that we trim long ohai lines to the terminal width
|
||||||
pretty_args = args.dup
|
pretty_args = args.dup
|
||||||
unless verbose
|
unless verbose?
|
||||||
case cmd
|
case cmd
|
||||||
when "./configure"
|
when "./configure"
|
||||||
pretty_args -= %w[--disable-dependency-tracking --disable-debug --disable-silent-rules]
|
pretty_args -= %w[--disable-dependency-tracking --disable-debug --disable-silent-rules]
|
||||||
@ -1961,7 +1972,7 @@ class Formula
|
|||||||
log.puts Time.now, "", cmd, args, ""
|
log.puts Time.now, "", cmd, args, ""
|
||||||
log.flush
|
log.flush
|
||||||
|
|
||||||
if verbose
|
if verbose?
|
||||||
rd, wr = IO.pipe
|
rd, wr = IO.pipe
|
||||||
begin
|
begin
|
||||||
pid = fork do
|
pid = fork do
|
||||||
@ -2004,7 +2015,7 @@ class Formula
|
|||||||
log_lines = Homebrew::EnvConfig.fail_log_lines
|
log_lines = Homebrew::EnvConfig.fail_log_lines
|
||||||
|
|
||||||
log.flush
|
log.flush
|
||||||
if !verbose || verbose_using_dots
|
if !verbose? || verbose_using_dots
|
||||||
puts "Last #{log_lines} lines from #{logfn}:"
|
puts "Last #{log_lines} lines from #{logfn}:"
|
||||||
Kernel.system "/usr/bin/tail", "-n", log_lines, logfn
|
Kernel.system "/usr/bin/tail", "-n", log_lines, logfn
|
||||||
end
|
end
|
||||||
@ -2092,8 +2103,10 @@ class Formula
|
|||||||
ENV.update(removed)
|
ENV.update(removed)
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_patches
|
def fetch_patches(verbose: false)
|
||||||
patchlist.select(&:external?).each(&:fetch)
|
patchlist.select(&:external?).each do |p|
|
||||||
|
p.fetch(verbose: verbose)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@ -1027,8 +1027,10 @@ class FormulaInstaller
|
|||||||
end
|
end
|
||||||
return if pour_bottle?
|
return if pour_bottle?
|
||||||
|
|
||||||
formula.fetch_patches
|
formula.fetch_patches(verbose: verbose?)
|
||||||
formula.resources.each(&:fetch)
|
formula.resources.each do |r|
|
||||||
|
r.fetch(verbose: verbose?)
|
||||||
|
end
|
||||||
downloader.fetch
|
downloader.fetch
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -179,12 +179,12 @@ class LegacyPatch < ExternalPatch
|
|||||||
resource.download_strategy = CurlDownloadStrategy
|
resource.download_strategy = CurlDownloadStrategy
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch
|
def fetch(verbose: false)
|
||||||
clear_cache
|
clear_cache
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
def verify_download_integrity(_fn)
|
def verify_download_integrity(_fn, verbose: false)
|
||||||
# no-op
|
# no-op
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -74,9 +74,10 @@ class Resource
|
|||||||
def stage(target = nil, &block)
|
def stage(target = nil, &block)
|
||||||
raise ArgumentError, "target directory or block is required" if !target && block.blank?
|
raise ArgumentError, "target directory or block is required" if !target && block.blank?
|
||||||
|
|
||||||
|
verbose = owner.owner.verbose?
|
||||||
prepare_patches
|
prepare_patches
|
||||||
fetch_patches(skip_downloaded: true)
|
fetch_patches(skip_downloaded: true, verbose: verbose)
|
||||||
fetch unless downloaded?
|
fetch(verbose: owner.owner.verbose?) unless downloaded?
|
||||||
|
|
||||||
unpack(target, &block)
|
unpack(target, &block)
|
||||||
end
|
end
|
||||||
@ -85,10 +86,12 @@ class Resource
|
|||||||
patches.grep(DATAPatch) { |p| p.path = owner.owner.path }
|
patches.grep(DATAPatch) { |p| p.path = owner.owner.path }
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_patches(skip_downloaded: false)
|
def fetch_patches(skip_downloaded: false, verbose: false)
|
||||||
external_patches = patches.select(&:external?)
|
external_patches = patches.select(&:external?)
|
||||||
external_patches.reject!(&:downloaded?) if skip_downloaded
|
external_patches.reject!(&:downloaded?) if skip_downloaded
|
||||||
external_patches.each(&:fetch)
|
external_patches.each do |p|
|
||||||
|
p.fetch(verbose: verbose)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def apply_patches
|
def apply_patches
|
||||||
@ -122,10 +125,10 @@ class Resource
|
|||||||
Partial.new(self, files)
|
Partial.new(self, files)
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch(verify_download_integrity: true)
|
def fetch(verify_download_integrity: true, verbose: false)
|
||||||
HOMEBREW_CACHE.mkpath
|
HOMEBREW_CACHE.mkpath
|
||||||
|
|
||||||
fetch_patches
|
fetch_patches(verbose: verbose)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
downloader.fetch
|
downloader.fetch
|
||||||
@ -134,13 +137,13 @@ class Resource
|
|||||||
end
|
end
|
||||||
|
|
||||||
download = cached_download
|
download = cached_download
|
||||||
verify_download_integrity(download) if verify_download_integrity
|
verify_download_integrity(download, verbose: verbose) if verify_download_integrity
|
||||||
download
|
download
|
||||||
end
|
end
|
||||||
|
|
||||||
def verify_download_integrity(fn)
|
def verify_download_integrity(fn, verbose: false)
|
||||||
if fn.file?
|
if fn.file?
|
||||||
ohai "Verifying #{fn.basename} checksum" if Homebrew.args.verbose?
|
ohai "Verifying #{fn.basename} checksum" if verbose
|
||||||
fn.verify_checksum(checksum)
|
fn.verify_checksum(checksum)
|
||||||
end
|
end
|
||||||
rescue ChecksumMissingError
|
rescue ChecksumMissingError
|
||||||
|
|||||||
@ -239,8 +239,8 @@ class HeadSoftwareSpec < SoftwareSpec
|
|||||||
@resource.version = Version.create("HEAD")
|
@resource.version = Version.create("HEAD")
|
||||||
end
|
end
|
||||||
|
|
||||||
def verify_download_integrity(_fn)
|
def verify_download_integrity(_fn, verbose: false)
|
||||||
nil
|
# no-op
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,9 @@ begin
|
|||||||
|
|
||||||
# tests can also return false to indicate failure
|
# tests can also return false to indicate failure
|
||||||
Timeout.timeout TEST_TIMEOUT_SECONDS do
|
Timeout.timeout TEST_TIMEOUT_SECONDS do
|
||||||
raise "test returned false" if formula.run_test(keep_tmp: args.keep_tmp?, debug: args.debug?) == false
|
if formula.run_test(keep_tmp: args.keep_tmp?, debug: args.debug?, verbose: args.verbose?) == false
|
||||||
|
raise "test returned false"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
rescue Exception => e # rubocop:disable Lint/RescueException
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
||||||
error_pipe.puts e.to_json
|
error_pipe.puts e.to_json
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user