brew.rb: handle missing args.
This commit is contained in:
parent
3840d7145c
commit
ea2892f8ee
@ -95,7 +95,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
mtime = insecure_download ? Time.new(1970, 1, 1) : Time.now
|
mtime = insecure_download ? Time.new(1970, 1, 1) : Time.now
|
||||||
FileUtils.touch(target, mtime: mtime) unless skip_download
|
FileUtils.touch(target, mtime:) unless skip_download
|
||||||
JSON.parse(target.read, freeze: true)
|
JSON.parse(target.read, freeze: true)
|
||||||
rescue JSON::ParserError
|
rescue JSON::ParserError
|
||||||
target.unlink
|
target.unlink
|
||||||
|
|||||||
@ -83,7 +83,7 @@ module Homebrew
|
|||||||
def self.write_names(regenerate: false)
|
def self.write_names(regenerate: false)
|
||||||
download_and_cache_data! unless cache.key?("casks")
|
download_and_cache_data! unless cache.key?("casks")
|
||||||
|
|
||||||
Homebrew::API.write_names_file(all_casks.keys, "cask", regenerate: regenerate)
|
Homebrew::API.write_names_file(all_casks.keys, "cask", regenerate:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -119,7 +119,7 @@ module Homebrew
|
|||||||
def self.write_names_and_aliases(regenerate: false)
|
def self.write_names_and_aliases(regenerate: false)
|
||||||
download_and_cache_data! unless cache.key?("formulae")
|
download_and_cache_data! unless cache.key?("formulae")
|
||||||
|
|
||||||
return unless Homebrew::API.write_names_file(all_formulae.keys, "formula", regenerate: regenerate)
|
return unless Homebrew::API.write_names_file(all_formulae.keys, "formula", regenerate:)
|
||||||
|
|
||||||
(HOMEBREW_CACHE_API/"formula_aliases.txt").open("w") do |file|
|
(HOMEBREW_CACHE_API/"formula_aliases.txt").open("w") do |file|
|
||||||
all_aliases.each do |alias_name, real_name|
|
all_aliases.each do |alias_name, real_name|
|
||||||
|
|||||||
@ -78,7 +78,7 @@ begin
|
|||||||
# - no arguments are passed
|
# - no arguments are passed
|
||||||
if empty_argv || help_flag
|
if empty_argv || help_flag
|
||||||
require "help"
|
require "help"
|
||||||
Homebrew::Help.help cmd, remaining_args: args.remaining, empty_argv: empty_argv
|
Homebrew::Help.help cmd, remaining_args: args.remaining, empty_argv:
|
||||||
# `Homebrew::Help.help` never returns, except for unknown commands.
|
# `Homebrew::Help.help` never returns, except for unknown commands.
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -133,14 +133,14 @@ rescue UsageError => e
|
|||||||
Homebrew::Help.help cmd, remaining_args: args.remaining, usage_error: e.message
|
Homebrew::Help.help cmd, remaining_args: args.remaining, usage_error: e.message
|
||||||
rescue SystemExit => e
|
rescue SystemExit => e
|
||||||
onoe "Kernel.exit" if args.debug? && !e.success?
|
onoe "Kernel.exit" if args.debug? && !e.success?
|
||||||
$stderr.puts Utils::Backtrace.clean(e) if args.debug?
|
$stderr.puts Utils::Backtrace.clean(e) if args&.debug? || ARGV.include?("--debug")
|
||||||
raise
|
raise
|
||||||
rescue Interrupt
|
rescue Interrupt
|
||||||
$stderr.puts # seemingly a newline is typical
|
$stderr.puts # seemingly a newline is typical
|
||||||
exit 130
|
exit 130
|
||||||
rescue BuildError => e
|
rescue BuildError => e
|
||||||
Utils::Analytics.report_build_error(e)
|
Utils::Analytics.report_build_error(e)
|
||||||
e.dump(verbose: args.verbose?)
|
e.dump(verbose: args&.verbose?)
|
||||||
|
|
||||||
if e.formula.head? || e.formula.deprecated? || e.formula.disabled?
|
if e.formula.head? || e.formula.deprecated? || e.formula.disabled?
|
||||||
reason = if e.formula.head?
|
reason = if e.formula.head?
|
||||||
@ -167,7 +167,7 @@ rescue RuntimeError, SystemCallError => e
|
|||||||
raise if e.message.empty?
|
raise if e.message.empty?
|
||||||
|
|
||||||
onoe e
|
onoe e
|
||||||
$stderr.puts Utils::Backtrace.clean(e) if args.debug?
|
$stderr.puts Utils::Backtrace.clean(e) if args&.debug? || ARGV.include?("--debug")
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
rescue MethodDeprecatedError => e
|
rescue MethodDeprecatedError => e
|
||||||
@ -176,7 +176,7 @@ rescue MethodDeprecatedError => e
|
|||||||
$stderr.puts "If reporting this issue please do so at (not Homebrew/brew or Homebrew/homebrew-core):"
|
$stderr.puts "If reporting this issue please do so at (not Homebrew/brew or Homebrew/homebrew-core):"
|
||||||
$stderr.puts " #{Formatter.url(e.issues_url)}"
|
$stderr.puts " #{Formatter.url(e.issues_url)}"
|
||||||
end
|
end
|
||||||
$stderr.puts Utils::Backtrace.clean(e) if args.debug?
|
$stderr.puts Utils::Backtrace.clean(e) if args&.debug? || ARGV.include?("--debug")
|
||||||
exit 1
|
exit 1
|
||||||
rescue Exception => e # rubocop:disable Lint/RescueException
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
||||||
onoe e
|
onoe e
|
||||||
|
|||||||
@ -80,7 +80,7 @@ class Build
|
|||||||
ENV.deps = formula_deps
|
ENV.deps = formula_deps
|
||||||
ENV.run_time_deps = run_time_deps
|
ENV.run_time_deps = run_time_deps
|
||||||
ENV.setup_build_environment(
|
ENV.setup_build_environment(
|
||||||
formula: formula,
|
formula:,
|
||||||
cc: args.cc,
|
cc: args.cc,
|
||||||
build_bottle: args.build_bottle?,
|
build_bottle: args.build_bottle?,
|
||||||
bottle_arch: args.bottle_arch,
|
bottle_arch: args.bottle_arch,
|
||||||
@ -93,7 +93,7 @@ class Build
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
ENV.setup_build_environment(
|
ENV.setup_build_environment(
|
||||||
formula: formula,
|
formula:,
|
||||||
cc: args.cc,
|
cc: args.cc,
|
||||||
build_bottle: args.build_bottle?,
|
build_bottle: args.build_bottle?,
|
||||||
bottle_arch: args.bottle_arch,
|
bottle_arch: args.bottle_arch,
|
||||||
@ -225,7 +225,7 @@ begin
|
|||||||
|
|
||||||
formula = args.named.to_formulae.first
|
formula = args.named.to_formulae.first
|
||||||
options = Options.create(args.flags_only)
|
options = Options.create(args.flags_only)
|
||||||
build = Build.new(formula, options, args: args)
|
build = Build.new(formula, options, args:)
|
||||||
build.install
|
build.install
|
||||||
rescue Exception => e # rubocop:disable Lint/RescueException
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
||||||
error_hash = JSON.parse e.to_json
|
error_hash = JSON.parse e.to_json
|
||||||
|
|||||||
@ -113,7 +113,7 @@ module Cask
|
|||||||
plist_status = command.run(
|
plist_status = command.run(
|
||||||
"/bin/launchctl",
|
"/bin/launchctl",
|
||||||
args: ["list", service],
|
args: ["list", service],
|
||||||
sudo: sudo,
|
sudo:,
|
||||||
sudo_as_root: sudo,
|
sudo_as_root: sudo,
|
||||||
print_stderr: false,
|
print_stderr: false,
|
||||||
).stdout
|
).stdout
|
||||||
@ -121,7 +121,7 @@ module Cask
|
|||||||
command.run!(
|
command.run!(
|
||||||
"/bin/launchctl",
|
"/bin/launchctl",
|
||||||
args: ["remove", service],
|
args: ["remove", service],
|
||||||
sudo: sudo,
|
sudo:,
|
||||||
sudo_as_root: sudo,
|
sudo_as_root: sudo,
|
||||||
)
|
)
|
||||||
sleep 1
|
sleep 1
|
||||||
@ -133,7 +133,7 @@ module Cask
|
|||||||
paths.each { |elt| elt.prepend(Dir.home).freeze } unless sudo
|
paths.each { |elt| elt.prepend(Dir.home).freeze } unless sudo
|
||||||
paths = paths.map { |elt| Pathname(elt) }.select(&:exist?)
|
paths = paths.map { |elt| Pathname(elt) }.select(&:exist?)
|
||||||
paths.each do |path|
|
paths.each do |path|
|
||||||
command.run!("/bin/rm", args: ["-f", "--", path], sudo: sudo, sudo_as_root: sudo)
|
command.run!("/bin/rm", args: ["-f", "--", path], sudo:, sudo_as_root: sudo)
|
||||||
end
|
end
|
||||||
# undocumented and untested: pass a path to uninstall :launchctl
|
# undocumented and untested: pass a path to uninstall :launchctl
|
||||||
next unless Pathname(service).exist?
|
next unless Pathname(service).exist?
|
||||||
@ -141,13 +141,13 @@ module Cask
|
|||||||
command.run!(
|
command.run!(
|
||||||
"/bin/launchctl",
|
"/bin/launchctl",
|
||||||
args: ["unload", "-w", "--", service],
|
args: ["unload", "-w", "--", service],
|
||||||
sudo: sudo,
|
sudo:,
|
||||||
sudo_as_root: sudo,
|
sudo_as_root: sudo,
|
||||||
)
|
)
|
||||||
command.run!(
|
command.run!(
|
||||||
"/bin/rm",
|
"/bin/rm",
|
||||||
args: ["-f", "--", service],
|
args: ["-f", "--", service],
|
||||||
sudo: sudo,
|
sudo:,
|
||||||
sudo_as_root: sudo,
|
sudo_as_root: sudo,
|
||||||
)
|
)
|
||||||
sleep 1
|
sleep 1
|
||||||
@ -511,13 +511,13 @@ module Cask
|
|||||||
|
|
||||||
# Directory counts as empty if it only contains a `.DS_Store`.
|
# Directory counts as empty if it only contains a `.DS_Store`.
|
||||||
if children.include?(ds_store = resolved_path/".DS_Store")
|
if children.include?(ds_store = resolved_path/".DS_Store")
|
||||||
Utils.gain_permissions_remove(ds_store, command: command)
|
Utils.gain_permissions_remove(ds_store, command:)
|
||||||
children.delete(ds_store)
|
children.delete(ds_store)
|
||||||
end
|
end
|
||||||
|
|
||||||
next false unless recursive_rmdir(*children, command: command)
|
next false unless recursive_rmdir(*children, command:)
|
||||||
|
|
||||||
Utils.gain_permissions_rmdir(resolved_path, command: command)
|
Utils.gain_permissions_rmdir(resolved_path, command:)
|
||||||
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|||||||
@ -31,11 +31,6 @@ module Cask
|
|||||||
def resolve_target(target)
|
def resolve_target(target)
|
||||||
super(target, base_dir: nil)
|
super(target, base_dir: nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(cask: Cask, source: T.any(String, Pathname), target: T.any(String, Pathname)).void }
|
|
||||||
def initialize(cask, source, target:)
|
|
||||||
super(cask, source, target: target)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -10,7 +10,7 @@ module Cask
|
|||||||
# @api private
|
# @api private
|
||||||
class Binary < Symlinked
|
class Binary < Symlinked
|
||||||
def link(command: nil, **options)
|
def link(command: nil, **options)
|
||||||
super(command: command, **options)
|
super(command:, **options)
|
||||||
return if source.executable?
|
return if source.executable?
|
||||||
|
|
||||||
if source.writable?
|
if source.writable?
|
||||||
|
|||||||
@ -94,7 +94,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
|
|
||||||
def to_h
|
def to_h
|
||||||
{ path: path }.tap do |h|
|
{ path: }.tap do |h|
|
||||||
h[:args] = args unless is_a?(ManualInstaller)
|
h[:args] = args unless is_a?(ManualInstaller)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -46,7 +46,7 @@ module Cask
|
|||||||
if target.parent.writable? && !force
|
if target.parent.writable? && !force
|
||||||
target.rmdir
|
target.rmdir
|
||||||
else
|
else
|
||||||
Utils.gain_permissions_remove(target, command: command)
|
Utils.gain_permissions_remove(target, command:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -55,7 +55,7 @@ module Cask
|
|||||||
same = command.run(
|
same = command.run(
|
||||||
"/usr/bin/diff",
|
"/usr/bin/diff",
|
||||||
args: ["--recursive", "--brief", source, target],
|
args: ["--recursive", "--brief", source, target],
|
||||||
verbose: verbose,
|
verbose:,
|
||||||
print_stdout: verbose,
|
print_stdout: verbose,
|
||||||
).success?
|
).success?
|
||||||
|
|
||||||
@ -76,22 +76,22 @@ module Cask
|
|||||||
raise CaskError, "#{message}." unless force
|
raise CaskError, "#{message}." unless force
|
||||||
|
|
||||||
opoo "#{message}; overwriting."
|
opoo "#{message}; overwriting."
|
||||||
delete(target, force: force, command: command, **options)
|
delete(target, force:, command:, **options)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
ohai "Moving #{self.class.english_name} '#{source.basename}' to '#{target}'"
|
ohai "Moving #{self.class.english_name} '#{source.basename}' to '#{target}'"
|
||||||
|
|
||||||
Utils.gain_permissions_mkpath(target.dirname, command: command) unless target.dirname.exist?
|
Utils.gain_permissions_mkpath(target.dirname, command:) unless target.dirname.exist?
|
||||||
|
|
||||||
if target.directory? && Quarantine.app_management_permissions_granted?(app: target, command: command)
|
if target.directory? && Quarantine.app_management_permissions_granted?(app: target, command:)
|
||||||
if target.writable?
|
if target.writable?
|
||||||
source.children.each { |child| FileUtils.move(child, target/child.basename) }
|
source.children.each { |child| FileUtils.move(child, target/child.basename) }
|
||||||
else
|
else
|
||||||
command.run!("/bin/cp", args: ["-pR", *source.children, target],
|
command.run!("/bin/cp", args: ["-pR", *source.children, target],
|
||||||
sudo: true)
|
sudo: true)
|
||||||
end
|
end
|
||||||
Quarantine.copy_xattrs(source, target, command: command)
|
Quarantine.copy_xattrs(source, target, command:)
|
||||||
source.rmtree
|
source.rmtree
|
||||||
elsif target.dirname.writable?
|
elsif target.dirname.writable?
|
||||||
FileUtils.move(source, target)
|
FileUtils.move(source, target)
|
||||||
@ -109,7 +109,7 @@ module Cask
|
|||||||
def post_move(command)
|
def post_move(command)
|
||||||
FileUtils.ln_sf target, source
|
FileUtils.ln_sf target, source
|
||||||
|
|
||||||
add_altname_metadata(target, source.basename, command: command)
|
add_altname_metadata(target, source.basename, command:)
|
||||||
end
|
end
|
||||||
|
|
||||||
def matching_artifact?(cask)
|
def matching_artifact?(cask)
|
||||||
@ -129,7 +129,7 @@ module Cask
|
|||||||
raise CaskError, "#{message}." unless force
|
raise CaskError, "#{message}." unless force
|
||||||
|
|
||||||
opoo "#{message}; overwriting."
|
opoo "#{message}; overwriting."
|
||||||
delete(source, force: force, command: command, **options)
|
delete(source, force:, command:, **options)
|
||||||
end
|
end
|
||||||
|
|
||||||
unless target.exist?
|
unless target.exist?
|
||||||
@ -144,7 +144,7 @@ module Cask
|
|||||||
# We need to preserve extended attributes between copies.
|
# We need to preserve extended attributes between copies.
|
||||||
command.run!("/bin/cp", args: ["-pR", target, source], sudo: !source.parent.writable?)
|
command.run!("/bin/cp", args: ["-pR", target, source], sudo: !source.parent.writable?)
|
||||||
|
|
||||||
delete(target, force: force, command: command, **options)
|
delete(target, force:, command:, **options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete(target, force: false, successor: nil, command: nil, **_)
|
def delete(target, force: false, successor: nil, command: nil, **_)
|
||||||
@ -154,7 +154,7 @@ module Cask
|
|||||||
return unless Utils.path_occupied?(target)
|
return unless Utils.path_occupied?(target)
|
||||||
|
|
||||||
if target.directory? && matching_artifact?(successor) && Quarantine.app_management_permissions_granted?(
|
if target.directory? && matching_artifact?(successor) && Quarantine.app_management_permissions_granted?(
|
||||||
app: target, command: command,
|
app: target, command:,
|
||||||
)
|
)
|
||||||
# If an app folder is deleted, macOS considers the app uninstalled and removes some data.
|
# If an app folder is deleted, macOS considers the app uninstalled and removes some data.
|
||||||
# Remove only the contents to handle this case.
|
# Remove only the contents to handle this case.
|
||||||
@ -162,13 +162,13 @@ module Cask
|
|||||||
if target.writable? && !force
|
if target.writable? && !force
|
||||||
child.rmtree
|
child.rmtree
|
||||||
else
|
else
|
||||||
Utils.gain_permissions_remove(child, command: command)
|
Utils.gain_permissions_remove(child, command:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elsif target.parent.writable? && !force
|
elsif target.parent.writable? && !force
|
||||||
target.rmtree
|
target.rmtree
|
||||||
else
|
else
|
||||||
Utils.gain_permissions_remove(target, command: command)
|
Utils.gain_permissions_remove(target, command:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -66,9 +66,9 @@ module Cask
|
|||||||
"/usr/sbin/installer",
|
"/usr/sbin/installer",
|
||||||
sudo: true,
|
sudo: true,
|
||||||
sudo_as_root: true,
|
sudo_as_root: true,
|
||||||
args: args,
|
args:,
|
||||||
print_stdout: true,
|
print_stdout: true,
|
||||||
env: env,
|
env:,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -57,30 +57,30 @@ module Cask
|
|||||||
if force && target.symlink? &&
|
if force && target.symlink? &&
|
||||||
(target.realpath == source.realpath || target.realpath.to_s.start_with?("#{cask.caskroom_path}/"))
|
(target.realpath == source.realpath || target.realpath.to_s.start_with?("#{cask.caskroom_path}/"))
|
||||||
opoo "#{message}; overwriting."
|
opoo "#{message}; overwriting."
|
||||||
Utils.gain_permissions_remove(target, command: command)
|
Utils.gain_permissions_remove(target, command:)
|
||||||
else
|
else
|
||||||
raise CaskError, "#{message}."
|
raise CaskError, "#{message}."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
ohai "Linking #{self.class.english_name} '#{source.basename}' to '#{target}'"
|
ohai "Linking #{self.class.english_name} '#{source.basename}' to '#{target}'"
|
||||||
create_filesystem_link(command: command)
|
create_filesystem_link(command:)
|
||||||
end
|
end
|
||||||
|
|
||||||
def unlink(command: nil, **)
|
def unlink(command: nil, **)
|
||||||
return unless target.symlink?
|
return unless target.symlink?
|
||||||
|
|
||||||
ohai "Unlinking #{self.class.english_name} '#{target}'"
|
ohai "Unlinking #{self.class.english_name} '#{target}'"
|
||||||
Utils.gain_permissions_remove(target, command: command)
|
Utils.gain_permissions_remove(target, command:)
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_filesystem_link(command: nil)
|
def create_filesystem_link(command: nil)
|
||||||
Utils.gain_permissions_mkpath(target.dirname, command: command)
|
Utils.gain_permissions_mkpath(target.dirname, command:)
|
||||||
|
|
||||||
command.run! "/bin/ln", args: ["-h", "-f", "-s", "--", source, target],
|
command.run! "/bin/ln", args: ["-h", "-f", "-s", "--", source, target],
|
||||||
sudo: !target.dirname.writable?
|
sudo: !target.dirname.writable?
|
||||||
|
|
||||||
add_altname_metadata(source, target.basename, command: command)
|
add_altname_metadata(source, target.basename, command:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -41,7 +41,7 @@ module Cask
|
|||||||
download = online || signing if download.nil?
|
download = online || signing if download.nil?
|
||||||
|
|
||||||
@cask = cask
|
@cask = cask
|
||||||
@download = Download.new(cask, quarantine: quarantine) if download
|
@download = Download.new(cask, quarantine:) if download
|
||||||
@online = online
|
@online = online
|
||||||
@strict = strict
|
@strict = strict
|
||||||
@signing = signing
|
@signing = signing
|
||||||
@ -95,7 +95,7 @@ module Cask
|
|||||||
# Only raise non-critical audits if the user specified `--strict`.
|
# Only raise non-critical audits if the user specified `--strict`.
|
||||||
return if strict_only && !@strict
|
return if strict_only && !@strict
|
||||||
|
|
||||||
errors << ({ message: message, location: location, corrected: false })
|
errors << ({ message:, location:, corrected: false })
|
||||||
end
|
end
|
||||||
|
|
||||||
def result
|
def result
|
||||||
@ -663,7 +663,7 @@ module Cask
|
|||||||
|
|
||||||
tag = SharedAudits.github_tag_from_url(cask.url)
|
tag = SharedAudits.github_tag_from_url(cask.url)
|
||||||
tag ||= cask.version
|
tag ||= cask.version
|
||||||
error = SharedAudits.github_release(user, repo, tag, cask: cask)
|
error = SharedAudits.github_release(user, repo, tag, cask:)
|
||||||
add_error error, location: cask.url.location if error
|
add_error error, location: cask.url.location if error
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -678,7 +678,7 @@ module Cask
|
|||||||
|
|
||||||
tag = SharedAudits.gitlab_tag_from_url(cask.url)
|
tag = SharedAudits.gitlab_tag_from_url(cask.url)
|
||||||
tag ||= cask.version
|
tag ||= cask.version
|
||||||
error = SharedAudits.gitlab_release(user, repo, tag, cask: cask)
|
error = SharedAudits.gitlab_release(user, repo, tag, cask:)
|
||||||
add_error error, location: cask.url.location if error
|
add_error error, location: cask.url.location if error
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -783,7 +783,7 @@ module Cask
|
|||||||
|
|
||||||
validate_url_for_https_availability(
|
validate_url_for_https_availability(
|
||||||
homepage, SharedAudits::URL_TYPE_HOMEPAGE,
|
homepage, SharedAudits::URL_TYPE_HOMEPAGE,
|
||||||
user_agents: user_agents,
|
user_agents:,
|
||||||
check_content: true,
|
check_content: true,
|
||||||
strict: strict?
|
strict: strict?
|
||||||
)
|
)
|
||||||
@ -843,7 +843,7 @@ module Cask
|
|||||||
add_error problem, location: location unless exception
|
add_error problem, location: location unless exception
|
||||||
elsif exception
|
elsif exception
|
||||||
add_error "#{url_to_check} is in the secure connection audit skiplist but does not need to be skipped",
|
add_error "#{url_to_check} is in the secure connection audit skiplist but does not need to be skipped",
|
||||||
location: location
|
location:
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -86,7 +86,7 @@ module Cask
|
|||||||
|
|
||||||
def audit_languages(languages)
|
def audit_languages(languages)
|
||||||
original_config = cask.config
|
original_config = cask.config
|
||||||
localized_config = original_config.merge(Config.new(explicit: { languages: languages }))
|
localized_config = original_config.merge(Config.new(explicit: { languages: }))
|
||||||
cask.config = localized_config
|
cask.config = localized_config
|
||||||
|
|
||||||
audit_cask_instance(cask)
|
audit_cask_instance(cask)
|
||||||
|
|||||||
@ -116,7 +116,7 @@ module Cask
|
|||||||
def timestamped_versions(caskroom_path: self.caskroom_path)
|
def timestamped_versions(caskroom_path: self.caskroom_path)
|
||||||
relative_paths = Pathname.glob(metadata_timestamped_path(
|
relative_paths = Pathname.glob(metadata_timestamped_path(
|
||||||
version: "*", timestamp: "*",
|
version: "*", timestamp: "*",
|
||||||
caskroom_path: caskroom_path
|
caskroom_path:
|
||||||
))
|
))
|
||||||
.map { |p| p.relative_path_from(p.parent.parent) }
|
.map { |p| p.relative_path_from(p.parent.parent) }
|
||||||
# Sorbet is unaware that Pathname is sortable: https://github.com/sorbet/sorbet/issues/6844
|
# Sorbet is unaware that Pathname is sortable: https://github.com/sorbet/sorbet/issues/6844
|
||||||
@ -227,8 +227,8 @@ module Cask
|
|||||||
end
|
end
|
||||||
|
|
||||||
def outdated?(greedy: false, greedy_latest: false, greedy_auto_updates: false)
|
def outdated?(greedy: false, greedy_latest: false, greedy_auto_updates: false)
|
||||||
!outdated_version(greedy: greedy, greedy_latest: greedy_latest,
|
!outdated_version(greedy:, greedy_latest:,
|
||||||
greedy_auto_updates: greedy_auto_updates).nil?
|
greedy_auto_updates:).nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
def outdated_version(greedy: false, greedy_latest: false, greedy_auto_updates: false)
|
def outdated_version(greedy: false, greedy_latest: false, greedy_auto_updates: false)
|
||||||
@ -252,8 +252,8 @@ module Cask
|
|||||||
def outdated_info(greedy, verbose, json, greedy_latest, greedy_auto_updates)
|
def outdated_info(greedy, verbose, json, greedy_latest, greedy_auto_updates)
|
||||||
return token if !verbose && !json
|
return token if !verbose && !json
|
||||||
|
|
||||||
installed_version = outdated_version(greedy: greedy, greedy_latest: greedy_latest,
|
installed_version = outdated_version(greedy:, greedy_latest:,
|
||||||
greedy_auto_updates: greedy_auto_updates).to_s
|
greedy_auto_updates:).to_s
|
||||||
|
|
||||||
if json
|
if json
|
||||||
{
|
{
|
||||||
@ -375,10 +375,10 @@ module Cask
|
|||||||
if @dsl.on_system_blocks_exist?
|
if @dsl.on_system_blocks_exist?
|
||||||
begin
|
begin
|
||||||
MacOSVersion::SYMBOLS.keys.product(OnSystem::ARCH_OPTIONS).each do |os, arch|
|
MacOSVersion::SYMBOLS.keys.product(OnSystem::ARCH_OPTIONS).each do |os, arch|
|
||||||
bottle_tag = ::Utils::Bottles::Tag.new(system: os, arch: arch)
|
bottle_tag = ::Utils::Bottles::Tag.new(system: os, arch:)
|
||||||
next unless bottle_tag.valid_combination?
|
next unless bottle_tag.valid_combination?
|
||||||
|
|
||||||
Homebrew::SimulateSystem.with os: os, arch: arch do
|
Homebrew::SimulateSystem.with(os:, arch:) do
|
||||||
refresh
|
refresh
|
||||||
|
|
||||||
to_h.each do |key, value|
|
to_h.each do |key, value|
|
||||||
|
|||||||
@ -44,7 +44,7 @@ module Cask
|
|||||||
).returns(Cask)
|
).returns(Cask)
|
||||||
}
|
}
|
||||||
def cask(header_token, **options, &block)
|
def cask(header_token, **options, &block)
|
||||||
Cask.new(header_token, source: content, tap: tap, **options, config: @config, &block)
|
Cask.new(header_token, source: content, tap:, **options, config: @config, &block)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -127,9 +127,7 @@ module Cask
|
|||||||
@content = path.read(encoding: "UTF-8")
|
@content = path.read(encoding: "UTF-8")
|
||||||
@config = config
|
@config = config
|
||||||
|
|
||||||
if path.extname == ".json"
|
return FromAPILoader.new(token, from_json: JSON.parse(@content)).load(config:) if path.extname == ".json"
|
||||||
return FromAPILoader.new(token, from_json: JSON.parse(@content)).load(config: config)
|
|
||||||
end
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
instance_eval(content, path).tap do |cask|
|
instance_eval(content, path).tap do |cask|
|
||||||
@ -207,7 +205,7 @@ module Cask
|
|||||||
def self.try_new(ref, warn: false)
|
def self.try_new(ref, warn: false)
|
||||||
ref = ref.to_s
|
ref = ref.to_s
|
||||||
|
|
||||||
return unless (token_tap_type = CaskLoader.tap_cask_token_type(ref, warn: warn))
|
return unless (token_tap_type = CaskLoader.tap_cask_token_type(ref, warn:))
|
||||||
|
|
||||||
token, tap, = token_tap_type
|
token, tap, = token_tap_type
|
||||||
new("#{tap}/#{token}")
|
new("#{tap}/#{token}")
|
||||||
@ -278,7 +276,7 @@ module Cask
|
|||||||
|
|
||||||
ref = "#{CoreCaskTap.instance}/#{token}"
|
ref = "#{CoreCaskTap.instance}/#{token}"
|
||||||
|
|
||||||
token, tap, = CaskLoader.tap_cask_token_type(ref, warn: warn)
|
token, tap, = CaskLoader.tap_cask_token_type(ref, warn:)
|
||||||
new("#{tap}/#{token}")
|
new("#{tap}/#{token}")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -295,7 +293,7 @@ module Cask
|
|||||||
cask_options = {
|
cask_options = {
|
||||||
loaded_from_api: true,
|
loaded_from_api: true,
|
||||||
source: JSON.pretty_generate(json_cask),
|
source: JSON.pretty_generate(json_cask),
|
||||||
config: config,
|
config:,
|
||||||
loader: self,
|
loader: self,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,7 +447,7 @@ module Cask
|
|||||||
return unless (token = ref[HOMEBREW_DEFAULT_TAP_CASK_REGEX, :token])
|
return unless (token = ref[HOMEBREW_DEFAULT_TAP_CASK_REGEX, :token])
|
||||||
return unless (tap = CoreCaskTap.instance).installed?
|
return unless (tap = CoreCaskTap.instance).installed?
|
||||||
|
|
||||||
return unless (loader = super("#{tap}/#{token}", warn: warn))
|
return unless (loader = super("#{tap}/#{token}", warn:))
|
||||||
|
|
||||||
loader if loader.path.exist?
|
loader if loader.path.exist?
|
||||||
end
|
end
|
||||||
@ -470,12 +468,12 @@ module Cask
|
|||||||
|
|
||||||
# If it exists in the default tap, never treat it as ambiguous with another tap.
|
# If it exists in the default tap, never treat it as ambiguous with another tap.
|
||||||
if (core_cask_tap = CoreCaskTap.instance).installed? &&
|
if (core_cask_tap = CoreCaskTap.instance).installed? &&
|
||||||
(loader= super("#{core_cask_tap}/#{token}", warn: warn))&.path&.exist?
|
(loader= super("#{core_cask_tap}/#{token}", warn:))&.path&.exist?
|
||||||
return loader
|
return loader
|
||||||
end
|
end
|
||||||
|
|
||||||
loaders = Tap.select { |tap| tap.installed? && !tap.core_cask_tap? }
|
loaders = Tap.select { |tap| tap.installed? && !tap.core_cask_tap? }
|
||||||
.filter_map { |tap| super("#{tap}/#{token}", warn: warn) }
|
.filter_map { |tap| super("#{tap}/#{token}", warn:) }
|
||||||
.select { |tap| tap.path.exist? }
|
.select { |tap| tap.path.exist? }
|
||||||
|
|
||||||
case loaders.count
|
case loaders.count
|
||||||
@ -532,7 +530,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.load(ref, config: nil, warn: true)
|
def self.load(ref, config: nil, warn: true)
|
||||||
self.for(ref, warn: warn).load(config: config)
|
self.for(ref, warn:).load(config:)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(tapped_token: String, warn: T::Boolean).returns(T.nilable([String, Tap, T.nilable(Symbol)])) }
|
sig { params(tapped_token: String, warn: T::Boolean).returns(T.nilable([String, Tap, T.nilable(Symbol)])) }
|
||||||
@ -582,7 +580,7 @@ module Cask
|
|||||||
FromInstalledPathLoader,
|
FromInstalledPathLoader,
|
||||||
NullLoader,
|
NullLoader,
|
||||||
].each do |loader_class|
|
].each do |loader_class|
|
||||||
if (loader = loader_class.try_new(ref, warn: warn))
|
if (loader = loader_class.try_new(ref, warn:))
|
||||||
$stderr.puts "#{$PROGRAM_NAME} (#{loader.class}): loading #{ref}" if debug?
|
$stderr.puts "#{$PROGRAM_NAME} (#{loader.class}): loading #{ref}" if debug?
|
||||||
return loader
|
return loader
|
||||||
end
|
end
|
||||||
|
|||||||
@ -44,18 +44,18 @@ module Cask
|
|||||||
"We'll set permissions properly so we won't need sudo in the future."
|
"We'll set permissions properly so we won't need sudo in the future."
|
||||||
end
|
end
|
||||||
|
|
||||||
SystemCommand.run("/bin/mkdir", args: ["-p", path], sudo: sudo)
|
SystemCommand.run("/bin/mkdir", args: ["-p", path], sudo:)
|
||||||
SystemCommand.run("/bin/chmod", args: ["g+rwx", path], sudo: sudo)
|
SystemCommand.run("/bin/chmod", args: ["g+rwx", path], sudo:)
|
||||||
SystemCommand.run("/usr/sbin/chown", args: [User.current, path], sudo: sudo)
|
SystemCommand.run("/usr/sbin/chown", args: [User.current, path], sudo:)
|
||||||
SystemCommand.run("/usr/bin/chgrp", args: ["admin", path], sudo: sudo)
|
SystemCommand.run("/usr/bin/chgrp", args: ["admin", path], sudo:)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(config: T.nilable(Config)).returns(T::Array[Cask]) }
|
sig { params(config: T.nilable(Config)).returns(T::Array[Cask]) }
|
||||||
def self.casks(config: nil)
|
def self.casks(config: nil)
|
||||||
tokens.sort.filter_map do |token|
|
tokens.sort.filter_map do |token|
|
||||||
CaskLoader.load(token, config: config, warn: false)
|
CaskLoader.load(token, config:, warn: false)
|
||||||
rescue TapCaskAmbiguityError => e
|
rescue TapCaskAmbiguityError => e
|
||||||
T.must(e.loaders.first).load(config: config)
|
T.must(e.loaders.first).load(config:)
|
||||||
rescue
|
rescue
|
||||||
# Don't blow up because of a single unavailable cask.
|
# Don't blow up because of a single unavailable cask.
|
||||||
nil
|
nil
|
||||||
|
|||||||
@ -66,7 +66,7 @@ module Cask
|
|||||||
default: config.fetch("default", {}),
|
default: config.fetch("default", {}),
|
||||||
env: config.fetch("env", {}),
|
env: config.fetch("env", {}),
|
||||||
explicit: config.fetch("explicit", {}),
|
explicit: config.fetch("explicit", {}),
|
||||||
ignore_invalid_keys: ignore_invalid_keys,
|
ignore_invalid_keys:,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -199,9 +199,9 @@ module Cask
|
|||||||
sig { params(options: T.untyped).returns(String) }
|
sig { params(options: T.untyped).returns(String) }
|
||||||
def to_json(*options)
|
def to_json(*options)
|
||||||
{
|
{
|
||||||
default: default,
|
default:,
|
||||||
env: env,
|
env:,
|
||||||
explicit: explicit,
|
explicit:,
|
||||||
}.to_json(*options)
|
}.to_json(*options)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -52,7 +52,7 @@ module Cask
|
|||||||
downloader.quiet! if quiet
|
downloader.quiet! if quiet
|
||||||
|
|
||||||
begin
|
begin
|
||||||
super(verify_download_integrity: false, timeout: timeout)
|
super(verify_download_integrity: false, timeout:)
|
||||||
rescue DownloadError => e
|
rescue DownloadError => e
|
||||||
error = CaskError.new("Download failed on Cask '#{cask}' with message: #{e.cause}")
|
error = CaskError.new("Download failed on Cask '#{cask}' with message: #{e.cause}")
|
||||||
error.set_backtrace e.backtrace
|
error.set_backtrace e.backtrace
|
||||||
@ -68,7 +68,7 @@ module Cask
|
|||||||
def time_file_size(timeout: nil)
|
def time_file_size(timeout: nil)
|
||||||
raise ArgumentError, "not supported for this download strategy" unless downloader.is_a?(CurlDownloadStrategy)
|
raise ArgumentError, "not supported for this download strategy" unless downloader.is_a?(CurlDownloadStrategy)
|
||||||
|
|
||||||
T.cast(downloader, CurlDownloadStrategy).resolved_time_file_size(timeout: timeout)
|
T.cast(downloader, CurlDownloadStrategy).resolved_time_file_size(timeout:)
|
||||||
end
|
end
|
||||||
|
|
||||||
def basename
|
def basename
|
||||||
|
|||||||
@ -209,9 +209,9 @@ module Cask
|
|||||||
|
|
||||||
set_unique_stanza(:url, args.empty? && options.empty? && !block) do
|
set_unique_stanza(:url, args.empty? && options.empty? && !block) do
|
||||||
if block
|
if block
|
||||||
URL.new(*args, **options, caller_location: caller_location, dsl: self, &block)
|
URL.new(*args, **options, caller_location:, dsl: self, &block)
|
||||||
else
|
else
|
||||||
URL.new(*args, **options, caller_location: caller_location)
|
URL.new(*args, **options, caller_location:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -249,7 +249,7 @@ module Cask
|
|||||||
set_unique_stanza(:sha256, should_return) do
|
set_unique_stanza(:sha256, should_return) do
|
||||||
@on_system_blocks_exist = true if arm.present? || intel.present?
|
@on_system_blocks_exist = true if arm.present? || intel.present?
|
||||||
|
|
||||||
val = arg || on_arch_conditional(arm: arm, intel: intel)
|
val = arg || on_arch_conditional(arm:, intel:)
|
||||||
case val
|
case val
|
||||||
when :no_check
|
when :no_check
|
||||||
val
|
val
|
||||||
@ -268,7 +268,7 @@ module Cask
|
|||||||
set_unique_stanza(:arch, should_return) do
|
set_unique_stanza(:arch, should_return) do
|
||||||
@on_system_blocks_exist = true
|
@on_system_blocks_exist = true
|
||||||
|
|
||||||
on_arch_conditional(arm: arm, intel: intel)
|
on_arch_conditional(arm:, intel:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -68,7 +68,7 @@ module Cask
|
|||||||
verify_has_sha if require_sha? && !force?
|
verify_has_sha if require_sha? && !force?
|
||||||
check_requirements
|
check_requirements
|
||||||
|
|
||||||
download(quiet: quiet, timeout: timeout)
|
download(quiet:, timeout:)
|
||||||
|
|
||||||
satisfy_cask_and_formula_dependencies
|
satisfy_cask_and_formula_dependencies
|
||||||
end
|
end
|
||||||
@ -109,7 +109,7 @@ module Cask
|
|||||||
|
|
||||||
@cask.config = @cask.default_config.merge(old_config)
|
@cask.config = @cask.default_config.merge(old_config)
|
||||||
|
|
||||||
install_artifacts(predecessor: predecessor)
|
install_artifacts(predecessor:)
|
||||||
|
|
||||||
if (tap = @cask.tap) && tap.should_report_analytics?
|
if (tap = @cask.tap) && tap.should_report_analytics?
|
||||||
::Utils::Analytics.report_package_event(:cask_install, package_name: @cask.token, tap_name: tap.name,
|
::Utils::Analytics.report_package_event(:cask_install, package_name: @cask.token, tap_name: tap.name,
|
||||||
@ -178,8 +178,8 @@ on_request: true)
|
|||||||
sig { params(quiet: T.nilable(T::Boolean), timeout: T.nilable(T.any(Integer, Float))).returns(Pathname) }
|
sig { params(quiet: T.nilable(T::Boolean), timeout: T.nilable(T.any(Integer, Float))).returns(Pathname) }
|
||||||
def download(quiet: nil, timeout: nil)
|
def download(quiet: nil, timeout: nil)
|
||||||
# Store cask download path in cask to prevent multiple downloads in a row when checking if it's outdated
|
# Store cask download path in cask to prevent multiple downloads in a row when checking if it's outdated
|
||||||
@cask.download ||= downloader.fetch(quiet: quiet, verify_download_integrity: @verify_download_integrity,
|
@cask.download ||= downloader.fetch(quiet:, verify_download_integrity: @verify_download_integrity,
|
||||||
timeout: timeout)
|
timeout:)
|
||||||
end
|
end
|
||||||
|
|
||||||
def verify_has_sha
|
def verify_has_sha
|
||||||
@ -209,21 +209,21 @@ on_request: true)
|
|||||||
if (nested_container = @cask.container&.nested)
|
if (nested_container = @cask.container&.nested)
|
||||||
Dir.mktmpdir("cask-installer", HOMEBREW_TEMP) do |tmpdir|
|
Dir.mktmpdir("cask-installer", HOMEBREW_TEMP) do |tmpdir|
|
||||||
tmpdir = Pathname(tmpdir)
|
tmpdir = Pathname(tmpdir)
|
||||||
primary_container.extract(to: tmpdir, basename: basename, verbose: verbose?)
|
primary_container.extract(to: tmpdir, basename:, verbose: verbose?)
|
||||||
|
|
||||||
FileUtils.chmod_R "+rw", tmpdir/nested_container, force: true, verbose: verbose?
|
FileUtils.chmod_R "+rw", tmpdir/nested_container, force: true, verbose: verbose?
|
||||||
|
|
||||||
UnpackStrategy.detect(tmpdir/nested_container, merge_xattrs: true)
|
UnpackStrategy.detect(tmpdir/nested_container, merge_xattrs: true)
|
||||||
.extract_nestedly(to: to, verbose: verbose?)
|
.extract_nestedly(to:, verbose: verbose?)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
primary_container.extract_nestedly(to: to, basename: basename, verbose: verbose?)
|
primary_container.extract_nestedly(to:, basename:, verbose: verbose?)
|
||||||
end
|
end
|
||||||
|
|
||||||
return unless quarantine?
|
return unless quarantine?
|
||||||
return unless Quarantine.available?
|
return unless Quarantine.available?
|
||||||
|
|
||||||
Quarantine.propagate(from: primary_container.path, to: to)
|
Quarantine.propagate(from: primary_container.path, to:)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(predecessor: T.nilable(Cask)).void }
|
sig { params(predecessor: T.nilable(Cask)).void }
|
||||||
@ -241,7 +241,7 @@ on_request: true)
|
|||||||
next if artifact.is_a?(Artifact::Binary) && !binaries?
|
next if artifact.is_a?(Artifact::Binary) && !binaries?
|
||||||
|
|
||||||
artifact.install_phase(
|
artifact.install_phase(
|
||||||
command: @command, verbose: verbose?, adopt: adopt?, force: force?, predecessor: predecessor,
|
command: @command, verbose: verbose?, adopt: adopt?, force: force?, predecessor:,
|
||||||
)
|
)
|
||||||
already_installed_artifacts.unshift(artifact)
|
already_installed_artifacts.unshift(artifact)
|
||||||
end
|
end
|
||||||
@ -401,7 +401,7 @@ on_request: true)
|
|||||||
def uninstall(successor: nil)
|
def uninstall(successor: nil)
|
||||||
load_installed_caskfile!
|
load_installed_caskfile!
|
||||||
oh1 "Uninstalling Cask #{Formatter.identifier(@cask)}"
|
oh1 "Uninstalling Cask #{Formatter.identifier(@cask)}"
|
||||||
uninstall_artifacts(clear: true, successor: successor)
|
uninstall_artifacts(clear: true, successor:)
|
||||||
if !reinstall? && !upgrade?
|
if !reinstall? && !upgrade?
|
||||||
remove_download_sha
|
remove_download_sha
|
||||||
remove_config_file
|
remove_config_file
|
||||||
@ -422,7 +422,7 @@ on_request: true)
|
|||||||
|
|
||||||
sig { params(successor: T.nilable(Cask)).void }
|
sig { params(successor: T.nilable(Cask)).void }
|
||||||
def start_upgrade(successor:)
|
def start_upgrade(successor:)
|
||||||
uninstall_artifacts(successor: successor)
|
uninstall_artifacts(successor:)
|
||||||
backup
|
backup
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -445,7 +445,7 @@ on_request: true)
|
|||||||
def revert_upgrade(predecessor:)
|
def revert_upgrade(predecessor:)
|
||||||
opoo "Reverting upgrade for Cask #{@cask}"
|
opoo "Reverting upgrade for Cask #{@cask}"
|
||||||
restore_backup
|
restore_backup
|
||||||
install_artifacts(predecessor: predecessor)
|
install_artifacts(predecessor:)
|
||||||
end
|
end
|
||||||
|
|
||||||
def finalize_upgrade
|
def finalize_upgrade
|
||||||
@ -471,7 +471,7 @@ on_request: true)
|
|||||||
verbose: verbose?,
|
verbose: verbose?,
|
||||||
skip: clear,
|
skip: clear,
|
||||||
force: force?,
|
force: force?,
|
||||||
successor: successor,
|
successor:,
|
||||||
upgrade: upgrade?,
|
upgrade: upgrade?,
|
||||||
reinstall: reinstall?,
|
reinstall: reinstall?,
|
||||||
)
|
)
|
||||||
@ -485,7 +485,7 @@ on_request: true)
|
|||||||
verbose: verbose?,
|
verbose: verbose?,
|
||||||
skip: clear,
|
skip: clear,
|
||||||
force: force?,
|
force: force?,
|
||||||
successor: successor,
|
successor:,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -18,7 +18,7 @@ module Cask
|
|||||||
|
|
||||||
raise CaskError, "Cannot create metadata path with empty version." if cask_version.empty?
|
raise CaskError, "Cannot create metadata path with empty version." if cask_version.empty?
|
||||||
|
|
||||||
metadata_main_container_path(caskroom_path: caskroom_path).join(cask_version)
|
metadata_main_container_path(caskroom_path:).join(cask_version)
|
||||||
end
|
end
|
||||||
|
|
||||||
def metadata_timestamped_path(version: self.version, timestamp: :latest, create: false,
|
def metadata_timestamped_path(version: self.version, timestamp: :latest, create: false,
|
||||||
@ -26,10 +26,10 @@ module Cask
|
|||||||
raise CaskError, "Cannot create metadata path when timestamp is :latest." if create && timestamp == :latest
|
raise CaskError, "Cannot create metadata path when timestamp is :latest." if create && timestamp == :latest
|
||||||
|
|
||||||
path = if timestamp == :latest
|
path = if timestamp == :latest
|
||||||
Pathname.glob(metadata_versioned_path(version: version, caskroom_path: caskroom_path).join("*")).max
|
Pathname.glob(metadata_versioned_path(version:, caskroom_path:).join("*")).max
|
||||||
else
|
else
|
||||||
timestamp = new_timestamp if timestamp == :now
|
timestamp = new_timestamp if timestamp == :now
|
||||||
metadata_versioned_path(version: version, caskroom_path: caskroom_path).join(timestamp)
|
metadata_versioned_path(version:, caskroom_path:).join(timestamp)
|
||||||
end
|
end
|
||||||
|
|
||||||
if create && !path.directory?
|
if create && !path.directory?
|
||||||
@ -45,8 +45,8 @@ module Cask
|
|||||||
raise CaskError, "Cannot create metadata subdir when timestamp is :latest." if create && timestamp == :latest
|
raise CaskError, "Cannot create metadata subdir when timestamp is :latest." if create && timestamp == :latest
|
||||||
raise CaskError, "Cannot create metadata subdir for empty leaf." if !leaf.respond_to?(:empty?) || leaf.empty?
|
raise CaskError, "Cannot create metadata subdir for empty leaf." if !leaf.respond_to?(:empty?) || leaf.empty?
|
||||||
|
|
||||||
parent = metadata_timestamped_path(version: version, timestamp: timestamp, create: create,
|
parent = metadata_timestamped_path(version:, timestamp:, create:,
|
||||||
caskroom_path: caskroom_path)
|
caskroom_path:)
|
||||||
|
|
||||||
return if parent.nil?
|
return if parent.nil?
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ module Cask
|
|||||||
return if new_cask.token == old_cask.token
|
return if new_cask.token == old_cask.token
|
||||||
|
|
||||||
migrator = new(old_cask, new_cask)
|
migrator = new(old_cask, new_cask)
|
||||||
migrator.migrate(dry_run: dry_run)
|
migrator.migrate(dry_run:)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(dry_run: T::Boolean).void }
|
sig { params(dry_run: T::Boolean).void }
|
||||||
|
|||||||
@ -21,14 +21,14 @@ module Cask
|
|||||||
|
|
||||||
casks.each do |cask|
|
casks.each do |cask|
|
||||||
Installer.new(cask,
|
Installer.new(cask,
|
||||||
binaries: binaries,
|
binaries:,
|
||||||
verbose: verbose,
|
verbose:,
|
||||||
force: force,
|
force:,
|
||||||
skip_cask_deps: skip_cask_deps,
|
skip_cask_deps:,
|
||||||
require_sha: require_sha,
|
require_sha:,
|
||||||
reinstall: true,
|
reinstall: true,
|
||||||
quarantine: quarantine,
|
quarantine:,
|
||||||
zap: zap).install
|
zap:).install
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -12,7 +12,7 @@ module Cask
|
|||||||
|
|
||||||
raise CaskNotInstalledError, cask if !cask.installed? && !force
|
raise CaskNotInstalledError, cask if !cask.installed? && !force
|
||||||
|
|
||||||
Installer.new(cask, binaries: binaries, force: force, verbose: verbose).uninstall
|
Installer.new(cask, binaries:, force:, verbose:).uninstall
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -44,8 +44,8 @@ module Cask
|
|||||||
|
|
||||||
outdated_casks = if casks.empty?
|
outdated_casks = if casks.empty?
|
||||||
Caskroom.casks(config: Config.from_args(args)).select do |cask|
|
Caskroom.casks(config: Config.from_args(args)).select do |cask|
|
||||||
cask.outdated?(greedy: greedy, greedy_latest: greedy_latest,
|
cask.outdated?(greedy:, greedy_latest:,
|
||||||
greedy_auto_updates: greedy_auto_updates)
|
greedy_auto_updates:)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
casks.select do |cask|
|
casks.select do |cask|
|
||||||
@ -113,8 +113,8 @@ module Cask
|
|||||||
upgradable_casks.each do |(old_cask, new_cask)|
|
upgradable_casks.each do |(old_cask, new_cask)|
|
||||||
upgrade_cask(
|
upgrade_cask(
|
||||||
old_cask, new_cask,
|
old_cask, new_cask,
|
||||||
binaries: binaries, force: force, skip_cask_deps: skip_cask_deps, verbose: verbose,
|
binaries:, force:, skip_cask_deps:, verbose:,
|
||||||
quarantine: quarantine, require_sha: require_sha
|
quarantine:, require_sha:
|
||||||
)
|
)
|
||||||
rescue => e
|
rescue => e
|
||||||
new_exception = e.exception("#{new_cask.full_name}: #{e}")
|
new_exception = e.exception("#{new_cask.full_name}: #{e}")
|
||||||
@ -153,9 +153,9 @@ module Cask
|
|||||||
old_config = old_cask.config
|
old_config = old_cask.config
|
||||||
|
|
||||||
old_options = {
|
old_options = {
|
||||||
binaries: binaries,
|
binaries:,
|
||||||
verbose: verbose,
|
verbose:,
|
||||||
force: force,
|
force:,
|
||||||
upgrade: true,
|
upgrade: true,
|
||||||
}.compact
|
}.compact
|
||||||
|
|
||||||
@ -165,13 +165,13 @@ module Cask
|
|||||||
new_cask.config = new_cask.default_config.merge(old_config)
|
new_cask.config = new_cask.default_config.merge(old_config)
|
||||||
|
|
||||||
new_options = {
|
new_options = {
|
||||||
binaries: binaries,
|
binaries:,
|
||||||
verbose: verbose,
|
verbose:,
|
||||||
force: force,
|
force:,
|
||||||
skip_cask_deps: skip_cask_deps,
|
skip_cask_deps:,
|
||||||
require_sha: require_sha,
|
require_sha:,
|
||||||
upgrade: true,
|
upgrade: true,
|
||||||
quarantine: quarantine,
|
quarantine:,
|
||||||
}.compact
|
}.compact
|
||||||
|
|
||||||
new_cask_installer =
|
new_cask_installer =
|
||||||
|
|||||||
@ -191,26 +191,26 @@ module Cask
|
|||||||
super(
|
super(
|
||||||
if block
|
if block
|
||||||
LazyObject.new do
|
LazyObject.new do
|
||||||
uri2, options = *BlockDSL.new(uri, dsl: dsl, &block).call
|
uri2, options = *BlockDSL.new(uri, dsl:, &block).call
|
||||||
options ||= {}
|
options ||= {}
|
||||||
DSL.new(uri2, **options)
|
DSL.new(uri2, **options)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
DSL.new(
|
DSL.new(
|
||||||
T.must(uri),
|
T.must(uri),
|
||||||
verified: verified,
|
verified:,
|
||||||
using: using,
|
using:,
|
||||||
tag: tag,
|
tag:,
|
||||||
branch: branch,
|
branch:,
|
||||||
revisions: revisions,
|
revisions:,
|
||||||
revision: revision,
|
revision:,
|
||||||
trust_cert: trust_cert,
|
trust_cert:,
|
||||||
cookies: cookies,
|
cookies:,
|
||||||
referer: referer,
|
referer:,
|
||||||
header: header,
|
header:,
|
||||||
user_agent: user_agent,
|
user_agent:,
|
||||||
data: data,
|
data:,
|
||||||
only_path: only_path,
|
only_path:,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|||||||
@ -269,7 +269,7 @@ module Homebrew
|
|||||||
.sort_by(&:name)
|
.sort_by(&:name)
|
||||||
.reject { |f| Cleanup.skip_clean_formula?(f) }
|
.reject { |f| Cleanup.skip_clean_formula?(f) }
|
||||||
.each do |formula|
|
.each do |formula|
|
||||||
cleanup_formula(formula, quiet: quiet, ds_store: false, cache_db: false)
|
cleanup_formula(formula, quiet:, ds_store: false, cache_db: false)
|
||||||
end
|
end
|
||||||
|
|
||||||
Cleanup.autoremove(dry_run: dry_run?) if Homebrew::EnvConfig.autoremove?
|
Cleanup.autoremove(dry_run: dry_run?) if Homebrew::EnvConfig.autoremove?
|
||||||
@ -326,16 +326,16 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def cleanup_formula(formula, quiet: false, ds_store: true, cache_db: true)
|
def cleanup_formula(formula, quiet: false, ds_store: true, cache_db: true)
|
||||||
formula.eligible_kegs_for_cleanup(quiet: quiet)
|
formula.eligible_kegs_for_cleanup(quiet:)
|
||||||
.each(&method(:cleanup_keg))
|
.each(&method(:cleanup_keg))
|
||||||
cleanup_cache(Pathname.glob(cache/"#{formula.name}--*").map { |path| { path: path, type: nil } })
|
cleanup_cache(Pathname.glob(cache/"#{formula.name}--*").map { |path| { path:, type: nil } })
|
||||||
rm_ds_store([formula.rack]) if ds_store
|
rm_ds_store([formula.rack]) if ds_store
|
||||||
cleanup_cache_db(formula.rack) if cache_db
|
cleanup_cache_db(formula.rack) if cache_db
|
||||||
cleanup_lockfiles(FormulaLock.new(formula.name).path)
|
cleanup_lockfiles(FormulaLock.new(formula.name).path)
|
||||||
end
|
end
|
||||||
|
|
||||||
def cleanup_cask(cask, ds_store: true)
|
def cleanup_cask(cask, ds_store: true)
|
||||||
cleanup_cache(Pathname.glob(cache/"Cask/#{cask.token}--*").map { |path| { path: path, type: :cask } })
|
cleanup_cache(Pathname.glob(cache/"Cask/#{cask.token}--*").map { |path| { path:, type: :cask } })
|
||||||
rm_ds_store([cask.caskroom_path]) if ds_store
|
rm_ds_store([cask.caskroom_path]) if ds_store
|
||||||
cleanup_lockfiles(CaskLock.new(cask.token).path)
|
cleanup_lockfiles(CaskLock.new(cask.token).path)
|
||||||
end
|
end
|
||||||
@ -363,10 +363,10 @@ module Homebrew
|
|||||||
api_source_files = (cache/"api-source").glob("*/*/*/*/*") # org/repo/git_head/type/file.rb
|
api_source_files = (cache/"api-source").glob("*/*/*/*/*") # org/repo/git_head/type/file.rb
|
||||||
gh_actions_artifacts = (cache/"gh-actions-artifact").directory? ? (cache/"gh-actions-artifact").children : []
|
gh_actions_artifacts = (cache/"gh-actions-artifact").directory? ? (cache/"gh-actions-artifact").children : []
|
||||||
|
|
||||||
files.map { |path| { path: path, type: nil } } +
|
files.map { |path| { path:, type: nil } } +
|
||||||
cask_files.map { |path| { path: path, type: :cask } } +
|
cask_files.map { |path| { path:, type: :cask } } +
|
||||||
api_source_files.map { |path| { path: path, type: :api_source } } +
|
api_source_files.map { |path| { path:, type: :api_source } } +
|
||||||
gh_actions_artifacts.map { |path| { path: path, type: :gh_actions_artifact } }
|
gh_actions_artifacts.map { |path| { path:, type: :gh_actions_artifact } }
|
||||||
end
|
end
|
||||||
|
|
||||||
def cleanup_empty_api_source_directories(directory = cache/"api-source")
|
def cleanup_empty_api_source_directories(directory = cache/"api-source")
|
||||||
|
|||||||
@ -40,8 +40,8 @@ module Homebrew
|
|||||||
self[:named] = NamedArgs.new(
|
self[:named] = NamedArgs.new(
|
||||||
*named_args.freeze,
|
*named_args.freeze,
|
||||||
parent: self,
|
parent: self,
|
||||||
cask_options: cask_options,
|
cask_options:,
|
||||||
without_api: without_api,
|
without_api:,
|
||||||
**options,
|
**options,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
@ -131,7 +131,7 @@ module Homebrew
|
|||||||
|
|
||||||
oses.product(arches).select do |os, arch|
|
oses.product(arches).select do |os, arch|
|
||||||
if skip_invalid_combinations
|
if skip_invalid_combinations
|
||||||
bottle_tag = Utils::Bottles::Tag.new(system: os, arch: arch)
|
bottle_tag = Utils::Bottles::Tag.new(system: os, arch:)
|
||||||
bottle_tag.valid_combination?
|
bottle_tag.valid_combination?
|
||||||
else
|
else
|
||||||
true
|
true
|
||||||
|
|||||||
@ -79,8 +79,8 @@ module Homebrew
|
|||||||
)
|
)
|
||||||
@to_formulae_and_casks ||= {}
|
@to_formulae_and_casks ||= {}
|
||||||
@to_formulae_and_casks[only] ||= downcased_unique_named.flat_map do |name|
|
@to_formulae_and_casks[only] ||= downcased_unique_named.flat_map do |name|
|
||||||
options = { warn: warn }.compact
|
options = { warn: }.compact
|
||||||
load_formula_or_cask(name, only: only, method: method, **options)
|
load_formula_or_cask(name, only:, method:, **options)
|
||||||
rescue FormulaUnreadableError, FormulaClassUnavailableError,
|
rescue FormulaUnreadableError, FormulaClassUnavailableError,
|
||||||
TapFormulaUnreadableError, TapFormulaClassUnavailableError,
|
TapFormulaUnreadableError, TapFormulaClassUnavailableError,
|
||||||
Cask::CaskUnreadableError
|
Cask::CaskUnreadableError
|
||||||
@ -100,7 +100,7 @@ module Homebrew
|
|||||||
|
|
||||||
def to_formulae_to_casks(only: parent&.only_formula_or_cask, method: nil)
|
def to_formulae_to_casks(only: parent&.only_formula_or_cask, method: nil)
|
||||||
@to_formulae_to_casks ||= {}
|
@to_formulae_to_casks ||= {}
|
||||||
@to_formulae_to_casks[[method, only]] = to_formulae_and_casks(only: only, method: method)
|
@to_formulae_to_casks[[method, only]] = to_formulae_and_casks(only:, method:)
|
||||||
.partition { |o| o.is_a?(Formula) || o.is_a?(Keg) }
|
.partition { |o| o.is_a?(Formula) || o.is_a?(Keg) }
|
||||||
.map(&:freeze).freeze
|
.map(&:freeze).freeze
|
||||||
end
|
end
|
||||||
@ -108,7 +108,7 @@ module Homebrew
|
|||||||
def to_formulae_and_casks_and_unavailable(only: parent&.only_formula_or_cask, method: nil)
|
def to_formulae_and_casks_and_unavailable(only: parent&.only_formula_or_cask, method: nil)
|
||||||
@to_formulae_casks_unknowns ||= {}
|
@to_formulae_casks_unknowns ||= {}
|
||||||
@to_formulae_casks_unknowns[method] = downcased_unique_named.map do |name|
|
@to_formulae_casks_unknowns[method] = downcased_unique_named.map do |name|
|
||||||
load_formula_or_cask(name, only: only, method: method)
|
load_formula_or_cask(name, only:, method:)
|
||||||
rescue FormulaOrCaskUnavailableError => e
|
rescue FormulaOrCaskUnavailableError => e
|
||||||
e
|
e
|
||||||
end.uniq.freeze
|
end.uniq.freeze
|
||||||
@ -122,7 +122,7 @@ module Homebrew
|
|||||||
begin
|
begin
|
||||||
formula = case method
|
formula = case method
|
||||||
when nil, :factory
|
when nil, :factory
|
||||||
options = { warn: warn, force_bottle: @force_bottle, flags: @flags }.compact
|
options = { warn:, force_bottle: @force_bottle, flags: @flags }.compact
|
||||||
Formulary.factory(name, *@override_spec, **options)
|
Formulary.factory(name, *@override_spec, **options)
|
||||||
when :resolve
|
when :resolve
|
||||||
resolve_formula(name)
|
resolve_formula(name)
|
||||||
@ -155,8 +155,8 @@ module Homebrew
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
config = Cask::Config.from_args(@parent) if @cask_options
|
config = Cask::Config.from_args(@parent) if @cask_options
|
||||||
options = { warn: warn }.compact
|
options = { warn: }.compact
|
||||||
cask = Cask::CaskLoader.load(name, config: config, **options)
|
cask = Cask::CaskLoader.load(name, config:, **options)
|
||||||
|
|
||||||
if unreadable_error.present?
|
if unreadable_error.present?
|
||||||
onoe <<~EOS
|
onoe <<~EOS
|
||||||
@ -177,8 +177,8 @@ module Homebrew
|
|||||||
# If we're trying to get a keg-like Cask, do our best to handle it
|
# If we're trying to get a keg-like Cask, do our best to handle it
|
||||||
# not being readable and return something that can be used.
|
# not being readable and return something that can be used.
|
||||||
if want_keg_like_cask
|
if want_keg_like_cask
|
||||||
cask_version = Cask::Cask.new(name, config: config).installed_version
|
cask_version = Cask::Cask.new(name, config:).installed_version
|
||||||
cask = Cask::Cask.new(name, config: config) do
|
cask = Cask::Cask.new(name, config:) do
|
||||||
version cask_version if cask_version
|
version cask_version if cask_version
|
||||||
end
|
end
|
||||||
return cask
|
return cask
|
||||||
@ -214,12 +214,12 @@ module Homebrew
|
|||||||
|
|
||||||
sig { params(uniq: T::Boolean).returns(T::Array[Formula]) }
|
sig { params(uniq: T::Boolean).returns(T::Array[Formula]) }
|
||||||
def to_resolved_formulae(uniq: true)
|
def to_resolved_formulae(uniq: true)
|
||||||
@to_resolved_formulae ||= to_formulae_and_casks(only: :formula, method: :resolve, uniq: uniq)
|
@to_resolved_formulae ||= to_formulae_and_casks(only: :formula, method: :resolve, uniq:)
|
||||||
.freeze
|
.freeze
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_resolved_formulae_to_casks(only: parent&.only_formula_or_cask)
|
def to_resolved_formulae_to_casks(only: parent&.only_formula_or_cask)
|
||||||
to_formulae_to_casks(only: only, method: :resolve)
|
to_formulae_to_casks(only:, method: :resolve)
|
||||||
end
|
end
|
||||||
|
|
||||||
LOCAL_PATH_REGEX = %r{^/|[.]|/$}
|
LOCAL_PATH_REGEX = %r{^/|[.]|/$}
|
||||||
@ -314,7 +314,7 @@ module Homebrew
|
|||||||
method = all_kegs ? :kegs : :default_kegs
|
method = all_kegs ? :kegs : :default_kegs
|
||||||
@to_kegs_to_casks ||= {}
|
@to_kegs_to_casks ||= {}
|
||||||
@to_kegs_to_casks[method] ||=
|
@to_kegs_to_casks[method] ||=
|
||||||
to_formulae_and_casks(only: only, ignore_unavailable: ignore_unavailable, method: method)
|
to_formulae_and_casks(only:, ignore_unavailable:, method:)
|
||||||
.partition { |o| o.is_a?(Keg) }
|
.partition { |o| o.is_a?(Keg) }
|
||||||
.map(&:freeze).freeze
|
.map(&:freeze).freeze
|
||||||
end
|
end
|
||||||
|
|||||||
@ -159,8 +159,8 @@ module Homebrew
|
|||||||
global_switch = names.first.is_a?(Symbol)
|
global_switch = names.first.is_a?(Symbol)
|
||||||
return if global_switch
|
return if global_switch
|
||||||
|
|
||||||
description = option_description(description, *names, hidden: hidden)
|
description = option_description(description, *names, hidden:)
|
||||||
process_option(*names, description, type: :switch, hidden: hidden) unless disable
|
process_option(*names, description, type: :switch, hidden:) unless disable
|
||||||
|
|
||||||
if replacement || disable
|
if replacement || disable
|
||||||
description += " (#{disable ? "disabled" : "deprecated"}#{"; replaced by #{replacement}" if replacement})"
|
description += " (#{disable ? "disabled" : "deprecated"}#{"; replaced by #{replacement}" if replacement})"
|
||||||
@ -171,11 +171,11 @@ module Homebrew
|
|||||||
odeprecated "the `#{names.first}` switch", replacement, disable: disable if !replacement.nil? || disable
|
odeprecated "the `#{names.first}` switch", replacement, disable: disable if !replacement.nil? || disable
|
||||||
value = true if names.none? { |name| name.start_with?("--[no-]") }
|
value = true if names.none? { |name| name.start_with?("--[no-]") }
|
||||||
|
|
||||||
set_switch(*names, value: value, from: :args)
|
set_switch(*names, value:, from: :args)
|
||||||
end
|
end
|
||||||
|
|
||||||
names.each do |name|
|
names.each do |name|
|
||||||
set_constraints(name, depends_on: depends_on)
|
set_constraints(name, depends_on:)
|
||||||
end
|
end
|
||||||
|
|
||||||
env_value = value_for_env(env)
|
env_value = value_for_env(env)
|
||||||
@ -211,8 +211,8 @@ module Homebrew
|
|||||||
|
|
||||||
def comma_array(name, description: nil, hidden: false)
|
def comma_array(name, description: nil, hidden: false)
|
||||||
name = name.chomp "="
|
name = name.chomp "="
|
||||||
description = option_description(description, name, hidden: hidden)
|
description = option_description(description, name, hidden:)
|
||||||
process_option(name, description, type: :comma_array, hidden: hidden)
|
process_option(name, description, type: :comma_array, hidden:)
|
||||||
@parser.on(name, OptionParser::REQUIRED_ARGUMENT, Array, *wrap_option_desc(description)) do |list|
|
@parser.on(name, OptionParser::REQUIRED_ARGUMENT, Array, *wrap_option_desc(description)) do |list|
|
||||||
@args[option_to_name(name)] = list
|
@args[option_to_name(name)] = list
|
||||||
end
|
end
|
||||||
@ -225,9 +225,9 @@ module Homebrew
|
|||||||
[OptionParser::OPTIONAL_ARGUMENT, :optional_flag]
|
[OptionParser::OPTIONAL_ARGUMENT, :optional_flag]
|
||||||
end
|
end
|
||||||
names.map! { |name| name.chomp "=" }
|
names.map! { |name| name.chomp "=" }
|
||||||
description = option_description(description, *names, hidden: hidden)
|
description = option_description(description, *names, hidden:)
|
||||||
if replacement.nil?
|
if replacement.nil?
|
||||||
process_option(*names, description, type: flag_type, hidden: hidden)
|
process_option(*names, description, type: flag_type, hidden:)
|
||||||
else
|
else
|
||||||
description += " (disabled#{"; replaced by #{replacement}" if replacement.present?})"
|
description += " (disabled#{"; replaced by #{replacement}" if replacement.present?})"
|
||||||
end
|
end
|
||||||
@ -240,7 +240,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
names.each do |name|
|
names.each do |name|
|
||||||
set_constraints(name, depends_on: depends_on)
|
set_constraints(name, depends_on:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -329,9 +329,9 @@ module Homebrew
|
|||||||
name = o.flag
|
name = o.flag
|
||||||
description = "`#{f.name}`: #{o.description}"
|
description = "`#{f.name}`: #{o.description}"
|
||||||
if name.end_with? "="
|
if name.end_with? "="
|
||||||
flag name, description: description
|
flag(name, description:)
|
||||||
else
|
else
|
||||||
switch name, description: description
|
switch name, description:
|
||||||
end
|
end
|
||||||
|
|
||||||
conflicts "--cask", name
|
conflicts "--cask", name
|
||||||
@ -339,7 +339,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
remaining, non_options = parse_remaining(argv, ignore_invalid_options: ignore_invalid_options)
|
remaining, non_options = parse_remaining(argv, ignore_invalid_options:)
|
||||||
|
|
||||||
named_args = if ignore_invalid_options
|
named_args = if ignore_invalid_options
|
||||||
[]
|
[]
|
||||||
@ -601,11 +601,11 @@ module Homebrew
|
|||||||
|
|
||||||
exception = if @min_named_args && @max_named_args && @min_named_args == @max_named_args &&
|
exception = if @min_named_args && @max_named_args && @min_named_args == @max_named_args &&
|
||||||
args.size != @max_named_args
|
args.size != @max_named_args
|
||||||
NumberOfNamedArgumentsError.new(@min_named_args, types: types)
|
NumberOfNamedArgumentsError.new(@min_named_args, types:)
|
||||||
elsif @min_named_args && args.size < @min_named_args
|
elsif @min_named_args && args.size < @min_named_args
|
||||||
MinNamedArgumentsError.new(@min_named_args, types: types)
|
MinNamedArgumentsError.new(@min_named_args, types:)
|
||||||
elsif @max_named_args && args.size > @max_named_args
|
elsif @max_named_args && args.size > @max_named_args
|
||||||
MaxNamedArgumentsError.new(@max_named_args, types: types)
|
MaxNamedArgumentsError.new(@max_named_args, types:)
|
||||||
end
|
end
|
||||||
|
|
||||||
raise exception if exception
|
raise exception if exception
|
||||||
|
|||||||
@ -63,9 +63,9 @@ module Homebrew
|
|||||||
ref = formula.loaded_from_api? ? formula.full_name : formula.path
|
ref = formula.loaded_from_api? ? formula.full_name : formula.path
|
||||||
|
|
||||||
os_arch_combinations.each do |os, arch|
|
os_arch_combinations.each do |os, arch|
|
||||||
SimulateSystem.with os: os, arch: arch do
|
SimulateSystem.with(os:, arch:) do
|
||||||
formula = Formulary.factory(ref)
|
formula = Formulary.factory(ref)
|
||||||
print_formula_cache(formula, os: os, arch: arch, args: args)
|
print_formula_cache(formula, os:, arch:, args:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -75,7 +75,7 @@ module Homebrew
|
|||||||
os_arch_combinations.each do |os, arch|
|
os_arch_combinations.each do |os, arch|
|
||||||
next if os == :linux
|
next if os == :linux
|
||||||
|
|
||||||
SimulateSystem.with os: os, arch: arch do
|
SimulateSystem.with(os:, arch:) do
|
||||||
cask = Cask::CaskLoader.load(ref)
|
cask = Cask::CaskLoader.load(ref)
|
||||||
print_cask_cache(cask)
|
print_cask_cache(cask)
|
||||||
end
|
end
|
||||||
@ -97,7 +97,7 @@ module Homebrew
|
|||||||
bottle_tag = if (bottle_tag = args.bottle_tag&.to_sym)
|
bottle_tag = if (bottle_tag = args.bottle_tag&.to_sym)
|
||||||
Utils::Bottles::Tag.from_symbol(bottle_tag)
|
Utils::Bottles::Tag.from_symbol(bottle_tag)
|
||||||
else
|
else
|
||||||
Utils::Bottles::Tag.new(system: os, arch: arch)
|
Utils::Bottles::Tag.new(system: os, arch:)
|
||||||
end
|
end
|
||||||
|
|
||||||
bottle = formula.bottle_for_tag(bottle_tag)
|
bottle = formula.bottle_for_tag(bottle_tag)
|
||||||
|
|||||||
@ -48,7 +48,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
cleanup = Cleanup.new(*args.named, dry_run: args.dry_run?, scrub: args.s?, days: days)
|
cleanup = Cleanup.new(*args.named, dry_run: args.dry_run?, scrub: args.s?, days:)
|
||||||
if args.prune_prefix?
|
if args.prune_prefix?
|
||||||
cleanup.prune_prefix_symlinks_and_directories
|
cleanup.prune_prefix_symlinks_and_directories
|
||||||
return
|
return
|
||||||
|
|||||||
@ -119,7 +119,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
if args.graph?
|
if args.graph?
|
||||||
dot_code = dot_code(dependents, recursive: recursive, args: args)
|
dot_code = dot_code(dependents, recursive:, args:)
|
||||||
if args.dot?
|
if args.dot?
|
||||||
puts dot_code
|
puts dot_code
|
||||||
else
|
else
|
||||||
@ -128,15 +128,15 @@ module Homebrew
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
puts_deps_tree dependents, recursive: recursive, args: args
|
puts_deps_tree(dependents, recursive:, args:)
|
||||||
return
|
return
|
||||||
elsif all
|
elsif all
|
||||||
puts_deps sorted_dependents(
|
puts_deps(sorted_dependents(
|
||||||
Formula.all(eval_all: args.eval_all?) + Cask::Cask.all(eval_all: args.eval_all?),
|
Formula.all(eval_all: args.eval_all?) + Cask::Cask.all(eval_all: args.eval_all?),
|
||||||
), recursive: recursive, args: args
|
), recursive:, args:)
|
||||||
return
|
return
|
||||||
elsif !args.no_named? && args.for_each?
|
elsif !args.no_named? && args.for_each?
|
||||||
puts_deps sorted_dependents(args.named.to_formulae_and_casks), recursive: recursive, args: args
|
puts_deps(sorted_dependents(args.named.to_formulae_and_casks), recursive:, args:)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -151,16 +151,16 @@ module Homebrew
|
|||||||
else
|
else
|
||||||
sorted_dependents(Formula.installed + Cask::Caskroom.casks)
|
sorted_dependents(Formula.installed + Cask::Caskroom.casks)
|
||||||
end
|
end
|
||||||
puts_deps sorted_dependents_formulae_and_casks, recursive: recursive, args: args
|
puts_deps(sorted_dependents_formulae_and_casks, recursive:, args:)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
dependents = dependents(args.named.to_formulae_and_casks)
|
dependents = dependents(args.named.to_formulae_and_casks)
|
||||||
check_head_spec(dependents) if args.HEAD?
|
check_head_spec(dependents) if args.HEAD?
|
||||||
|
|
||||||
all_deps = deps_for_dependents(dependents, recursive: recursive, args: args, &(args.union? ? :| : :&))
|
all_deps = deps_for_dependents(dependents, recursive:, args:, &(args.union? ? :| : :&))
|
||||||
condense_requirements(all_deps, args: args)
|
condense_requirements(all_deps, args:)
|
||||||
all_deps.map! { |d| dep_display_name(d, args: args) }
|
all_deps.map! { |d| dep_display_name(d, args:) }
|
||||||
all_deps.uniq!
|
all_deps.uniq!
|
||||||
all_deps.sort! unless args.topological?
|
all_deps.sort! unless args.topological?
|
||||||
puts all_deps
|
puts all_deps
|
||||||
@ -218,7 +218,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.deps_for_dependents(dependents, args:, recursive: false, &block)
|
def self.deps_for_dependents(dependents, args:, recursive: false, &block)
|
||||||
dependents.map { |d| deps_for_dependent(d, recursive: recursive, args: args) }.reduce(&block)
|
dependents.map { |d| deps_for_dependent(d, recursive:, args:) }.reduce(&block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.check_head_spec(dependents)
|
def self.check_head_spec(dependents)
|
||||||
@ -230,10 +230,10 @@ module Homebrew
|
|||||||
def self.puts_deps(dependents, args:, recursive: false)
|
def self.puts_deps(dependents, args:, recursive: false)
|
||||||
check_head_spec(dependents) if args.HEAD?
|
check_head_spec(dependents) if args.HEAD?
|
||||||
dependents.each do |dependent|
|
dependents.each do |dependent|
|
||||||
deps = deps_for_dependent(dependent, recursive: recursive, args: args)
|
deps = deps_for_dependent(dependent, recursive:, args:)
|
||||||
condense_requirements(deps, args: args)
|
condense_requirements(deps, args:)
|
||||||
deps.sort_by!(&:name)
|
deps.sort_by!(&:name)
|
||||||
deps.map! { |d| dep_display_name(d, args: args) }
|
deps.map! { |d| dep_display_name(d, args:) }
|
||||||
puts "#{dependent.full_name}: #{deps.join(" ")}"
|
puts "#{dependent.full_name}: #{deps.join(" ")}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -241,7 +241,7 @@ module Homebrew
|
|||||||
def self.dot_code(dependents, recursive:, args:)
|
def self.dot_code(dependents, recursive:, args:)
|
||||||
dep_graph = {}
|
dep_graph = {}
|
||||||
dependents.each do |d|
|
dependents.each do |d|
|
||||||
graph_deps(d, dep_graph: dep_graph, recursive: recursive, args: args)
|
graph_deps(d, dep_graph:, recursive:, args:)
|
||||||
end
|
end
|
||||||
|
|
||||||
dot_code = dep_graph.map do |d, deps|
|
dot_code = dep_graph.map do |d, deps|
|
||||||
@ -264,7 +264,7 @@ module Homebrew
|
|||||||
def self.graph_deps(formula, dep_graph:, recursive:, args:)
|
def self.graph_deps(formula, dep_graph:, recursive:, args:)
|
||||||
return if dep_graph.key?(formula)
|
return if dep_graph.key?(formula)
|
||||||
|
|
||||||
dependables = dependables(formula, args: args)
|
dependables = dependables(formula, args:)
|
||||||
dep_graph[formula] = dependables
|
dep_graph[formula] = dependables
|
||||||
return unless recursive
|
return unless recursive
|
||||||
|
|
||||||
@ -272,9 +272,9 @@ module Homebrew
|
|||||||
next unless dep.is_a? Dependency
|
next unless dep.is_a? Dependency
|
||||||
|
|
||||||
graph_deps(Formulary.factory(dep.name),
|
graph_deps(Formulary.factory(dep.name),
|
||||||
dep_graph: dep_graph,
|
dep_graph:,
|
||||||
recursive: true,
|
recursive: true,
|
||||||
args: args)
|
args:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -282,7 +282,7 @@ module Homebrew
|
|||||||
check_head_spec(dependents) if args.HEAD?
|
check_head_spec(dependents) if args.HEAD?
|
||||||
dependents.each do |d|
|
dependents.each do |d|
|
||||||
puts d.full_name
|
puts d.full_name
|
||||||
recursive_deps_tree(d, dep_stack: [], prefix: "", recursive: recursive, args: args)
|
recursive_deps_tree(d, dep_stack: [], prefix: "", recursive:, args:)
|
||||||
puts
|
puts
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -297,7 +297,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.recursive_deps_tree(formula, dep_stack:, prefix:, recursive:, args:)
|
def self.recursive_deps_tree(formula, dep_stack:, prefix:, recursive:, args:)
|
||||||
dependables = dependables(formula, args: args)
|
dependables = dependables(formula, args:)
|
||||||
max = dependables.length - 1
|
max = dependables.length - 1
|
||||||
dep_stack.push formula.name
|
dep_stack.push formula.name
|
||||||
dependables.each_with_index do |dep, i|
|
dependables.each_with_index do |dep, i|
|
||||||
@ -307,7 +307,7 @@ module Homebrew
|
|||||||
"├──"
|
"├──"
|
||||||
end
|
end
|
||||||
|
|
||||||
display_s = "#{tree_lines} #{dep_display_name(dep, args: args)}"
|
display_s = "#{tree_lines} #{dep_display_name(dep, args:)}"
|
||||||
|
|
||||||
# Detect circular dependencies and consider them a failure if present.
|
# Detect circular dependencies and consider them a failure if present.
|
||||||
is_circular = dep_stack.include?(dep.name)
|
is_circular = dep_stack.include?(dep.name)
|
||||||
@ -329,10 +329,10 @@ module Homebrew
|
|||||||
next unless dep.is_a? Dependency
|
next unless dep.is_a? Dependency
|
||||||
|
|
||||||
recursive_deps_tree(Formulary.factory(dep.name),
|
recursive_deps_tree(Formulary.factory(dep.name),
|
||||||
dep_stack: dep_stack,
|
dep_stack:,
|
||||||
prefix: prefix + prefix_addition,
|
prefix: prefix + prefix_addition,
|
||||||
recursive: true,
|
recursive: true,
|
||||||
args: args)
|
args:)
|
||||||
end
|
end
|
||||||
|
|
||||||
dep_stack.pop
|
dep_stack.pop
|
||||||
|
|||||||
@ -68,7 +68,7 @@ module Homebrew
|
|||||||
else
|
else
|
||||||
query = args.named.join(" ")
|
query = args.named.join(" ")
|
||||||
string_or_regex = Search.query_regexp(query)
|
string_or_regex = Search.query_regexp(query)
|
||||||
Search.search_descriptions(string_or_regex, args, search_type: search_type)
|
Search.search_descriptions(string_or_regex, args, search_type:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -98,7 +98,7 @@ module Homebrew
|
|||||||
ref = formula.loaded_from_api? ? formula.full_name : formula.path
|
ref = formula.loaded_from_api? ? formula.full_name : formula.path
|
||||||
|
|
||||||
os_arch_combinations.each do |os, arch|
|
os_arch_combinations.each do |os, arch|
|
||||||
SimulateSystem.with os: os, arch: arch do
|
SimulateSystem.with(os:, arch:) do
|
||||||
formula = Formulary.factory(ref, args.HEAD? ? :head : :stable)
|
formula = Formulary.factory(ref, args.HEAD? ? :head : :stable)
|
||||||
|
|
||||||
formula.print_tap_action verb: "Fetching"
|
formula.print_tap_action verb: "Fetching"
|
||||||
@ -118,7 +118,7 @@ module Homebrew
|
|||||||
bottle_tag = if (bottle_tag = args.bottle_tag&.to_sym)
|
bottle_tag = if (bottle_tag = args.bottle_tag&.to_sym)
|
||||||
Utils::Bottles::Tag.from_symbol(bottle_tag)
|
Utils::Bottles::Tag.from_symbol(bottle_tag)
|
||||||
else
|
else
|
||||||
Utils::Bottles::Tag.new(system: os, arch: arch)
|
Utils::Bottles::Tag.new(system: os, arch:)
|
||||||
end
|
end
|
||||||
|
|
||||||
bottle = formula.bottle_for_tag(bottle_tag)
|
bottle = formula.bottle_for_tag(bottle_tag)
|
||||||
@ -131,10 +131,10 @@ module Homebrew
|
|||||||
begin
|
begin
|
||||||
bottle.fetch_tab
|
bottle.fetch_tab
|
||||||
rescue DownloadError
|
rescue DownloadError
|
||||||
retry if retry_fetch?(bottle, args: args)
|
retry if retry_fetch?(bottle, args:)
|
||||||
raise
|
raise
|
||||||
end
|
end
|
||||||
fetch_formula(bottle, args: args)
|
fetch_formula(bottle, args:)
|
||||||
rescue Interrupt
|
rescue Interrupt
|
||||||
raise
|
raise
|
||||||
rescue => e
|
rescue => e
|
||||||
@ -150,14 +150,14 @@ module Homebrew
|
|||||||
|
|
||||||
next if fetched_bottle
|
next if fetched_bottle
|
||||||
|
|
||||||
fetch_formula(formula, args: args)
|
fetch_formula(formula, args:)
|
||||||
|
|
||||||
formula.resources.each do |r|
|
formula.resources.each do |r|
|
||||||
fetch_resource(r, args: args)
|
fetch_resource(r, args:)
|
||||||
r.patches.each { |p| fetch_patch(p, args: args) if p.external? }
|
r.patches.each { |p| fetch_patch(p, args:) if p.external? }
|
||||||
end
|
end
|
||||||
|
|
||||||
formula.patchlist.each { |p| fetch_patch(p, args: args) if p.external? }
|
formula.patchlist.each { |p| fetch_patch(p, args:) if p.external? }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -167,7 +167,7 @@ module Homebrew
|
|||||||
os_arch_combinations.each do |os, arch|
|
os_arch_combinations.each do |os, arch|
|
||||||
next if os == :linux
|
next if os == :linux
|
||||||
|
|
||||||
SimulateSystem.with os: os, arch: arch do
|
SimulateSystem.with(os:, arch:) do
|
||||||
cask = Cask::CaskLoader.load(ref)
|
cask = Cask::CaskLoader.load(ref)
|
||||||
|
|
||||||
if cask.url.nil? || cask.sha256.nil?
|
if cask.url.nil? || cask.sha256.nil?
|
||||||
@ -178,8 +178,8 @@ module Homebrew
|
|||||||
quarantine = args.quarantine?
|
quarantine = args.quarantine?
|
||||||
quarantine = true if quarantine.nil?
|
quarantine = true if quarantine.nil?
|
||||||
|
|
||||||
download = Cask::Download.new(cask, quarantine: quarantine)
|
download = Cask::Download.new(cask, quarantine:)
|
||||||
fetch_cask(download, args: args)
|
fetch_cask(download, args:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -188,28 +188,28 @@ module Homebrew
|
|||||||
|
|
||||||
def self.fetch_resource(resource, args:)
|
def self.fetch_resource(resource, args:)
|
||||||
puts "Resource: #{resource.name}"
|
puts "Resource: #{resource.name}"
|
||||||
fetch_fetchable resource, args: args
|
fetch_fetchable resource, args:
|
||||||
rescue ChecksumMismatchError => e
|
rescue ChecksumMismatchError => e
|
||||||
retry if retry_fetch?(resource, args: args)
|
retry if retry_fetch?(resource, args:)
|
||||||
opoo "Resource #{resource.name} reports different sha256: #{e.expected}"
|
opoo "Resource #{resource.name} reports different sha256: #{e.expected}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.fetch_formula(formula, args:)
|
def self.fetch_formula(formula, args:)
|
||||||
fetch_fetchable formula, args: args
|
fetch_fetchable(formula, args:)
|
||||||
rescue ChecksumMismatchError => e
|
rescue ChecksumMismatchError => e
|
||||||
retry if retry_fetch?(formula, args: args)
|
retry if retry_fetch?(formula, args:)
|
||||||
opoo "Formula reports different sha256: #{e.expected}"
|
opoo "Formula reports different sha256: #{e.expected}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.fetch_cask(cask_download, args:)
|
def self.fetch_cask(cask_download, args:)
|
||||||
fetch_fetchable cask_download, args: args
|
fetch_fetchable(cask_download, args:)
|
||||||
rescue ChecksumMismatchError => e
|
rescue ChecksumMismatchError => e
|
||||||
retry if retry_fetch?(cask_download, args: args)
|
retry if retry_fetch?(cask_download, args:)
|
||||||
opoo "Cask reports different sha256: #{e.expected}"
|
opoo "Cask reports different sha256: #{e.expected}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.fetch_patch(patch, args:)
|
def self.fetch_patch(patch, args:)
|
||||||
fetch_fetchable patch, args: args
|
fetch_fetchable(patch, args:)
|
||||||
rescue ChecksumMismatchError => e
|
rescue ChecksumMismatchError => e
|
||||||
opoo "Patch reports different sha256: #{e.expected}"
|
opoo "Patch reports different sha256: #{e.expected}"
|
||||||
Homebrew.failed = true
|
Homebrew.failed = true
|
||||||
@ -242,7 +242,7 @@ module Homebrew
|
|||||||
begin
|
begin
|
||||||
download = formula.fetch(verify_download_integrity: false)
|
download = formula.fetch(verify_download_integrity: false)
|
||||||
rescue DownloadError
|
rescue DownloadError
|
||||||
retry if retry_fetch?(formula, args: args)
|
retry if retry_fetch?(formula, args:)
|
||||||
raise
|
raise
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -125,6 +125,6 @@ module Homebrew
|
|||||||
|
|
||||||
Install.perform_preinstall_checks(all_fatal: true)
|
Install.perform_preinstall_checks(all_fatal: true)
|
||||||
Install.perform_build_from_source_checks(all_fatal: true)
|
Install.perform_build_from_source_checks(all_fatal: true)
|
||||||
gistify_logs(args.named.to_resolved_formulae.first, args: args)
|
gistify_logs(args.named.to_resolved_formulae.first, args:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -96,11 +96,11 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
print_analytics(args: args)
|
print_analytics(args:)
|
||||||
elsif args.json
|
elsif args.json
|
||||||
all = args.eval_all?
|
all = args.eval_all?
|
||||||
|
|
||||||
print_json(all, args: args)
|
print_json(all, args:)
|
||||||
elsif args.github?
|
elsif args.github?
|
||||||
raise FormulaOrCaskUnspecifiedError if args.no_named?
|
raise FormulaOrCaskUnspecifiedError if args.no_named?
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ module Homebrew
|
|||||||
elsif args.no_named?
|
elsif args.no_named?
|
||||||
print_statistics
|
print_statistics
|
||||||
else
|
else
|
||||||
print_info(args: args)
|
print_info(args:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ module Homebrew
|
|||||||
sig { params(args: CLI::Args).void }
|
sig { params(args: CLI::Args).void }
|
||||||
def print_analytics(args:)
|
def print_analytics(args:)
|
||||||
if args.no_named?
|
if args.no_named?
|
||||||
Utils::Analytics.output(args: args)
|
Utils::Analytics.output(args:)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -132,11 +132,11 @@ module Homebrew
|
|||||||
|
|
||||||
case obj
|
case obj
|
||||||
when Formula
|
when Formula
|
||||||
Utils::Analytics.formula_output(obj, args: args)
|
Utils::Analytics.formula_output(obj, args:)
|
||||||
when Cask::Cask
|
when Cask::Cask
|
||||||
Utils::Analytics.cask_output(obj, args: args)
|
Utils::Analytics.cask_output(obj, args:)
|
||||||
when FormulaOrCaskUnavailableError
|
when FormulaOrCaskUnavailableError
|
||||||
Utils::Analytics.output(filter: obj.name, args: args)
|
Utils::Analytics.output(filter: obj.name, args:)
|
||||||
else
|
else
|
||||||
raise
|
raise
|
||||||
end
|
end
|
||||||
@ -150,9 +150,9 @@ module Homebrew
|
|||||||
|
|
||||||
case obj
|
case obj
|
||||||
when Formula
|
when Formula
|
||||||
info_formula(obj, args: args)
|
info_formula(obj, args:)
|
||||||
when Cask::Cask
|
when Cask::Cask
|
||||||
info_cask(obj, args: args)
|
info_cask(obj, args:)
|
||||||
when FormulaUnreadableError, FormulaClassUnavailableError,
|
when FormulaUnreadableError, FormulaClassUnavailableError,
|
||||||
TapFormulaUnreadableError, TapFormulaClassUnavailableError,
|
TapFormulaUnreadableError, TapFormulaClassUnavailableError,
|
||||||
Cask::CaskUnreadableError
|
Cask::CaskUnreadableError
|
||||||
@ -341,7 +341,7 @@ module Homebrew
|
|||||||
caveats = Caveats.new(formula)
|
caveats = Caveats.new(formula)
|
||||||
ohai "Caveats", caveats.to_s unless caveats.empty?
|
ohai "Caveats", caveats.to_s unless caveats.empty?
|
||||||
|
|
||||||
Utils::Analytics.formula_output(formula, args: args)
|
Utils::Analytics.formula_output(formula, args:)
|
||||||
end
|
end
|
||||||
|
|
||||||
def decorate_dependencies(dependencies)
|
def decorate_dependencies(dependencies)
|
||||||
|
|||||||
@ -258,7 +258,7 @@ module Homebrew
|
|||||||
require_sha: args.require_sha?,
|
require_sha: args.require_sha?,
|
||||||
skip_cask_deps: args.skip_cask_deps?,
|
skip_cask_deps: args.skip_cask_deps?,
|
||||||
verbose: args.verbose?,
|
verbose: args.verbose?,
|
||||||
args: args,
|
args:,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -86,10 +86,10 @@ module Homebrew
|
|||||||
puts full_cask_names if full_cask_names.present?
|
puts full_cask_names if full_cask_names.present?
|
||||||
end
|
end
|
||||||
elsif args.pinned?
|
elsif args.pinned?
|
||||||
filtered_list(args: args)
|
filtered_list(args:)
|
||||||
elsif args.versions?
|
elsif args.versions?
|
||||||
filtered_list(args: args) unless args.cask?
|
filtered_list(args:) unless args.cask?
|
||||||
list_casks(args: args) if args.cask? || (!args.formula? && !args.multiple? && args.no_named?)
|
list_casks(args:) if args.cask? || (!args.formula? && !args.multiple? && args.no_named?)
|
||||||
elsif args.no_named?
|
elsif args.no_named?
|
||||||
ENV["CLICOLOR"] = nil
|
ENV["CLICOLOR"] = nil
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ module Homebrew
|
|||||||
system_command! "find", args: casks.map(&:caskroom_path) + find_args, print_stdout: true if casks.present?
|
system_command! "find", args: casks.map(&:caskroom_path) + find_args, print_stdout: true if casks.present?
|
||||||
else
|
else
|
||||||
kegs.each { |keg| PrettyListing.new keg } if kegs.present?
|
kegs.each { |keg| PrettyListing.new keg } if kegs.present?
|
||||||
list_casks(args: args) if casks.present?
|
list_casks(args:) if casks.present?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -41,11 +41,11 @@ module Homebrew
|
|||||||
ENV["PATH"] = PATH.new(ORIGINAL_PATHS).to_s
|
ENV["PATH"] = PATH.new(ORIGINAL_PATHS).to_s
|
||||||
|
|
||||||
if args.no_named?
|
if args.no_named?
|
||||||
git_log HOMEBREW_REPOSITORY, args: args
|
git_log(HOMEBREW_REPOSITORY, args:)
|
||||||
else
|
else
|
||||||
path = args.named.to_paths.first
|
path = args.named.to_paths.first
|
||||||
tap = Tap.from_path(path)
|
tap = Tap.from_path(path)
|
||||||
git_log path.dirname, path, tap, args: args
|
git_log path.dirname, path, tap, args:
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -35,9 +35,9 @@ module Homebrew
|
|||||||
all = args.eval_all?
|
all = args.eval_all?
|
||||||
|
|
||||||
if all
|
if all
|
||||||
puts_options Formula.all(eval_all: args.eval_all?).sort, args: args
|
puts_options(Formula.all(eval_all: args.eval_all?).sort, args:)
|
||||||
elsif args.installed?
|
elsif args.installed?
|
||||||
puts_options Formula.installed.sort, args: args
|
puts_options(Formula.installed.sort, args:)
|
||||||
elsif args.command.present?
|
elsif args.command.present?
|
||||||
cmd_options = Commands.command_options(args.command)
|
cmd_options = Commands.command_options(args.command)
|
||||||
odie "Unknown command: #{args.command}" if cmd_options.nil?
|
odie "Unknown command: #{args.command}" if cmd_options.nil?
|
||||||
@ -51,7 +51,7 @@ module Homebrew
|
|||||||
elsif args.no_named?
|
elsif args.no_named?
|
||||||
raise FormulaUnspecifiedError
|
raise FormulaUnspecifiedError
|
||||||
else
|
else
|
||||||
puts_options args.named.to_formulae, args: args
|
puts_options args.named.to_formulae, args:
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -55,16 +55,16 @@ module Homebrew
|
|||||||
odie "`brew outdated --json=v1` is no longer supported. Use brew outdated --json=v2 instead."
|
odie "`brew outdated --json=v1` is no longer supported. Use brew outdated --json=v2 instead."
|
||||||
when :v2, :default
|
when :v2, :default
|
||||||
formulae, casks = if args.formula?
|
formulae, casks = if args.formula?
|
||||||
[outdated_formulae(args: args), []]
|
[outdated_formulae(args:), []]
|
||||||
elsif args.cask?
|
elsif args.cask?
|
||||||
[[], outdated_casks(args: args)]
|
[[], outdated_casks(args:)]
|
||||||
else
|
else
|
||||||
outdated_formulae_casks args: args
|
outdated_formulae_casks(args:)
|
||||||
end
|
end
|
||||||
|
|
||||||
json = {
|
json = {
|
||||||
"formulae" => json_info(formulae, args: args),
|
"formulae" => json_info(formulae, args:),
|
||||||
"casks" => json_info(casks, args: args),
|
"casks" => json_info(casks, args:),
|
||||||
}
|
}
|
||||||
puts JSON.pretty_generate(json)
|
puts JSON.pretty_generate(json)
|
||||||
|
|
||||||
@ -72,14 +72,14 @@ module Homebrew
|
|||||||
|
|
||||||
else
|
else
|
||||||
outdated = if args.formula?
|
outdated = if args.formula?
|
||||||
outdated_formulae args: args
|
outdated_formulae(args:)
|
||||||
elsif args.cask?
|
elsif args.cask?
|
||||||
outdated_casks args: args
|
outdated_casks(args:)
|
||||||
else
|
else
|
||||||
outdated_formulae_casks(args: args).flatten
|
outdated_formulae_casks(args:).flatten
|
||||||
end
|
end
|
||||||
|
|
||||||
print_outdated(outdated, args: args)
|
print_outdated(outdated, args:)
|
||||||
end
|
end
|
||||||
|
|
||||||
Homebrew.failed = args.named.present? && outdated.present?
|
Homebrew.failed = args.named.present? && outdated.present?
|
||||||
@ -137,7 +137,7 @@ module Homebrew
|
|||||||
|
|
||||||
{ name: f.full_name,
|
{ name: f.full_name,
|
||||||
installed_versions: outdated_versions.map(&:to_s),
|
installed_versions: outdated_versions.map(&:to_s),
|
||||||
current_version: current_version,
|
current_version:,
|
||||||
pinned: f.pinned?,
|
pinned: f.pinned?,
|
||||||
pinned_version: f.pinned_version }
|
pinned_version: f.pinned_version }
|
||||||
else
|
else
|
||||||
@ -166,14 +166,14 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.outdated_formulae(args:)
|
def self.outdated_formulae(args:)
|
||||||
select_outdated((args.named.to_resolved_formulae.presence || Formula.installed), args: args).sort
|
select_outdated((args.named.to_resolved_formulae.presence || Formula.installed), args:).sort
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.outdated_casks(args:)
|
def self.outdated_casks(args:)
|
||||||
if args.named.present?
|
if args.named.present?
|
||||||
select_outdated(args.named.to_casks, args: args)
|
select_outdated(args.named.to_casks, args:)
|
||||||
else
|
else
|
||||||
select_outdated(Cask::Caskroom.casks, args: args)
|
select_outdated(Cask::Caskroom.casks, args:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ module Homebrew
|
|||||||
casks = Cask::Caskroom.casks
|
casks = Cask::Caskroom.casks
|
||||||
end
|
end
|
||||||
|
|
||||||
[select_outdated(formulae, args: args).sort, select_outdated(casks, args: args)]
|
[select_outdated(formulae, args:).sort, select_outdated(casks, args:)]
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.select_outdated(formulae_or_casks, args:)
|
def self.select_outdated(formulae_or_casks, args:)
|
||||||
|
|||||||
@ -59,7 +59,7 @@ module Homebrew
|
|||||||
|
|
||||||
Uninstall.uninstall_kegs(
|
Uninstall.uninstall_kegs(
|
||||||
kegs_by_rack,
|
kegs_by_rack,
|
||||||
casks: casks,
|
casks:,
|
||||||
force: args.force?,
|
force: args.force?,
|
||||||
ignore_dependencies: args.ignore_dependencies?,
|
ignore_dependencies: args.ignore_dependencies?,
|
||||||
named_args: args.named,
|
named_args: args.named,
|
||||||
|
|||||||
@ -109,7 +109,7 @@ module Homebrew
|
|||||||
odie "update-report should not be called directly!" if initial_revision.empty? || current_revision.empty?
|
odie "update-report should not be called directly!" if initial_revision.empty? || current_revision.empty?
|
||||||
|
|
||||||
if initial_revision != current_revision
|
if initial_revision != current_revision
|
||||||
auto_update_header args: args
|
auto_update_header(args:)
|
||||||
|
|
||||||
updated = true
|
updated = true
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
unless updated_taps.empty?
|
unless updated_taps.empty?
|
||||||
auto_update_header args: args
|
auto_update_header(args:)
|
||||||
puts "Updated #{Utils.pluralize("tap", updated_taps.count, include_count: true)} (#{updated_taps.to_sentence})."
|
puts "Updated #{Utils.pluralize("tap", updated_taps.count, include_count: true)} (#{updated_taps.to_sentence})."
|
||||||
updated = true
|
updated = true
|
||||||
end
|
end
|
||||||
@ -689,7 +689,7 @@ class Reporter
|
|||||||
end
|
end
|
||||||
next if oldnames_to_migrate.empty?
|
next if oldnames_to_migrate.empty?
|
||||||
|
|
||||||
Migrator.migrate_if_needed(formula, force: force)
|
Migrator.migrate_if_needed(formula, force:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -743,7 +743,7 @@ class ReporterHub
|
|||||||
|
|
||||||
def add(reporter, auto_update: false)
|
def add(reporter, auto_update: false)
|
||||||
@reporters << reporter
|
@reporters << reporter
|
||||||
report = reporter.report(auto_update: auto_update).delete_if { |_k, v| v.empty? }
|
report = reporter.report(auto_update:).delete_if { |_k, v| v.empty? }
|
||||||
@hash.update(report) { |_key, oldval, newval| oldval.concat(newval) }
|
@hash.update(report) { |_key, oldval, newval| oldval.concat(newval) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -137,8 +137,8 @@ module Homebrew
|
|||||||
only_upgrade_formulae = formulae.present? && casks.blank?
|
only_upgrade_formulae = formulae.present? && casks.blank?
|
||||||
only_upgrade_casks = casks.present? && formulae.blank?
|
only_upgrade_casks = casks.present? && formulae.blank?
|
||||||
|
|
||||||
upgrade_outdated_formulae(formulae, args: args) unless only_upgrade_casks
|
upgrade_outdated_formulae(formulae, args:) unless only_upgrade_casks
|
||||||
upgrade_outdated_casks(casks, args: args) unless only_upgrade_formulae
|
upgrade_outdated_casks(casks, args:) unless only_upgrade_formulae
|
||||||
|
|
||||||
Cleanup.periodic_clean!(dry_run: args.dry_run?)
|
Cleanup.periodic_clean!(dry_run: args.dry_run?)
|
||||||
|
|
||||||
@ -269,7 +269,7 @@ module Homebrew
|
|||||||
require_sha: args.require_sha?,
|
require_sha: args.require_sha?,
|
||||||
skip_cask_deps: args.skip_cask_deps?,
|
skip_cask_deps: args.skip_cask_deps?,
|
||||||
verbose: args.verbose?,
|
verbose: args.verbose?,
|
||||||
args: args,
|
args:,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -69,7 +69,7 @@ module Homebrew
|
|||||||
# If the formula doesn't exist: fake the needed formula object name.
|
# If the formula doesn't exist: fake the needed formula object name.
|
||||||
# This is a legacy use of OpenStruct that should be refactored.
|
# This is a legacy use of OpenStruct that should be refactored.
|
||||||
# rubocop:disable Style/OpenStructUse
|
# rubocop:disable Style/OpenStructUse
|
||||||
args.named.map { |name| OpenStruct.new name: name, full_name: name }
|
args.named.map { |name| OpenStruct.new name:, full_name: name }
|
||||||
# rubocop:enable Style/OpenStructUse
|
# rubocop:enable Style/OpenStructUse
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ module Homebrew
|
|||||||
!args.include_optional? &&
|
!args.include_optional? &&
|
||||||
!args.skip_recommended?
|
!args.skip_recommended?
|
||||||
|
|
||||||
uses = intersection_of_dependents(use_runtime_dependents, used_formulae, args: args)
|
uses = intersection_of_dependents(use_runtime_dependents, used_formulae, args:)
|
||||||
|
|
||||||
return if uses.empty?
|
return if uses.empty?
|
||||||
|
|
||||||
|
|||||||
@ -116,7 +116,7 @@ module Commands
|
|||||||
def self.official_external_commands_paths(quiet:)
|
def self.official_external_commands_paths(quiet:)
|
||||||
OFFICIAL_CMD_TAPS.flat_map do |tap_name, cmds|
|
OFFICIAL_CMD_TAPS.flat_map do |tap_name, cmds|
|
||||||
tap = Tap.fetch(tap_name)
|
tap = Tap.fetch(tap_name)
|
||||||
tap.install(quiet: quiet) unless tap.installed?
|
tap.install(quiet:) unless tap.installed?
|
||||||
cmds.map(&method(:external_ruby_v2_cmd_path)).compact
|
cmds.map(&method(:external_ruby_v2_cmd_path)).compact
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -54,7 +54,7 @@ class CompilerFailure
|
|||||||
version = 9999
|
version = 9999
|
||||||
exact_major_match = false
|
exact_major_match = false
|
||||||
end
|
end
|
||||||
new(type, version, exact_major_match: exact_major_match, &block)
|
new(type, version, exact_major_match:, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def fails_with?(compiler)
|
def fails_with?(compiler)
|
||||||
|
|||||||
@ -25,7 +25,7 @@ module DependenciesHelpers
|
|||||||
|
|
||||||
cache_key = "recursive_includes_#{includes}_#{ignores}"
|
cache_key = "recursive_includes_#{includes}_#{ignores}"
|
||||||
|
|
||||||
klass.expand(root_dependent, cache_key: cache_key) do |dependent, dep|
|
klass.expand(root_dependent, cache_key:) do |dependent, dep|
|
||||||
klass.prune if ignores.any? { |ignore| dep.public_send(ignore) }
|
klass.prune if ignores.any? { |ignore| dep.public_send(ignore) }
|
||||||
klass.prune if includes.none? do |include|
|
klass.prune if includes.none? do |include|
|
||||||
# Ignore indirect test dependencies
|
# Ignore indirect test dependencies
|
||||||
|
|||||||
@ -74,7 +74,7 @@ class Dependency
|
|||||||
end
|
end
|
||||||
|
|
||||||
def satisfied?(inherited_options = [], minimum_version: nil, minimum_revision: nil)
|
def satisfied?(inherited_options = [], minimum_version: nil, minimum_revision: nil)
|
||||||
installed?(minimum_version: minimum_version, minimum_revision: minimum_revision) &&
|
installed?(minimum_version:, minimum_revision:) &&
|
||||||
missing_options(inherited_options).empty?
|
missing_options(inherited_options).empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -133,14 +133,14 @@ class Dependency
|
|||||||
when :skip
|
when :skip
|
||||||
next if @expand_stack.include? dep.name
|
next if @expand_stack.include? dep.name
|
||||||
|
|
||||||
expanded_deps.concat(expand(dep.to_formula, cache_key: cache_key, &block))
|
expanded_deps.concat(expand(dep.to_formula, cache_key:, &block))
|
||||||
when :keep_but_prune_recursive_deps
|
when :keep_but_prune_recursive_deps
|
||||||
expanded_deps << dep
|
expanded_deps << dep
|
||||||
else
|
else
|
||||||
next if @expand_stack.include? dep.name
|
next if @expand_stack.include? dep.name
|
||||||
|
|
||||||
dep_formula = dep.to_formula
|
dep_formula = dep.to_formula
|
||||||
expanded_deps.concat(expand(dep_formula, cache_key: cache_key, &block))
|
expanded_deps.concat(expand(dep_formula, cache_key:, &block))
|
||||||
|
|
||||||
# Fixes names for renamed/aliased formulae.
|
# Fixes names for renamed/aliased formulae.
|
||||||
dep = dep.dup_with_formula_name(dep_formula)
|
dep = dep.dup_with_formula_name(dep_formula)
|
||||||
@ -249,7 +249,7 @@ class UsesFromMacOSDependency < Dependency
|
|||||||
|
|
||||||
sig { params(minimum_version: T.nilable(Version), minimum_revision: T.nilable(Integer)).returns(T::Boolean) }
|
sig { params(minimum_version: T.nilable(Version), minimum_revision: T.nilable(Integer)).returns(T::Boolean) }
|
||||||
def installed?(minimum_version: nil, minimum_revision: nil)
|
def installed?(minimum_version: nil, minimum_revision: nil)
|
||||||
use_macos_install? || super(minimum_version: minimum_version, minimum_revision: minimum_revision)
|
use_macos_install? || super(minimum_version:, minimum_revision:)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
@ -276,7 +276,7 @@ class UsesFromMacOSDependency < Dependency
|
|||||||
|
|
||||||
sig { override.params(formula: Formula).returns(T.self_type) }
|
sig { override.params(formula: Formula).returns(T.self_type) }
|
||||||
def dup_with_formula_name(formula)
|
def dup_with_formula_name(formula)
|
||||||
self.class.new(formula.full_name.to_s, tags, bounds: bounds)
|
self.class.new(formula.full_name.to_s, tags, bounds:)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { returns(String) }
|
sig { returns(String) }
|
||||||
|
|||||||
@ -34,7 +34,7 @@ class DescriptionCacheStore < CacheStore
|
|||||||
return unless eval_all
|
return unless eval_all
|
||||||
return unless database.empty?
|
return unless database.empty?
|
||||||
|
|
||||||
Formula.all(eval_all: eval_all).each { |f| update!(f.full_name, f.desc) }
|
Formula.all(eval_all:).each { |f| update!(f.full_name, f.desc) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Use an update report to update the {DescriptionCacheStore}.
|
# Use an update report to update the {DescriptionCacheStore}.
|
||||||
@ -100,7 +100,7 @@ class CaskDescriptionCacheStore < DescriptionCacheStore
|
|||||||
return unless eval_all
|
return unless eval_all
|
||||||
return unless database.empty?
|
return unless database.empty?
|
||||||
|
|
||||||
Cask::Cask.all(eval_all: eval_all)
|
Cask::Cask.all(eval_all:)
|
||||||
.each { |c| update!(c.full_name, [c.name.join(", "), c.desc.presence]) }
|
.each { |c| update!(c.full_name, [c.name.join(", "), c.desc.presence]) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@ require "search"
|
|||||||
class Descriptions
|
class Descriptions
|
||||||
# Given a regex, find all formulae whose specified fields contain a match.
|
# Given a regex, find all formulae whose specified fields contain a match.
|
||||||
def self.search(string_or_regex, field, cache_store, eval_all = Homebrew::EnvConfig.eval_all?)
|
def self.search(string_or_regex, field, cache_store, eval_all = Homebrew::EnvConfig.eval_all?)
|
||||||
cache_store.populate_if_empty!(eval_all: eval_all)
|
cache_store.populate_if_empty!(eval_all:)
|
||||||
|
|
||||||
results = case field
|
results = case field
|
||||||
when :name
|
when :name
|
||||||
|
|||||||
@ -210,20 +210,20 @@ module Homebrew
|
|||||||
|
|
||||||
only = only_cops ? ["style"] : args.only
|
only = only_cops ? ["style"] : args.only
|
||||||
options = {
|
options = {
|
||||||
new_formula: new_formula,
|
new_formula:,
|
||||||
strict: strict,
|
strict:,
|
||||||
online: online,
|
online:,
|
||||||
git: args.git?,
|
git: args.git?,
|
||||||
only: only,
|
only:,
|
||||||
except: args.except,
|
except: args.except,
|
||||||
spdx_license_data: spdx_license_data,
|
spdx_license_data:,
|
||||||
spdx_exception_data: spdx_exception_data,
|
spdx_exception_data:,
|
||||||
style_offenses: style_offenses&.for_path(f.path),
|
style_offenses: style_offenses&.for_path(f.path),
|
||||||
tap_audit: tap_audit,
|
tap_audit:,
|
||||||
}.compact
|
}.compact
|
||||||
|
|
||||||
errors = os_arch_combinations.flat_map do |os, arch|
|
errors = os_arch_combinations.flat_map do |os, arch|
|
||||||
SimulateSystem.with os: os, arch: arch do
|
SimulateSystem.with(os:, arch:) do
|
||||||
odebug "Auditing Formula #{f} on os #{os} and arch #{arch}"
|
odebug "Auditing Formula #{f} on os #{os} and arch #{arch}"
|
||||||
|
|
||||||
audit_proc = proc { FormulaAuditor.new(Formulary.factory(path), **options).tap(&:audit) }
|
audit_proc = proc { FormulaAuditor.new(Formulary.factory(path), **options).tap(&:audit) }
|
||||||
@ -251,7 +251,7 @@ module Homebrew
|
|||||||
errors = os_arch_combinations.flat_map do |os, arch|
|
errors = os_arch_combinations.flat_map do |os, arch|
|
||||||
next [] if os == :linux
|
next [] if os == :linux
|
||||||
|
|
||||||
SimulateSystem.with os: os, arch: arch do
|
SimulateSystem.with(os:, arch:) do
|
||||||
odebug "Auditing Cask #{cask} on os #{os} and arch #{arch}"
|
odebug "Auditing Cask #{cask} on os #{os} and arch #{arch}"
|
||||||
|
|
||||||
Cask::Auditor.audit(
|
Cask::Auditor.audit(
|
||||||
|
|||||||
@ -96,13 +96,13 @@ module Homebrew
|
|||||||
|
|
||||||
if args.merge?
|
if args.merge?
|
||||||
Homebrew.install_bundler_gems!(groups: ["ast"])
|
Homebrew.install_bundler_gems!(groups: ["ast"])
|
||||||
return merge(args: args)
|
return merge(args:)
|
||||||
end
|
end
|
||||||
|
|
||||||
gnu_tar_formula_ensure_installed_if_needed!(only_json_tab: args.only_json_tab?)
|
gnu_tar_formula_ensure_installed_if_needed!(only_json_tab: args.only_json_tab?)
|
||||||
|
|
||||||
args.named.to_resolved_formulae(uniq: false).each do |formula|
|
args.named.to_resolved_formulae(uniq: false).each do |formula|
|
||||||
bottle_formula formula, args: args
|
bottle_formula formula, args:
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
keg_contain_absolute_symlink_starting_with?(string, keg, args: args) || result
|
keg_contain_absolute_symlink_starting_with?(string, keg, args:) || result
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.keg_contain_absolute_symlink_starting_with?(string, keg, args:)
|
def self.keg_contain_absolute_symlink_starting_with?(string, keg, args:)
|
||||||
@ -482,7 +482,7 @@ module Homebrew
|
|||||||
else
|
else
|
||||||
HOMEBREW_REPOSITORY
|
HOMEBREW_REPOSITORY
|
||||||
end.to_s
|
end.to_s
|
||||||
if keg_contain?(repository_reference, keg, ignores + ALLOWABLE_HOMEBREW_REPOSITORY_LINKS, args: args)
|
if keg_contain?(repository_reference, keg, ignores + ALLOWABLE_HOMEBREW_REPOSITORY_LINKS, args:)
|
||||||
odie "Bottle contains non-relocatable reference to #{repository_reference}!"
|
odie "Bottle contains non-relocatable reference to #{repository_reference}!"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -490,16 +490,16 @@ module Homebrew
|
|||||||
if args.skip_relocation?
|
if args.skip_relocation?
|
||||||
skip_relocation = true
|
skip_relocation = true
|
||||||
else
|
else
|
||||||
relocatable = false if keg_contain?(prefix_check, keg, ignores, formula_and_runtime_deps_names, args: args)
|
relocatable = false if keg_contain?(prefix_check, keg, ignores, formula_and_runtime_deps_names, args:)
|
||||||
relocatable = false if keg_contain?(cellar, keg, ignores, formula_and_runtime_deps_names, args: args)
|
relocatable = false if keg_contain?(cellar, keg, ignores, formula_and_runtime_deps_names, args:)
|
||||||
if keg_contain?(HOMEBREW_LIBRARY.to_s, keg, ignores, formula_and_runtime_deps_names, args: args)
|
if keg_contain?(HOMEBREW_LIBRARY.to_s, keg, ignores, formula_and_runtime_deps_names, args:)
|
||||||
relocatable = false
|
relocatable = false
|
||||||
end
|
end
|
||||||
if prefix != prefix_check
|
if prefix != prefix_check
|
||||||
relocatable = false if keg_contain_absolute_symlink_starting_with?(prefix, keg, args: args)
|
relocatable = false if keg_contain_absolute_symlink_starting_with?(prefix, keg, args:)
|
||||||
relocatable = false if keg_contain?("#{prefix}/etc", keg, ignores, args: args)
|
relocatable = false if keg_contain?("#{prefix}/etc", keg, ignores, args:)
|
||||||
relocatable = false if keg_contain?("#{prefix}/var", keg, ignores, args: args)
|
relocatable = false if keg_contain?("#{prefix}/var", keg, ignores, args:)
|
||||||
relocatable = false if keg_contain?("#{prefix}/share/vim", keg, ignores, args: args)
|
relocatable = false if keg_contain?("#{prefix}/share/vim", keg, ignores, args:)
|
||||||
end
|
end
|
||||||
skip_relocation = relocatable && !keg.require_relocation?
|
skip_relocation = relocatable && !keg.require_relocation?
|
||||||
end
|
end
|
||||||
@ -661,7 +661,7 @@ module Homebrew
|
|||||||
tag.to_sym
|
tag.to_sym
|
||||||
end
|
end
|
||||||
|
|
||||||
sha256_hash = { cellar: cellar, tag_sym => tag_hash["sha256"] }
|
sha256_hash = { cellar:, tag_sym => tag_hash["sha256"] }
|
||||||
bottle.sha256 sha256_hash
|
bottle.sha256 sha256_hash
|
||||||
|
|
||||||
break if all_bottle
|
break if all_bottle
|
||||||
@ -735,7 +735,7 @@ module Homebrew
|
|||||||
|
|
||||||
require "utils/ast"
|
require "utils/ast"
|
||||||
formula_ast = Utils::AST::FormulaAST.new(path.read)
|
formula_ast = Utils::AST::FormulaAST.new(path.read)
|
||||||
checksums = old_checksums(formula, formula_ast, bottle_hash, args: args)
|
checksums = old_checksums(formula, formula_ast, bottle_hash, args:)
|
||||||
update_or_add = checksums.nil? ? "add" : "update"
|
update_or_add = checksums.nil? ? "add" : "update"
|
||||||
|
|
||||||
checksums&.each(&bottle.method(:sha256))
|
checksums&.each(&bottle.method(:sha256))
|
||||||
|
|||||||
@ -123,7 +123,7 @@ module Homebrew
|
|||||||
raise UsageError, "No `--version`, `--url` or `--sha256` argument specified!"
|
raise UsageError, "No `--version`, `--url` or `--sha256` argument specified!"
|
||||||
end
|
end
|
||||||
|
|
||||||
check_pull_requests(cask, args: args, new_version: new_version)
|
check_pull_requests(cask, args:, new_version:)
|
||||||
|
|
||||||
replacement_pairs ||= []
|
replacement_pairs ||= []
|
||||||
branch_name = "bump-#{cask.token}"
|
branch_name = "bump-#{cask.token}"
|
||||||
@ -149,7 +149,7 @@ module Homebrew
|
|||||||
# For simplicity, our naming defers to the arm version if we multiple architectures are specified
|
# For simplicity, our naming defers to the arm version if we multiple architectures are specified
|
||||||
branch_version = new_version.arm || new_version.general
|
branch_version = new_version.arm || new_version.general
|
||||||
if branch_version.is_a?(Cask::DSL::Version)
|
if branch_version.is_a?(Cask::DSL::Version)
|
||||||
commit_version = shortened_version(branch_version, cask: cask)
|
commit_version = shortened_version(branch_version, cask:)
|
||||||
branch_name = "bump-#{cask.token}-#{branch_version.tr(",:", "-")}"
|
branch_name = "bump-#{cask.token}-#{branch_version.tr(",:", "-")}"
|
||||||
commit_message ||= "#{cask.token} #{commit_version}"
|
commit_message ||= "#{cask.token} #{commit_version}"
|
||||||
end
|
end
|
||||||
@ -166,18 +166,18 @@ module Homebrew
|
|||||||
read_only_run: args.dry_run?,
|
read_only_run: args.dry_run?,
|
||||||
silent: args.quiet?)
|
silent: args.quiet?)
|
||||||
|
|
||||||
run_cask_audit(cask, old_contents, args: args)
|
run_cask_audit(cask, old_contents, args:)
|
||||||
run_cask_style(cask, old_contents, args: args)
|
run_cask_style(cask, old_contents, args:)
|
||||||
|
|
||||||
pr_info = {
|
pr_info = {
|
||||||
branch_name: branch_name,
|
branch_name:,
|
||||||
commit_message: commit_message,
|
commit_message:,
|
||||||
old_contents: old_contents,
|
old_contents:,
|
||||||
pr_message: "Created with `brew bump-cask-pr`.",
|
pr_message: "Created with `brew bump-cask-pr`.",
|
||||||
sourcefile_path: cask.sourcefile_path,
|
sourcefile_path: cask.sourcefile_path,
|
||||||
tap: cask.tap,
|
tap: cask.tap,
|
||||||
}
|
}
|
||||||
GitHub.create_bump_pr(pr_info, args: args)
|
GitHub.create_bump_pr(pr_info, args:)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(version: Cask::DSL::Version, cask: Cask::Cask).returns(Cask::DSL::Version) }
|
sig { params(version: Cask::DSL::Version, cask: Cask::Cask).returns(Cask::DSL::Version) }
|
||||||
@ -201,7 +201,7 @@ module Homebrew
|
|||||||
# When blocks are absent, arch is not relevant. For consistency, we simulate the arm architecture.
|
# When blocks are absent, arch is not relevant. For consistency, we simulate the arm architecture.
|
||||||
arch_options = cask.on_system_blocks_exist? ? OnSystem::ARCH_OPTIONS : [:arm]
|
arch_options = cask.on_system_blocks_exist? ? OnSystem::ARCH_OPTIONS : [:arm]
|
||||||
arch_options.each do |arch|
|
arch_options.each do |arch|
|
||||||
SimulateSystem.with arch: arch do
|
SimulateSystem.with(arch:) do
|
||||||
old_cask = Cask::CaskLoader.load(cask.sourcefile_path)
|
old_cask = Cask::CaskLoader.load(cask.sourcefile_path)
|
||||||
old_version = old_cask.version
|
old_version = old_cask.version
|
||||||
bump_version = new_version.send(arch) || new_version.general
|
bump_version = new_version.send(arch) || new_version.general
|
||||||
@ -272,7 +272,7 @@ module Homebrew
|
|||||||
cask.token,
|
cask.token,
|
||||||
tap_remote_repo,
|
tap_remote_repo,
|
||||||
state: "closed",
|
state: "closed",
|
||||||
version: shortened_version(version, cask: cask),
|
version: shortened_version(version, cask:),
|
||||||
file: cask.sourcefile_path.relative_path_from(cask.tap.path).to_s,
|
file: cask.sourcefile_path.relative_path_from(cask.tap.path).to_s,
|
||||||
quiet: args.quiet?,
|
quiet: args.quiet?,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -134,10 +134,10 @@ module Homebrew
|
|||||||
remote_branch = formula.tap.git_repo.origin_branch_name
|
remote_branch = formula.tap.git_repo.origin_branch_name
|
||||||
previous_branch = "-"
|
previous_branch = "-"
|
||||||
|
|
||||||
check_open_pull_requests(formula, tap_remote_repo, args: args)
|
check_open_pull_requests(formula, tap_remote_repo, args:)
|
||||||
|
|
||||||
new_version = args.version
|
new_version = args.version
|
||||||
check_new_version(formula, tap_remote_repo, version: new_version, args: args) if new_version.present?
|
check_new_version(formula, tap_remote_repo, version: new_version, args:) if new_version.present?
|
||||||
|
|
||||||
opoo "This formula has patches that may be resolved upstream." if formula.patchlist.present?
|
opoo "This formula has patches that may be resolved upstream." if formula.patchlist.present?
|
||||||
if formula.resources.any? { |resource| !resource.name.start_with?("homebrew-") }
|
if formula.resources.any? { |resource| !resource.name.start_with?("homebrew-") }
|
||||||
@ -149,7 +149,7 @@ module Homebrew
|
|||||||
new_mirror ||= determine_mirror(new_url)
|
new_mirror ||= determine_mirror(new_url)
|
||||||
new_mirrors ||= [new_mirror] if new_mirror.present?
|
new_mirrors ||= [new_mirror] if new_mirror.present?
|
||||||
|
|
||||||
check_for_mirrors(formula, old_mirrors, new_mirrors, args: args) if new_url.present?
|
check_for_mirrors(formula, old_mirrors, new_mirrors, args:) if new_url.present?
|
||||||
|
|
||||||
old_hash = formula_spec.checksum&.hexdigest
|
old_hash = formula_spec.checksum&.hexdigest
|
||||||
new_hash = args.sha256
|
new_hash = args.sha256
|
||||||
@ -161,10 +161,10 @@ module Homebrew
|
|||||||
old_version = old_formula_version.to_s
|
old_version = old_formula_version.to_s
|
||||||
forced_version = new_version.present?
|
forced_version = new_version.present?
|
||||||
new_url_hash = if new_url.present? && new_hash.present?
|
new_url_hash = if new_url.present? && new_hash.present?
|
||||||
check_new_version(formula, tap_remote_repo, url: new_url, args: args) if new_version.blank?
|
check_new_version(formula, tap_remote_repo, url: new_url, args:) if new_version.blank?
|
||||||
true
|
true
|
||||||
elsif new_tag.present? && new_revision.present?
|
elsif new_tag.present? && new_revision.present?
|
||||||
check_new_version(formula, tap_remote_repo, url: old_url, tag: new_tag, args: args) if new_version.blank?
|
check_new_version(formula, tap_remote_repo, url: old_url, tag: new_tag, args:) if new_version.blank?
|
||||||
false
|
false
|
||||||
elsif old_hash.blank?
|
elsif old_hash.blank?
|
||||||
if new_tag.blank? && new_version.blank? && new_revision.blank?
|
if new_tag.blank? && new_version.blank? && new_revision.blank?
|
||||||
@ -179,7 +179,7 @@ module Homebrew
|
|||||||
and old tag are both #{new_tag}.
|
and old tag are both #{new_tag}.
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
check_new_version(formula, tap_remote_repo, url: old_url, tag: new_tag, args: args) if new_version.blank?
|
check_new_version(formula, tap_remote_repo, url: old_url, tag: new_tag, args:) if new_version.blank?
|
||||||
resource_path, forced_version = fetch_resource_and_forced_version(formula, new_version, old_url, tag: new_tag)
|
resource_path, forced_version = fetch_resource_and_forced_version(formula, new_version, old_url, tag: new_tag)
|
||||||
new_revision = Utils.popen_read("git", "-C", resource_path.to_s, "rev-parse", "-q", "--verify", "HEAD")
|
new_revision = Utils.popen_read("git", "-C", resource_path.to_s, "rev-parse", "-q", "--verify", "HEAD")
|
||||||
new_revision = new_revision.strip
|
new_revision = new_revision.strip
|
||||||
@ -206,7 +206,7 @@ module Homebrew
|
|||||||
#{new_url}
|
#{new_url}
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
check_new_version(formula, tap_remote_repo, url: new_url, args: args) if new_version.blank?
|
check_new_version(formula, tap_remote_repo, url: new_url, args:) if new_version.blank?
|
||||||
resource_path, forced_version = fetch_resource_and_forced_version(formula, new_version, new_url)
|
resource_path, forced_version = fetch_resource_and_forced_version(formula, new_version, new_url)
|
||||||
Utils::Tar.validate_file(resource_path)
|
Utils::Tar.validate_file(resource_path)
|
||||||
new_hash = resource_path.sha256
|
new_hash = resource_path.sha256
|
||||||
@ -344,7 +344,7 @@ module Homebrew
|
|||||||
ignore_non_pypi_packages: true
|
ignore_non_pypi_packages: true
|
||||||
end
|
end
|
||||||
|
|
||||||
run_audit(formula, alias_rename, old_contents, args: args)
|
run_audit(formula, alias_rename, old_contents, args:)
|
||||||
|
|
||||||
pr_message = "Created with `brew bump-formula-pr`."
|
pr_message = "Created with `brew bump-formula-pr`."
|
||||||
if resources_checked.nil? && formula.resources.any? { |resource| !resource.name.start_with?("homebrew-") }
|
if resources_checked.nil? && formula.resources.any? { |resource| !resource.name.start_with?("homebrew-") }
|
||||||
@ -379,18 +379,18 @@ module Homebrew
|
|||||||
|
|
||||||
pr_info = {
|
pr_info = {
|
||||||
sourcefile_path: formula.path,
|
sourcefile_path: formula.path,
|
||||||
old_contents: old_contents,
|
old_contents:,
|
||||||
additional_files: alias_rename,
|
additional_files: alias_rename,
|
||||||
remote: remote,
|
remote:,
|
||||||
remote_branch: remote_branch,
|
remote_branch:,
|
||||||
branch_name: "bump-#{formula.name}-#{new_formula_version}",
|
branch_name: "bump-#{formula.name}-#{new_formula_version}",
|
||||||
commit_message: "#{formula.name} #{new_formula_version}",
|
commit_message: "#{formula.name} #{new_formula_version}",
|
||||||
previous_branch: previous_branch,
|
previous_branch:,
|
||||||
tap: formula.tap,
|
tap: formula.tap,
|
||||||
tap_remote_repo: tap_remote_repo,
|
tap_remote_repo:,
|
||||||
pr_message: pr_message,
|
pr_message:,
|
||||||
}
|
}
|
||||||
GitHub.create_bump_pr(pr_info, args: args)
|
GitHub.create_bump_pr(pr_info, args:)
|
||||||
end
|
end
|
||||||
|
|
||||||
def determine_mirror(url)
|
def determine_mirror(url)
|
||||||
@ -456,7 +456,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
check_throttle(formula, version)
|
check_throttle(formula, version)
|
||||||
check_closed_pull_requests(formula, tap_remote_repo, args: args, version: version)
|
check_closed_pull_requests(formula, tap_remote_repo, args:, version:)
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_throttle(formula, new_version)
|
def check_throttle(formula, new_version)
|
||||||
@ -472,7 +472,7 @@ module Homebrew
|
|||||||
def check_closed_pull_requests(formula, tap_remote_repo, args:, version:)
|
def check_closed_pull_requests(formula, tap_remote_repo, args:, version:)
|
||||||
# if we haven't already found open requests, try for an exact match across closed requests
|
# if we haven't already found open requests, try for an exact match across closed requests
|
||||||
GitHub.check_for_duplicate_pull_requests(formula.name, tap_remote_repo,
|
GitHub.check_for_duplicate_pull_requests(formula.name, tap_remote_repo,
|
||||||
version: version,
|
version:,
|
||||||
state: "closed",
|
state: "closed",
|
||||||
file: formula.path.relative_path_from(formula.tap.path).to_s,
|
file: formula.path.relative_path_from(formula.tap.path).to_s,
|
||||||
quiet: args.quiet?)
|
quiet: args.quiet?)
|
||||||
|
|||||||
@ -150,14 +150,14 @@ module Homebrew
|
|||||||
package_data = if formula_or_cask.is_a?(Formula) && formula_or_cask.versioned_formula?
|
package_data = if formula_or_cask.is_a?(Formula) && formula_or_cask.versioned_formula?
|
||||||
nil
|
nil
|
||||||
else
|
else
|
||||||
Repology.single_package_query(name, repository: repository)
|
Repology.single_package_query(name, repository:)
|
||||||
end
|
end
|
||||||
|
|
||||||
retrieve_and_display_info_and_open_pr(
|
retrieve_and_display_info_and_open_pr(
|
||||||
formula_or_cask,
|
formula_or_cask,
|
||||||
name,
|
name,
|
||||||
package_data&.values&.first,
|
package_data&.values&.first,
|
||||||
args: args,
|
args:,
|
||||||
ambiguous_cask: ambiguous_casks.include?(formula_or_cask),
|
ambiguous_cask: ambiguous_casks.include?(formula_or_cask),
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
@ -218,8 +218,8 @@ module Homebrew
|
|||||||
formula_or_cask,
|
formula_or_cask,
|
||||||
name,
|
name,
|
||||||
repositories,
|
repositories,
|
||||||
args: args,
|
args:,
|
||||||
ambiguous_cask: ambiguous_cask,
|
ambiguous_cask:,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -283,7 +283,7 @@ module Homebrew
|
|||||||
|
|
||||||
version_info = Livecheck.latest_version(
|
version_info = Livecheck.latest_version(
|
||||||
formula_or_cask,
|
formula_or_cask,
|
||||||
referenced_formula_or_cask: referenced_formula_or_cask,
|
referenced_formula_or_cask:,
|
||||||
json: true, full_name: false, verbose: true, debug: false
|
json: true, full_name: false, verbose: true, debug: false
|
||||||
)
|
)
|
||||||
return "unable to get versions" if version_info.blank?
|
return "unable to get versions" if version_info.blank?
|
||||||
@ -306,7 +306,7 @@ module Homebrew
|
|||||||
def retrieve_pull_requests(formula_or_cask, name, state:, version: nil)
|
def retrieve_pull_requests(formula_or_cask, name, state:, version: nil)
|
||||||
tap_remote_repo = formula_or_cask.tap&.remote_repo || formula_or_cask.tap&.full_name
|
tap_remote_repo = formula_or_cask.tap&.remote_repo || formula_or_cask.tap&.full_name
|
||||||
pull_requests = begin
|
pull_requests = begin
|
||||||
GitHub.fetch_pull_requests(name, tap_remote_repo, state: state, version: version)
|
GitHub.fetch_pull_requests(name, tap_remote_repo, state:, version:)
|
||||||
rescue GitHub::API::ValidationFailedError => e
|
rescue GitHub::API::ValidationFailedError => e
|
||||||
odebug "Error fetching pull requests for #{formula_or_cask} #{name}: #{e}"
|
odebug "Error fetching pull requests for #{formula_or_cask} #{name}: #{e}"
|
||||||
nil
|
nil
|
||||||
@ -340,7 +340,7 @@ module Homebrew
|
|||||||
arch_options = is_cask_with_blocks ? OnSystem::ARCH_OPTIONS : [:arm]
|
arch_options = is_cask_with_blocks ? OnSystem::ARCH_OPTIONS : [:arm]
|
||||||
|
|
||||||
arch_options.each do |arch|
|
arch_options.each do |arch|
|
||||||
SimulateSystem.with arch: arch do
|
SimulateSystem.with(arch:) do
|
||||||
version_key = is_cask_with_blocks ? arch : :general
|
version_key = is_cask_with_blocks ? arch : :general
|
||||||
|
|
||||||
# We reload the formula/cask here to ensure we're getting the correct version for the current arch
|
# We reload the formula/cask here to ensure we're getting the correct version for the current arch
|
||||||
@ -415,14 +415,14 @@ module Homebrew
|
|||||||
end.presence
|
end.presence
|
||||||
|
|
||||||
VersionBumpInfo.new(
|
VersionBumpInfo.new(
|
||||||
type: type,
|
type:,
|
||||||
multiple_versions: multiple_versions,
|
multiple_versions:,
|
||||||
version_name: version_name,
|
version_name:,
|
||||||
current_version: current_version,
|
current_version:,
|
||||||
repology_latest: repology_latest,
|
repology_latest:,
|
||||||
new_version: new_version,
|
new_version:,
|
||||||
open_pull_requests: open_pull_requests,
|
open_pull_requests:,
|
||||||
closed_pull_requests: closed_pull_requests,
|
closed_pull_requests:,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -436,10 +436,10 @@ module Homebrew
|
|||||||
).void
|
).void
|
||||||
}
|
}
|
||||||
def retrieve_and_display_info_and_open_pr(formula_or_cask, name, repositories, args:, ambiguous_cask: false)
|
def retrieve_and_display_info_and_open_pr(formula_or_cask, name, repositories, args:, ambiguous_cask: false)
|
||||||
version_info = retrieve_versions_by_arch(formula_or_cask: formula_or_cask,
|
version_info = retrieve_versions_by_arch(formula_or_cask:,
|
||||||
repositories: repositories,
|
repositories:,
|
||||||
args: args,
|
args:,
|
||||||
name: name)
|
name:)
|
||||||
|
|
||||||
current_version = version_info.current_version
|
current_version = version_info.current_version
|
||||||
new_version = version_info.new_version
|
new_version = version_info.new_version
|
||||||
|
|||||||
@ -71,7 +71,7 @@ module Homebrew
|
|||||||
# committer details to match the ones on GitHub.
|
# committer details to match the ones on GitHub.
|
||||||
# TODO: Switch to using the GitHub APIs instead of `git log` if
|
# TODO: Switch to using the GitHub APIs instead of `git log` if
|
||||||
# they ever support trailers.
|
# they ever support trailers.
|
||||||
results[username] = scan_repositories(repos, username, args, from: from)
|
results[username] = scan_repositories(repos, username, args, from:)
|
||||||
grand_totals[username] = total(results[username])
|
grand_totals[username] = total(results[username])
|
||||||
|
|
||||||
contributions = contribution_types.filter_map do |type|
|
contributions = contribution_types.filter_map do |type|
|
||||||
@ -85,7 +85,7 @@ module Homebrew
|
|||||||
puts [
|
puts [
|
||||||
"#{username} contributed",
|
"#{username} contributed",
|
||||||
*contributions.to_sentence,
|
*contributions.to_sentence,
|
||||||
"#{time_period(from: from, to: args.to)}.",
|
"#{time_period(from:, to: args.to)}.",
|
||||||
].join(" ")
|
].join(" ")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ module Homebrew
|
|||||||
data[repo] = {
|
data[repo] = {
|
||||||
author: author_commits,
|
author: author_commits,
|
||||||
committer: committer_commits,
|
committer: committer_commits,
|
||||||
coauthorship: git_log_trailers_cmd(T.must(repo_path), person, "Co-authored-by", from: from, to: args.to),
|
coauthorship: git_log_trailers_cmd(T.must(repo_path), person, "Co-authored-by", from:, to: args.to),
|
||||||
review: count_reviews(repo_full_name, person, args),
|
review: count_reviews(repo_full_name, person, args),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -203,7 +203,7 @@ module Homebrew
|
|||||||
|
|
||||||
sig { params(repo_full_name: String, person: String, args: Homebrew::CLI::Args).returns(Integer) }
|
sig { params(repo_full_name: String, person: String, args: Homebrew::CLI::Args).returns(Integer) }
|
||||||
def count_reviews(repo_full_name, person, args)
|
def count_reviews(repo_full_name, person, args)
|
||||||
GitHub.count_issues("", is: "pr", repo: repo_full_name, reviewed_by: person, review: "approved", args: args)
|
GitHub.count_issues("", is: "pr", repo: repo_full_name, reviewed_by: person, review: "approved", args:)
|
||||||
rescue GitHub::API::ValidationFailedError
|
rescue GitHub::API::ValidationFailedError
|
||||||
if args.verbose?
|
if args.verbose?
|
||||||
onoe "Couldn't search GitHub for PRs by #{person}. Their profile might be private. Defaulting to 0."
|
onoe "Couldn't search GitHub for PRs by #{person}. Their profile might be private. Defaulting to 0."
|
||||||
|
|||||||
@ -74,9 +74,9 @@ module Homebrew
|
|||||||
args = create_args.parse
|
args = create_args.parse
|
||||||
|
|
||||||
path = if args.cask?
|
path = if args.cask?
|
||||||
create_cask(args: args)
|
create_cask(args:)
|
||||||
else
|
else
|
||||||
create_formula(args: args)
|
create_formula(args:)
|
||||||
end
|
end
|
||||||
|
|
||||||
exec_editor path
|
exec_editor path
|
||||||
@ -181,7 +181,7 @@ module Homebrew
|
|||||||
args.set_version,
|
args.set_version,
|
||||||
tap: args.tap,
|
tap: args.tap,
|
||||||
url: args.named.first,
|
url: args.named.first,
|
||||||
mode: mode,
|
mode:,
|
||||||
license: args.set_license,
|
license: args.set_license,
|
||||||
fetch: !args.no_fetch?,
|
fetch: !args.no_fetch?,
|
||||||
head: args.HEAD?,
|
head: args.HEAD?,
|
||||||
|
|||||||
@ -36,6 +36,6 @@ module Homebrew
|
|||||||
Homebrew.forget_user_gem_groups!
|
Homebrew.forget_user_gem_groups!
|
||||||
end
|
end
|
||||||
|
|
||||||
Homebrew.install_bundler_gems!(groups: groups)
|
Homebrew.install_bundler_gems!(groups:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -12,7 +12,7 @@ class String
|
|||||||
end
|
end
|
||||||
|
|
||||||
def c(config: nil)
|
def c(config: nil)
|
||||||
Cask::CaskLoader.load(self, config: config)
|
Cask::CaskLoader.load(self, config:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ class Symbol
|
|||||||
end
|
end
|
||||||
|
|
||||||
def c(config: nil)
|
def c(config: nil)
|
||||||
to_s.c(config: config)
|
to_s.c(config:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -163,12 +163,12 @@ module Homebrew
|
|||||||
package_name = package_file.basename.to_s.chomp(".rb")
|
package_name = package_file.basename.to_s.chomp(".rb")
|
||||||
|
|
||||||
odebug "Cherry-picking #{package_file}: #{commit}"
|
odebug "Cherry-picking #{package_file}: #{commit}"
|
||||||
Utils::Git.cherry_pick!(git_repo.to_s, commit, verbose: verbose, resolve: resolve)
|
Utils::Git.cherry_pick!(git_repo.to_s, commit, verbose:, resolve:)
|
||||||
|
|
||||||
old_package = Utils::Git.file_at_commit(git_repo.to_s, file, "HEAD^")
|
old_package = Utils::Git.file_at_commit(git_repo.to_s, file, "HEAD^")
|
||||||
new_package = Utils::Git.file_at_commit(git_repo.to_s, file, "HEAD")
|
new_package = Utils::Git.file_at_commit(git_repo.to_s, file, "HEAD")
|
||||||
|
|
||||||
bump_subject = determine_bump_subject(old_package, new_package, package_file, reason: reason).strip
|
bump_subject = determine_bump_subject(old_package, new_package, package_file, reason:).strip
|
||||||
subject, body, trailers = separate_commit_message(git_repo.commit_message)
|
subject, body, trailers = separate_commit_message(git_repo.commit_message)
|
||||||
|
|
||||||
if subject != bump_subject && !subject.start_with?("#{package_name}:")
|
if subject != bump_subject && !subject.start_with?("#{package_name}:")
|
||||||
@ -214,13 +214,13 @@ module Homebrew
|
|||||||
trailers = [trailers + co_author_trailers].flatten.uniq.compact
|
trailers = [trailers + co_author_trailers].flatten.uniq.compact
|
||||||
|
|
||||||
# Apply the patch series but don't commit anything yet.
|
# Apply the patch series but don't commit anything yet.
|
||||||
Utils::Git.cherry_pick!(git_repo.pathname, "--no-commit", *commits, verbose: verbose, resolve: resolve)
|
Utils::Git.cherry_pick!(git_repo.pathname, "--no-commit", *commits, verbose:, resolve:)
|
||||||
|
|
||||||
# Determine the bump subject by comparing the original state of the tree to its current state.
|
# Determine the bump subject by comparing the original state of the tree to its current state.
|
||||||
package_file = git_repo.pathname / file
|
package_file = git_repo.pathname / file
|
||||||
old_package = Utils::Git.file_at_commit(git_repo.pathname, file, "#{commits.first}^")
|
old_package = Utils::Git.file_at_commit(git_repo.pathname, file, "#{commits.first}^")
|
||||||
new_package = package_file.read
|
new_package = package_file.read
|
||||||
bump_subject = determine_bump_subject(old_package, new_package, package_file, reason: reason)
|
bump_subject = determine_bump_subject(old_package, new_package, package_file, reason:)
|
||||||
|
|
||||||
# Commit with the new subject, body, and trailers.
|
# Commit with the new subject, body, and trailers.
|
||||||
safe_system("git", "-C", git_repo.pathname, "commit", "--quiet",
|
safe_system("git", "-C", git_repo.pathname, "commit", "--quiet",
|
||||||
@ -273,14 +273,14 @@ module Homebrew
|
|||||||
if files.length == 1 && files_to_commits[files.first].length == 1
|
if files.length == 1 && files_to_commits[files.first].length == 1
|
||||||
# If there's a 1:1 mapping of commits to files, just cherry pick and (maybe) reword.
|
# If there's a 1:1 mapping of commits to files, just cherry pick and (maybe) reword.
|
||||||
reword_package_commit(
|
reword_package_commit(
|
||||||
commit, files.first, git_repo: git_repo, reason: reason, verbose: verbose, resolve: resolve
|
commit, files.first, git_repo:, reason:, verbose:, resolve:
|
||||||
)
|
)
|
||||||
processed_commits << commit
|
processed_commits << commit
|
||||||
elsif files.length == 1 && files_to_commits[files.first].length > 1
|
elsif files.length == 1 && files_to_commits[files.first].length > 1
|
||||||
# If multiple commits modify a single file, squash them down into a single commit.
|
# If multiple commits modify a single file, squash them down into a single commit.
|
||||||
file = files.first
|
file = files.first
|
||||||
commits = files_to_commits[file]
|
commits = files_to_commits[file]
|
||||||
squash_package_commits(commits, file, git_repo: git_repo, reason: reason, verbose: verbose, resolve: resolve)
|
squash_package_commits(commits, file, git_repo:, reason:, verbose:, resolve:)
|
||||||
processed_commits += commits
|
processed_commits += commits
|
||||||
else
|
else
|
||||||
# We can't split commits (yet) so just raise an error.
|
# We can't split commits (yet) so just raise an error.
|
||||||
@ -362,7 +362,7 @@ module Homebrew
|
|||||||
|
|
||||||
def self.pr_check_conflicts(repo, pull_request)
|
def self.pr_check_conflicts(repo, pull_request)
|
||||||
long_build_pr_files = GitHub.issues(
|
long_build_pr_files = GitHub.issues(
|
||||||
repo: repo, state: "open", labels: "no long build conflict",
|
repo:, state: "open", labels: "no long build conflict",
|
||||||
).each_with_object({}) do |long_build_pr, hash|
|
).each_with_object({}) do |long_build_pr, hash|
|
||||||
next unless long_build_pr.key?("pull_request")
|
next unless long_build_pr.key?("pull_request")
|
||||||
|
|
||||||
@ -459,15 +459,15 @@ module Homebrew
|
|||||||
odebug "Pull request merge-base: #{original_commit}"
|
odebug "Pull request merge-base: #{original_commit}"
|
||||||
|
|
||||||
unless args.no_commit?
|
unless args.no_commit?
|
||||||
cherry_pick_pr!(user, repo, pr, path: tap.path, args: args) unless args.no_cherry_pick?
|
cherry_pick_pr!(user, repo, pr, path: tap.path, args:) unless args.no_cherry_pick?
|
||||||
if args.autosquash? && !args.dry_run?
|
if args.autosquash? && !args.dry_run?
|
||||||
autosquash!(original_commit, tap: tap, cherry_picked: !args.no_cherry_pick?,
|
autosquash!(original_commit, tap:, cherry_picked: !args.no_cherry_pick?,
|
||||||
verbose: args.verbose?, resolve: args.resolve?, reason: args.message)
|
verbose: args.verbose?, resolve: args.resolve?, reason: args.message)
|
||||||
end
|
end
|
||||||
signoff!(git_repo, pull_request: pr, dry_run: args.dry_run?) unless args.clean?
|
signoff!(git_repo, pull_request: pr, dry_run: args.dry_run?) unless args.clean?
|
||||||
end
|
end
|
||||||
|
|
||||||
unless formulae_need_bottles?(tap, original_commit, pr_labels, args: args)
|
unless formulae_need_bottles?(tap, original_commit, pr_labels, args:)
|
||||||
ohai "Skipping artifacts for ##{pr} as the formulae don't need bottles"
|
ohai "Skipping artifacts for ##{pr} as the formulae don't need bottles"
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|||||||
@ -102,7 +102,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue Exception => e # rubocop:disable Lint/RescueException
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
||||||
retry if retry_test?(f, args: args)
|
retry if retry_test?(f, args:)
|
||||||
ofail "#{f.full_name}: failed"
|
ofail "#{f.full_name}: failed"
|
||||||
$stderr.puts e, Utils::Backtrace.clean(e)
|
$stderr.puts e, Utils::Backtrace.clean(e)
|
||||||
ensure
|
ensure
|
||||||
|
|||||||
@ -41,7 +41,7 @@ module Homebrew
|
|||||||
|
|
||||||
update = args.update? || args.update_all?
|
update = args.update? || args.update_all?
|
||||||
groups = update ? Homebrew.valid_gem_groups : ["typecheck"]
|
groups = update ? Homebrew.valid_gem_groups : ["typecheck"]
|
||||||
Homebrew.install_bundler_gems!(groups: groups)
|
Homebrew.install_bundler_gems!(groups:)
|
||||||
|
|
||||||
HOMEBREW_LIBRARY_PATH.cd do
|
HOMEBREW_LIBRARY_PATH.cd do
|
||||||
if update
|
if update
|
||||||
|
|||||||
@ -65,7 +65,7 @@ module Homebrew
|
|||||||
raise "Unknown arch #{@bottle_tag.arch}."
|
raise "Unknown arch #{@bottle_tag.arch}."
|
||||||
end
|
end
|
||||||
|
|
||||||
Homebrew::SimulateSystem.with os: os, arch: arch do
|
Homebrew::SimulateSystem.with(os:, arch:) do
|
||||||
all = args.eval_all?
|
all = args.eval_all?
|
||||||
if args.total?
|
if args.total?
|
||||||
if !all && !Homebrew::EnvConfig.eval_all?
|
if !all && !Homebrew::EnvConfig.eval_all?
|
||||||
|
|||||||
@ -33,7 +33,7 @@ module Homebrew
|
|||||||
members = {
|
members = {
|
||||||
plc: GitHub.members_by_team("Homebrew", "plc"),
|
plc: GitHub.members_by_team("Homebrew", "plc"),
|
||||||
tsc: GitHub.members_by_team("Homebrew", "tsc"),
|
tsc: GitHub.members_by_team("Homebrew", "tsc"),
|
||||||
maintainers: maintainers,
|
maintainers:,
|
||||||
}
|
}
|
||||||
|
|
||||||
sentences = {}
|
sentences = {}
|
||||||
|
|||||||
@ -21,7 +21,7 @@ module Homebrew
|
|||||||
def self.missing_deps(formulae, hide = nil)
|
def self.missing_deps(formulae, hide = nil)
|
||||||
missing = {}
|
missing = {}
|
||||||
formulae.each do |f|
|
formulae.each do |f|
|
||||||
missing_dependencies = f.missing_dependencies(hide: hide)
|
missing_dependencies = f.missing_dependencies(hide:)
|
||||||
next if missing_dependencies.empty?
|
next if missing_dependencies.empty?
|
||||||
|
|
||||||
yield f.full_name, missing_dependencies if block_given?
|
yield f.full_name, missing_dependencies if block_given?
|
||||||
|
|||||||
@ -107,7 +107,7 @@ class AbstractDownloadStrategy
|
|||||||
UnpackStrategy.detect(cached_location,
|
UnpackStrategy.detect(cached_location,
|
||||||
prioritize_extension: true,
|
prioritize_extension: true,
|
||||||
ref_type: @ref_type, ref: @ref)
|
ref_type: @ref_type, ref: @ref)
|
||||||
.extract_nestedly(basename: basename,
|
.extract_nestedly(basename:,
|
||||||
prioritize_extension: true,
|
prioritize_extension: true,
|
||||||
verbose: verbose? && !quiet?)
|
verbose: verbose? && !quiet?)
|
||||||
chdir(&block) if block
|
chdir(&block) if block
|
||||||
@ -162,7 +162,7 @@ class AbstractDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def silent_command(*args, **options)
|
def silent_command(*args, **options)
|
||||||
system_command(*args, print_stderr: false, env: env, **options)
|
system_command(*args, print_stderr: false, env:, **options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def command!(*args, **options)
|
def command!(*args, **options)
|
||||||
@ -442,7 +442,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
|||||||
puts "Already downloaded: #{cached_location}"
|
puts "Already downloaded: #{cached_location}"
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
_fetch(url: url, resolved_url: resolved_url, timeout: Utils::Timer.remaining!(end_time))
|
_fetch(url:, resolved_url:, timeout: Utils::Timer.remaining!(end_time))
|
||||||
rescue ErrorDuringExecution
|
rescue ErrorDuringExecution
|
||||||
raise CurlDownloadStrategyError, url
|
raise CurlDownloadStrategyError, url
|
||||||
end
|
end
|
||||||
@ -473,7 +473,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def resolved_time_file_size(timeout: nil)
|
def resolved_time_file_size(timeout: nil)
|
||||||
_, _, time, file_size = resolve_url_basename_time_file_size(url, timeout: timeout)
|
_, _, time, file_size = resolve_url_basename_time_file_size(url, timeout:)
|
||||||
[time, file_size]
|
[time, file_size]
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -489,7 +489,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
|||||||
return @resolved_info_cache[url] if @resolved_info_cache.include?(url)
|
return @resolved_info_cache[url] if @resolved_info_cache.include?(url)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
parsed_output = curl_headers(url.to_s, wanted_headers: ["content-disposition"], timeout: timeout)
|
parsed_output = curl_headers(url.to_s, wanted_headers: ["content-disposition"], timeout:)
|
||||||
rescue ErrorDuringExecution
|
rescue ErrorDuringExecution
|
||||||
return [url, parse_basename(url), nil, nil, false]
|
return [url, parse_basename(url), nil, nil, false]
|
||||||
end
|
end
|
||||||
@ -559,7 +559,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def _curl_download(resolved_url, to, timeout)
|
def _curl_download(resolved_url, to, timeout)
|
||||||
curl_download resolved_url, to: to, try_partial: @try_partial, timeout: timeout
|
curl_download resolved_url, to:, try_partial: @try_partial, timeout:
|
||||||
end
|
end
|
||||||
|
|
||||||
# Curl options to be always passed to curl,
|
# Curl options to be always passed to curl,
|
||||||
@ -611,7 +611,7 @@ class HomebrewCurlDownloadStrategy < CurlDownloadStrategy
|
|||||||
def _curl_download(resolved_url, to, timeout)
|
def _curl_download(resolved_url, to, timeout)
|
||||||
raise HomebrewCurlDownloadStrategyError, url unless Formula["curl"].any_version_installed?
|
raise HomebrewCurlDownloadStrategyError, url unless Formula["curl"].any_version_installed?
|
||||||
|
|
||||||
curl_download resolved_url, to: to, try_partial: @try_partial, timeout: timeout, use_homebrew_curl: true
|
curl_download resolved_url, to:, try_partial: @try_partial, timeout:, use_homebrew_curl: true
|
||||||
end
|
end
|
||||||
|
|
||||||
def curl_output(*args, **options)
|
def curl_output(*args, **options)
|
||||||
@ -666,7 +666,7 @@ class CurlApacheMirrorDownloadStrategy < CurlDownloadStrategy
|
|||||||
|
|
||||||
def resolve_url_basename_time_file_size(url, timeout: nil)
|
def resolve_url_basename_time_file_size(url, timeout: nil)
|
||||||
if url == self.url
|
if url == self.url
|
||||||
super("#{apache_mirrors["preferred"]}#{apache_mirrors["path_info"]}", timeout: timeout)
|
super("#{apache_mirrors["preferred"]}#{apache_mirrors["path_info"]}", timeout:)
|
||||||
else
|
else
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
@ -698,7 +698,7 @@ class CurlPostDownloadStrategy < CurlDownloadStrategy
|
|||||||
query.nil? ? [url, "-X", "POST"] : [url, "-d", query]
|
query.nil? ? [url, "-X", "POST"] : [url, "-d", query]
|
||||||
end
|
end
|
||||||
|
|
||||||
curl_download(*args, to: temporary_path, try_partial: @try_partial, timeout: timeout)
|
curl_download(*args, to: temporary_path, try_partial: @try_partial, timeout:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -709,7 +709,7 @@ end
|
|||||||
class NoUnzipCurlDownloadStrategy < CurlDownloadStrategy
|
class NoUnzipCurlDownloadStrategy < CurlDownloadStrategy
|
||||||
def stage
|
def stage
|
||||||
UnpackStrategy::Uncompressed.new(cached_location)
|
UnpackStrategy::Uncompressed.new(cached_location)
|
||||||
.extract(basename: basename,
|
.extract(basename:,
|
||||||
verbose: verbose? && !quiet?)
|
verbose: verbose? && !quiet?)
|
||||||
yield if block_given?
|
yield if block_given?
|
||||||
end
|
end
|
||||||
@ -821,18 +821,18 @@ class SubversionDownloadStrategy < VCSDownloadStrategy
|
|||||||
def clone_repo(timeout: nil)
|
def clone_repo(timeout: nil)
|
||||||
case @ref_type
|
case @ref_type
|
||||||
when :revision
|
when :revision
|
||||||
fetch_repo cached_location, @url, @ref, timeout: timeout
|
fetch_repo cached_location, @url, @ref, timeout:
|
||||||
when :revisions
|
when :revisions
|
||||||
# nil is OK for main_revision, as fetch_repo will then get latest
|
# nil is OK for main_revision, as fetch_repo will then get latest
|
||||||
main_revision = @ref[:trunk]
|
main_revision = @ref[:trunk]
|
||||||
fetch_repo cached_location, @url, main_revision, ignore_externals: true, timeout: timeout
|
fetch_repo(cached_location, @url, main_revision, ignore_externals: true, timeout:)
|
||||||
|
|
||||||
externals do |external_name, external_url|
|
externals do |external_name, external_url|
|
||||||
fetch_repo cached_location/external_name, external_url, @ref[external_name], ignore_externals: true,
|
fetch_repo cached_location/external_name, external_url, @ref[external_name], ignore_externals: true,
|
||||||
timeout: timeout
|
timeout:
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
fetch_repo cached_location, @url, timeout: timeout
|
fetch_repo cached_location, @url, timeout:
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
alias update clone_repo
|
alias update clone_repo
|
||||||
@ -893,10 +893,10 @@ class GitDownloadStrategy < VCSDownloadStrategy
|
|||||||
sig { params(timeout: T.nilable(Time)).void }
|
sig { params(timeout: T.nilable(Time)).void }
|
||||||
def update(timeout: nil)
|
def update(timeout: nil)
|
||||||
config_repo
|
config_repo
|
||||||
update_repo(timeout: timeout)
|
update_repo(timeout:)
|
||||||
checkout(timeout: timeout)
|
checkout(timeout:)
|
||||||
reset
|
reset
|
||||||
update_submodules(timeout: timeout) if submodules?
|
update_submodules(timeout:) if submodules?
|
||||||
end
|
end
|
||||||
|
|
||||||
def shallow_dir?
|
def shallow_dir?
|
||||||
@ -1018,8 +1018,8 @@ class GitDownloadStrategy < VCSDownloadStrategy
|
|||||||
|
|
||||||
configure_sparse_checkout if partial_clone_sparse_checkout?
|
configure_sparse_checkout if partial_clone_sparse_checkout?
|
||||||
|
|
||||||
checkout(timeout: timeout)
|
checkout(timeout:)
|
||||||
update_submodules(timeout: timeout) if submodules?
|
update_submodules(timeout:) if submodules?
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(timeout: T.nilable(Time)).void }
|
sig { params(timeout: T.nilable(Time)).void }
|
||||||
|
|||||||
@ -75,7 +75,7 @@ class Downloadable
|
|||||||
raise ArgumentError, "attempted to use a Downloadable without a URL!" if primary_url.blank?
|
raise ArgumentError, "attempted to use a Downloadable without a URL!" if primary_url.blank?
|
||||||
|
|
||||||
download_strategy.new(primary_url, download_name, version,
|
download_strategy.new(primary_url, download_name, version,
|
||||||
mirrors: mirrors, cache: cache, **T.must(@url).specs)
|
mirrors:, cache:, **T.must(@url).specs)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ class Downloadable
|
|||||||
cache.mkpath
|
cache.mkpath
|
||||||
|
|
||||||
begin
|
begin
|
||||||
downloader.fetch(timeout: timeout)
|
downloader.fetch(timeout:)
|
||||||
rescue ErrorDuringExecution, CurlDownloadStrategyError => e
|
rescue ErrorDuringExecution, CurlDownloadStrategyError => e
|
||||||
raise DownloadError.new(self, e)
|
raise DownloadError.new(self, e)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -44,10 +44,10 @@ module EnvActivation
|
|||||||
def with_build_environment(env: nil, cc: nil, build_bottle: false, bottle_arch: nil, debug_symbols: false, &_block)
|
def with_build_environment(env: nil, cc: nil, build_bottle: false, bottle_arch: nil, debug_symbols: false, &_block)
|
||||||
old_env = to_hash.dup
|
old_env = to_hash.dup
|
||||||
tmp_env = to_hash.dup.extend(EnvActivation)
|
tmp_env = to_hash.dup.extend(EnvActivation)
|
||||||
T.cast(tmp_env, EnvActivation).activate_extensions!(env: env)
|
T.cast(tmp_env, EnvActivation).activate_extensions!(env:)
|
||||||
T.cast(tmp_env, T.any(Superenv, Stdenv))
|
T.cast(tmp_env, T.any(Superenv, Stdenv))
|
||||||
.setup_build_environment(cc: cc, build_bottle: build_bottle, bottle_arch: bottle_arch,
|
.setup_build_environment(cc:, build_bottle:, bottle_arch:,
|
||||||
debug_symbols: debug_symbols)
|
debug_symbols:)
|
||||||
replace(tmp_env)
|
replace(tmp_env)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
|||||||
@ -55,7 +55,7 @@ module Kernel
|
|||||||
end
|
end
|
||||||
|
|
||||||
def oh1(title, truncate: :auto)
|
def oh1(title, truncate: :auto)
|
||||||
puts oh1_title(title, truncate: truncate)
|
puts oh1_title(title, truncate:)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Print a message prefixed with "Warning" (do this rarely).
|
# Print a message prefixed with "Warning" (do this rarely).
|
||||||
@ -156,7 +156,7 @@ module Kernel
|
|||||||
end
|
end
|
||||||
|
|
||||||
def odisabled(method, replacement = nil, **options)
|
def odisabled(method, replacement = nil, **options)
|
||||||
options = { disable: true, caller: caller }.merge(options)
|
options = { disable: true, caller: }.merge(options)
|
||||||
# This odeprecated should stick around indefinitely.
|
# This odeprecated should stick around indefinitely.
|
||||||
odeprecated(method, replacement, **options)
|
odeprecated(method, replacement, **options)
|
||||||
end
|
end
|
||||||
@ -364,8 +364,8 @@ module Kernel
|
|||||||
end
|
end
|
||||||
# Call this method itself with redirected stdout
|
# Call this method itself with redirected stdout
|
||||||
redirect_stdout(file) do
|
redirect_stdout(file) do
|
||||||
return ensure_formula_installed!(formula_or_name, latest: latest,
|
return ensure_formula_installed!(formula_or_name, latest:,
|
||||||
reason: reason, output_to_stderr: false)
|
reason:, output_to_stderr: false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -403,7 +403,7 @@ module Kernel
|
|||||||
].compact.first
|
].compact.first
|
||||||
return executable if executable.exist?
|
return executable if executable.exist?
|
||||||
|
|
||||||
ensure_formula_installed!(formula_name, reason: reason).opt_bin/name
|
ensure_formula_installed!(formula_name, reason:).opt_bin/name
|
||||||
end
|
end
|
||||||
|
|
||||||
def paths
|
def paths
|
||||||
@ -429,7 +429,7 @@ module Kernel
|
|||||||
if ((size * 10).to_i % 10).zero?
|
if ((size * 10).to_i % 10).zero?
|
||||||
"#{size.to_i}#{unit}"
|
"#{size.to_i}#{unit}"
|
||||||
else
|
else
|
||||||
"#{format("%<size>.1f", size: size)}#{unit}"
|
"#{format("%<size>.1f", size:)}#{unit}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,8 @@
|
|||||||
module Stdenv
|
module Stdenv
|
||||||
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false,
|
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false,
|
||||||
debug_symbols: false)
|
debug_symbols: false)
|
||||||
generic_setup_build_environment(formula: formula, cc: cc, build_bottle: build_bottle, bottle_arch: bottle_arch,
|
generic_setup_build_environment(formula:, cc:, build_bottle:, bottle_arch:,
|
||||||
testing_formula: testing_formula, debug_symbols: debug_symbols)
|
testing_formula:, debug_symbols:)
|
||||||
|
|
||||||
prepend_path "CPATH", HOMEBREW_PREFIX/"include"
|
prepend_path "CPATH", HOMEBREW_PREFIX/"include"
|
||||||
prepend_path "LIBRARY_PATH", HOMEBREW_PREFIX/"lib"
|
prepend_path "LIBRARY_PATH", HOMEBREW_PREFIX/"lib"
|
||||||
|
|||||||
@ -15,8 +15,8 @@ module Superenv
|
|||||||
# @private
|
# @private
|
||||||
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false,
|
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false,
|
||||||
debug_symbols: false)
|
debug_symbols: false)
|
||||||
generic_setup_build_environment(formula: formula, cc: cc, build_bottle: build_bottle, bottle_arch: bottle_arch,
|
generic_setup_build_environment(formula:, cc:, build_bottle:, bottle_arch:,
|
||||||
testing_formula: testing_formula, debug_symbols: debug_symbols)
|
testing_formula:, debug_symbols:)
|
||||||
self["HOMEBREW_OPTIMIZATION_LEVEL"] = "O2"
|
self["HOMEBREW_OPTIMIZATION_LEVEL"] = "O2"
|
||||||
self["HOMEBREW_DYNAMIC_LINKER"] = determine_dynamic_linker_path
|
self["HOMEBREW_DYNAMIC_LINKER"] = determine_dynamic_linker_path
|
||||||
self["HOMEBREW_RPATH_PATHS"] = determine_rpath_paths(@formula)
|
self["HOMEBREW_RPATH_PATHS"] = determine_rpath_paths(@formula)
|
||||||
|
|||||||
@ -31,7 +31,7 @@ module Homebrew
|
|||||||
private_constant :GCC_RUNTIME_LIBS
|
private_constant :GCC_RUNTIME_LIBS
|
||||||
|
|
||||||
def self.perform_preinstall_checks(all_fatal: false, cc: nil)
|
def self.perform_preinstall_checks(all_fatal: false, cc: nil)
|
||||||
generic_perform_preinstall_checks(all_fatal: all_fatal, cc: cc)
|
generic_perform_preinstall_checks(all_fatal:, cc:)
|
||||||
symlink_ld_so
|
symlink_ld_so
|
||||||
setup_preferred_gcc_libs
|
setup_preferred_gcc_libs
|
||||||
end
|
end
|
||||||
|
|||||||
@ -29,7 +29,7 @@ class LinkageChecker
|
|||||||
private
|
private
|
||||||
|
|
||||||
def check_dylibs(rebuild_cache:)
|
def check_dylibs(rebuild_cache:)
|
||||||
generic_check_dylibs(rebuild_cache: rebuild_cache)
|
generic_check_dylibs(rebuild_cache:)
|
||||||
|
|
||||||
# glibc and gcc are implicit dependencies.
|
# glibc and gcc are implicit dependencies.
|
||||||
# No other linkage to system libraries is expected or desired.
|
# No other linkage to system libraries is expected or desired.
|
||||||
|
|||||||
@ -14,9 +14,9 @@ module SharedEnvExtension
|
|||||||
}
|
}
|
||||||
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false,
|
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false,
|
||||||
debug_symbols: false)
|
debug_symbols: false)
|
||||||
generic_shared_setup_build_environment(formula: formula, cc: cc, build_bottle: build_bottle,
|
generic_shared_setup_build_environment(formula:, cc:, build_bottle:,
|
||||||
bottle_arch: bottle_arch, testing_formula: testing_formula,
|
bottle_arch:, testing_formula:,
|
||||||
debug_symbols: debug_symbols)
|
debug_symbols:)
|
||||||
|
|
||||||
# Normalise the system Perl version used, where multiple may be available
|
# Normalise the system Perl version used, where multiple may be available
|
||||||
self["VERSIONER_PERL_VERSION"] = MacOS.preferred_perl_version
|
self["VERSIONER_PERL_VERSION"] = MacOS.preferred_perl_version
|
||||||
|
|||||||
@ -12,8 +12,8 @@ module Stdenv
|
|||||||
|
|
||||||
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false,
|
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false,
|
||||||
debug_symbols: false)
|
debug_symbols: false)
|
||||||
generic_setup_build_environment(formula: formula, cc: cc, build_bottle: build_bottle, bottle_arch: bottle_arch,
|
generic_setup_build_environment(formula:, cc:, build_bottle:, bottle_arch:,
|
||||||
testing_formula: testing_formula, debug_symbols: debug_symbols)
|
testing_formula:, debug_symbols:)
|
||||||
|
|
||||||
append "LDFLAGS", "-Wl,-headerpad_max_install_names"
|
append "LDFLAGS", "-Wl,-headerpad_max_install_names"
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ module Stdenv
|
|||||||
self["LC_CTYPE"] = "C"
|
self["LC_CTYPE"] = "C"
|
||||||
|
|
||||||
# Add lib and include etc. from the current macosxsdk to compiler flags:
|
# Add lib and include etc. from the current macosxsdk to compiler flags:
|
||||||
macosxsdk(formula: @formula, testing_formula: testing_formula)
|
macosxsdk(formula: @formula, testing_formula:)
|
||||||
|
|
||||||
return unless MacOS::Xcode.without_clt?
|
return unless MacOS::Xcode.without_clt?
|
||||||
|
|
||||||
|
|||||||
@ -99,8 +99,8 @@ module Superenv
|
|||||||
MacOS::CLT::PKG_PATH
|
MacOS::CLT::PKG_PATH
|
||||||
end
|
end
|
||||||
|
|
||||||
generic_setup_build_environment(formula: formula, cc: cc, build_bottle: build_bottle, bottle_arch: bottle_arch,
|
generic_setup_build_environment(formula:, cc:, build_bottle:, bottle_arch:,
|
||||||
testing_formula: testing_formula, debug_symbols: debug_symbols)
|
testing_formula:, debug_symbols:)
|
||||||
|
|
||||||
# Filter out symbols known not to be defined since GNU Autotools can't
|
# Filter out symbols known not to be defined since GNU Autotools can't
|
||||||
# reliably figure this out with Xcode 8 and above.
|
# reliably figure this out with Xcode 8 and above.
|
||||||
|
|||||||
@ -18,8 +18,8 @@ class Formula
|
|||||||
).returns(T::Array[String])
|
).returns(T::Array[String])
|
||||||
}
|
}
|
||||||
def std_cmake_args(install_prefix: prefix, install_libdir: "lib", find_framework: "LAST")
|
def std_cmake_args(install_prefix: prefix, install_libdir: "lib", find_framework: "LAST")
|
||||||
args = generic_std_cmake_args(install_prefix: install_prefix, install_libdir: install_libdir,
|
args = generic_std_cmake_args(install_prefix:, install_libdir:,
|
||||||
find_framework: find_framework)
|
find_framework:)
|
||||||
|
|
||||||
# Avoid false positives for clock_gettime support on 10.11.
|
# Avoid false positives for clock_gettime support on 10.11.
|
||||||
# CMake cache entries for other weak symbols may be added here as needed.
|
# CMake cache entries for other weak symbols may be added here as needed.
|
||||||
|
|||||||
@ -133,7 +133,7 @@ class Keg
|
|||||||
VARIABLE_REFERENCE_RX = /^@(loader_|executable_|r)path/
|
VARIABLE_REFERENCE_RX = /^@(loader_|executable_|r)path/
|
||||||
|
|
||||||
def each_linkage_for(file, linkage_type, resolve_variable_references: false, &block)
|
def each_linkage_for(file, linkage_type, resolve_variable_references: false, &block)
|
||||||
file.public_send(linkage_type, resolve_variable_references: resolve_variable_references)
|
file.public_send(linkage_type, resolve_variable_references:)
|
||||||
.grep_v(VARIABLE_REFERENCE_RX)
|
.grep_v(VARIABLE_REFERENCE_RX)
|
||||||
.each(&block)
|
.each(&block)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -17,7 +17,7 @@ module UnpackStrategy
|
|||||||
# (Also, Homebrew's ZIP artifact automatically deletes this folder.)
|
# (Also, Homebrew's ZIP artifact automatically deletes this folder.)
|
||||||
return system_command! "ditto",
|
return system_command! "ditto",
|
||||||
args: ["-x", "-k", path, unpack_dir],
|
args: ["-x", "-k", path, unpack_dir],
|
||||||
verbose: verbose,
|
verbose:,
|
||||||
print_stderr: false
|
print_stderr: false
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -26,9 +26,9 @@ module UnpackStrategy
|
|||||||
rescue ErrorDuringExecution => e
|
rescue ErrorDuringExecution => e
|
||||||
raise unless e.stderr.include?("End-of-central-directory signature not found.")
|
raise unless e.stderr.include?("End-of-central-directory signature not found.")
|
||||||
|
|
||||||
system_command! "ditto",
|
system_command!("ditto",
|
||||||
args: ["-x", "-k", path, unpack_dir],
|
args: ["-x", "-k", path, unpack_dir],
|
||||||
verbose: verbose
|
verbose:)
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -45,12 +45,12 @@ module UnpackStrategy
|
|||||||
|
|
||||||
# `ditto` keeps Finder attributes intact and does not skip volume labels
|
# `ditto` keeps Finder attributes intact and does not skip volume labels
|
||||||
# like `unzip` does, which can prevent disk images from being unzipped.
|
# like `unzip` does, which can prevent disk images from being unzipped.
|
||||||
system_command! "ditto",
|
system_command!("ditto",
|
||||||
args: ["-x", "-k", path, tmp_unpack_dir],
|
args: ["-x", "-k", path, tmp_unpack_dir],
|
||||||
verbose: verbose
|
verbose:)
|
||||||
|
|
||||||
volumes.each do |volume|
|
volumes.each do |volume|
|
||||||
FileUtils.mv tmp_unpack_dir/volume, unpack_dir/volume, verbose: verbose
|
FileUtils.mv tmp_unpack_dir/volume, unpack_dir/volume, verbose:
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1408,7 +1408,7 @@ class Formula
|
|||||||
def brew(fetch: true, keep_tmp: false, debug_symbols: false, interactive: false)
|
def brew(fetch: true, keep_tmp: false, debug_symbols: false, interactive: false)
|
||||||
@prefix_returns_versioned_prefix = true
|
@prefix_returns_versioned_prefix = true
|
||||||
active_spec.fetch if fetch
|
active_spec.fetch if fetch
|
||||||
stage(interactive: interactive, debug_symbols: debug_symbols) do |staging|
|
stage(interactive:, debug_symbols:) do |staging|
|
||||||
staging.retain! if keep_tmp || debug_symbols
|
staging.retain! if keep_tmp || debug_symbols
|
||||||
|
|
||||||
prepare_patches
|
prepare_patches
|
||||||
@ -1505,7 +1505,7 @@ class Formula
|
|||||||
end
|
end
|
||||||
|
|
||||||
if current_version ||
|
if current_version ||
|
||||||
((head_version = latest_head_version) && !head_version_outdated?(head_version, fetch_head: fetch_head))
|
((head_version = latest_head_version) && !head_version_outdated?(head_version, fetch_head:))
|
||||||
[]
|
[]
|
||||||
else
|
else
|
||||||
all_kegs += old_installed_formulae.flat_map(&:installed_kegs)
|
all_kegs += old_installed_formulae.flat_map(&:installed_kegs)
|
||||||
@ -1564,7 +1564,7 @@ class Formula
|
|||||||
# @private
|
# @private
|
||||||
sig { params(fetch_head: T::Boolean).returns(T::Boolean) }
|
sig { params(fetch_head: T::Boolean).returns(T::Boolean) }
|
||||||
def outdated?(fetch_head: false)
|
def outdated?(fetch_head: false)
|
||||||
!outdated_kegs(fetch_head: fetch_head).empty?
|
!outdated_kegs(fetch_head:).empty?
|
||||||
rescue Migrator::MigrationNeededError
|
rescue Migrator::MigrationNeededError
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
@ -2077,14 +2077,14 @@ class Formula
|
|||||||
# @private
|
# @private
|
||||||
def recursive_dependencies(&block)
|
def recursive_dependencies(&block)
|
||||||
cache_key = "Formula#recursive_dependencies" unless block
|
cache_key = "Formula#recursive_dependencies" unless block
|
||||||
Dependency.expand(self, cache_key: cache_key, &block)
|
Dependency.expand(self, cache_key:, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
# The full set of Requirements for this formula's dependency tree.
|
# The full set of Requirements for this formula's dependency tree.
|
||||||
# @private
|
# @private
|
||||||
def recursive_requirements(&block)
|
def recursive_requirements(&block)
|
||||||
cache_key = "Formula#recursive_requirements" unless block
|
cache_key = "Formula#recursive_requirements" unless block
|
||||||
Requirement.expand(self, cache_key: cache_key, &block)
|
Requirement.expand(self, cache_key:, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns a Keg for the opt_prefix or installed_prefix if they exist.
|
# Returns a Keg for the opt_prefix or installed_prefix if they exist.
|
||||||
@ -2140,8 +2140,8 @@ class Formula
|
|||||||
|
|
||||||
Formula.cache[:runtime_formula_dependencies] ||= {}
|
Formula.cache[:runtime_formula_dependencies] ||= {}
|
||||||
Formula.cache[:runtime_formula_dependencies][cache_key] ||= runtime_dependencies(
|
Formula.cache[:runtime_formula_dependencies][cache_key] ||= runtime_dependencies(
|
||||||
read_from_tab: read_from_tab,
|
read_from_tab:,
|
||||||
undeclared: undeclared,
|
undeclared:,
|
||||||
).filter_map do |d|
|
).filter_map do |d|
|
||||||
d.to_formula
|
d.to_formula
|
||||||
rescue FormulaUnavailableError
|
rescue FormulaUnavailableError
|
||||||
@ -2198,7 +2198,7 @@ class Formula
|
|||||||
|
|
||||||
all_dependables.map do |dependable|
|
all_dependables.map do |dependable|
|
||||||
{
|
{
|
||||||
dependable: dependable,
|
dependable:,
|
||||||
# Now find the list of specs each dependency was a part of.
|
# Now find the list of specs each dependency was a part of.
|
||||||
specs: dependables.filter_map { |spec, spec_deps| spec if spec_deps&.include?(dependable) },
|
specs: dependables.filter_map { |spec, spec_deps| spec if spec_deps&.include?(dependable) },
|
||||||
}
|
}
|
||||||
@ -2384,15 +2384,15 @@ class Formula
|
|||||||
if path.exist? && on_system_blocks_exist?
|
if path.exist? && on_system_blocks_exist?
|
||||||
formula_contents = path.read
|
formula_contents = path.read
|
||||||
OnSystem::ALL_OS_ARCH_COMBINATIONS.each do |os, arch|
|
OnSystem::ALL_OS_ARCH_COMBINATIONS.each do |os, arch|
|
||||||
bottle_tag = Utils::Bottles::Tag.new(system: os, arch: arch)
|
bottle_tag = Utils::Bottles::Tag.new(system: os, arch:)
|
||||||
next unless bottle_tag.valid_combination?
|
next unless bottle_tag.valid_combination?
|
||||||
|
|
||||||
Homebrew::SimulateSystem.with os: os, arch: arch do
|
Homebrew::SimulateSystem.with(os:, arch:) do
|
||||||
variations_namespace = Formulary.class_s("#{namespace_prefix}#{bottle_tag.to_sym.capitalize}")
|
variations_namespace = Formulary.class_s("#{namespace_prefix}#{bottle_tag.to_sym.capitalize}")
|
||||||
variations_formula_class = Formulary.load_formula(name, path, formula_contents, variations_namespace,
|
variations_formula_class = Formulary.load_formula(name, path, formula_contents, variations_namespace,
|
||||||
flags: self.class.build_flags, ignore_errors: true)
|
flags: self.class.build_flags, ignore_errors: true)
|
||||||
variations_formula = variations_formula_class.new(name, path, :stable,
|
variations_formula = variations_formula_class.new(name, path, :stable,
|
||||||
alias_path: alias_path, force_bottle: force_bottle)
|
alias_path:, force_bottle:)
|
||||||
|
|
||||||
variations_formula.public_send(hash_method).each do |key, value|
|
variations_formula.public_send(hash_method).each do |key, value|
|
||||||
next if value.to_s == hash[key].to_s
|
next if value.to_s == hash[key].to_s
|
||||||
@ -2563,7 +2563,7 @@ class Formula
|
|||||||
|
|
||||||
# @private
|
# @private
|
||||||
def fetch(verify_download_integrity: true)
|
def fetch(verify_download_integrity: true)
|
||||||
active_spec.fetch(verify_download_integrity: verify_download_integrity)
|
active_spec.fetch(verify_download_integrity:)
|
||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
@ -2661,7 +2661,7 @@ class Formula
|
|||||||
).void
|
).void
|
||||||
}
|
}
|
||||||
def inreplace(paths, before = nil, after = nil, audit_result = true, &block) # rubocop:disable Style/OptionalBooleanParameter
|
def inreplace(paths, before = nil, after = nil, audit_result = true, &block) # rubocop:disable Style/OptionalBooleanParameter
|
||||||
Utils::Inreplace.inreplace(paths, before, after, audit_result: audit_result, &block)
|
Utils::Inreplace.inreplace(paths, before, after, audit_result:, &block)
|
||||||
rescue Utils::Inreplace::Error => e
|
rescue Utils::Inreplace::Error => e
|
||||||
onoe e.to_s
|
onoe e.to_s
|
||||||
raise BuildError.new(self, "inreplace", Array(paths), {})
|
raise BuildError.new(self, "inreplace", Array(paths), {})
|
||||||
@ -2686,7 +2686,7 @@ class Formula
|
|||||||
# @private
|
# @private
|
||||||
def declared_runtime_dependencies
|
def declared_runtime_dependencies
|
||||||
cache_key = "Formula#declared_runtime_dependencies" unless build.any_args_or_options?
|
cache_key = "Formula#declared_runtime_dependencies" unless build.any_args_or_options?
|
||||||
Dependency.expand(self, cache_key: cache_key) do |_, dependency|
|
Dependency.expand(self, cache_key:) do |_, dependency|
|
||||||
Dependency.prune if dependency.build?
|
Dependency.prune if dependency.build?
|
||||||
next if dependency.required?
|
next if dependency.required?
|
||||||
|
|
||||||
@ -2984,7 +2984,7 @@ class Formula
|
|||||||
end
|
end
|
||||||
|
|
||||||
def stage(interactive: false, debug_symbols: false)
|
def stage(interactive: false, debug_symbols: false)
|
||||||
active_spec.stage(debug_symbols: debug_symbols) do |staging|
|
active_spec.stage(debug_symbols:) do |staging|
|
||||||
@source_modified_time = active_spec.source_modified_time
|
@source_modified_time = active_spec.source_modified_time
|
||||||
@buildpath = Pathname.pwd
|
@buildpath = Pathname.pwd
|
||||||
env_home = T.must(buildpath)/".brew_home"
|
env_home = T.must(buildpath)/".brew_home"
|
||||||
|
|||||||
@ -566,7 +566,7 @@ module Homebrew
|
|||||||
user_agents: [:browser, :default],
|
user_agents: [:browser, :default],
|
||||||
check_content: true,
|
check_content: true,
|
||||||
strict: @strict,
|
strict: @strict,
|
||||||
use_homebrew_curl: use_homebrew_curl,
|
use_homebrew_curl:,
|
||||||
))
|
))
|
||||||
problem http_content_problem
|
problem http_content_problem
|
||||||
end
|
end
|
||||||
@ -693,7 +693,7 @@ module Homebrew
|
|||||||
|
|
||||||
ra = ResourceAuditor.new(
|
ra = ResourceAuditor.new(
|
||||||
spec, spec_name,
|
spec, spec_name,
|
||||||
online: @online, strict: @strict, only: @only, except: except,
|
online: @online, strict: @strict, only: @only, except:,
|
||||||
use_homebrew_curl: spec.using == :homebrew_curl
|
use_homebrew_curl: spec.using == :homebrew_curl
|
||||||
).audit
|
).audit
|
||||||
ra.problems.each do |message|
|
ra.problems.each do |message|
|
||||||
@ -782,7 +782,7 @@ module Homebrew
|
|||||||
tag ||= stable.version
|
tag ||= stable.version
|
||||||
|
|
||||||
if @online
|
if @online
|
||||||
error = SharedAudits.gitlab_release(owner, repo, tag, formula: formula)
|
error = SharedAudits.gitlab_release(owner, repo, tag, formula:)
|
||||||
problem error if error
|
problem error if error
|
||||||
end
|
end
|
||||||
when %r{^https://github.com/([\w-]+)/([\w-]+)}
|
when %r{^https://github.com/([\w-]+)/([\w-]+)}
|
||||||
@ -792,7 +792,7 @@ module Homebrew
|
|||||||
tag ||= formula.stable.specs[:tag]
|
tag ||= formula.stable.specs[:tag]
|
||||||
|
|
||||||
if @online
|
if @online
|
||||||
error = SharedAudits.github_release(owner, repo, tag, formula: formula)
|
error = SharedAudits.github_release(owner, repo, tag, formula:)
|
||||||
problem error if error
|
problem error if error
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -956,11 +956,11 @@ module Homebrew
|
|||||||
private
|
private
|
||||||
|
|
||||||
def problem(message, location: nil, corrected: false)
|
def problem(message, location: nil, corrected: false)
|
||||||
@problems << ({ message: message, location: location, corrected: corrected })
|
@problems << ({ message:, location:, corrected: })
|
||||||
end
|
end
|
||||||
|
|
||||||
def new_formula_problem(message, location: nil, corrected: false)
|
def new_formula_problem(message, location: nil, corrected: false)
|
||||||
@new_formula_problems << ({ message: message, location: location, corrected: corrected })
|
@new_formula_problems << ({ message:, location:, corrected: })
|
||||||
end
|
end
|
||||||
|
|
||||||
def head_only?(formula)
|
def head_only?(formula)
|
||||||
@ -976,7 +976,7 @@ module Homebrew
|
|||||||
return false if variations.blank?
|
return false if variations.blank?
|
||||||
|
|
||||||
MacOSVersion::SYMBOLS.keys.product(OnSystem::ARCH_OPTIONS).each do |os, arch|
|
MacOSVersion::SYMBOLS.keys.product(OnSystem::ARCH_OPTIONS).each do |os, arch|
|
||||||
bottle_tag = Utils::Bottles::Tag.new(system: os, arch: arch)
|
bottle_tag = Utils::Bottles::Tag.new(system: os, arch:)
|
||||||
next unless bottle_tag.valid_combination?
|
next unless bottle_tag.valid_combination?
|
||||||
|
|
||||||
variation_dependencies = variations.dig(bottle_tag.to_sym, "dependencies")
|
variation_dependencies = variations.dig(bottle_tag.to_sym, "dependencies")
|
||||||
|
|||||||
@ -420,7 +420,7 @@ class FormulaInstaller
|
|||||||
|
|
||||||
if (tap = formula.tap) && tap.should_report_analytics?
|
if (tap = formula.tap) && tap.should_report_analytics?
|
||||||
Utils::Analytics.report_package_event(:formula_install, package_name: formula.name, tap_name: tap.name,
|
Utils::Analytics.report_package_event(:formula_install, package_name: formula.name, tap_name: tap.name,
|
||||||
on_request: installed_on_request?, options: options)
|
on_request: installed_on_request?, options:)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.class.attempted << formula
|
self.class.attempted << formula
|
||||||
@ -597,7 +597,7 @@ on_request: installed_on_request?, options: options)
|
|||||||
def expand_dependencies_for_formula(formula, inherited_options)
|
def expand_dependencies_for_formula(formula, inherited_options)
|
||||||
# Cache for this expansion only. FormulaInstaller has a lot of inputs which can alter expansion.
|
# Cache for this expansion only. FormulaInstaller has a lot of inputs which can alter expansion.
|
||||||
cache_key = "FormulaInstaller-#{formula.full_name}-#{Time.now.to_f}"
|
cache_key = "FormulaInstaller-#{formula.full_name}-#{Time.now.to_f}"
|
||||||
Dependency.expand(formula, cache_key: cache_key) do |dependent, dep|
|
Dependency.expand(formula, cache_key:) do |dependent, dep|
|
||||||
inherited_options[dep.name] |= inherited_options_for(dep)
|
inherited_options[dep.name] |= inherited_options_for(dep)
|
||||||
build = effective_build_options_for(
|
build = effective_build_options_for(
|
||||||
dependent,
|
dependent,
|
||||||
@ -732,7 +732,7 @@ on_request: installed_on_request?, options: options)
|
|||||||
|
|
||||||
fi = FormulaInstaller.new(
|
fi = FormulaInstaller.new(
|
||||||
df,
|
df,
|
||||||
options: options,
|
options:,
|
||||||
link_keg: keg_had_linked_keg ? keg_was_linked : nil,
|
link_keg: keg_had_linked_keg ? keg_was_linked : nil,
|
||||||
installed_as_dependency: true,
|
installed_as_dependency: true,
|
||||||
installed_on_request: df.any_version_installed? && tab.present? && tab.installed_on_request,
|
installed_on_request: df.any_version_installed? && tab.present? && tab.installed_on_request,
|
||||||
@ -1280,7 +1280,7 @@ on_request: installed_on_request?, options: options)
|
|||||||
|
|
||||||
keg = Keg.new(formula.prefix)
|
keg = Keg.new(formula.prefix)
|
||||||
skip_linkage = formula.bottle_specification.skip_relocation?
|
skip_linkage = formula.bottle_specification.skip_relocation?
|
||||||
keg.replace_placeholders_with_locations tab.changed_files, skip_linkage: skip_linkage
|
keg.replace_placeholders_with_locations(tab.changed_files, skip_linkage:)
|
||||||
|
|
||||||
cellar = formula.bottle_specification.tag_to_cellar(Utils::Bottles.tag)
|
cellar = formula.bottle_specification.tag_to_cellar(Utils::Bottles.tag)
|
||||||
return if [:any, :any_skip_relocation].include?(cellar)
|
return if [:any, :any_skip_relocation].include?(cellar)
|
||||||
|
|||||||
@ -145,7 +145,7 @@ module Formulary
|
|||||||
def self.load_formula_from_path(name, path, flags:, ignore_errors:)
|
def self.load_formula_from_path(name, path, flags:, ignore_errors:)
|
||||||
contents = path.open("r") { |f| ensure_utf8_encoding(f).read }
|
contents = path.open("r") { |f| ensure_utf8_encoding(f).read }
|
||||||
namespace = "FormulaNamespace#{namespace_key(path.to_s)}"
|
namespace = "FormulaNamespace#{namespace_key(path.to_s)}"
|
||||||
klass = load_formula(name, path, contents, namespace, flags: flags, ignore_errors: ignore_errors)
|
klass = load_formula(name, path, contents, namespace, flags:, ignore_errors:)
|
||||||
platform_cache[:path] ||= {}
|
platform_cache[:path] ||= {}
|
||||||
platform_cache[:path][path] = klass
|
platform_cache[:path][path] = klass
|
||||||
end
|
end
|
||||||
@ -305,7 +305,7 @@ module Formulary
|
|||||||
rebuild bottles_stable["rebuild"]
|
rebuild bottles_stable["rebuild"]
|
||||||
bottles_stable["files"].each do |tag, bottle_spec|
|
bottles_stable["files"].each do |tag, bottle_spec|
|
||||||
cellar = Formulary.convert_to_string_or_symbol bottle_spec["cellar"]
|
cellar = Formulary.convert_to_string_or_symbol bottle_spec["cellar"]
|
||||||
sha256 cellar: cellar, tag.to_sym => bottle_spec["sha256"]
|
sha256 cellar:, tag.to_sym => bottle_spec["sha256"]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -434,8 +434,8 @@ module Formulary
|
|||||||
flags: T.unsafe(nil)
|
flags: T.unsafe(nil)
|
||||||
)
|
)
|
||||||
options = {
|
options = {
|
||||||
force_bottle: force_bottle,
|
force_bottle:,
|
||||||
flags: flags,
|
flags:,
|
||||||
}.compact
|
}.compact
|
||||||
|
|
||||||
if name.include?("/") || File.exist?(name)
|
if name.include?("/") || File.exist?(name)
|
||||||
@ -523,12 +523,12 @@ module Formulary
|
|||||||
# a formula that was loaded in another way.
|
# a formula that was loaded in another way.
|
||||||
def get_formula(spec, alias_path: nil, force_bottle: false, flags: [], ignore_errors: false)
|
def get_formula(spec, alias_path: nil, force_bottle: false, flags: [], ignore_errors: false)
|
||||||
alias_path ||= self.alias_path
|
alias_path ||= self.alias_path
|
||||||
klass(flags: flags, ignore_errors: ignore_errors)
|
klass(flags:, ignore_errors:)
|
||||||
.new(name, path, spec, alias_path: alias_path, tap: tap, force_bottle: force_bottle)
|
.new(name, path, spec, alias_path:, tap:, force_bottle:)
|
||||||
end
|
end
|
||||||
|
|
||||||
def klass(flags:, ignore_errors:)
|
def klass(flags:, ignore_errors:)
|
||||||
load_file(flags: flags, ignore_errors: ignore_errors) unless Formulary.formula_class_defined_from_path?(path)
|
load_file(flags:, ignore_errors:) unless Formulary.formula_class_defined_from_path?(path)
|
||||||
Formulary.formula_class_get_from_path(path)
|
Formulary.formula_class_get_from_path(path)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -537,7 +537,7 @@ module Formulary
|
|||||||
def load_file(flags:, ignore_errors:)
|
def load_file(flags:, ignore_errors:)
|
||||||
raise FormulaUnavailableError, name unless path.file?
|
raise FormulaUnavailableError, name unless path.file?
|
||||||
|
|
||||||
Formulary.load_formula_from_path(name, path, flags: flags, ignore_errors: ignore_errors)
|
Formulary.load_formula_from_path(name, path, flags:, ignore_errors:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -574,9 +574,9 @@ module Formulary
|
|||||||
|
|
||||||
def get_formula(spec, force_bottle: false, flags: [], ignore_errors: false, **)
|
def get_formula(spec, force_bottle: false, flags: [], ignore_errors: false, **)
|
||||||
formula = begin
|
formula = begin
|
||||||
contents = Utils::Bottles.formula_contents @bottle_filename, name: name
|
contents = Utils::Bottles.formula_contents(@bottle_filename, name:)
|
||||||
Formulary.from_contents(name, path, contents, spec, force_bottle: force_bottle,
|
Formulary.from_contents(name, path, contents, spec, force_bottle:,
|
||||||
flags: flags, ignore_errors: ignore_errors)
|
flags:, ignore_errors:)
|
||||||
rescue FormulaUnreadableError => e
|
rescue FormulaUnreadableError => e
|
||||||
opoo <<~EOS
|
opoo <<~EOS
|
||||||
Unreadable formula in #{@bottle_filename}:
|
Unreadable formula in #{@bottle_filename}:
|
||||||
@ -620,18 +620,18 @@ module Formulary
|
|||||||
path = alias_path.resolved_path
|
path = alias_path.resolved_path
|
||||||
|
|
||||||
{
|
{
|
||||||
alias_path: alias_path,
|
alias_path:,
|
||||||
tap: tap,
|
tap:,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tap: tap,
|
tap:,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
elsif (tap = Homebrew::API.tap_from_source_download(path))
|
elsif (tap = Homebrew::API.tap_from_source_download(path))
|
||||||
# Don't treat cache symlinks as aliases.
|
# Don't treat cache symlinks as aliases.
|
||||||
{
|
{
|
||||||
tap: tap,
|
tap:,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{}
|
{}
|
||||||
@ -651,7 +651,7 @@ module Formulary
|
|||||||
|
|
||||||
options = {
|
options = {
|
||||||
alias_path: (alias_path if alias_dir == tap&.alias_dir),
|
alias_path: (alias_path if alias_dir == tap&.alias_dir),
|
||||||
tap: tap,
|
tap:,
|
||||||
}.compact
|
}.compact
|
||||||
|
|
||||||
super(name, path, **options)
|
super(name, path, **options)
|
||||||
@ -667,7 +667,7 @@ module Formulary
|
|||||||
def self.try_new(ref, from: T.unsafe(nil), warn: false)
|
def self.try_new(ref, from: T.unsafe(nil), warn: false)
|
||||||
ref = ref.to_s
|
ref = ref.to_s
|
||||||
|
|
||||||
new(ref, from: from) if URL_START_REGEX.match?(ref)
|
new(ref, from:) if URL_START_REGEX.match?(ref)
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_reader :url
|
attr_reader :url
|
||||||
@ -722,7 +722,7 @@ module Formulary
|
|||||||
def self.try_new(ref, from: T.unsafe(nil), warn: false)
|
def self.try_new(ref, from: T.unsafe(nil), warn: false)
|
||||||
ref = ref.to_s
|
ref = ref.to_s
|
||||||
|
|
||||||
return unless (name_tap_type = Formulary.tap_formula_name_type(ref, warn: warn))
|
return unless (name_tap_type = Formulary.tap_formula_name_type(ref, warn:))
|
||||||
|
|
||||||
name, tap, type = name_tap_type
|
name, tap, type = name_tap_type
|
||||||
path = Formulary.find_formula_in_tap(name, tap)
|
path = Formulary.find_formula_in_tap(name, tap)
|
||||||
@ -734,14 +734,14 @@ module Formulary
|
|||||||
{}
|
{}
|
||||||
end
|
end
|
||||||
|
|
||||||
new(name, path, tap: tap, **options)
|
new(name, path, tap:, **options)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(name: String, path: Pathname, tap: Tap, alias_name: String).void }
|
sig { params(name: String, path: Pathname, tap: Tap, alias_name: String).void }
|
||||||
def initialize(name, path, tap:, alias_name: T.unsafe(nil))
|
def initialize(name, path, tap:, alias_name: T.unsafe(nil))
|
||||||
options = {
|
options = {
|
||||||
alias_path: (tap.alias_dir/alias_name if alias_name),
|
alias_path: (tap.alias_dir/alias_name if alias_name),
|
||||||
tap: tap,
|
tap:,
|
||||||
}.compact
|
}.compact
|
||||||
|
|
||||||
super(name, path, **options)
|
super(name, path, **options)
|
||||||
@ -779,12 +779,12 @@ module Formulary
|
|||||||
|
|
||||||
# If it exists in the default tap, never treat it as ambiguous with another tap.
|
# If it exists in the default tap, never treat it as ambiguous with another tap.
|
||||||
if (core_tap = CoreTap.instance).installed? &&
|
if (core_tap = CoreTap.instance).installed? &&
|
||||||
(loader = super("#{core_tap}/#{name}", warn: warn))&.path&.exist?
|
(loader = super("#{core_tap}/#{name}", warn:))&.path&.exist?
|
||||||
return loader
|
return loader
|
||||||
end
|
end
|
||||||
|
|
||||||
loaders = Tap.select { |tap| tap.installed? && !tap.core_tap? }
|
loaders = Tap.select { |tap| tap.installed? && !tap.core_tap? }
|
||||||
.filter_map { |tap| super("#{tap}/#{name}", warn: warn) }
|
.filter_map { |tap| super("#{tap}/#{name}", warn:) }
|
||||||
.select { |tap| tap.path.exist? }
|
.select { |tap| tap.path.exist? }
|
||||||
|
|
||||||
case loaders.count
|
case loaders.count
|
||||||
@ -861,7 +861,7 @@ module Formulary
|
|||||||
|
|
||||||
def klass(flags:, ignore_errors:)
|
def klass(flags:, ignore_errors:)
|
||||||
namespace = "FormulaNamespace#{Digest::MD5.hexdigest(contents.to_s)}"
|
namespace = "FormulaNamespace#{Digest::MD5.hexdigest(contents.to_s)}"
|
||||||
Formulary.load_formula(name, path, contents, namespace, flags: flags, ignore_errors: ignore_errors)
|
Formulary.load_formula(name, path, contents, namespace, flags:, ignore_errors:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -885,7 +885,7 @@ module Formulary
|
|||||||
|
|
||||||
ref = "#{CoreTap.instance}/#{name}"
|
ref = "#{CoreTap.instance}/#{name}"
|
||||||
|
|
||||||
return unless (name_tap_type = Formulary.tap_formula_name_type(ref, warn: warn))
|
return unless (name_tap_type = Formulary.tap_formula_name_type(ref, warn:))
|
||||||
|
|
||||||
name, tap, type = name_tap_type
|
name, tap, type = name_tap_type
|
||||||
|
|
||||||
@ -895,28 +895,28 @@ module Formulary
|
|||||||
{}
|
{}
|
||||||
end
|
end
|
||||||
|
|
||||||
new(name, tap: tap, **options)
|
new(name, tap:, **options)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(name: String, tap: Tap, alias_name: String).void }
|
sig { params(name: String, tap: Tap, alias_name: String).void }
|
||||||
def initialize(name, tap: T.unsafe(nil), alias_name: T.unsafe(nil))
|
def initialize(name, tap: T.unsafe(nil), alias_name: T.unsafe(nil))
|
||||||
options = {
|
options = {
|
||||||
alias_path: (CoreTap.instance.alias_dir/alias_name if alias_name),
|
alias_path: (CoreTap.instance.alias_dir/alias_name if alias_name),
|
||||||
tap: tap,
|
tap:,
|
||||||
}.compact
|
}.compact
|
||||||
|
|
||||||
super(name, Formulary.core_path(name), **options)
|
super(name, Formulary.core_path(name), **options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def klass(flags:, ignore_errors:)
|
def klass(flags:, ignore_errors:)
|
||||||
load_from_api(flags: flags) unless Formulary.formula_class_defined_from_api?(name)
|
load_from_api(flags:) unless Formulary.formula_class_defined_from_api?(name)
|
||||||
Formulary.formula_class_get_from_api(name)
|
Formulary.formula_class_get_from_api(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def load_from_api(flags:)
|
def load_from_api(flags:)
|
||||||
Formulary.load_formula_from_api(name, flags: flags)
|
Formulary.load_formula_from_api(name, flags:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -954,11 +954,11 @@ module Formulary
|
|||||||
return platform_cache[:formulary_factory][cache_key]
|
return platform_cache[:formulary_factory][cache_key]
|
||||||
end
|
end
|
||||||
|
|
||||||
loader_options = { from: from, warn: warn }.compact
|
loader_options = { from:, warn: }.compact
|
||||||
formula_options = { alias_path: alias_path,
|
formula_options = { alias_path:,
|
||||||
force_bottle: force_bottle,
|
force_bottle:,
|
||||||
flags: flags,
|
flags:,
|
||||||
ignore_errors: ignore_errors }.compact
|
ignore_errors: }.compact
|
||||||
|
|
||||||
formula = loader_for(ref, **loader_options)
|
formula = loader_for(ref, **loader_options)
|
||||||
.get_formula(spec, **formula_options)
|
.get_formula(spec, **formula_options)
|
||||||
@ -997,9 +997,9 @@ module Formulary
|
|||||||
keg = kegs.find(&:linked?) || kegs.find(&:optlinked?) || kegs.max_by(&:version)
|
keg = kegs.find(&:linked?) || kegs.find(&:optlinked?) || kegs.max_by(&:version)
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
alias_path: alias_path,
|
alias_path:,
|
||||||
force_bottle: force_bottle,
|
force_bottle:,
|
||||||
flags: flags,
|
flags:,
|
||||||
}.compact
|
}.compact
|
||||||
|
|
||||||
if keg
|
if keg
|
||||||
@ -1041,11 +1041,11 @@ module Formulary
|
|||||||
formula_name = keg.rack.basename.to_s
|
formula_name = keg.rack.basename.to_s
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
alias_path: alias_path,
|
alias_path:,
|
||||||
from: :keg,
|
from: :keg,
|
||||||
warn: false,
|
warn: false,
|
||||||
force_bottle: force_bottle,
|
force_bottle:,
|
||||||
flags: flags,
|
flags:,
|
||||||
}.compact
|
}.compact
|
||||||
|
|
||||||
f = if tap.nil?
|
f = if tap.nil?
|
||||||
@ -1088,10 +1088,10 @@ module Formulary
|
|||||||
ignore_errors: T.unsafe(nil)
|
ignore_errors: T.unsafe(nil)
|
||||||
)
|
)
|
||||||
options = {
|
options = {
|
||||||
alias_path: alias_path,
|
alias_path:,
|
||||||
force_bottle: force_bottle,
|
force_bottle:,
|
||||||
flags: flags,
|
flags:,
|
||||||
ignore_errors: ignore_errors,
|
ignore_errors:,
|
||||||
}.compact
|
}.compact
|
||||||
FormulaContentsLoader.new(name, path, contents).get_formula(spec, **options)
|
FormulaContentsLoader.new(name, path, contents).get_formula(spec, **options)
|
||||||
end
|
end
|
||||||
@ -1166,7 +1166,7 @@ module Formulary
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.loader_for(ref, from: T.unsafe(nil), warn: true)
|
def self.loader_for(ref, from: T.unsafe(nil), warn: true)
|
||||||
options = { from: from, warn: warn }.compact
|
options = { from:, warn: }.compact
|
||||||
|
|
||||||
[
|
[
|
||||||
FromBottleLoader,
|
FromBottleLoader,
|
||||||
|
|||||||
@ -38,14 +38,14 @@ class GitRepository
|
|||||||
# Gets the full commit hash of the HEAD commit.
|
# Gets the full commit hash of the HEAD commit.
|
||||||
sig { params(safe: T::Boolean).returns(T.nilable(String)) }
|
sig { params(safe: T::Boolean).returns(T.nilable(String)) }
|
||||||
def head_ref(safe: false)
|
def head_ref(safe: false)
|
||||||
popen_git("rev-parse", "--verify", "--quiet", "HEAD", safe: safe)
|
popen_git("rev-parse", "--verify", "--quiet", "HEAD", safe:)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Gets a short commit hash of the HEAD commit.
|
# Gets a short commit hash of the HEAD commit.
|
||||||
sig { params(length: T.nilable(Integer), safe: T::Boolean).returns(T.nilable(String)) }
|
sig { params(length: T.nilable(Integer), safe: T::Boolean).returns(T.nilable(String)) }
|
||||||
def short_head_ref(length: nil, safe: false)
|
def short_head_ref(length: nil, safe: false)
|
||||||
short_arg = length.present? ? "--short=#{length}" : "--short"
|
short_arg = length.present? ? "--short=#{length}" : "--short"
|
||||||
popen_git("rev-parse", short_arg, "--verify", "--quiet", "HEAD", safe: safe)
|
popen_git("rev-parse", short_arg, "--verify", "--quiet", "HEAD", safe:)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Gets the relative date of the last commit, e.g. "1 hour ago"
|
# Gets the relative date of the last commit, e.g. "1 hour ago"
|
||||||
@ -57,7 +57,7 @@ class GitRepository
|
|||||||
# Gets the name of the currently checked-out branch, or HEAD if the repository is in a detached HEAD state.
|
# Gets the name of the currently checked-out branch, or HEAD if the repository is in a detached HEAD state.
|
||||||
sig { params(safe: T::Boolean).returns(T.nilable(String)) }
|
sig { params(safe: T::Boolean).returns(T.nilable(String)) }
|
||||||
def branch_name(safe: false)
|
def branch_name(safe: false)
|
||||||
popen_git("rev-parse", "--abbrev-ref", "HEAD", safe: safe)
|
popen_git("rev-parse", "--abbrev-ref", "HEAD", safe:)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Change the name of a local branch
|
# Change the name of a local branch
|
||||||
@ -104,7 +104,7 @@ class GitRepository
|
|||||||
# Gets the full commit message of the specified commit, or of the HEAD commit if unspecified.
|
# Gets the full commit message of the specified commit, or of the HEAD commit if unspecified.
|
||||||
sig { params(commit: String, safe: T::Boolean).returns(T.nilable(String)) }
|
sig { params(commit: String, safe: T::Boolean).returns(T.nilable(String)) }
|
||||||
def commit_message(commit = "HEAD", safe: false)
|
def commit_message(commit = "HEAD", safe: false)
|
||||||
popen_git("log", "-1", "--pretty=%B", commit, "--", safe: safe, err: :out)&.strip
|
popen_git("log", "-1", "--pretty=%B", commit, "--", safe:, err: :out)&.strip
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { returns(String) }
|
sig { returns(String) }
|
||||||
@ -128,6 +128,6 @@ class GitRepository
|
|||||||
raise "Git is unavailable"
|
raise "Git is unavailable"
|
||||||
end
|
end
|
||||||
|
|
||||||
Utils.popen_read(Utils::Git.git, *args, safe: safe, chdir: pathname, err: err).chomp.presence
|
Utils.popen_read(Utils::Git.git, *args, safe:, chdir: pathname, err:).chomp.presence
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -67,7 +67,7 @@ class GitHubPackages
|
|||||||
bottles_hash.each do |formula_full_name, bottle_hash|
|
bottles_hash.each do |formula_full_name, bottle_hash|
|
||||||
# First, check that we won't encounter an error in the middle of uploading bottles.
|
# First, check that we won't encounter an error in the middle of uploading bottles.
|
||||||
preupload_check(user, token, skopeo, formula_full_name, bottle_hash,
|
preupload_check(user, token, skopeo, formula_full_name, bottle_hash,
|
||||||
keep_old: keep_old, dry_run: dry_run, warn_on_error: warn_on_error)
|
keep_old:, dry_run:, warn_on_error:)
|
||||||
end
|
end
|
||||||
|
|
||||||
# We intentionally iterate over `bottles_hash` twice to
|
# We intentionally iterate over `bottles_hash` twice to
|
||||||
@ -76,7 +76,7 @@ class GitHubPackages
|
|||||||
bottles_hash.each do |formula_full_name, bottle_hash|
|
bottles_hash.each do |formula_full_name, bottle_hash|
|
||||||
# Next, upload the bottles after checking them all.
|
# Next, upload the bottles after checking them all.
|
||||||
upload_bottle(user, token, skopeo, formula_full_name, bottle_hash,
|
upload_bottle(user, token, skopeo, formula_full_name, bottle_hash,
|
||||||
keep_old: keep_old, dry_run: dry_run, warn_on_error: warn_on_error)
|
keep_old:, dry_run:, warn_on_error:)
|
||||||
end
|
end
|
||||||
# rubocop:enable Style/CombinableLoops
|
# rubocop:enable Style/CombinableLoops
|
||||||
end
|
end
|
||||||
@ -207,7 +207,7 @@ class GitHubPackages
|
|||||||
puts "#{skopeo} #{args.join(" ")} --src-creds=#{user}:$HOMEBREW_GITHUB_PACKAGES_TOKEN"
|
puts "#{skopeo} #{args.join(" ")} --src-creds=#{user}:$HOMEBREW_GITHUB_PACKAGES_TOKEN"
|
||||||
else
|
else
|
||||||
args << "--src-creds=#{user}:#{token}"
|
args << "--src-creds=#{user}:#{token}"
|
||||||
system_command!(skopeo, verbose: true, print_stdout: true, args: args)
|
system_command!(skopeo, verbose: true, print_stdout: true, args:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ class GitHubPackages
|
|||||||
def upload_bottle(user, token, skopeo, formula_full_name, bottle_hash, keep_old:, dry_run:, warn_on_error:)
|
def upload_bottle(user, token, skopeo, formula_full_name, bottle_hash, keep_old:, dry_run:, warn_on_error:)
|
||||||
# We run the preupload check twice to prevent TOCTOU bugs.
|
# We run the preupload check twice to prevent TOCTOU bugs.
|
||||||
result = preupload_check(user, token, skopeo, formula_full_name, bottle_hash,
|
result = preupload_check(user, token, skopeo, formula_full_name, bottle_hash,
|
||||||
keep_old: keep_old, dry_run: dry_run, warn_on_error: warn_on_error)
|
keep_old:, dry_run:, warn_on_error:)
|
||||||
|
|
||||||
formula_name, org, repo, version, rebuild, version_rebuild, image_name, image_uri, keep_old = *result
|
formula_name, org, repo, version, rebuild, version_rebuild, image_name, image_uri, keep_old = *result
|
||||||
|
|
||||||
@ -272,7 +272,7 @@ class GitHubPackages
|
|||||||
root.mkpath
|
root.mkpath
|
||||||
|
|
||||||
if keep_old
|
if keep_old
|
||||||
download(user, token, skopeo, image_uri, root, dry_run: dry_run)
|
download(user, token, skopeo, image_uri, root, dry_run:)
|
||||||
else
|
else
|
||||||
write_image_layout(root)
|
write_image_layout(root)
|
||||||
end
|
end
|
||||||
@ -368,8 +368,8 @@ class GitHubPackages
|
|||||||
end
|
end
|
||||||
|
|
||||||
platform_hash = {
|
platform_hash = {
|
||||||
architecture: architecture,
|
architecture:,
|
||||||
os: os,
|
os:,
|
||||||
"os.version" => os_version,
|
"os.version" => os_version,
|
||||||
}.compact_blank
|
}.compact_blank
|
||||||
|
|
||||||
@ -446,7 +446,7 @@ class GitHubPackages
|
|||||||
args << "--dest-creds=#{user}:#{token}"
|
args << "--dest-creds=#{user}:#{token}"
|
||||||
retry_count = 0
|
retry_count = 0
|
||||||
begin
|
begin
|
||||||
system_command!(skopeo, verbose: true, print_stdout: true, args: args)
|
system_command!(skopeo, verbose: true, print_stdout: true, args:)
|
||||||
rescue ErrorDuringExecution
|
rescue ErrorDuringExecution
|
||||||
retry_count += 1
|
retry_count += 1
|
||||||
odie "Cannot perform an upload to registry after retrying multiple times!" if retry_count >= 10
|
odie "Cannot perform an upload to registry after retrying multiple times!" if retry_count >= 10
|
||||||
@ -486,8 +486,8 @@ class GitHubPackages
|
|||||||
def write_image_index(manifests, blobs, annotations)
|
def write_image_index(manifests, blobs, annotations)
|
||||||
image_index = {
|
image_index = {
|
||||||
schemaVersion: 2,
|
schemaVersion: 2,
|
||||||
manifests: manifests,
|
manifests:,
|
||||||
annotations: annotations,
|
annotations:,
|
||||||
}
|
}
|
||||||
validate_schema!(IMAGE_INDEX_SCHEMA_URI, image_index)
|
validate_schema!(IMAGE_INDEX_SCHEMA_URI, image_index)
|
||||||
write_hash(blobs, image_index)
|
write_hash(blobs, image_index)
|
||||||
@ -500,7 +500,7 @@ class GitHubPackages
|
|||||||
mediaType: "application/vnd.oci.image.index.v1+json",
|
mediaType: "application/vnd.oci.image.index.v1+json",
|
||||||
digest: "sha256:#{index_json_sha256}",
|
digest: "sha256:#{index_json_sha256}",
|
||||||
size: index_json_size,
|
size: index_json_size,
|
||||||
annotations: annotations,
|
annotations:,
|
||||||
}],
|
}],
|
||||||
}
|
}
|
||||||
validate_schema!(IMAGE_INDEX_SCHEMA_URI, index_json)
|
validate_schema!(IMAGE_INDEX_SCHEMA_URI, index_json)
|
||||||
|
|||||||
@ -34,7 +34,7 @@ class GitHubReleases
|
|||||||
remote_file = tag_hash["filename"]
|
remote_file = tag_hash["filename"]
|
||||||
local_file = tag_hash["local_filename"]
|
local_file = tag_hash["local_filename"]
|
||||||
odebug "Uploading #{remote_file}"
|
odebug "Uploading #{remote_file}"
|
||||||
GitHub.upload_release_asset user, repo, release["id"], local_file: local_file, remote_file: remote_file
|
GitHub.upload_release_asset user, repo, release["id"], local_file:, remote_file:
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -100,7 +100,7 @@ class GitHubRunnerMatrix
|
|||||||
raise "Unexpected platform: #{platform}" if VALID_PLATFORMS.exclude?(platform)
|
raise "Unexpected platform: #{platform}" if VALID_PLATFORMS.exclude?(platform)
|
||||||
raise "Unexpected arch: #{arch}" if VALID_ARCHES.exclude?(arch)
|
raise "Unexpected arch: #{arch}" if VALID_ARCHES.exclude?(arch)
|
||||||
|
|
||||||
runner = GitHubRunner.new(platform: platform, arch: arch, spec: spec, macos_version: macos_version)
|
runner = GitHubRunner.new(platform:, arch:, spec:, macos_version:)
|
||||||
runner.active = active_runner?(runner)
|
runner.active = active_runner?(runner)
|
||||||
runner.freeze
|
runner.freeze
|
||||||
end
|
end
|
||||||
@ -147,7 +147,7 @@ class GitHubRunnerMatrix
|
|||||||
|
|
||||||
spec = MacOSRunnerSpec.new(
|
spec = MacOSRunnerSpec.new(
|
||||||
name: "macOS #{version}-x86_64",
|
name: "macOS #{version}-x86_64",
|
||||||
runner: runner,
|
runner:,
|
||||||
timeout: runner_timeout,
|
timeout: runner_timeout,
|
||||||
cleanup: !runner.end_with?(ephemeral_suffix),
|
cleanup: !runner.end_with?(ephemeral_suffix),
|
||||||
)
|
)
|
||||||
@ -167,7 +167,7 @@ class GitHubRunnerMatrix
|
|||||||
runner_timeout /= 2 if runner_timeout < GITHUB_ACTIONS_LONG_TIMEOUT
|
runner_timeout /= 2 if runner_timeout < GITHUB_ACTIONS_LONG_TIMEOUT
|
||||||
spec = MacOSRunnerSpec.new(
|
spec = MacOSRunnerSpec.new(
|
||||||
name: "macOS #{version}-arm64",
|
name: "macOS #{version}-arm64",
|
||||||
runner: runner,
|
runner:,
|
||||||
timeout: runner_timeout,
|
timeout: runner_timeout,
|
||||||
cleanup: !runner.end_with?(ephemeral_suffix),
|
cleanup: !runner.end_with?(ephemeral_suffix),
|
||||||
)
|
)
|
||||||
@ -214,7 +214,7 @@ class GitHubRunnerMatrix
|
|||||||
next false unless formula.public_send(:"#{arch}_compatible?")
|
next false unless formula.public_send(:"#{arch}_compatible?")
|
||||||
next false if macos_version.present? && !formula.compatible_with?(macos_version)
|
next false if macos_version.present? && !formula.compatible_with?(macos_version)
|
||||||
|
|
||||||
compatible_dependents = formula.dependents(platform: platform, arch: arch, macos_version: macos_version&.to_sym)
|
compatible_dependents = formula.dependents(platform:, arch:, macos_version: macos_version&.to_sym)
|
||||||
.dup
|
.dup
|
||||||
|
|
||||||
compatible_dependents.select! do |dependent_f|
|
compatible_dependents.select! do |dependent_f|
|
||||||
|
|||||||
@ -59,7 +59,7 @@ module Homebrew
|
|||||||
|
|
||||||
# Display command-specific (or generic) help in response to `UsageError`.
|
# Display command-specific (or generic) help in response to `UsageError`.
|
||||||
if usage_error
|
if usage_error
|
||||||
$stderr.puts path ? command_help(cmd, path, remaining_args: remaining_args) : HOMEBREW_HELP
|
$stderr.puts path ? command_help(cmd, path, remaining_args:) : HOMEBREW_HELP
|
||||||
$stderr.puts
|
$stderr.puts
|
||||||
onoe usage_error
|
onoe usage_error
|
||||||
exit 1
|
exit 1
|
||||||
@ -69,7 +69,7 @@ module Homebrew
|
|||||||
return if path.nil?
|
return if path.nil?
|
||||||
|
|
||||||
# Display help for internal command (or generic help if undocumented).
|
# Display help for internal command (or generic help if undocumented).
|
||||||
puts command_help(cmd, path, remaining_args: remaining_args)
|
puts command_help(cmd, path, remaining_args:)
|
||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ module Homebrew
|
|||||||
output = if Commands.valid_internal_cmd?(cmd) ||
|
output = if Commands.valid_internal_cmd?(cmd) ||
|
||||||
Commands.valid_internal_dev_cmd?(cmd) ||
|
Commands.valid_internal_dev_cmd?(cmd) ||
|
||||||
Commands.external_ruby_v2_cmd_path(cmd)
|
Commands.external_ruby_v2_cmd_path(cmd)
|
||||||
parser_help(path, remaining_args: remaining_args)
|
parser_help(path, remaining_args:)
|
||||||
end
|
end
|
||||||
|
|
||||||
output ||= comment_help(path)
|
output ||= comment_help(path)
|
||||||
|
|||||||
@ -78,7 +78,7 @@ module Homebrew
|
|||||||
|
|
||||||
installed_head_version = formula.latest_head_version
|
installed_head_version = formula.latest_head_version
|
||||||
if installed_head_version &&
|
if installed_head_version &&
|
||||||
!formula.head_version_outdated?(installed_head_version, fetch_head: fetch_head)
|
!formula.head_version_outdated?(installed_head_version, fetch_head:)
|
||||||
new_head_installed = true
|
new_head_installed = true
|
||||||
end
|
end
|
||||||
prefix_installed = formula.prefix.exist? && !formula.prefix.children.empty?
|
prefix_installed = formula.prefix.exist? && !formula.prefix.children.empty?
|
||||||
@ -245,30 +245,30 @@ module Homebrew
|
|||||||
skip_post_install: false
|
skip_post_install: false
|
||||||
)
|
)
|
||||||
formula_installers = formulae_to_install.filter_map do |formula|
|
formula_installers = formulae_to_install.filter_map do |formula|
|
||||||
Migrator.migrate_if_needed(formula, force: force, dry_run: dry_run)
|
Migrator.migrate_if_needed(formula, force:, dry_run:)
|
||||||
build_options = formula.build
|
build_options = formula.build
|
||||||
|
|
||||||
formula_installer = FormulaInstaller.new(
|
formula_installer = FormulaInstaller.new(
|
||||||
formula,
|
formula,
|
||||||
options: build_options.used_options,
|
options: build_options.used_options,
|
||||||
build_bottle: build_bottle,
|
build_bottle:,
|
||||||
force_bottle: force_bottle,
|
force_bottle:,
|
||||||
bottle_arch: bottle_arch,
|
bottle_arch:,
|
||||||
ignore_deps: ignore_deps,
|
ignore_deps:,
|
||||||
only_deps: only_deps,
|
only_deps:,
|
||||||
include_test_formulae: include_test_formulae,
|
include_test_formulae:,
|
||||||
build_from_source_formulae: build_from_source_formulae,
|
build_from_source_formulae:,
|
||||||
cc: cc,
|
cc:,
|
||||||
git: git,
|
git:,
|
||||||
interactive: interactive,
|
interactive:,
|
||||||
keep_tmp: keep_tmp,
|
keep_tmp:,
|
||||||
debug_symbols: debug_symbols,
|
debug_symbols:,
|
||||||
force: force,
|
force:,
|
||||||
overwrite: overwrite,
|
overwrite:,
|
||||||
debug: debug,
|
debug:,
|
||||||
quiet: quiet,
|
quiet:,
|
||||||
verbose: verbose,
|
verbose:,
|
||||||
skip_post_install: skip_post_install,
|
skip_post_install:,
|
||||||
)
|
)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -355,7 +355,7 @@ module Homebrew
|
|||||||
|
|
||||||
upgrade = formula.linked? && formula.outdated? && !formula.head? && !Homebrew::EnvConfig.no_install_upgrade?
|
upgrade = formula.linked? && formula.outdated? && !formula.head? && !Homebrew::EnvConfig.no_install_upgrade?
|
||||||
|
|
||||||
Upgrade.install_formula(formula_installer, upgrade: upgrade)
|
Upgrade.install_formula(formula_installer, upgrade:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -408,16 +408,16 @@ class Keg
|
|||||||
|
|
||||||
ObserverPathnameExtension.reset_counts!
|
ObserverPathnameExtension.reset_counts!
|
||||||
|
|
||||||
optlink(verbose: verbose, dry_run: dry_run, overwrite: overwrite) unless dry_run
|
optlink(verbose:, dry_run:, overwrite:) unless dry_run
|
||||||
|
|
||||||
# yeah indeed, you have to force anything you need in the main tree into
|
# yeah indeed, you have to force anything you need in the main tree into
|
||||||
# these dirs REMEMBER that *NOT* everything needs to be in the main tree
|
# these dirs REMEMBER that *NOT* everything needs to be in the main tree
|
||||||
link_dir("etc", verbose: verbose, dry_run: dry_run, overwrite: overwrite) { :mkpath }
|
link_dir("etc", verbose:, dry_run:, overwrite:) { :mkpath }
|
||||||
link_dir("bin", verbose: verbose, dry_run: dry_run, overwrite: overwrite) { :skip_dir }
|
link_dir("bin", verbose:, dry_run:, overwrite:) { :skip_dir }
|
||||||
link_dir("sbin", verbose: verbose, dry_run: dry_run, overwrite: overwrite) { :skip_dir }
|
link_dir("sbin", verbose:, dry_run:, overwrite:) { :skip_dir }
|
||||||
link_dir("include", verbose: verbose, dry_run: dry_run, overwrite: overwrite) { :link }
|
link_dir("include", verbose:, dry_run:, overwrite:) { :link }
|
||||||
|
|
||||||
link_dir("share", verbose: verbose, dry_run: dry_run, overwrite: overwrite) do |relative_path|
|
link_dir("share", verbose:, dry_run:, overwrite:) do |relative_path|
|
||||||
case relative_path.to_s
|
case relative_path.to_s
|
||||||
when INFOFILE_RX then :info
|
when INFOFILE_RX then :info
|
||||||
when "locale/locale.alias",
|
when "locale/locale.alias",
|
||||||
@ -436,7 +436,7 @@ class Keg
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
link_dir("lib", verbose: verbose, dry_run: dry_run, overwrite: overwrite) do |relative_path|
|
link_dir("lib", verbose:, dry_run:, overwrite:) do |relative_path|
|
||||||
case relative_path.to_s
|
case relative_path.to_s
|
||||||
when "charset.alias"
|
when "charset.alias"
|
||||||
:skip_file
|
:skip_file
|
||||||
@ -462,7 +462,7 @@ class Keg
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
link_dir("Frameworks", verbose: verbose, dry_run: dry_run, overwrite: overwrite) do |relative_path|
|
link_dir("Frameworks", verbose:, dry_run:, overwrite:) do |relative_path|
|
||||||
# Frameworks contain symlinks pointing into a subdir, so we have to use
|
# Frameworks contain symlinks pointing into a subdir, so we have to use
|
||||||
# the :link strategy. However, for Foo.framework and
|
# the :link strategy. However, for Foo.framework and
|
||||||
# Foo.framework/Versions we have to use :mkpath so that multiple formulae
|
# Foo.framework/Versions we have to use :mkpath so that multiple formulae
|
||||||
@ -473,11 +473,9 @@ class Keg
|
|||||||
:link
|
:link
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
unless dry_run
|
make_relative_symlink(linked_keg_record, path, verbose:, dry_run:, overwrite:) unless dry_run
|
||||||
make_relative_symlink(linked_keg_record, path, verbose: verbose, dry_run: dry_run, overwrite: overwrite)
|
|
||||||
end
|
|
||||||
rescue LinkError
|
rescue LinkError
|
||||||
unlink(verbose: verbose)
|
unlink(verbose:)
|
||||||
raise
|
raise
|
||||||
else
|
else
|
||||||
ObserverPathnameExtension.n
|
ObserverPathnameExtension.n
|
||||||
@ -512,16 +510,16 @@ class Keg
|
|||||||
|
|
||||||
def optlink(verbose: false, dry_run: false, overwrite: false)
|
def optlink(verbose: false, dry_run: false, overwrite: false)
|
||||||
opt_record.delete if opt_record.symlink? || opt_record.exist?
|
opt_record.delete if opt_record.symlink? || opt_record.exist?
|
||||||
make_relative_symlink(opt_record, path, verbose: verbose, dry_run: dry_run, overwrite: overwrite)
|
make_relative_symlink(opt_record, path, verbose:, dry_run:, overwrite:)
|
||||||
aliases.each do |a|
|
aliases.each do |a|
|
||||||
alias_opt_record = opt_record.parent/a
|
alias_opt_record = opt_record.parent/a
|
||||||
alias_opt_record.delete if alias_opt_record.symlink? || alias_opt_record.exist?
|
alias_opt_record.delete if alias_opt_record.symlink? || alias_opt_record.exist?
|
||||||
make_relative_symlink(alias_opt_record, path, verbose: verbose, dry_run: dry_run, overwrite: overwrite)
|
make_relative_symlink(alias_opt_record, path, verbose:, dry_run:, overwrite:)
|
||||||
end
|
end
|
||||||
|
|
||||||
oldname_opt_records.each do |record|
|
oldname_opt_records.each do |record|
|
||||||
record.delete
|
record.delete
|
||||||
make_relative_symlink(record, path, verbose: verbose, dry_run: dry_run, overwrite: overwrite)
|
make_relative_symlink(record, path, verbose:, dry_run:, overwrite:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -641,10 +639,10 @@ class Keg
|
|||||||
when :info
|
when :info
|
||||||
next if File.basename(src) == "dir" # skip historical local 'dir' files
|
next if File.basename(src) == "dir" # skip historical local 'dir' files
|
||||||
|
|
||||||
make_relative_symlink dst, src, verbose: verbose, dry_run: dry_run, overwrite: overwrite
|
make_relative_symlink(dst, src, verbose:, dry_run:, overwrite:)
|
||||||
dst.install_info
|
dst.install_info
|
||||||
else
|
else
|
||||||
make_relative_symlink dst, src, verbose: verbose, dry_run: dry_run, overwrite: overwrite
|
make_relative_symlink dst, src, verbose:, dry_run:, overwrite:
|
||||||
end
|
end
|
||||||
elsif src.directory?
|
elsif src.directory?
|
||||||
# if the dst dir already exists, then great! walk the rest of the tree tho
|
# if the dst dir already exists, then great! walk the rest of the tree tho
|
||||||
@ -658,10 +656,10 @@ class Keg
|
|||||||
when :skip_dir
|
when :skip_dir
|
||||||
Find.prune
|
Find.prune
|
||||||
when :mkpath
|
when :mkpath
|
||||||
dst.mkpath unless resolve_any_conflicts(dst, verbose: verbose, dry_run: dry_run, overwrite: overwrite)
|
dst.mkpath unless resolve_any_conflicts(dst, verbose:, dry_run:, overwrite:)
|
||||||
else
|
else
|
||||||
unless resolve_any_conflicts(dst, verbose: verbose, dry_run: dry_run, overwrite: overwrite)
|
unless resolve_any_conflicts(dst, verbose:, dry_run:, overwrite:)
|
||||||
make_relative_symlink dst, src, verbose: verbose, dry_run: dry_run, overwrite: overwrite
|
make_relative_symlink(dst, src, verbose:, dry_run:, overwrite:)
|
||||||
Find.prune
|
Find.prune
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -128,7 +128,7 @@ class Keg
|
|||||||
def replace_placeholders_with_locations(files, skip_linkage: false)
|
def replace_placeholders_with_locations(files, skip_linkage: false)
|
||||||
relocation = prepare_relocation_to_locations.freeze
|
relocation = prepare_relocation_to_locations.freeze
|
||||||
relocate_dynamic_linkage(relocation) unless skip_linkage
|
relocate_dynamic_linkage(relocation) unless skip_linkage
|
||||||
replace_text_in_files(relocation, files: files)
|
replace_text_in_files(relocation, files:)
|
||||||
end
|
end
|
||||||
|
|
||||||
def openjdk_dep_name_if_applicable
|
def openjdk_dep_name_if_applicable
|
||||||
|
|||||||
@ -167,7 +167,7 @@ module Language
|
|||||||
|
|
||||||
ENV.refurbish_args
|
ENV.refurbish_args
|
||||||
venv = Virtualenv.new formula, venv_root, python
|
venv = Virtualenv.new formula, venv_root, python
|
||||||
venv.create(system_site_packages: system_site_packages, without_pip: without_pip)
|
venv.create(system_site_packages:, without_pip:)
|
||||||
|
|
||||||
# Find any Python bindings provided by recursive dependencies
|
# Find any Python bindings provided by recursive dependencies
|
||||||
formula_deps = formula.recursive_dependencies
|
formula_deps = formula.recursive_dependencies
|
||||||
@ -228,10 +228,10 @@ module Language
|
|||||||
python = T.must(wanted.first)
|
python = T.must(wanted.first)
|
||||||
python = "python3" if python == "python"
|
python = "python3" if python == "python"
|
||||||
end
|
end
|
||||||
venv = virtualenv_create(libexec, python.delete("@"), system_site_packages: system_site_packages,
|
venv = virtualenv_create(libexec, python.delete("@"), system_site_packages:,
|
||||||
without_pip: without_pip)
|
without_pip:)
|
||||||
venv.pip_install resources
|
venv.pip_install resources
|
||||||
venv.pip_install_and_link(T.must(buildpath), link_manpages: link_manpages)
|
venv.pip_install_and_link(T.must(buildpath), link_manpages:)
|
||||||
venv
|
venv
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -327,10 +327,10 @@ module Language
|
|||||||
targets = Array(targets)
|
targets = Array(targets)
|
||||||
targets.each do |t|
|
targets.each do |t|
|
||||||
if t.is_a?(Resource)
|
if t.is_a?(Resource)
|
||||||
t.stage { do_install(Pathname.pwd, build_isolation: build_isolation) }
|
t.stage { do_install(Pathname.pwd, build_isolation:) }
|
||||||
else
|
else
|
||||||
t = t.lines.map(&:strip) if t.is_a?(String) && t.include?("\n")
|
t = t.lines.map(&:strip) if t.is_a?(String) && t.include?("\n")
|
||||||
do_install(t, build_isolation: build_isolation)
|
do_install(t, build_isolation:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -351,7 +351,7 @@ module Language
|
|||||||
bin_before = Dir[@venv_root/"bin/*"].to_set
|
bin_before = Dir[@venv_root/"bin/*"].to_set
|
||||||
man_before = Dir[@venv_root/"share/man/man*/*"].to_set if link_manpages
|
man_before = Dir[@venv_root/"share/man/man*/*"].to_set if link_manpages
|
||||||
|
|
||||||
pip_install(targets, build_isolation: build_isolation)
|
pip_install(targets, build_isolation:)
|
||||||
|
|
||||||
bin_after = Dir[@venv_root/"bin/*"].to_set
|
bin_after = Dir[@venv_root/"bin/*"].to_set
|
||||||
bin_to_link = (bin_after - bin_before).to_a
|
bin_to_link = (bin_after - bin_before).to_a
|
||||||
@ -375,7 +375,7 @@ module Language
|
|||||||
}
|
}
|
||||||
def do_install(targets, build_isolation: true)
|
def do_install(targets, build_isolation: true)
|
||||||
targets = Array(targets)
|
targets = Array(targets)
|
||||||
args = @formula.std_pip_args(prefix: false, build_isolation: build_isolation)
|
args = @formula.std_pip_args(prefix: false, build_isolation:)
|
||||||
@formula.system @python, "-m", "pip", "--python=#{@venv_root}/bin/python", "install", *args, *targets
|
@formula.system @python, "-m", "pip", "--python=#{@venv_root}/bin/python", "install", *args, *targets
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -31,7 +31,7 @@ class LinkageChecker
|
|||||||
@files_missing_rpaths = []
|
@files_missing_rpaths = []
|
||||||
@executable_path_dylibs = []
|
@executable_path_dylibs = []
|
||||||
|
|
||||||
check_dylibs(rebuild_cache: rebuild_cache)
|
check_dylibs(rebuild_cache:)
|
||||||
end
|
end
|
||||||
|
|
||||||
def display_normal_output
|
def display_normal_output
|
||||||
@ -63,15 +63,15 @@ class LinkageChecker
|
|||||||
end
|
end
|
||||||
|
|
||||||
def display_test_output(puts_output: true, strict: false)
|
def display_test_output(puts_output: true, strict: false)
|
||||||
display_items "Missing libraries", @broken_dylibs, puts_output: puts_output
|
display_items("Missing libraries", @broken_dylibs, puts_output:)
|
||||||
display_items "Broken dependencies", @broken_deps, puts_output: puts_output
|
display_items("Broken dependencies", @broken_deps, puts_output:)
|
||||||
display_items "Unwanted system libraries", @unwanted_system_dylibs, puts_output: puts_output
|
display_items("Unwanted system libraries", @unwanted_system_dylibs, puts_output:)
|
||||||
display_items "Conflicting libraries", @version_conflict_deps, puts_output: puts_output
|
display_items("Conflicting libraries", @version_conflict_deps, puts_output:)
|
||||||
return unless strict
|
return unless strict
|
||||||
|
|
||||||
display_items "Undeclared dependencies with linkage", @undeclared_deps, puts_output: puts_output
|
display_items("Undeclared dependencies with linkage", @undeclared_deps, puts_output:)
|
||||||
display_items "Files with missing rpath", @files_missing_rpaths, puts_output: puts_output
|
display_items("Files with missing rpath", @files_missing_rpaths, puts_output:)
|
||||||
display_items "@executable_path references in libraries", @executable_path_dylibs, puts_output: puts_output
|
display_items "@executable_path references in libraries", @executable_path_dylibs, puts_output:
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(test: T::Boolean, strict: T::Boolean).returns(T::Boolean) }
|
sig { params(test: T::Boolean, strict: T::Boolean).returns(T::Boolean) }
|
||||||
@ -179,7 +179,7 @@ class LinkageChecker
|
|||||||
|
|
||||||
return unless keg_files_dylibs_was_empty
|
return unless keg_files_dylibs_was_empty
|
||||||
|
|
||||||
store&.update!(keg_files_dylibs: keg_files_dylibs)
|
store&.update!(keg_files_dylibs:)
|
||||||
end
|
end
|
||||||
alias generic_check_dylibs check_dylibs
|
alias generic_check_dylibs check_dylibs
|
||||||
|
|
||||||
|
|||||||
@ -21,12 +21,12 @@ class LinuxRunnerSpec < T::Struct
|
|||||||
}
|
}
|
||||||
def to_h
|
def to_h
|
||||||
{
|
{
|
||||||
name: name,
|
name:,
|
||||||
runner: runner,
|
runner:,
|
||||||
container: container,
|
container:,
|
||||||
workdir: workdir,
|
workdir:,
|
||||||
timeout: timeout,
|
timeout:,
|
||||||
cleanup: cleanup,
|
cleanup:,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -128,11 +128,11 @@ module Homebrew
|
|||||||
if debug
|
if debug
|
||||||
# Print the chain of references for debugging
|
# Print the chain of references for debugging
|
||||||
puts "Reference Chain:"
|
puts "Reference Chain:"
|
||||||
puts package_or_resource_name(first_formula_or_cask, full_name: full_name)
|
puts package_or_resource_name(first_formula_or_cask, full_name:)
|
||||||
|
|
||||||
references << referenced_formula_or_cask
|
references << referenced_formula_or_cask
|
||||||
references.each do |ref_formula_or_cask|
|
references.each do |ref_formula_or_cask|
|
||||||
puts package_or_resource_name(ref_formula_or_cask, full_name: full_name)
|
puts package_or_resource_name(ref_formula_or_cask, full_name:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -145,8 +145,8 @@ module Homebrew
|
|||||||
referenced_formula_or_cask,
|
referenced_formula_or_cask,
|
||||||
first_formula_or_cask,
|
first_formula_or_cask,
|
||||||
references,
|
references,
|
||||||
full_name: full_name,
|
full_name:,
|
||||||
debug: debug,
|
debug:,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Returning references along with the final referenced formula/cask
|
# Returning references along with the final referenced formula/cask
|
||||||
@ -225,7 +225,7 @@ module Homebrew
|
|||||||
name = package_or_resource_name(formula_or_cask, full_name: use_full_name)
|
name = package_or_resource_name(formula_or_cask, full_name: use_full_name)
|
||||||
|
|
||||||
referenced_formula_or_cask, livecheck_references =
|
referenced_formula_or_cask, livecheck_references =
|
||||||
resolve_livecheck_reference(formula_or_cask, full_name: use_full_name, debug: debug)
|
resolve_livecheck_reference(formula_or_cask, full_name: use_full_name, debug:)
|
||||||
|
|
||||||
if debug && i.positive?
|
if debug && i.positive?
|
||||||
puts <<~EOS
|
puts <<~EOS
|
||||||
@ -243,11 +243,11 @@ module Homebrew
|
|||||||
referenced_formula_or_cask,
|
referenced_formula_or_cask,
|
||||||
name,
|
name,
|
||||||
full_name: use_full_name,
|
full_name: use_full_name,
|
||||||
verbose: verbose,
|
verbose:,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
skip_info ||= SkipConditions.skip_information(formula_or_cask, full_name: use_full_name, verbose: verbose)
|
skip_info ||= SkipConditions.skip_information(formula_or_cask, full_name: use_full_name, verbose:)
|
||||||
if skip_info.present?
|
if skip_info.present?
|
||||||
next skip_info if json && !newer_only
|
next skip_info if json && !newer_only
|
||||||
|
|
||||||
@ -279,9 +279,9 @@ module Homebrew
|
|||||||
else
|
else
|
||||||
version_info = latest_version(
|
version_info = latest_version(
|
||||||
formula_or_cask,
|
formula_or_cask,
|
||||||
referenced_formula_or_cask: referenced_formula_or_cask,
|
referenced_formula_or_cask:,
|
||||||
livecheck_references: livecheck_references,
|
livecheck_references:,
|
||||||
json: json, full_name: use_full_name, verbose: verbose, debug: debug
|
json:, full_name: use_full_name, verbose:, debug:
|
||||||
)
|
)
|
||||||
version_info[:latest] if version_info.present?
|
version_info[:latest] if version_info.present?
|
||||||
end
|
end
|
||||||
@ -289,20 +289,20 @@ module Homebrew
|
|||||||
check_for_resources = check_resources && formula_or_cask.is_a?(Formula) && formula_or_cask.resources.present?
|
check_for_resources = check_resources && formula_or_cask.is_a?(Formula) && formula_or_cask.resources.present?
|
||||||
if check_for_resources
|
if check_for_resources
|
||||||
resource_version_info = formula_or_cask.resources.map do |resource|
|
resource_version_info = formula_or_cask.resources.map do |resource|
|
||||||
res_skip_info ||= SkipConditions.skip_information(resource, verbose: verbose)
|
res_skip_info ||= SkipConditions.skip_information(resource, verbose:)
|
||||||
if res_skip_info.present?
|
if res_skip_info.present?
|
||||||
res_skip_info
|
res_skip_info
|
||||||
else
|
else
|
||||||
res_version_info = resource_version(
|
res_version_info = resource_version(
|
||||||
resource,
|
resource,
|
||||||
latest.to_s,
|
latest.to_s,
|
||||||
json: json,
|
json:,
|
||||||
debug: debug,
|
debug:,
|
||||||
quiet: quiet,
|
quiet:,
|
||||||
verbose: verbose,
|
verbose:,
|
||||||
)
|
)
|
||||||
if res_version_info.empty?
|
if res_version_info.empty?
|
||||||
status_hash(resource, "error", ["Unable to get versions"], verbose: verbose)
|
status_hash(resource, "error", ["Unable to get versions"], verbose:)
|
||||||
else
|
else
|
||||||
res_version_info
|
res_version_info
|
||||||
end
|
end
|
||||||
@ -319,7 +319,7 @@ module Homebrew
|
|||||||
next version_info if version_info.is_a?(Hash) && version_info[:status] && version_info[:messages]
|
next version_info if version_info.is_a?(Hash) && version_info[:status] && version_info[:messages]
|
||||||
|
|
||||||
latest_info = status_hash(formula_or_cask, "error", [no_versions_msg], full_name: use_full_name,
|
latest_info = status_hash(formula_or_cask, "error", [no_versions_msg], full_name: use_full_name,
|
||||||
verbose: verbose)
|
verbose:)
|
||||||
if check_for_resources
|
if check_for_resources
|
||||||
unless verbose
|
unless verbose
|
||||||
resource_version_info.map! do |info|
|
resource_version_info.map! do |info|
|
||||||
@ -383,8 +383,8 @@ module Homebrew
|
|||||||
next info
|
next info
|
||||||
end
|
end
|
||||||
puts if debug
|
puts if debug
|
||||||
print_latest_version(info, verbose: verbose, ambiguous_cask: ambiguous_casks.include?(formula_or_cask))
|
print_latest_version(info, verbose:, ambiguous_cask: ambiguous_casks.include?(formula_or_cask))
|
||||||
print_resources_info(resource_version_info, verbose: verbose) if check_for_resources
|
print_resources_info(resource_version_info, verbose:) if check_for_resources
|
||||||
nil
|
nil
|
||||||
rescue => e
|
rescue => e
|
||||||
Homebrew.failed = true
|
Homebrew.failed = true
|
||||||
@ -394,7 +394,7 @@ module Homebrew
|
|||||||
progress&.increment
|
progress&.increment
|
||||||
unless quiet
|
unless quiet
|
||||||
status_hash(formula_or_cask, "error", [e.to_s], full_name: use_full_name,
|
status_hash(formula_or_cask, "error", [e.to_s], full_name: use_full_name,
|
||||||
verbose: verbose)
|
verbose:)
|
||||||
end
|
end
|
||||||
elsif !quiet
|
elsif !quiet
|
||||||
name = package_or_resource_name(formula_or_cask, full_name: use_full_name)
|
name = package_or_resource_name(formula_or_cask, full_name: use_full_name)
|
||||||
@ -402,7 +402,7 @@ module Homebrew
|
|||||||
|
|
||||||
onoe "#{Tty.blue}#{name}#{Tty.reset}: #{e}"
|
onoe "#{Tty.blue}#{name}#{Tty.reset}: #{e}"
|
||||||
$stderr.puts Utils::Backtrace.clean(e) if debug && !e.is_a?(Livecheck::Error)
|
$stderr.puts Utils::Backtrace.clean(e) if debug && !e.is_a?(Livecheck::Error)
|
||||||
print_resources_info(resource_version_info, verbose: verbose) if check_for_resources
|
print_resources_info(resource_version_info, verbose:) if check_for_resources
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -425,9 +425,9 @@ module Homebrew
|
|||||||
def package_or_resource_name(package_or_resource, full_name: false)
|
def package_or_resource_name(package_or_resource, full_name: false)
|
||||||
case package_or_resource
|
case package_or_resource
|
||||||
when Formula
|
when Formula
|
||||||
formula_name(package_or_resource, full_name: full_name)
|
formula_name(package_or_resource, full_name:)
|
||||||
when Cask::Cask
|
when Cask::Cask
|
||||||
cask_name(package_or_resource, full_name: full_name)
|
cask_name(package_or_resource, full_name:)
|
||||||
when Resource
|
when Resource
|
||||||
package_or_resource.name
|
package_or_resource.name
|
||||||
else
|
else
|
||||||
@ -465,9 +465,9 @@ module Homebrew
|
|||||||
|
|
||||||
status_hash = {}
|
status_hash = {}
|
||||||
if formula
|
if formula
|
||||||
status_hash[:formula] = formula_name(formula, full_name: full_name)
|
status_hash[:formula] = formula_name(formula, full_name:)
|
||||||
elsif cask
|
elsif cask
|
||||||
status_hash[:cask] = cask_name(cask, full_name: full_name)
|
status_hash[:cask] = cask_name(cask, full_name:)
|
||||||
elsif resource
|
elsif resource
|
||||||
status_hash[:resource] = resource.name
|
status_hash[:resource] = resource.name
|
||||||
end
|
end
|
||||||
@ -512,7 +512,7 @@ module Homebrew
|
|||||||
if r_info[:status] && r_info[:messages]
|
if r_info[:status] && r_info[:messages]
|
||||||
SkipConditions.print_skip_information(r_info)
|
SkipConditions.print_skip_information(r_info)
|
||||||
else
|
else
|
||||||
print_latest_version(r_info, verbose: verbose)
|
print_latest_version(r_info, verbose:)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -673,19 +673,19 @@ module Homebrew
|
|||||||
|
|
||||||
if debug
|
if debug
|
||||||
if formula
|
if formula
|
||||||
puts "Formula: #{formula_name(formula, full_name: full_name)}"
|
puts "Formula: #{formula_name(formula, full_name:)}"
|
||||||
puts "Head only?: true" if formula.head_only?
|
puts "Head only?: true" if formula.head_only?
|
||||||
elsif cask
|
elsif cask
|
||||||
puts "Cask: #{cask_name(formula_or_cask, full_name: full_name)}"
|
puts "Cask: #{cask_name(formula_or_cask, full_name:)}"
|
||||||
end
|
end
|
||||||
puts "Livecheckable?: #{has_livecheckable ? "Yes" : "No"}"
|
puts "Livecheckable?: #{has_livecheckable ? "Yes" : "No"}"
|
||||||
|
|
||||||
livecheck_references.each do |ref_formula_or_cask|
|
livecheck_references.each do |ref_formula_or_cask|
|
||||||
case ref_formula_or_cask
|
case ref_formula_or_cask
|
||||||
when Formula
|
when Formula
|
||||||
puts "Formula Ref: #{formula_name(ref_formula_or_cask, full_name: full_name)}"
|
puts "Formula Ref: #{formula_name(ref_formula_or_cask, full_name:)}"
|
||||||
when Cask::Cask
|
when Cask::Cask
|
||||||
puts "Cask Ref: #{cask_name(ref_formula_or_cask, full_name: full_name)}"
|
puts "Cask Ref: #{cask_name(ref_formula_or_cask, full_name:)}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -702,7 +702,7 @@ module Homebrew
|
|||||||
|
|
||||||
strategies = Strategy.from_url(
|
strategies = Strategy.from_url(
|
||||||
url,
|
url,
|
||||||
livecheck_strategy: livecheck_strategy,
|
livecheck_strategy:,
|
||||||
url_provided: livecheck_url.present?,
|
url_provided: livecheck_url.present?,
|
||||||
regex_provided: livecheck_regex.present?,
|
regex_provided: livecheck_regex.present?,
|
||||||
block_provided: livecheck_strategy_block.present?,
|
block_provided: livecheck_strategy_block.present?,
|
||||||
@ -746,7 +746,7 @@ module Homebrew
|
|||||||
|
|
||||||
strategy_args = {
|
strategy_args = {
|
||||||
regex: livecheck_regex,
|
regex: livecheck_regex,
|
||||||
homebrew_curl: homebrew_curl,
|
homebrew_curl:,
|
||||||
}
|
}
|
||||||
# TODO: Set `cask`/`url` args based on the presence of the keyword arg
|
# TODO: Set `cask`/`url` args based on the presence of the keyword arg
|
||||||
# in the strategy's `#find_versions` method once we figure out why
|
# in the strategy's `#find_versions` method once we figure out why
|
||||||
@ -769,7 +769,7 @@ module Homebrew
|
|||||||
puts messages unless json
|
puts messages unless json
|
||||||
next if i + 1 < urls.length
|
next if i + 1 < urls.length
|
||||||
|
|
||||||
return status_hash(formula_or_cask, "error", messages, full_name: full_name, verbose: verbose)
|
return status_hash(formula_or_cask, "error", messages, full_name:, verbose:)
|
||||||
end
|
end
|
||||||
|
|
||||||
if debug
|
if debug
|
||||||
@ -817,9 +817,9 @@ module Homebrew
|
|||||||
version_info[:meta][:references] = livecheck_references.map do |ref_formula_or_cask|
|
version_info[:meta][:references] = livecheck_references.map do |ref_formula_or_cask|
|
||||||
case ref_formula_or_cask
|
case ref_formula_or_cask
|
||||||
when Formula
|
when Formula
|
||||||
{ formula: formula_name(ref_formula_or_cask, full_name: full_name) }
|
{ formula: formula_name(ref_formula_or_cask, full_name:) }
|
||||||
when Cask::Cask
|
when Cask::Cask
|
||||||
{ cask: cask_name(ref_formula_or_cask, full_name: full_name) }
|
{ cask: cask_name(ref_formula_or_cask, full_name:) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -897,7 +897,7 @@ module Homebrew
|
|||||||
|
|
||||||
strategies = Strategy.from_url(
|
strategies = Strategy.from_url(
|
||||||
url,
|
url,
|
||||||
livecheck_strategy: livecheck_strategy,
|
livecheck_strategy:,
|
||||||
url_provided: livecheck_url.present?,
|
url_provided: livecheck_url.present?,
|
||||||
regex_provided: livecheck_regex.present?,
|
regex_provided: livecheck_regex.present?,
|
||||||
block_provided: livecheck_strategy_block.present?,
|
block_provided: livecheck_strategy_block.present?,
|
||||||
@ -934,7 +934,7 @@ module Homebrew
|
|||||||
next if strategy.blank?
|
next if strategy.blank?
|
||||||
|
|
||||||
strategy_args = {
|
strategy_args = {
|
||||||
url: url,
|
url:,
|
||||||
regex: livecheck_regex,
|
regex: livecheck_regex,
|
||||||
homebrew_curl: false,
|
homebrew_curl: false,
|
||||||
}.compact
|
}.compact
|
||||||
@ -949,7 +949,7 @@ module Homebrew
|
|||||||
puts messages unless json
|
puts messages unless json
|
||||||
next if i + 1 < urls.length
|
next if i + 1 < urls.length
|
||||||
|
|
||||||
return status_hash(resource, "error", messages, verbose: verbose)
|
return status_hash(resource, "error", messages, verbose:)
|
||||||
end
|
end
|
||||||
|
|
||||||
if debug
|
if debug
|
||||||
@ -989,7 +989,7 @@ module Homebrew
|
|||||||
res_current = T.must(resource.version)
|
res_current = T.must(resource.version)
|
||||||
res_latest = Version.new(match_version_map.values.max_by { |v| LivecheckVersion.create(resource, v) })
|
res_latest = Version.new(match_version_map.values.max_by { |v| LivecheckVersion.create(resource, v) })
|
||||||
|
|
||||||
return status_hash(resource, "error", ["Unable to get versions"], verbose: verbose) if res_latest.blank?
|
return status_hash(resource, "error", ["Unable to get versions"], verbose:) if res_latest.blank?
|
||||||
|
|
||||||
is_outdated = res_current < res_latest
|
is_outdated = res_current < res_latest
|
||||||
is_newer_than_upstream = res_current > res_latest
|
is_newer_than_upstream = res_current > res_latest
|
||||||
@ -1023,7 +1023,7 @@ module Homebrew
|
|||||||
rescue => e
|
rescue => e
|
||||||
Homebrew.failed = true
|
Homebrew.failed = true
|
||||||
if json
|
if json
|
||||||
status_hash(resource, "error", [e.to_s], verbose: verbose)
|
status_hash(resource, "error", [e.to_s], verbose:)
|
||||||
elsif !quiet
|
elsif !quiet
|
||||||
onoe "#{Tty.blue}#{resource.name}#{Tty.reset}: #{e}"
|
onoe "#{Tty.blue}#{resource.name}#{Tty.reset}: #{e}"
|
||||||
$stderr.puts Utils::Backtrace.clean(e) if debug && !e.is_a?(Livecheck::Error)
|
$stderr.puts Utils::Backtrace.clean(e) if debug && !e.is_a?(Livecheck::Error)
|
||||||
|
|||||||
@ -44,7 +44,7 @@ module Homebrew
|
|||||||
return {} if !package_or_resource.livecheck.skip? && skip_message.blank?
|
return {} if !package_or_resource.livecheck.skip? && skip_message.blank?
|
||||||
|
|
||||||
skip_messages = skip_message ? [skip_message] : nil
|
skip_messages = skip_message ? [skip_message] : nil
|
||||||
Livecheck.status_hash(package_or_resource, "skipped", skip_messages, full_name: full_name, verbose: verbose)
|
Livecheck.status_hash(package_or_resource, "skipped", skip_messages, full_name:, verbose:)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig {
|
sig {
|
||||||
@ -62,8 +62,8 @@ module Homebrew
|
|||||||
formula,
|
formula,
|
||||||
"error",
|
"error",
|
||||||
["HEAD only formula must be installed to be livecheckable"],
|
["HEAD only formula must be installed to be livecheckable"],
|
||||||
full_name: full_name,
|
full_name:,
|
||||||
verbose: verbose,
|
verbose:,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ module Homebrew
|
|||||||
def formula_deprecated(formula, livecheckable, full_name: false, verbose: false)
|
def formula_deprecated(formula, livecheckable, full_name: false, verbose: false)
|
||||||
return {} if !formula.deprecated? || livecheckable
|
return {} if !formula.deprecated? || livecheckable
|
||||||
|
|
||||||
Livecheck.status_hash(formula, "deprecated", full_name: full_name, verbose: verbose)
|
Livecheck.status_hash(formula, "deprecated", full_name:, verbose:)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig {
|
sig {
|
||||||
@ -92,7 +92,7 @@ module Homebrew
|
|||||||
def formula_disabled(formula, livecheckable, full_name: false, verbose: false)
|
def formula_disabled(formula, livecheckable, full_name: false, verbose: false)
|
||||||
return {} if !formula.disabled? || livecheckable
|
return {} if !formula.disabled? || livecheckable
|
||||||
|
|
||||||
Livecheck.status_hash(formula, "disabled", full_name: full_name, verbose: verbose)
|
Livecheck.status_hash(formula, "disabled", full_name:, verbose:)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig {
|
sig {
|
||||||
@ -106,7 +106,7 @@ module Homebrew
|
|||||||
def formula_versioned(formula, livecheckable, full_name: false, verbose: false)
|
def formula_versioned(formula, livecheckable, full_name: false, verbose: false)
|
||||||
return {} if !formula.versioned_formula? || livecheckable
|
return {} if !formula.versioned_formula? || livecheckable
|
||||||
|
|
||||||
Livecheck.status_hash(formula, "versioned", full_name: full_name, verbose: verbose)
|
Livecheck.status_hash(formula, "versioned", full_name:, verbose:)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig {
|
sig {
|
||||||
@ -120,7 +120,7 @@ module Homebrew
|
|||||||
def cask_discontinued(cask, livecheckable, full_name: false, verbose: false)
|
def cask_discontinued(cask, livecheckable, full_name: false, verbose: false)
|
||||||
return {} if !cask.discontinued? || livecheckable
|
return {} if !cask.discontinued? || livecheckable
|
||||||
|
|
||||||
Livecheck.status_hash(cask, "discontinued", full_name: full_name, verbose: verbose)
|
Livecheck.status_hash(cask, "discontinued", full_name:, verbose:)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig {
|
sig {
|
||||||
@ -134,7 +134,7 @@ module Homebrew
|
|||||||
def cask_deprecated(cask, livecheckable, full_name: false, verbose: false)
|
def cask_deprecated(cask, livecheckable, full_name: false, verbose: false)
|
||||||
return {} if !cask.deprecated? || livecheckable
|
return {} if !cask.deprecated? || livecheckable
|
||||||
|
|
||||||
Livecheck.status_hash(cask, "deprecated", full_name: full_name, verbose: verbose)
|
Livecheck.status_hash(cask, "deprecated", full_name:, verbose:)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig {
|
sig {
|
||||||
@ -148,7 +148,7 @@ module Homebrew
|
|||||||
def cask_disabled(cask, livecheckable, full_name: false, verbose: false)
|
def cask_disabled(cask, livecheckable, full_name: false, verbose: false)
|
||||||
return {} if !cask.disabled? || livecheckable
|
return {} if !cask.disabled? || livecheckable
|
||||||
|
|
||||||
Livecheck.status_hash(cask, "disabled", full_name: full_name, verbose: verbose)
|
Livecheck.status_hash(cask, "disabled", full_name:, verbose:)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig {
|
sig {
|
||||||
@ -162,7 +162,7 @@ module Homebrew
|
|||||||
def cask_version_latest(cask, livecheckable, full_name: false, verbose: false)
|
def cask_version_latest(cask, livecheckable, full_name: false, verbose: false)
|
||||||
return {} if !(cask.present? && cask.version&.latest?) || livecheckable
|
return {} if !(cask.present? && cask.version&.latest?) || livecheckable
|
||||||
|
|
||||||
Livecheck.status_hash(cask, "latest", full_name: full_name, verbose: verbose)
|
Livecheck.status_hash(cask, "latest", full_name:, verbose:)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig {
|
sig {
|
||||||
@ -176,7 +176,7 @@ module Homebrew
|
|||||||
def cask_url_unversioned(cask, livecheckable, full_name: false, verbose: false)
|
def cask_url_unversioned(cask, livecheckable, full_name: false, verbose: false)
|
||||||
return {} if !(cask.present? && cask.url&.unversioned?) || livecheckable
|
return {} if !(cask.present? && cask.url&.unversioned?) || livecheckable
|
||||||
|
|
||||||
Livecheck.status_hash(cask, "unversioned", full_name: full_name, verbose: verbose)
|
Livecheck.status_hash(cask, "unversioned", full_name:, verbose:)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Skip conditions for formulae.
|
# Skip conditions for formulae.
|
||||||
@ -227,7 +227,7 @@ module Homebrew
|
|||||||
return {} unless checks
|
return {} unless checks
|
||||||
|
|
||||||
checks.each do |method_name|
|
checks.each do |method_name|
|
||||||
skip_hash = send(method_name, package_or_resource, livecheckable, full_name: full_name, verbose: verbose)
|
skip_hash = send(method_name, package_or_resource, livecheckable, full_name:, verbose:)
|
||||||
return skip_hash if skip_hash.present?
|
return skip_hash if skip_hash.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -254,12 +254,12 @@ module Homebrew
|
|||||||
)
|
)
|
||||||
skip_info = SkipConditions.skip_information(
|
skip_info = SkipConditions.skip_information(
|
||||||
livecheck_package_or_resource,
|
livecheck_package_or_resource,
|
||||||
full_name: full_name,
|
full_name:,
|
||||||
verbose: verbose,
|
verbose:,
|
||||||
)
|
)
|
||||||
return if skip_info.blank?
|
return if skip_info.blank?
|
||||||
|
|
||||||
referenced_name = Livecheck.package_or_resource_name(livecheck_package_or_resource, full_name: full_name)
|
referenced_name = Livecheck.package_or_resource_name(livecheck_package_or_resource, full_name:)
|
||||||
referenced_type = case livecheck_package_or_resource
|
referenced_type = case livecheck_package_or_resource
|
||||||
when Formula
|
when Formula
|
||||||
:formula
|
:formula
|
||||||
|
|||||||
@ -192,7 +192,7 @@ module Homebrew
|
|||||||
url,
|
url,
|
||||||
wanted_headers: ["location", "content-disposition"],
|
wanted_headers: ["location", "content-disposition"],
|
||||||
use_homebrew_curl: homebrew_curl,
|
use_homebrew_curl: homebrew_curl,
|
||||||
user_agent: user_agent,
|
user_agent:,
|
||||||
**DEFAULT_CURL_OPTIONS,
|
**DEFAULT_CURL_OPTIONS,
|
||||||
)
|
)
|
||||||
rescue ErrorDuringExecution
|
rescue ErrorDuringExecution
|
||||||
@ -222,7 +222,7 @@ module Homebrew
|
|||||||
*PAGE_CONTENT_CURL_ARGS, url,
|
*PAGE_CONTENT_CURL_ARGS, url,
|
||||||
**DEFAULT_CURL_OPTIONS,
|
**DEFAULT_CURL_OPTIONS,
|
||||||
use_homebrew_curl: homebrew_curl,
|
use_homebrew_curl: homebrew_curl,
|
||||||
user_agent: user_agent
|
user_agent:
|
||||||
)
|
)
|
||||||
next unless status.success?
|
next unless status.success?
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user