diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2ee3d3d130..532b00437f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -53,7 +53,7 @@ jobs: - name: Set up Ruby if: matrix.os == 'ubuntu-latest' - uses: actions/setup-ruby@master + uses: actions/setup-ruby@main with: ruby-version: '2.6' diff --git a/Library/Homebrew/Gemfile b/Library/Homebrew/Gemfile index e6a4fdb19b..dc63d715a2 100644 --- a/Library/Homebrew/Gemfile +++ b/Library/Homebrew/Gemfile @@ -14,8 +14,8 @@ gem "rspec-wait", require: false gem "rubocop" gem "simplecov", require: false if ENV["HOMEBREW_SORBET"] - gem "sorbet" - gem "sorbet-runtime" + gem "sorbet", "0.5.5823" + gem "sorbet-runtime", "0.5.5823" gem "tapioca" end @@ -23,7 +23,7 @@ end gem "activesupport" gem "concurrent-ruby" gem "mechanize" -gem "patchelf" if ENV["HOMEBREW_PATCHELF_RB"] +gem "patchelf" gem "plist" gem "rubocop-performance" gem "rubocop-rspec" diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock index 15fa68ef5b..6988423278 100644 --- a/Library/Homebrew/Gemfile.lock +++ b/Library/Homebrew/Gemfile.lock @@ -8,6 +8,7 @@ GEM tzinfo (~> 1.1) zeitwerk (~> 2.2, >= 2.2.2) ast (2.4.1) + bindata (2.4.8) byebug (11.1.3) codecov (0.2.2) colorize @@ -20,10 +21,12 @@ GEM docile (1.3.2) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) + elftools (1.1.2) + bindata (~> 2) hpricot (0.8.6) http-cookie (1.0.3) domain_name (~> 0.5) - i18n (1.8.4) + i18n (1.8.5) concurrent-ruby (~> 1.0) json (2.3.1) mechanize (2.7.6) @@ -48,10 +51,12 @@ GEM mini_portile2 (~> 2.4.0) ntlm-http (0.1.1) parallel (1.19.2) - parallel_tests (3.0.0) + parallel_tests (3.1.0) parallel parser (2.7.1.4) ast (~> 2.4.1) + patchelf (1.1.1) + elftools (~> 1.1) plist (3.5.0) rainbow (3.0.0) rdiscount (2.2.0.1) @@ -122,6 +127,7 @@ DEPENDENCIES concurrent-ruby mechanize parallel_tests + patchelf plist ronn rspec diff --git a/Library/Homebrew/bintray.rb b/Library/Homebrew/bintray.rb index cb2966ca0d..d9b8512876 100644 --- a/Library/Homebrew/bintray.rb +++ b/Library/Homebrew/bintray.rb @@ -10,30 +10,27 @@ class Bintray end def inspect - "#" + "#" end - def initialize(user: ENV["HOMEBREW_BINTRAY_USER"], key: ENV["HOMEBREW_BINTRAY_KEY"], org: "homebrew", clear: true) - @bintray_user = user - @bintray_key = key + def initialize(org: "homebrew") @bintray_org = org - if !@bintray_user || !@bintray_key - unless Homebrew.args.dry_run? - raise UsageError, "Missing HOMEBREW_BINTRAY_USER or HOMEBREW_BINTRAY_KEY variables!" - end - end - raise UsageError, "Must set a Bintray organisation!" unless @bintray_org ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] = "1" if @bintray_org == "homebrew" && !OS.mac? - - ENV.delete "HOMEBREW_BINTRAY_KEY" if clear end def open_api(url, *extra_curl_args, auth: true) args = extra_curl_args - args += ["--user", "#{@bintray_user}:#{@bintray_key}"] if auth + + if auth + raise UsageError, "HOMEBREW_BINTRAY_USER is unset." unless (user = Homebrew::EnvConfig.bintray_user) + raise UsageError, "HOMEBREW_BINTRAY_KEY is unset." unless (key = Homebrew::EnvConfig.bintray_key) + + args += ["--user", "#{user}:#{key}"] + end + curl(*args, url, show_output: Homebrew.args.verbose?, secrets: @bintray_key) diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 08e0055cce..d86bc8298c 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -150,7 +150,7 @@ rescue BuildError => e Utils::Analytics.report_build_error(e) e.dump - output_unsupported_error if Homebrew.args.HEAD? || e.formula.deprecated? || e.formula.disabled? + output_unsupported_error if e.formula.head? || e.formula.deprecated? || e.formula.disabled? exit 1 rescue RuntimeError, SystemCallError => e diff --git a/Library/Homebrew/build.rb b/Library/Homebrew/build.rb index 0d3dece199..f448995e09 100644 --- a/Library/Homebrew/build.rb +++ b/Library/Homebrew/build.rb @@ -16,13 +16,14 @@ require "socket" require "cmd/install" class Build - attr_reader :formula, :deps, :reqs + attr_reader :formula, :deps, :reqs, :args - def initialize(formula, options) + def initialize(formula, options, args:) @formula = formula @formula.build = BuildOptions.new(options, formula.options) + @args = args - if Homebrew.args.ignore_deps? + if args.ignore_deps? @deps = [] @reqs = [] else @@ -82,20 +83,20 @@ class Build fixopt(dep) unless dep.opt_prefix.directory? end - ENV.activate_extensions! + ENV.activate_extensions!(args: args) - if superenv? + if superenv?(args: args) ENV.keg_only_deps = keg_only_deps ENV.deps = formula_deps ENV.run_time_deps = run_time_deps ENV.x11 = reqs.any? { |rq| rq.is_a?(X11Requirement) } - ENV.setup_build_environment(formula) + ENV.setup_build_environment(formula, args: args) post_superenv_hacks - reqs.each(&:modify_build_environment) + reqs.each { |req| req.modify_build_environment(args: args) } deps.each(&:modify_build_environment) else - ENV.setup_build_environment(formula) - reqs.each(&:modify_build_environment) + ENV.setup_build_environment(formula, args: args) + reqs.each { |req| req.modify_build_environment(args: args) } deps.each(&:modify_build_environment) keg_only_deps.each do |dep| @@ -120,24 +121,23 @@ class Build formula.update_head_version - formula.brew(fetch: false) do |_formula, staging| + formula.brew(fetch: false, keep_tmp: args.keep_tmp?, interactive: args.interactive?) do |_formula, _staging| # For head builds, HOMEBREW_FORMULA_PREFIX should include the commit, # which is not known until after the formula has been staged. ENV["HOMEBREW_FORMULA_PREFIX"] = formula.prefix - staging.retain! if Homebrew.args.keep_tmp? formula.patch - if Homebrew.args.git? + if args.git? system "git", "init" system "git", "add", "-A" end - if Homebrew.args.interactive? + if args.interactive? ohai "Entering interactive mode" puts "Type `exit` to return and finalize the installation." puts "Install to this prefix: #{formula.prefix}" - if Homebrew.args.git? + if args.git? puts "This directory is now a git repo. Make your changes and then use:" puts " git diff | pbcopy" puts "to copy the diff to the clipboard." @@ -190,15 +190,15 @@ class Build end begin - Homebrew.install_args.parse + args = Homebrew.install_args.parse error_pipe = UNIXSocket.open(ENV["HOMEBREW_ERROR_PIPE"], &:recv_io) error_pipe.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) trap("INT", old_trap) - formula = Homebrew.args.formulae.first - options = Options.create(Homebrew.args.flags_only) - build = Build.new(formula, options) + formula = args.formulae.first + options = Options.create(args.flags_only) + build = Build.new(formula, options, args: args) build.install rescue Exception => e # rubocop:disable Lint/RescueException error_hash = JSON.parse e.to_json diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index db019bda75..fbaff98c80 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -17,12 +17,12 @@ module Cask attr_predicate :appcast? - def initialize(cask, appcast: false, download: false, + def initialize(cask, appcast: false, download: false, quarantine: nil, token_conflicts: false, online: false, strict: false, new_cask: false, commit_range: nil, command: SystemCommand) @cask = cask @appcast = appcast - @download = download + @download = Download.new(cask, quarantine: quarantine) if download @online = online @strict = strict @new_cask = new_cask diff --git a/Library/Homebrew/cask/auditor.rb b/Library/Homebrew/cask/auditor.rb index 4f209120dc..7abc4bb2c6 100644 --- a/Library/Homebrew/cask/auditor.rb +++ b/Library/Homebrew/cask/auditor.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require "cask/download" - module Cask class Auditor include Checkable @@ -51,28 +49,26 @@ module Cask private def audit_all_languages - saved_languages = MacOS.instance_variable_get(:@languages) - begin - language_blocks.keys.all?(&method(:audit_languages)) - ensure - MacOS.instance_variable_set(:@languages, saved_languages) - end + language_blocks.keys.all?(&method(:audit_languages)) end def audit_languages(languages) ohai "Auditing language: #{languages.map { |lang| "'#{lang}'" }.to_sentence}" - MacOS.instance_variable_set(:@languages, languages) - audit_cask_instance(CaskLoader.load(cask.sourcefile_path)) + localized_cask = CaskLoader.load(cask.sourcefile_path) + config = localized_cask.config + config.languages = languages + localized_cask.config = config + audit_cask_instance(localized_cask) end def audit_cask_instance(cask) - download = audit_download? && Download.new(cask, quarantine: quarantine?) audit = Audit.new(cask, appcast: audit_appcast?, online: audit_online?, strict: audit_strict?, new_cask: audit_new_cask?, token_conflicts: audit_token_conflicts?, - download: download, + download: audit_download?, + quarantine: quarantine?, commit_range: commit_range) audit.run! puts audit.summary diff --git a/Library/Homebrew/cask/cmd.rb b/Library/Homebrew/cask/cmd.rb index 139e063887..60abf6580a 100644 --- a/Library/Homebrew/cask/cmd.rb +++ b/Library/Homebrew/cask/cmd.rb @@ -65,8 +65,7 @@ module Cask option "--help", :help, false - # handled in OS::Mac - option "--language a,b,c", ->(*) {} + option "--language=a,b,c", ->(value) { Config.global.languages = value } # override default handling of --version option "--version", ->(*) { raise OptionParser::InvalidOption } @@ -180,8 +179,6 @@ module Cask end def process_options(*args) - exclude_regex = /^--#{Regexp.union(*Config::DEFAULT_DIRS.keys.map(&Regexp.public_method(:escape)))}=/ - non_options = [] if idx = args.index("--") @@ -189,15 +186,31 @@ module Cask args = args.first(idx) end + exclude_regex = /^--#{Regexp.union(*Config::DEFAULT_DIRS.keys.map(&Regexp.public_method(:escape)))}=/ cask_opts = Shellwords.shellsplit(ENV.fetch("HOMEBREW_CASK_OPTS", "")) .reject { |arg| arg.match?(exclude_regex) } all_args = cask_opts + args - remaining = all_args.select do |arg| - !process_arguments([arg]).empty? - rescue OptionParser::InvalidOption, OptionParser::MissingArgument, OptionParser::AmbiguousOption - true + i = 0 + remaining = [] + + while i < all_args.count + begin + arg = all_args[i] + + remaining << arg unless process_arguments([arg]).empty? + rescue OptionParser::MissingArgument + raise if i + 1 >= all_args.count + + args = all_args[i..(i + 1)] + process_arguments(args) + i += 1 + rescue OptionParser::InvalidOption + remaining << arg + end + + i += 1 end remaining + non_options diff --git a/Library/Homebrew/cask/cmd/doctor.rb b/Library/Homebrew/cask/cmd/doctor.rb index dc6bead70e..cc5dbe3730 100644 --- a/Library/Homebrew/cask/cmd/doctor.rb +++ b/Library/Homebrew/cask/cmd/doctor.rb @@ -2,12 +2,11 @@ require "system_config" require "cask/checkable" +require "diagnostic" module Cask class Cmd class Doctor < AbstractCommand - include Checkable - def initialize(*) super return if args.empty? @@ -15,219 +14,24 @@ module Cask raise ArgumentError, "#{self.class.command_name} does not take arguments." end - def success? - !(errors? || warnings?) - end - def summary_header "Cask's Doctor Checkup" end def run - check_software_versions - check_xattr - check_quarantine_support - check_install_location - check_staging_location - check_taps - check_load_path - check_environment_variables + success = true - puts summary unless success? - raise CaskError, "There are some problems with your setup." unless success? - end + checks = Homebrew::Diagnostic::Checks.new true + checks.cask_checks.each do |check| + out = checks.send(check) - def check_software_versions - ohai "Homebrew Version", HOMEBREW_VERSION - ohai "macOS", MacOS.full_version - ohai "SIP", self.class.check_sip - ohai "Java", SystemConfig.describe_java - end - - # This could be done by calling into Homebrew, but the situation - # where `brew doctor` is needed is precisely the situation where such - # things are less dependable. - def check_install_location - ohai "Homebrew Cask Install Location" - - locations = Dir.glob(HOMEBREW_CELLAR.join("brew-cask", "*")).reverse - if locations.empty? - puts self.class.none_string - else - locations.map do |l| - add_error "Legacy install at #{l}. Run `brew uninstall --force brew-cask`." - puts l + if out.present? + success = false + puts out end end - end - def check_staging_location - ohai "Homebrew Cask Staging Location" - - path = Caskroom.path - - if path.exist? && !path.writable? - add_error "The staging path #{user_tilde(path.to_s)} is not writable by the current user." - add_error "To fix, run \'sudo chown -R $(whoami):staff #{user_tilde(path.to_s)}'" - end - - puts user_tilde(path.to_s) - end - - def check_taps - default_tap = Tap.default_cask_tap - alt_taps = Tap.select { |t| t.cask_dir.exist? && t != default_tap } - - ohai "Homebrew Cask Taps:" - [default_tap, *alt_taps].each do |tap| - if tap.path.blank? - puts none_string - else - puts "#{tap.path} (#{cask_count_for_tap(tap)})" - end - end - end - - def check_load_path - ohai "Contents of $LOAD_PATH" - paths = $LOAD_PATH.map(&method(:user_tilde)) - - if paths.empty? - puts none_string - add_error "$LOAD_PATH is empty" - else - puts paths - end - end - - def check_environment_variables - ohai "Environment Variables" - - environment_variables = %w[ - RUBYLIB - RUBYOPT - RUBYPATH - RBENV_VERSION - CHRUBY_VERSION - GEM_HOME - GEM_PATH - BUNDLE_PATH - PATH - SHELL - HOMEBREW_CASK_OPTS - ] - - locale_variables = ENV.keys.grep(/^(?:LC_\S+|LANG|LANGUAGE)\Z/).sort - - (locale_variables + environment_variables).sort.each(&method(:render_env_var)) - end - - def check_xattr - ohai "xattr issues" - result = system_command "/usr/bin/xattr" - - if result.status.success? - puts none_string - elsif result.stderr.include? "ImportError: No module named pkg_resources" - result = system_command "/usr/bin/python", "--version" - - if result.stdout.include? "Python 2.7" - add_error "Your Python installation has a broken version of setuptools." - add_error "To fix, reinstall macOS or run 'sudo /usr/bin/python -m pip install -I setuptools'." - else - add_error "The system Python version is wrong." - add_error "To fix, run 'defaults write com.apple.versioner.python Version 2.7'." - end - elsif result.stderr.include? "pkg_resources.DistributionNotFound" - add_error "Your Python installation is unable to find xattr." - else - add_error "unknown xattr error: #{result.stderr.split("\n").last}" - end - end - - def check_quarantine_support - ohai "Gatekeeper support" - - case Quarantine.check_quarantine_support - when :quarantine_available - puts "Enabled" - when :xattr_broken - add_error "There's not a working version of xattr." - when :no_swift - add_error "Swift is not available on this system." - when :no_quarantine - add_error "This feature requires the macOS 10.10 SDK or higher." - else - onoe "Unknown support status" - end - end - - def user_tilde(path) - self.class.user_tilde(path) - end - - def cask_count_for_tap(tap) - self.class.cask_count_for_tap(tap) - end - - def none_string - self.class.none_string - end - - def render_env_var(var) - self.class.render_env_var(var) - end - - def self.check_sip - csrutil = "/usr/bin/csrutil" - return "N/A" unless File.executable?(csrutil) - - Open3.capture2(csrutil, "status") - .first - .gsub("This is an unsupported configuration, likely to break in " \ - "the future and leave your machine in an unknown state.", "") - .gsub("System Integrity Protection status: ", "") - .delete("\t\.") - .capitalize - .strip - end - - def self.locale_variables - ENV.keys.grep(/^(?:LC_\S+|LANG|LANGUAGE)\Z/).sort - end - - def self.none_string - "" - end - - def self.error_string(string = "Error") - Formatter.error("(#{string})") - end - - def self.alt_taps - Tap.select { |t| t.cask_dir.exist? && t != Tap.default_cask_tap } - end - - def self.cask_count_for_tap(tap) - cask_count = begin - tap.cask_files.count - rescue - add_error "Unable to read from Tap: #{tap.path}" - 0 - end - - "#{cask_count} #{"cask".pluralize(cask_count)}" - end - - def self.render_env_var(var) - return unless ENV.key?(var) - - var = %Q(#{var}="#{ENV[var]}") - puts user_tilde(var) - end - - def self.user_tilde(path) - path.gsub(ENV["HOME"], "~") + raise CaskError, "There are some problems with your setup." unless success end def self.help diff --git a/Library/Homebrew/cask/cmd/info.rb b/Library/Homebrew/cask/cmd/info.rb index 5669d0dcd3..49806cd131 100644 --- a/Library/Homebrew/cask/cmd/info.rb +++ b/Library/Homebrew/cask/cmd/info.rb @@ -46,7 +46,7 @@ module Cask def self.info(cask) puts get_info(cask) - ::Utils::Analytics.cask_output(cask) + ::Utils::Analytics.cask_output(cask, args: Homebrew::CLI::Args.new) end def self.title_info(cask) diff --git a/Library/Homebrew/cask/config.rb b/Library/Homebrew/cask/config.rb index bd9bd71155..74c68bc243 100644 --- a/Library/Homebrew/cask/config.rb +++ b/Library/Homebrew/cask/config.rb @@ -2,6 +2,9 @@ require "json" +require "lazy_object" +require "locale" + require "extend/hash_validator" using HashValidator @@ -24,6 +27,12 @@ module Cask screen_saverdir: "~/Library/Screen Savers", }.freeze + def self.defaults + { + languages: LazyObject.new { MacOS.languages }, + }.merge(DEFAULT_DIRS).freeze + end + def self.global @global ||= new end @@ -69,16 +78,16 @@ module Cask attr_accessor :explicit def initialize(default: nil, env: nil, explicit: {}) - @default = self.class.canonicalize(DEFAULT_DIRS.merge(default)) if default + @default = self.class.canonicalize(self.class.defaults.merge(default)) if default @env = self.class.canonicalize(env) if env @explicit = self.class.canonicalize(explicit) - @env&.assert_valid_keys!(*DEFAULT_DIRS.keys) - @explicit.assert_valid_keys!(*DEFAULT_DIRS.keys) + @env&.assert_valid_keys!(*self.class.defaults.keys) + @explicit.assert_valid_keys!(*self.class.defaults.keys) end def default - @default ||= self.class.canonicalize(DEFAULT_DIRS) + @default ||= self.class.canonicalize(self.class.defaults) end def env @@ -86,7 +95,16 @@ module Cask Shellwords.shellsplit(ENV.fetch("HOMEBREW_CASK_OPTS", "")) .select { |arg| arg.include?("=") } .map { |arg| arg.split("=", 2) } - .map { |(flag, value)| [flag.sub(/^--/, ""), value] }, + .map do |(flag, value)| + key = flag.sub(/^--/, "") + + if key == "language" + key = "languages" + value = value.split(",") + end + + [key, value] + end, ) end @@ -98,6 +116,24 @@ module Cask @manpagedir ||= HOMEBREW_PREFIX/"share/man" end + def languages + [ + *explicit[:languages], + *env[:languages], + *default[:languages], + ].uniq.select do |lang| + # Ensure all languages are valid. + Locale.parse(lang) + true + rescue Locale::ParserError + false + end + end + + def languages=(languages) + explicit[:languages] = languages + end + DEFAULT_DIRS.each_key do |dir| define_method(dir) do explicit.fetch(dir, env.fetch(dir, default.fetch(dir))) diff --git a/Library/Homebrew/cask/dsl.rb b/Library/Homebrew/cask/dsl.rb index 525f927a2f..87b83e8d3f 100644 --- a/Library/Homebrew/cask/dsl.rb +++ b/Library/Homebrew/cask/dsl.rb @@ -137,13 +137,13 @@ module Cask raise CaskInvalidError.new(cask, "No default language specified.") if @language_blocks.default.nil? - locales = MacOS.languages - .map do |language| - Locale.parse(language) - rescue Locale::ParserError - nil - end - .compact + locales = cask.config.languages + .map do |language| + Locale.parse(language) + rescue Locale::ParserError + nil + end + .compact locales.each do |locale| key = locale.detect(@language_blocks.keys) @@ -225,7 +225,7 @@ module Cask end def caskroom_path - @cask.caskroom_path + cask.caskroom_path end def staged_path diff --git a/Library/Homebrew/cli/parser.rb b/Library/Homebrew/cli/parser.rb index 13532c8991..e48cafab01 100644 --- a/Library/Homebrew/cli/parser.rb +++ b/Library/Homebrew/cli/parser.rb @@ -171,7 +171,7 @@ module Homebrew Homebrew.args = @args @args_parsed = true - @parser + @args end def global_option?(name, desc) diff --git a/Library/Homebrew/cmd/--cache.rb b/Library/Homebrew/cmd/--cache.rb index 1dd0bb2c5e..191f018c3f 100644 --- a/Library/Homebrew/cmd/--cache.rb +++ b/Library/Homebrew/cmd/--cache.rb @@ -6,6 +6,8 @@ require "cask/cmd" require "cask/cask_loader" module Homebrew + extend Fetch + module_function def __cache_args @@ -58,7 +60,7 @@ module Homebrew def print_formula_cache(name) formula = Formulary.factory name - if Fetch.fetch_bottle?(formula) + if fetch_bottle?(formula) puts formula.bottle.cached_download else puts formula.cached_download diff --git a/Library/Homebrew/cmd/--env.rb b/Library/Homebrew/cmd/--env.rb index a0c16eaafc..ad97d80d13 100644 --- a/Library/Homebrew/cmd/--env.rb +++ b/Library/Homebrew/cmd/--env.rb @@ -27,11 +27,11 @@ module Homebrew end def __env - __env_args.parse + args = __env_args.parse - ENV.activate_extensions! - ENV.deps = args.formulae if superenv? - ENV.setup_build_environment + ENV.activate_extensions!(args: args) + ENV.deps = args.formulae if superenv?(args: args) + ENV.setup_build_environment(args: args) shell = if args.plain? nil diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index d5e63b1409..03412059f9 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -5,6 +5,8 @@ require "ostruct" require "cli/parser" module Homebrew + extend DependenciesHelpers + module_function def deps_args diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index 225f570ef4..7fc4208926 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -2,6 +2,7 @@ require "diagnostic" require "cli/parser" +require "cask/caskroom" module Homebrew module_function @@ -32,11 +33,11 @@ module Homebrew inject_dump_stats!(Diagnostic::Checks, /^check_*/) if args.audit_debug? - checks = Diagnostic::Checks.new + checks = Diagnostic::Checks.new args.verbose? if args.list_checks? puts checks.all.sort - exit + return end if args.no_named? @@ -45,6 +46,7 @@ module Homebrew check_missing_deps ] methods = (checks.all.sort - slow_checks) + slow_checks + methods -= checks.cask_checks if Cask::Caskroom.casks.blank? else methods = args.named end diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb index 2f5045bccf..362af7506a 100644 --- a/Library/Homebrew/cmd/fetch.rb +++ b/Library/Homebrew/cmd/fetch.rb @@ -5,6 +5,8 @@ require "fetch" require "cli/parser" module Homebrew + extend Fetch + module_function def fetch_args @@ -62,7 +64,7 @@ module Homebrew f.print_tap_action verb: "Fetching" fetched_bottle = false - if Fetch.fetch_bottle?(f) + if fetch_bottle?(f) begin fetch_formula(f.bottle) rescue Interrupt diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb index 2daaedf90d..bcd8a71e3a 100644 --- a/Library/Homebrew/cmd/info.rb +++ b/Library/Homebrew/cmd/info.rb @@ -96,7 +96,7 @@ module Homebrew def print_info if args.no_named? if args.analytics? - Utils::Analytics.output + Utils::Analytics.output(args: args) elsif HOMEBREW_CELLAR.exist? count = Formula.racks.length puts "#{count} #{"keg".pluralize(count)}, #{HOMEBREW_CELLAR.dup.abv}" @@ -107,13 +107,13 @@ module Homebrew begin formula = Formulary.factory(f) if args.analytics? - Utils::Analytics.formula_output(formula) + Utils::Analytics.formula_output(formula, args: args) else - info_formula(formula) + info_formula(formula, args: args) end rescue FormulaUnavailableError => e if args.analytics? - Utils::Analytics.output(filter: f) + Utils::Analytics.output(filter: f, args: args) next end ofail e.message @@ -159,7 +159,7 @@ module Homebrew end end - def info_formula(f) + def info_formula(f, args:) specs = [] if stable = f.stable @@ -239,7 +239,7 @@ module Homebrew caveats = Caveats.new(f) ohai "Caveats", caveats.to_s unless caveats.empty? - Utils::Analytics.formula_output(f) + Utils::Analytics.formula_output(f, args: args) end def decorate_dependencies(dependencies) @@ -256,7 +256,7 @@ module Homebrew def decorate_requirements(requirements) req_status = requirements.map do |req| req_s = req.display_s - req.satisfied? ? pretty_installed(req_s) : pretty_uninstalled(req_s) + req.satisfied?(args: args) ? pretty_installed(req_s) : pretty_uninstalled(req_s) end req_status.join(", ") end diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index a608b72ea9..34c33d71fa 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -94,7 +94,7 @@ module Homebrew end def install - install_args.parse + args = install_args.parse args.named.each do |name| next if File.exist?(name) @@ -263,7 +263,7 @@ module Homebrew Cleanup.install_formula_clean!(f) end - check_installed_dependents + check_installed_dependents(args: args) Homebrew.messages.display_messages rescue FormulaUnreadableError, FormulaClassUnavailableError, @@ -323,13 +323,19 @@ module Homebrew f.print_tap_action build_options = f.build - fi = FormulaInstaller.new(f) + fi = FormulaInstaller.new(f, force_bottle: args.force_bottle?, include_test: args.include_test?, + build_from_source: args.build_from_source?) fi.options = build_options.used_options + fi.env = args.env + fi.force = args.force? + fi.keep_tmp = args.keep_tmp? fi.ignore_deps = args.ignore_dependencies? fi.only_deps = args.only_dependencies? fi.build_bottle = args.build_bottle? + fi.bottle_arch = args.bottle_arch fi.interactive = args.interactive? fi.git = args.git? + fi.cc = args.cc fi.prelude fi.fetch fi.install diff --git a/Library/Homebrew/cmd/postinstall.rb b/Library/Homebrew/cmd/postinstall.rb index 7539479787..89e3adf736 100644 --- a/Library/Homebrew/cmd/postinstall.rb +++ b/Library/Homebrew/cmd/postinstall.rb @@ -22,11 +22,12 @@ module Homebrew end def postinstall - postinstall_args.parse + args = postinstall_args.parse args.resolved_formulae.each do |f| ohai "Postinstalling #{f}" fi = FormulaInstaller.new(f) + fi.force = args.force? fi.post_install end end diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index 037260a2ea..7a732f7d01 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -54,7 +54,7 @@ module Homebrew end def reinstall - reinstall_args.parse + args = reinstall_args.parse FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed? @@ -67,11 +67,11 @@ module Homebrew next end Migrator.migrate_if_needed(f) - reinstall_formula(f) + reinstall_formula(f, args: args) Cleanup.install_formula_clean!(f) end - check_installed_dependents + check_installed_dependents(args: args) Homebrew.messages.display_messages diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb index 47b5f50db1..6b0d842827 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -118,7 +118,7 @@ module Homebrew if hub.empty? puts "No changes to formulae." else - hub.dump + hub.dump(updated_formula_report: !args.preinstall?) hub.reporters.each(&:migrate_tap_migration) hub.reporters.each(&:migrate_formula_rename) CacheStoreDatabase.use(:descriptions) do |db| @@ -218,6 +218,14 @@ class Reporter new_tap = tap.tap_migrations[name] @report[status.to_sym] << full_name unless new_tap when "M" + name = tap.formula_file_to_name(src) + + # Skip reporting updated formulae to speed up automatic updates. + if Homebrew.args.preinstall? + @report[:M] << name + next + end + begin formula = Formulary.factory(tap.path/src) new_version = formula.pkg_version @@ -229,7 +237,8 @@ class Reporter rescue Exception => e # rubocop:disable Lint/RescueException onoe "#{e.message}\n#{e.backtrace.join "\n"}" if Homebrew::EnvConfig.developer? end - @report[:M] << tap.formula_file_to_name(src) + + @report[:M] << name when /^R\d{0,3}/ src_full_name = tap.formula_file_to_name(src) dst_full_name = tap.formula_file_to_name(dst) @@ -422,11 +431,19 @@ class ReporterHub delegate empty?: :@hash - def dump + def dump(updated_formula_report: true) # Key Legend: Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R) dump_formula_report :A, "New Formulae" - dump_formula_report :M, "Updated Formulae" + if updated_formula_report + dump_formula_report :M, "Updated Formulae" + else + updated = select_formula(:M).count + if updated.positive? + ohai "Updated Formulae" + puts "Updated #{updated} #{"formula".pluralize(updated)}." + end + end dump_formula_report :R, "Renamed Formulae" dump_formula_report :D, "Deleted Formulae" dump_formula_report :MC, "Updated Casks" diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 66a8049165..caaf02a746 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -56,7 +56,7 @@ module Homebrew end def upgrade - upgrade_args.parse + args = upgrade_args.parse FormulaInstaller.prevent_build_flags unless DevelopmentTools.installed? @@ -109,9 +109,9 @@ module Homebrew puts formulae_upgrades.join("\n") end - upgrade_formulae(formulae_to_install) + upgrade_formulae(formulae_to_install, args: args) - check_installed_dependents + check_installed_dependents(args: args) Homebrew.messages.display_messages end diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb index 8d2bc18040..db8a89c20d 100644 --- a/Library/Homebrew/cmd/uses.rb +++ b/Library/Homebrew/cmd/uses.rb @@ -8,6 +8,8 @@ require "formula" require "cli/parser" module Homebrew + extend DependenciesHelpers + module_function def uses_args @@ -15,10 +17,10 @@ module Homebrew usage_banner <<~EOS `uses` [] - Show formulae that specify as a dependency. When given multiple - formula arguments, show the intersection of formulae that use . - By default, `uses` shows all formulae that specify as a required - or recommended dependency for their stable builds. + Show formulae that specify as a dependency (i.e. show dependents + of ). When given multiple formula arguments, show the intersection + of formulae that use . By default, `uses` shows all formulae that + specify as a required or recommended dependency for their stable builds. EOS switch "--recursive", description: "Resolve more than one level of dependencies." @@ -45,6 +47,9 @@ module Homebrew def uses uses_args.parse + odeprecated "brew uses --devel" if args.devel? + odeprecated "brew uses --HEAD" if args.HEAD? + Formulary.enable_factory_cache! used_formulae_missing = false diff --git a/Library/Homebrew/dependencies.rb b/Library/Homebrew/dependencies.rb index 512a06a09b..cd88377eed 100644 --- a/Library/Homebrew/dependencies.rb +++ b/Library/Homebrew/dependencies.rb @@ -56,9 +56,7 @@ class Requirements < DelegateClass(Set) end end -module Homebrew - module_function - +module DependenciesHelpers def argv_includes_ignores(argv) includes = [] ignores = [] @@ -81,7 +79,7 @@ module Homebrew ignores << "optional?" end - ignores << "recommended?" if Homebrew.args.skip_recommended? + ignores << "recommended?" if args.skip_recommended? [includes, ignores] end diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 373f60669f..d63d240a29 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -73,7 +73,7 @@ module Homebrew end def audit - audit_args.parse + args = audit_args.parse Homebrew.auditing = true inject_dump_stats!(FormulaAuditor, /^audit_/) if args.audit_debug? @@ -88,8 +88,8 @@ module Homebrew git = args.git? skip_style = args.skip_style? || args.no_named? - ENV.activate_extensions! - ENV.setup_build_environment + ENV.activate_extensions!(args: args) + ENV.setup_build_environment(args: args) audit_formulae = args.no_named? ? Formula : args.resolved_formulae style_files = args.formulae_paths unless skip_style @@ -320,9 +320,10 @@ module Homebrew problem "Formula name conflicts with existing core formula." end - USES_FROM_MACOS_ALLOWLIST = %w[ + PROVIDED_BY_MACOS_DEPENDS_ON_ALLOWLIST = %w[ apr apr-util + libressl openblas openssl@1.1 ].freeze @@ -383,7 +384,7 @@ module Homebrew dep_f.keg_only? && dep_f.keg_only_reason.provided_by_macos? && dep_f.keg_only_reason.applicable? && - !USES_FROM_MACOS_ALLOWLIST.include?(dep.name) + !PROVIDED_BY_MACOS_DEPENDS_ON_ALLOWLIST.include?(dep.name) new_formula_problem( "Dependency '#{dep.name}' is provided by macOS; " \ "please replace 'depends_on' with 'uses_from_macos'.", @@ -522,6 +523,30 @@ module Homebrew problem "Formulae in homebrew/core should not use `bottle :disabled`" end + def audit_github_repository_archived + return if formula.deprecated? + + user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*}) if @online + return if user.blank? + + metadata = SharedAudits.github_repo_data(user, repo) + return if metadata.nil? + + problem "GitHub repo is archived" if metadata["archived"] + end + + def audit_gitlab_repository_archived + return if formula.deprecated? + + user, repo = get_repo_data(%r{https?://gitlab\.com/([^/]+)/([^/]+)/?.*}) if @online + return if user.blank? + + metadata = SharedAudits.gitlab_repo_data(user, repo) + return if metadata.nil? + + problem "GitLab repo is archived" if metadata["archived"] + end + def audit_github_repository user, repo = get_repo_data(%r{https?://github\.com/([^/]+)/([^/]+)/?.*}) if @new_formula @@ -607,7 +632,10 @@ module Homebrew "libepoxy" => "1.5", }.freeze - GITHUB_PRERELEASE_ALLOWLIST = %w[].freeze + GITHUB_PRERELEASE_ALLOWLIST = { + "gitless" => "0.8.8", + "telegram-cli" => "1.3.1", + }.freeze # version_prefix = stable_version_string.sub(/\d+$/, "") # version_prefix = stable_version_string.split(".")[0..1].join(".") diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index 8386d76e3b..113c0bad39 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -480,7 +480,7 @@ module Homebrew update_or_add = nil Utils::Inreplace.inreplace(path) do |s| - if s.include? "bottle do" + if s.inreplace_string.include? "bottle do" update_or_add = "update" if args.keep_old? mismatches = [] diff --git a/Library/Homebrew/dev-cmd/bump-formula-pr.rb b/Library/Homebrew/dev-cmd/bump-formula-pr.rb index f306d7a594..0db722e006 100644 --- a/Library/Homebrew/dev-cmd/bump-formula-pr.rb +++ b/Library/Homebrew/dev-cmd/bump-formula-pr.rb @@ -28,8 +28,6 @@ module Homebrew URL-and-SHA-256 style specification into a tag-and-revision style specification, nor vice versa. It must use whichever style specification the formula already uses. EOS - switch "--devel", - description: "Bump the development rather than stable version. The development spec must already exist." switch "-n", "--dry-run", description: "Print what would be done rather than doing it." switch "--write", @@ -123,7 +121,7 @@ module Homebrew formula = args.formulae.first new_url = args.url - formula ||= determine_formula_from_url(new_url, args.devel?) if new_url + formula ||= determine_formula_from_url(new_url) if new_url raise FormulaUnspecifiedError unless formula tap_full_name, origin_branch, previous_branch = use_correct_linux_tap(formula) @@ -132,12 +130,8 @@ module Homebrew new_version = args.version check_all_pull_requests(formula, tap_full_name, version: new_version) if new_version - requested_spec, formula_spec = if args.devel? - devel_message = " (devel)" - [:devel, formula.devel] - else - [:stable, formula.stable] - end + requested_spec = :stable + formula_spec = formula.stable odie "#{formula}: no #{requested_spec} specification found!" unless formula_spec hash_type, old_hash = if (checksum = formula_spec.checksum) @@ -149,7 +143,7 @@ module Homebrew new_revision = args.revision new_mirrors ||= args.mirror new_mirror ||= case new_url - when requested_spec != :devel && %r{.*ftp.gnu.org/gnu.*} + when %r{.*ftp.gnu.org/gnu.*} new_url.sub "ftp.gnu.org/gnu", "ftpmirror.gnu.org" when %r{.*download.savannah.gnu.org/*} new_url.sub "download.savannah.gnu.org", "download-mirror.savannah.gnu.org" @@ -175,7 +169,7 @@ module Homebrew new_tag ||= old_tag.gsub(old_version, new_version) if new_tag == old_tag odie <<~EOS - You probably need to bump this formula manually since the new tag + You need to bump this formula manually since the new tag and old tag are both #{new_tag}. EOS end @@ -190,7 +184,7 @@ module Homebrew new_url ||= old_url.gsub(old_version, new_version) if new_url == old_url odie <<~EOS - You probably need to bump this formula manually since the new URL + You need to bump this formula manually since the new URL and old URL are both: #{new_url} EOS @@ -272,45 +266,34 @@ module Homebrew end if forced_version && new_version != "0" - case requested_spec - when :stable - replacement_pairs << if File.read(formula.path).include?("version \"#{old_formula_version}\"") - [ - old_formula_version.to_s, - new_version, - ] - elsif new_mirrors - [ - /^( +)(mirror "#{Regexp.escape(new_mirrors.last)}"\n)/m, - "\\1\\2\\1version \"#{new_version}\"\n", - ] - else - [ - /^( +)(url "#{Regexp.escape(new_url)}"\n)/m, - "\\1\\2\\1version \"#{new_version}\"\n", - ] - end - when :devel - replacement_pairs << [ - /( devel do.+?version ")#{old_formula_version}("\n.+?end\n)/m, - "\\1#{new_version}\\2", + replacement_pairs << if File.read(formula.path).include?("version \"#{old_formula_version}\"") + [ + old_formula_version.to_s, + new_version, + ] + elsif new_mirrors + [ + /^( +)(mirror "#{Regexp.escape(new_mirrors.last)}"\n)/m, + "\\1\\2\\1version \"#{new_version}\"\n", + ] + elsif new_url + [ + /^( +)(url "#{Regexp.escape(new_url)}"\n)/m, + "\\1\\2\\1version \"#{new_version}\"\n", + ] + elsif new_revision + [ + /^( {2})( +)(:revision => "#{new_revision}"\n)/m, + "\\1\\2\\3\\1version \"#{new_version}\"\n", ] end elsif forced_version && new_version == "0" - case requested_spec - when :stable - replacement_pairs << [ - /^ version "[\w.\-+]+"\n/m, - "", - ] - when :devel - replacement_pairs << [ - /( devel do.+?)^ +version "[^\n]+"\n(.+?end\n)/m, - "\\1\\2", - ] - end + replacement_pairs << [ + /^ version "[\w.\-+]+"\n/m, + "", + ] end - new_contents = inreplace_pairs(formula.path, replacement_pairs.uniq) + new_contents = inreplace_pairs(formula.path, replacement_pairs.uniq.compact) new_formula_version = formula_version(formula, requested_spec, new_contents) @@ -330,13 +313,13 @@ module Homebrew if new_formula_version < old_formula_version formula.path.atomic_write(old_contents) unless args.dry_run? odie <<~EOS - You probably need to bump this formula manually since changing the + You need to bump this formula manually since changing the version from #{old_formula_version} to #{new_formula_version} would be a downgrade. EOS elsif new_formula_version == old_formula_version formula.path.atomic_write(old_contents) unless args.dry_run? odie <<~EOS - You probably need to bump this formula manually since the new version + You need to bump this formula manually since the new version and old version are both #{new_formula_version}. EOS end @@ -362,7 +345,7 @@ module Homebrew ohai "git add #{alias_rename.first} #{alias_rename.last}" if alias_rename.present? ohai "git checkout --no-track -b #{branch} #{origin_branch}" ohai "git commit --no-edit --verbose --message='#{formula.name} " \ - "#{new_formula_version}#{devel_message}' -- #{changed_files.join(" ")}" + "#{new_formula_version}' -- #{changed_files.join(" ")}" ohai "git push --set-upstream $HUB_REMOTE #{branch}:#{branch}" ohai "git checkout --quiet #{previous_branch}" ohai "create pull request with GitHub API" @@ -379,7 +362,7 @@ module Homebrew safe_system "git", "add", *alias_rename if alias_rename.present? safe_system "git", "checkout", "--no-track", "-b", branch, origin_branch safe_system "git", "commit", "--no-edit", "--verbose", - "--message=#{formula.name} #{new_formula_version}#{devel_message}", + "--message=#{formula.name} #{new_formula_version}", "--", *changed_files safe_system "git", "push", "--set-upstream", remote_url, "#{branch}:#{branch}" safe_system "git", "checkout", "--quiet", previous_branch @@ -394,7 +377,7 @@ module Homebrew #{user_message} EOS end - pr_title = "#{formula.name} #{new_formula_version}#{devel_message}" + pr_title = "#{formula.name} #{new_formula_version}" begin url = GitHub.create_pull_request(tap_full_name, pr_title, @@ -411,7 +394,7 @@ module Homebrew end end - def determine_formula_from_url(url, is_devel) + def determine_formula_from_url(url) # Split the new URL on / and find any formulae that have the same URL # except for the last component, but don't try to match any more than the # first five components since sometimes the last component isn't the only @@ -423,14 +406,10 @@ module Homebrew base_url = /#{Regexp.escape(base_url)}/ guesses = [] Formula.each do |f| - if is_devel && f.devel && f.devel.url && f.devel.url.match(base_url) - guesses << f - elsif f.stable&.url && f.stable.url.match(base_url) - guesses << f - end + guesses << f if f.stable&.url && f.stable.url.match(base_url) end return guesses.shift if guesses.count == 1 - return unless guesses.count > 1 + return if guesses.count <= 1 odie "Couldn't guess formula for sure; could be one of these:\n#{guesses.map(&:name).join(", ")}" end @@ -525,6 +504,53 @@ module Homebrew end end + def fetch_pull_requests(query, tap_full_name, state: nil) + GitHub.issues_for_formula(query, tap_full_name: tap_full_name, state: state).select do |pr| + pr["html_url"].include?("/pull/") && + /(^|\s)#{Regexp.quote(query)}(:|\s|$)/i =~ pr["title"] + end + rescue GitHub::RateLimitExceededError => e + opoo e.message + [] + end + + def check_open_pull_requests(formula, tap_full_name) + # check for open requests + pull_requests = fetch_pull_requests(formula.name, tap_full_name, state: "open") + check_for_duplicate_pull_requests(pull_requests) + end + + def check_all_pull_requests(formula, tap_full_name, version: nil, url: nil, tag: nil) + unless version + specs = {} + specs[:tag] = tag if tag + version = Version.detect(url, specs) + end + # if we haven't already found open requests, try for an exact match across all requests + pull_requests = fetch_pull_requests("#{formula.name} #{version}", tap_full_name) if pull_requests.blank? + check_for_duplicate_pull_requests(pull_requests) + end + + def check_for_duplicate_pull_requests(pull_requests) + return if pull_requests.blank? + + duplicates_message = <<~EOS + These pull requests may be duplicates: + #{pull_requests.map { |pr| "#{pr["title"]} #{pr["html_url"]}" }.join("\n")} + EOS + error_message = "Duplicate PRs should not be opened. Use --force to override this error." + if args.force? && !args.quiet? + opoo duplicates_message + elsif !args.force? && args.quiet? + odie error_message + elsif !args.force? + odie <<~EOS + #{duplicates_message.chomp} + #{error_message} + EOS + end + end + def alias_update_pair(formula, new_formula_version) versioned_alias = formula.aliases.grep(/^.*@\d+(\.\d+)?$/).first return if versioned_alias.nil? diff --git a/Library/Homebrew/dev-cmd/create.rb b/Library/Homebrew/dev-cmd/create.rb index 379dfde470..3c22558c27 100644 --- a/Library/Homebrew/dev-cmd/create.rb +++ b/Library/Homebrew/dev-cmd/create.rb @@ -17,7 +17,7 @@ module Homebrew Homebrew will attempt to automatically derive the formula name and version, but if it fails, you'll have to make your own template. The `wget` formula serves as a simple example. For the complete API, see: - + EOS switch "--autotools", description: "Create a basic template for an Autotools-style build." @@ -63,7 +63,7 @@ module Homebrew # Create a formula from a tarball URL def create - create_args.parse + args = create_args.parse # Ensure that the cache exists so we can fetch the tarball HOMEBREW_CACHE.mkpath @@ -75,7 +75,7 @@ module Homebrew license = args.set_license tap = args.tap - fc = FormulaCreator.new + fc = FormulaCreator.new(args) fc.name = name fc.version = version fc.license = license diff --git a/Library/Homebrew/dev-cmd/mirror.rb b/Library/Homebrew/dev-cmd/mirror.rb index 25c6317363..851ad476a9 100644 --- a/Library/Homebrew/dev-cmd/mirror.rb +++ b/Library/Homebrew/dev-cmd/mirror.rb @@ -27,7 +27,7 @@ module Homebrew end def mirror - mirror_args.parse + args = mirror_args.parse bintray_org = args.bintray_org || "homebrew" bintray_repo = args.bintray_repo || "mirror" diff --git a/Library/Homebrew/dev-cmd/pr-pull.rb b/Library/Homebrew/dev-cmd/pr-pull.rb index 8d7c783e3c..6a672e4119 100644 --- a/Library/Homebrew/dev-cmd/pr-pull.rb +++ b/Library/Homebrew/dev-cmd/pr-pull.rb @@ -76,7 +76,7 @@ module Homebrew end end - def signoff!(pr, tap:) + def signoff!(pr, tap:, args:) message = Utils.popen_read "git", "-C", tap.path, "log", "-1", "--pretty=%B" subject = message.lines.first.strip @@ -95,15 +95,15 @@ module Homebrew body += "\n\n#{close_message}" unless body.include? close_message new_message = [subject, body, trailers].join("\n\n").strip - if Homebrew.args.dry_run? + if args.dry_run? puts "git commit --amend --signoff -m $message" else safe_system "git", "-C", tap.path, "commit", "--amend", "--signoff", "--allow-empty", "-q", "-m", new_message end end - def cherry_pick_pr!(pr, path: ".") - if Homebrew.args.dry_run? + def cherry_pick_pr!(pr, path: ".", args:) + if args.dry_run? puts <<~EOS git fetch --force origin +refs/pull/#{pr}/head git merge-base HEAD FETCH_HEAD @@ -120,7 +120,7 @@ module Homebrew result = Homebrew.args.verbose? ? system(*cherry_pick_args) : quiet_system(*cherry_pick_args) unless result - if Homebrew.args.resolve? + if args.resolve? odie "Cherry-pick failed: try to resolve it." else system "git", "-C", path, "cherry-pick", "--abort" @@ -138,19 +138,19 @@ module Homebrew opoo "Current branch is #{branch}: do you need to pull inside #{ref}?" end - def formulae_need_bottles?(tap, original_commit) - return if Homebrew.args.dry_run? + def formulae_need_bottles?(tap, original_commit, args:) + return if args.dry_run? changed_formulae(tap, original_commit).any? do |f| !f.bottle_unneeded? && !f.bottle_disabled? end end - def mirror_formulae(tap, original_commit, publish: true, org:, repo:) + def mirror_formulae(tap, original_commit, publish: true, org:, repo:, args:) changed_formulae(tap, original_commit).select do |f| stable_urls = [f.stable.url] + f.stable.mirrors stable_urls.grep(%r{^https://dl.bintray.com/#{org}/#{repo}/}) do |mirror_url| - if Homebrew.args.dry_run? + if args.dry_run? puts "brew mirror #{f.full_name}" else odebug "Mirroring #{mirror_url}" @@ -210,7 +210,7 @@ module Homebrew end def pr_pull - pr_pull_args.parse + args = pr_pull_args.parse bintray_user = ENV["HOMEBREW_BINTRAY_USER"] bintray_key = ENV["HOMEBREW_BINTRAY_KEY"] @@ -239,14 +239,16 @@ module Homebrew Dir.mktmpdir pr do |dir| cd dir do original_commit = Utils.popen_read("git", "-C", tap.path, "rev-parse", "HEAD").chomp - cherry_pick_pr! pr, path: tap.path - signoff! pr, tap: tap unless args.clean? + cherry_pick_pr!(pr, path: tap.path, args: args) + signoff!(pr, tap: tap, args: args) unless args.clean? unless args.no_upload? - mirror_formulae(tap, original_commit, org: bintray_org, repo: mirror_repo, publish: !args.no_publish?) + mirror_formulae(tap, original_commit, + org: bintray_org, repo: mirror_repo, publish: !args.no_publish?, + args: args) end - unless formulae_need_bottles? tap, original_commit + unless formulae_need_bottles?(tap, original_commit, args: args) ohai "Skipping artifacts for ##{pr} as the formulae don't need bottles" next end diff --git a/Library/Homebrew/dev-cmd/pr-upload.rb b/Library/Homebrew/dev-cmd/pr-upload.rb index 9453428e91..2d27d6f5a5 100644 --- a/Library/Homebrew/dev-cmd/pr-upload.rb +++ b/Library/Homebrew/dev-cmd/pr-upload.rb @@ -33,7 +33,7 @@ module Homebrew end def pr_upload - pr_upload_args.parse + args = pr_upload_args.parse bintray_org = args.bintray_org || "homebrew" bintray = Bintray.new(org: bintray_org) @@ -48,13 +48,9 @@ module Homebrew if args.dry_run? puts "brew #{bottle_args.join " "}" - else - safe_system HOMEBREW_BREW_FILE, *bottle_args - end - - if args.dry_run? puts "Upload bottles described by these JSON files to Bintray:\n #{Dir["*.json"].join("\n ")}" else + safe_system HOMEBREW_BREW_FILE, *bottle_args bintray.upload_bottle_json(Dir["*.json"], publish_package: !args.no_publish?, warn_on_error: args.warn_on_upload_failure?) diff --git a/Library/Homebrew/dev-cmd/sh.rb b/Library/Homebrew/dev-cmd/sh.rb index fc8a8117de..e1f103ec6b 100644 --- a/Library/Homebrew/dev-cmd/sh.rb +++ b/Library/Homebrew/dev-cmd/sh.rb @@ -27,16 +27,16 @@ module Homebrew end def sh - sh_args.parse + args = sh_args.parse - ENV.activate_extensions! + ENV.activate_extensions!(args: args) - if superenv? + if superenv?(args: args) ENV.set_x11_env_if_installed ENV.deps = Formula.installed.select { |f| f.keg_only? && f.opt_prefix.directory? } end - ENV.setup_build_environment - if superenv? + ENV.setup_build_environment(args: args) + if superenv?(args: args) # superenv stopped adding brew's bin but generally users will want it ENV["PATH"] = PATH.new(ENV["PATH"]).insert(1, HOMEBREW_PREFIX/"bin") end diff --git a/Library/Homebrew/dev-cmd/update-test.rb b/Library/Homebrew/dev-cmd/update-test.rb index 45fc962d87..fdf208dd49 100644 --- a/Library/Homebrew/dev-cmd/update-test.rb +++ b/Library/Homebrew/dev-cmd/update-test.rb @@ -123,6 +123,6 @@ module Homebrew end end ensure - FileUtils.rm_rf "update-test" unless Homebrew.args.keep_tmp? + FileUtils.rm_rf "update-test" unless args.keep_tmp? end end diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 6f1f01234e..a2fb1b28c5 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -7,6 +7,9 @@ require "formulary" require "version" require "development_tools" require "utils/shell" +require "system_config" +require "cask/caskroom" +require "cask/quarantine" module Homebrew module Diagnostic @@ -61,6 +64,10 @@ module Homebrew end class Checks + def initialize(verbose = true) + @verbose = verbose + end + ############# HELPERS # Finds files in `HOMEBREW_PREFIX` *and* /usr/local. # Specify paths relative to a prefix, e.g. "include/foo.h". @@ -75,6 +82,18 @@ module Homebrew list.reduce(string.dup) { |acc, elem| acc << " #{elem}\n" } .freeze end + + def user_tilde(path) + path.gsub(ENV["HOME"], "~") + end + + def none_string + "" + end + + def add_info(*args) + ohai(*args) if @verbose + end ############# END HELPERS def fatal_preinstall_checks @@ -854,9 +873,160 @@ module Homebrew EOS end + def check_cask_software_versions + add_info "Homebrew Version", HOMEBREW_VERSION + add_info "macOS", MacOS.full_version + add_info "SIP", begin + csrutil = "/usr/bin/csrutil" + if File.executable?(csrutil) + Open3.capture2(csrutil, "status") + .first + .gsub("This is an unsupported configuration, likely to break in " \ + "the future and leave your machine in an unknown state.", "") + .gsub("System Integrity Protection status: ", "") + .delete("\t\.") + .capitalize + .strip + else + "N/A" + end + end + add_info "Java", SystemConfig.describe_java + + nil + end + + def check_cask_install_location + locations = Dir.glob(HOMEBREW_CELLAR.join("brew-cask", "*")).reverse + return if locations.empty? + + locations.map do |l| + "Legacy install at #{l}. Run `brew uninstall --force brew-cask`." + end.join "\n" + end + + def check_cask_staging_location + # Skip this check when running CI since the staging path is not writable for security reasons + return if ENV["HOMEBREW_GITHUB_ACTIONS"] + + path = Cask::Caskroom.path + + add_info "Homebrew Cask Staging Location", user_tilde(path.to_s) + + return unless path.exist? && !path.writable? + + <<~EOS + The staging path #{user_tilde(path.to_s)} is not writable by the current user. + To fix, run \'sudo chown -R $(whoami):staff #{user_tilde(path.to_s)}' + EOS + end + + def check_cask_taps + default_tap = Tap.default_cask_tap + alt_taps = Tap.select { |t| t.cask_dir.exist? && t != default_tap } + + error_tap_paths = [] + + add_info "Homebrew Cask Taps:", ([default_tap, *alt_taps].map do |tap| + if tap.path.blank? + none_string + else + cask_count = begin + tap.cask_files.count + rescue + error_tap_paths << tap.path + 0 + end + + "#{tap.path} (#{cask_count} #{"cask".pluralize(cask_count)})" + end + end) + + taps = "tap".pluralize error_tap_paths.count + "Unable to read from cask #{taps}: #{error_tap_paths.to_sentence}" if error_tap_paths.present? + end + + def check_cask_load_path + paths = $LOAD_PATH.map(&method(:user_tilde)) + + add_info "$LOAD_PATHS", paths.presence || none_string + + "$LOAD_PATH is empty" if paths.blank? + end + + def check_cask_environment_variables + environment_variables = %w[ + RUBYLIB + RUBYOPT + RUBYPATH + RBENV_VERSION + CHRUBY_VERSION + GEM_HOME + GEM_PATH + BUNDLE_PATH + PATH + SHELL + HOMEBREW_CASK_OPTS + ] + + locale_variables = ENV.keys.grep(/^(?:LC_\S+|LANG|LANGUAGE)\Z/).sort + + add_info "Cask Environment Variables:", ((locale_variables + environment_variables).sort.each do |var| + next unless ENV.key?(var) + + var = %Q(#{var}="#{ENV[var]}") + user_tilde(var) + end) + end + + def check_cask_xattr + result = system_command "/usr/bin/xattr" + + return if result.status.success? + + if result.stderr.include? "ImportError: No module named pkg_resources" + result = system_command "/usr/bin/python", "--version" + + if result.stdout.include? "Python 2.7" + <<~EOS + Your Python installation has a broken version of setuptools. + To fix, reinstall macOS or run 'sudo /usr/bin/python -m pip install -I setuptools'. + EOS + else + <<~EOS + The system Python version is wrong. + To fix, run 'defaults write com.apple.versioner.python Version 2.7'. + EOS + end + elsif result.stderr.include? "pkg_resources.DistributionNotFound" + "Your Python installation is unable to find xattr." + else + "unknown xattr error: #{result.stderr.split("\n").last}" + end + end + + def check_cask_quarantine_support + case Cask::Quarantine.check_quarantine_support + when :quarantine_available + nil + when :xattr_broken + "There's not a working version of xattr." + when :no_swift + "Swift is not available on this system." + when :no_quarantine + "This feature requires the macOS 10.10 SDK or higher." + else + "Unknown support status" + end + end + def all methods.map(&:to_s).grep(/^check_/) end + + def cask_checks + all.grep(/^check_cask_/) + end end end end diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb index a3a2ecd088..f35099a448 100644 --- a/Library/Homebrew/extend/ENV.rb +++ b/Library/Homebrew/extend/ENV.rb @@ -5,24 +5,24 @@ require "extend/ENV/shared" require "extend/ENV/std" require "extend/ENV/super" -def superenv? - Homebrew.args.env != "std" && Superenv.bin +def superenv?(args:) + args&.env != "std" && Superenv.bin end module EnvActivation - def activate_extensions! - if superenv? + def activate_extensions!(args:) + if superenv?(args: args) extend(Superenv) else extend(Stdenv) end end - def with_build_environment + def with_build_environment(args:) old_env = to_hash.dup tmp_env = to_hash.dup.extend(EnvActivation) - tmp_env.activate_extensions! - tmp_env.setup_build_environment + tmp_env.activate_extensions!(args: args) + tmp_env.setup_build_environment(args: args) replace(tmp_env) yield ensure diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb index 6c995e8f16..b3bae473d4 100644 --- a/Library/Homebrew/extend/ENV/shared.rb +++ b/Library/Homebrew/extend/ENV/shared.rb @@ -29,8 +29,9 @@ module SharedEnvExtension ].freeze # @private - def setup_build_environment(formula = nil) + def setup_build_environment(formula = nil, args: nil) @formula = formula + @args = args reset end @@ -162,7 +163,7 @@ module SharedEnvExtension # ENV.append_to_cflags "-I ./missing/includes" # end def compiler - @compiler ||= if (cc = Homebrew.args.cc) + @compiler ||= if (cc = @args.cc) warn_about_non_apple_gcc($&) if cc =~ GNU_GCC_REGEXP fetch_compiler(cc, "--cc") elsif (cc = homebrew_cc) @@ -254,8 +255,8 @@ module SharedEnvExtension # @private def effective_arch - if Homebrew.args.build_bottle? && Homebrew.args.bottle_arch - Homebrew.args.bottle_arch.to_sym + if @args&.build_bottle? && @args&.bottle_arch + @args.bottle_arch.to_sym else Hardware.oldest_cpu end diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb index 41c0861f18..6023114635 100644 --- a/Library/Homebrew/extend/ENV/std.rb +++ b/Library/Homebrew/extend/ENV/std.rb @@ -11,7 +11,7 @@ module Stdenv SAFE_CFLAGS_FLAGS = "-w -pipe" # @private - def setup_build_environment(formula = nil) + def setup_build_environment(formula = nil, args: nil) super self["HOMEBREW_ENV"] = "std" @@ -110,14 +110,14 @@ module Stdenv end def clang - super + super() replace_in_cflags(/-Xarch_#{Hardware::CPU.arch_32_bit} (-march=\S*)/, '\1') map = Hardware::CPU.optimization_flags.dup if DevelopmentTools.clang_build_version < 700 # Clang mistakenly enables AES-NI on plain Nehalem map[:nehalem] = "-march=nehalem -Xclang -target-feature -Xclang -aes" end - set_cpu_cflags map + set_cpu_cflags(map) end def m64 @@ -186,7 +186,7 @@ module Stdenv # @private def set_cpu_cflags(map = Hardware::CPU.optimization_flags) # rubocop:disable Naming/AccessorMethodName - set_cpu_flags CC_FLAG_VARS, map + set_cpu_flags(CC_FLAG_VARS, map) end def make_jobs diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index 676da204c8..3fc3be8f3b 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -36,7 +36,7 @@ module Superenv end # @private - def setup_build_environment(formula = nil) + def setup_build_environment(formula = nil, args: nil) super send(compiler) diff --git a/Library/Homebrew/extend/os/linux/extend/ENV/shared.rb b/Library/Homebrew/extend/os/linux/extend/ENV/shared.rb index a7eb3b9671..e70ce40cce 100644 --- a/Library/Homebrew/extend/os/linux/extend/ENV/shared.rb +++ b/Library/Homebrew/extend/os/linux/extend/ENV/shared.rb @@ -3,9 +3,9 @@ module SharedEnvExtension # @private def effective_arch - if Homebrew.args.build_bottle? && Homebrew.args.bottle_arch - Homebrew.args.bottle_arch.to_sym - elsif Homebrew.args.build_bottle? + if @args&.build_bottle? && @args&.bottle_arch + @args.bottle_arch.to_sym + elsif @args&.build_bottle? Hardware.oldest_cpu else :native diff --git a/Library/Homebrew/extend/os/linux/extend/ENV/std.rb b/Library/Homebrew/extend/os/linux/extend/ENV/std.rb index af3f462eee..ecaafb74a9 100644 --- a/Library/Homebrew/extend/os/linux/extend/ENV/std.rb +++ b/Library/Homebrew/extend/os/linux/extend/ENV/std.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true module Stdenv - def setup_build_environment(formula = nil) - generic_setup_build_environment(formula) + def setup_build_environment(formula = nil, args: nil) + generic_setup_build_environment(formula, args: args) prepend_path "CPATH", HOMEBREW_PREFIX/"include" prepend_path "LIBRARY_PATH", HOMEBREW_PREFIX/"lib" diff --git a/Library/Homebrew/extend/os/linux/extend/ENV/super.rb b/Library/Homebrew/extend/os/linux/extend/ENV/super.rb index fe11864c4c..45a92d6a39 100644 --- a/Library/Homebrew/extend/os/linux/extend/ENV/super.rb +++ b/Library/Homebrew/extend/os/linux/extend/ENV/super.rb @@ -7,8 +7,8 @@ module Superenv end # @private - def setup_build_environment(formula = nil) - generic_setup_build_environment(formula) + def setup_build_environment(formula = nil, args: nil) + generic_setup_build_environment(formula, args: args) self["HOMEBREW_OPTIMIZATION_LEVEL"] = "O2" self["HOMEBREW_DYNAMIC_LINKER"] = determine_dynamic_linker_path self["HOMEBREW_RPATH_PATHS"] = determine_rpath_paths(formula) diff --git a/Library/Homebrew/extend/os/linux/formula.rb b/Library/Homebrew/extend/os/linux/formula.rb index 12b28db2a0..e1562909aa 100644 --- a/Library/Homebrew/extend/os/linux/formula.rb +++ b/Library/Homebrew/extend/os/linux/formula.rb @@ -7,23 +7,6 @@ class Formula "#{name}.so#{"." unless version.nil?}#{version}" end - undef allowed_missing_lib? - def allowed_missing_lib?(lib) - # lib: Full path to the missing library - # Ex.: /home/linuxbrew/.linuxbrew/lib/libsomething.so.1 - # x - Name of or a pattern for a library, linkage to which is allowed to be missing. - # Ex. 1: "libONE.so.1" - # Ex. 2: %r{(libONE|libTWO)\.so} - self.class.allowed_missing_libraries.any? do |x| - case x - when Regexp - x.match? lib - when String - lib.include? x - end - end - end - class << self undef on_linux @@ -31,14 +14,15 @@ class Formula yield end - def ignore_missing_libraries(*libs) - libs.flatten! - allowed_missing_libraries.merge(libs) - end + undef ignore_missing_libraries - # @private - def allowed_missing_libraries - @allowed_missing_libraries ||= Set.new + def ignore_missing_libraries(*libs) + libraries = libs.flatten + if libraries.any? { |x| !x.is_a?(String) && !x.is_a?(Regexp) } + raise FormulaSpecificationError, "#{__method__} can handle Strings and Regular Expressions only" + end + + allowed_missing_libraries.merge(libraries) end end end diff --git a/Library/Homebrew/extend/os/linux/keg_relocate.rb b/Library/Homebrew/extend/os/linux/keg_relocate.rb index a707898c03..2866373b91 100644 --- a/Library/Homebrew/extend/os/linux/keg_relocate.rb +++ b/Library/Homebrew/extend/os/linux/keg_relocate.rb @@ -20,28 +20,22 @@ class Keg patchelf = DevelopmentTools.locate "patchelf" odie "Could not locate patchelf, please: brew install patchelf." if patchelf.nil? + cmd = [patchelf] - cmd_rpath = [patchelf, "--print-rpath", file] - old_rpath = Utils.popen_read(*cmd_rpath, err: :out).strip + old_rpath = file.rpath + new_rpath = if old_rpath + rpath = old_rpath.split(":") + .map { |x| x.sub(old_prefix, new_prefix) } + .select { |x| x.start_with?(new_prefix, "$ORIGIN") } - # patchelf requires that the ELF file have a .dynstr section. - # Skip ELF files that do not have a .dynstr section. - return if ["cannot find section .dynstr", "strange: no string table"].include?(old_rpath) + lib_path = "#{new_prefix}/lib" + rpath << lib_path unless rpath.include? lib_path + new_rpath = rpath.join(":") + cmd.push "--force-rpath", "--set-rpath", new_rpath - unless $CHILD_STATUS.success? - raise ErrorDuringExecution.new(cmd_rpath, status: $CHILD_STATUS, output: [[:stderr, old_rpath]]) + new_rpath end - rpath = old_rpath - .split(":") - .map { |x| x.sub(old_prefix, new_prefix) } - .select { |x| x.start_with?(new_prefix, "$ORIGIN") } - - lib_path = "#{new_prefix}/lib" - rpath << lib_path unless rpath.include? lib_path - new_rpath = rpath.join(":") - cmd = [patchelf, "--force-rpath", "--set-rpath", new_rpath] - old_interpreter = file.interpreter new_interpreter = if old_interpreter.nil? nil diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/std.rb b/Library/Homebrew/extend/os/mac/extend/ENV/std.rb index 11287c3167..b59af01949 100644 --- a/Library/Homebrew/extend/os/mac/extend/ENV/std.rb +++ b/Library/Homebrew/extend/os/mac/extend/ENV/std.rb @@ -32,8 +32,8 @@ module Stdenv append "CFLAGS", "-I#{MacOS::X11.include}" unless MacOS::CLT.installed? end - def setup_build_environment(formula = nil) - generic_setup_build_environment formula + def setup_build_environment(formula = nil, args: nil) + generic_setup_build_environment(formula, args: args) # sed is strict, and errors out when it encounters files with # mixed character sets diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb index f1b92e5ce2..424d76c26f 100644 --- a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb +++ b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb @@ -106,7 +106,7 @@ module Superenv end # @private - def setup_build_environment(formula = nil) + def setup_build_environment(formula = nil, args: nil) sdk = formula ? MacOS.sdk_for_formula(formula) : MacOS.sdk if MacOS.sdk_root_needed? || sdk&.source == :xcode self["HOMEBREW_SDKROOT"] = sdk.path @@ -119,7 +119,7 @@ module Superenv self["HOMEBREW_SDKROOT"] = nil self["HOMEBREW_DEVELOPER_DIR"] = nil end - generic_setup_build_environment(formula) + generic_setup_build_environment(formula, args: args) # Filter out symbols known not to be defined since GNU Autotools can't # reliably figure this out with Xcode 8 and above. diff --git a/Library/Homebrew/extend/string.rb b/Library/Homebrew/extend/string.rb index 903168af60..90f3134f9d 100644 --- a/Library/Homebrew/extend/string.rb +++ b/Library/Homebrew/extend/string.rb @@ -3,22 +3,27 @@ require "active_support/core_ext/object/blank" # Used by the inreplace function (in `utils.rb`). -module StringInreplaceExtension - attr_accessor :errors +class StringInreplaceExtension + attr_accessor :errors, :inreplace_string + + def initialize(str) + @inreplace_string = str + @errors = [] + end def self.extended(str) str.errors = [] end def sub!(before, after) - result = super + result = inreplace_string.sub!(before, after) errors << "expected replacement of #{before.inspect} with #{after.inspect}" unless result result end # Warn if nothing was replaced def gsub!(before, after, audit_result = true) - result = super(before, after) + result = inreplace_string.gsub!(before, after) errors << "expected replacement of #{before.inspect} with #{after.inspect}" if audit_result && result.nil? result end @@ -43,6 +48,6 @@ module StringInreplaceExtension # Finds the specified variable def get_make_var(flag) - self[/^#{Regexp.escape(flag)}[ \t]*[\\?+:!]?=[ \t]*((?:.*\\\n)*.*)$/, 1] + inreplace_string[/^#{Regexp.escape(flag)}[ \t]*[\\?+:!]?=[ \t]*((?:.*\\\n)*.*)$/, 1] end end diff --git a/Library/Homebrew/fetch.rb b/Library/Homebrew/fetch.rb index 6564aaf955..4db267aa72 100644 --- a/Library/Homebrew/fetch.rb +++ b/Library/Homebrew/fetch.rb @@ -2,12 +2,10 @@ module Homebrew module Fetch - module_function - def fetch_bottle?(f) - return true if Homebrew.args.force_bottle? && f.bottle + return true if args.force_bottle? && f.bottle return false unless f.bottle && f.pour_bottle? - return false if Homebrew.args.build_formula_from_source?(f) + return false if args.build_formula_from_source?(f) return false unless f.bottle.compatible_cellar? true diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 06084522f6..a259e3ef0d 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1131,13 +1131,6 @@ class Formula end end - # Whether this {Formula} is allowed to have a broken linkage to specified library. - # Defaults to false. - # @return [Boolean] - def allowed_missing_lib?(*) - false - end - # Whether this {Formula} is deprecated (i.e. warns on installation). # Defaults to false. # @method deprecated? @@ -1170,11 +1163,11 @@ class Formula # yields |self,staging| with current working directory set to the uncompressed tarball # where staging is a Mktemp staging context # @private - def brew(fetch: true) + def brew(fetch: true, keep_tmp: false, interactive: false) @prefix_returns_versioned_prefix = true active_spec.fetch if fetch - stage do |staging| - staging.retain! if Homebrew.args.keep_tmp? + stage(interactive: interactive) do |staging| + staging.retain! if keep_tmp prepare_patches fetch_patches if fetch @@ -1182,7 +1175,7 @@ class Formula begin yield self, staging rescue - staging.retain! if Homebrew.args.interactive? || Homebrew.args.debug? + staging.retain! if interactive || Homebrew.args.debug? raise ensure cp Dir["config.log", "CMakeCache.txt"], logs @@ -1799,7 +1792,7 @@ class Formula end # @private - def run_test + def run_test(keep_tmp: false) @prefix_returns_versioned_prefix = true test_env = { @@ -1815,7 +1808,7 @@ class Formula Utils.set_git_name_email! mktemp("#{name}-test") do |staging| - staging.retain! if Homebrew.args.keep_tmp? + staging.retain! if keep_tmp @testpath = staging.tmpdir test_env[:HOME] = @testpath setup_home @testpath @@ -2141,7 +2134,7 @@ class Formula } end - def stage + def stage(interactive: false) active_spec.stage do |staging| @source_modified_time = active_spec.source_modified_time @buildpath = Pathname.pwd @@ -2152,7 +2145,7 @@ class Formula HOMEBREW_PATH: nil, } - unless Homebrew.args.interactive? + unless interactive stage_env[:HOME] = env_home stage_env.merge!(common_stage_test_env) end @@ -2763,6 +2756,15 @@ class Formula def link_overwrite_paths @link_overwrite_paths ||= Set.new end + + def ignore_missing_libraries(*) + raise FormulaSpecificationError, "#{__method__} is available on Linux only" + end + + # @private + def allowed_missing_libraries + @allowed_missing_libraries ||= Set.new + end end end diff --git a/Library/Homebrew/formula_creator.rb b/Library/Homebrew/formula_creator.rb index 81eec27d0e..97b8b5e64b 100644 --- a/Library/Homebrew/formula_creator.rb +++ b/Library/Homebrew/formula_creator.rb @@ -5,9 +5,13 @@ require "erb" module Homebrew class FormulaCreator - attr_reader :url, :sha256, :desc, :homepage + attr_reader :args, :url, :sha256, :desc, :homepage attr_accessor :name, :version, :tap, :path, :mode, :license + def initialize(args) + @args = args + end + def url=(url) @url = url path = Pathname.new(url) @@ -41,11 +45,11 @@ module Homebrew end def fetch? - !Homebrew.args.no_fetch? + !args.no_fetch? end def head? - @head || Homebrew.args.HEAD? + @head || args.HEAD? end def generate! diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 2ce2787f0c..5ac720ebee 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -38,25 +38,31 @@ class FormulaInstaller end attr_reader :formula - attr_accessor :options, :build_bottle, :installed_as_dependency, :installed_on_request, :link_keg + attr_accessor :cc, :env, :options, :build_bottle, :bottle_arch, + :installed_as_dependency, :installed_on_request, :link_keg mode_attr_accessor :show_summary_heading, :show_header mode_attr_accessor :build_from_source, :force_bottle, :include_test - mode_attr_accessor :ignore_deps, :only_deps, :interactive, :git + mode_attr_accessor :ignore_deps, :only_deps, :interactive, :git, :force, :keep_tmp mode_attr_accessor :verbose, :debug, :quiet - def initialize(formula) + def initialize(formula, force_bottle: false, include_test: false, build_from_source: false, cc: nil) @formula = formula + @env = nil + @force = false + @keep_tmp = false @link_keg = !formula.keg_only? @show_header = false @ignore_deps = false @only_deps = false - @build_from_source = Homebrew.args.build_from_source? + @build_from_source = build_from_source @build_bottle = false - @force_bottle = Homebrew.args.force_bottle? - @include_test = Homebrew.args.include_test? + @bottle_arch = nil + @force_bottle = force_bottle + @include_test = include_test @interactive = false @git = false + @cc = cc @verbose = Homebrew.args.verbose? @quiet = Homebrew.args.quiet? @debug = Homebrew.args.debug? @@ -108,7 +114,7 @@ class FormulaInstaller return false if !formula.bottled? && !formula.local_bottle_path return true if force_bottle? return false if build_from_source? || build_bottle? || interactive? - return false if Homebrew.args.cc + return false if cc return false unless options.empty? return false if formula.bottle_disabled? @@ -280,7 +286,7 @@ class FormulaInstaller return if only_deps? - if build_bottle? && (arch = Homebrew.args.bottle_arch) && !Hardware::CPU.optimization_flags.include?(arch.to_sym) + if build_bottle? && (arch = bottle_arch) && !Hardware::CPU.optimization_flags.include?(arch.to_sym) raise "Unrecognized architecture for --bottle-arch: #{arch}" end @@ -367,7 +373,7 @@ class FormulaInstaller end def check_conflicts - return if Homebrew.args.force? + return if force? conflicts = formula.conflicts.select do |c| f = Formulary.factory(c.name) @@ -469,7 +475,7 @@ class FormulaInstaller if req.prune_from_option?(build) Requirement.prune - elsif req.satisfied? + elsif req.satisfied?(args: Homebrew.args) Requirement.prune elsif (req.build? || req.test?) && !keep_build_test Requirement.prune @@ -576,11 +582,12 @@ class FormulaInstaller def fetch_dependency(dep) df = dep.to_formula - fi = FormulaInstaller.new(df) + fi = FormulaInstaller.new(df, force_bottle: false, + include_test: Homebrew.args.include_formula_test_deps?(df), + build_from_source: Homebrew.args.build_formula_from_source?(df)) - fi.build_from_source = Homebrew.args.build_formula_from_source?(df) - fi.force_bottle = false - fi.include_test = Homebrew.args.include_formula_test_deps?(df) + fi.force = force? + fi.keep_tmp = keep_tmp? fi.verbose = verbose? fi.quiet = quiet? fi.debug = debug? @@ -616,14 +623,16 @@ class FormulaInstaller EOS end - fi = FormulaInstaller.new(df) + fi = FormulaInstaller.new(df, force_bottle: false, + include_test: Homebrew.args.include_formula_test_deps?(df), + build_from_source: Homebrew.args.build_formula_from_source?(df)) + fi.options |= tab.used_options fi.options |= Tab.remap_deprecated_options(df.deprecated_options, dep.options) fi.options |= inherited_options fi.options &= df.options - fi.build_from_source = Homebrew.args.build_formula_from_source?(df) - fi.force_bottle = false - fi.include_test = Homebrew.args.include_formula_test_deps?(df) + fi.force = force? + fi.keep_tmp = keep_tmp? fi.verbose = verbose? fi.quiet = quiet? fi.debug = debug? @@ -732,18 +741,18 @@ class FormulaInstaller if build_bottle? args << "--build-bottle" - args << "--bottle-arch=#{Homebrew.args.bottle_arch}" if Homebrew.args.bottle_arch + args << "--bottle-arch=#{bottle_arch}" if bottle_arch end args << "--git" if git? args << "--interactive" if interactive? args << "--verbose" if verbose? args << "--debug" if debug? - args << "--cc=#{Homebrew.args.cc}" if Homebrew.args.cc - args << "--keep-tmp" if Homebrew.args.keep_tmp? + args << "--cc=#{cc}" if cc + args << "--keep-tmp" if keep_tmp? - if Homebrew.args.env.present? - args << "--env=#{Homebrew.args.env}" + if env.present? + args << "--env=#{env}" elsif formula.env.std? || formula.deps.select(&:build?).any? { |d| d.name == "scons" } args << "--env=std" end @@ -789,7 +798,7 @@ class FormulaInstaller sandbox = Sandbox.new formula.logs.mkpath sandbox.record_log(formula.logs/"build.sandbox.log") - sandbox.allow_write_path(ENV["HOME"]) if Homebrew.args.interactive? + sandbox.allow_write_path(ENV["HOME"]) if interactive? sandbox.allow_write_temp_and_cache sandbox.allow_write_log(formula) sandbox.allow_cvs diff --git a/Library/Homebrew/linkage_checker.rb b/Library/Homebrew/linkage_checker.rb index a0dbfeadef..65263161d9 100644 --- a/Library/Homebrew/linkage_checker.rb +++ b/Library/Homebrew/linkage_checker.rb @@ -15,6 +15,8 @@ class LinkageChecker @system_dylibs = Set.new @broken_dylibs = Set.new + @unexpected_broken_dylibs = nil + @unexpected_present_dylibs = nil @variable_dylibs = Set.new @brewed_dylibs = Hash.new { |h, k| h[k] = Set.new } @reverse_links = Hash.new { |h, k| h[k] = Set.new } @@ -56,32 +58,63 @@ class LinkageChecker def display_test_output(puts_output: true) display_items "Missing libraries", broken_dylibs_with_expectations, puts_output: puts_output + display_items "Unused missing linkage information", unexpected_present_dylibs, puts_output: puts_output display_items "Broken dependencies", @broken_deps, puts_output: puts_output display_items "Unwanted system libraries", @unwanted_system_dylibs, puts_output: puts_output display_items "Conflicting libraries", @version_conflict_deps, puts_output: puts_output if @broken_dylibs.empty? puts "No broken library linkage detected" - elsif unexpected_broken_libs.empty? + elsif unexpected_broken_dylibs.empty? puts "No unexpected broken library linkage detected." else - puts "Broken library linkage detected" + puts "Unexpected missing library linkage detected" end + + puts "Unexpected non-missing linkage detected" if unexpected_present_dylibs.present? end def broken_library_linkage? issues = [@broken_deps, @unwanted_system_dylibs, @version_conflict_deps] - [issues, unexpected_broken_libs].flatten.any?(&:present?) + [issues, unexpected_broken_dylibs, unexpected_present_dylibs].flatten.any?(&:present?) end - def unexpected_broken_libs - @broken_dylibs.reject { |lib| @formula.allowed_missing_lib? lib } + def unexpected_broken_dylibs + return @unexpected_broken_dylibs if @unexpected_broken_dylibs + + @unexpected_broken_dylibs = @broken_dylibs.reject do |broken_lib| + @formula.class.allowed_missing_libraries.any? do |allowed_missing_lib| + case allowed_missing_lib + when Regexp + allowed_missing_lib.match? broken_lib + when String + broken_lib.include? allowed_missing_lib + end + end + end + end + + def unexpected_present_dylibs + @unexpected_present_dylibs ||= @formula.class.allowed_missing_libraries.reject do |allowed_missing_lib| + @broken_dylibs.any? do |broken_lib| + case allowed_missing_lib + when Regexp + allowed_missing_lib.match? broken_lib + when String + broken_lib.include? allowed_missing_lib + end + end + end end def broken_dylibs_with_expectations output = {} - @broken_dylibs.each do |lib| - output[lib] = (unexpected_broken_libs.include? lib) ? ["unexpected"] : ["expected"] + @broken_dylibs.each do |broken_lib| + output[broken_lib] = if unexpected_broken_dylibs.include? broken_lib + ["unexpected"] + else + ["expected"] + end end output end @@ -275,7 +308,11 @@ class LinkageChecker end else things.sort.each do |item| - output += "\n #{item}" + output += if item.is_a? Regexp + "\n #{item.inspect}" + else + "\n #{item}" + end end end puts output if puts_output diff --git a/Library/Homebrew/os/linux/elf.rb b/Library/Homebrew/os/linux/elf.rb index 2730d1da41..06baa117f1 100644 --- a/Library/Homebrew/os/linux/elf.rb +++ b/Library/Homebrew/os/linux/elf.rb @@ -1,7 +1,45 @@ # frozen_string_literal: true +if HOMEBREW_PATCHELF_RB + require "utils/gems" + Homebrew.install_bundler_gems! + require "patchelf" + + module PatchELF + refine Patcher do + # patchelf.rb throws exception when the requested entry is missing in the ELF file. + # We prefer an API that returns nil. + + def rpath + super + rescue PatchELF::MissingTagError + nil + end + + def runpath + super + rescue PatchELF::MissingTagError + nil + end + + def soname + super + rescue PatchELF::MissingTagError + nil + end + + def interpreter + super + rescue PatchELF::MissingSegmentError + nil + end + end + end +end + # @see https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header module ELFShim + using PatchELF if HOMEBREW_PATCHELF_RB MAGIC_NUMBER_OFFSET = 0 MAGIC_NUMBER_ASCII = "\x7fELF" @@ -68,16 +106,21 @@ module ELFShim elf_type == :executable end + def rpath + return @rpath if defined? @rpath + + @rpath = if HOMEBREW_PATCHELF_RB + rpath_using_patchelf_rb + else + rpath_using_patchelf + end + end + def interpreter return @interpreter if defined? @interpreter @interpreter = if HOMEBREW_PATCHELF_RB - begin - patchelf_patcher.interpreter - rescue PatchELF::PatchError => e - opoo e unless e.to_s.start_with? "No interpreter found" - nil - end + patchelf_patcher.interpreter elsif (patchelf = DevelopmentTools.locate "patchelf") interp = Utils.popen_read(patchelf, "--print-interpreter", to_s, err: :out).strip $CHILD_STATUS.success? ? interp : nil @@ -132,6 +175,8 @@ module ELFShim private def needed_libraries(path) + return [nil, []] unless path.dynamic_elf? + if HOMEBREW_PATCHELF_RB needed_libraries_using_patchelf_rb path elsif DevelopmentTools.locate "readelf" @@ -147,26 +192,10 @@ module ELFShim def needed_libraries_using_patchelf_rb(path) patcher = path.patchelf_patcher - return [nil, []] unless patcher - - soname = begin - patcher.soname - rescue PatchELF::PatchError => e - opoo e unless e.to_s.start_with? "Entry DT_SONAME not found, not a shared library?" - nil - end - needed = begin - patcher.needed - rescue PatchELF::PatchError => e - opoo e - [] - end - [soname, needed] + [patcher.soname, patcher.needed] end def needed_libraries_using_patchelf(path) - return [nil, []] unless path.dynamic_elf? - patchelf = DevelopmentTools.locate "patchelf" if path.dylib? command = [patchelf, "--print-soname", path.expand_path.to_s] @@ -198,14 +227,32 @@ module ELFShim end end + def rpath_using_patchelf_rb + patchelf_patcher.runpath || patchelf_patcher.rpath + end + + def rpath_using_patchelf + patchelf = DevelopmentTools.locate "patchelf" + odie "Could not locate patchelf, please: brew install patchelf." if patchelf.nil? + + cmd_rpath = [patchelf, "--print-rpath", to_s] + rpath = Utils.popen_read(*cmd_rpath, err: :out).strip + + # patchelf requires that the ELF file have a .dynstr section. + # Skip ELF files that do not have a .dynstr section. + return if ["cannot find section .dynstr", "strange: no string table"].include?(rpath) + + unless $CHILD_STATUS.success? + raise ErrorDuringExecution.new(cmd_rpath, status: $CHILD_STATUS, output: [[:stderr, rpath]]) + end + + rpath unless rpath.blank? + end + def patchelf_patcher return unless HOMEBREW_PATCHELF_RB - @patchelf_patcher ||= begin - Homebrew.install_bundler_gems! - require "patchelf" - PatchELF::Patcher.new to_s, logging: false - end + @patchelf_patcher ||= PatchELF::Patcher.new to_s, logging: false end def metadata diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index 8a854ab01f..b44a47bcc4 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -68,21 +68,7 @@ module OS end os_langs = os_langs.scan(/[^ \n"(),]+/) - @languages = [ - *Homebrew.args.value("language")&.split(","), - *ENV["HOMEBREW_LANGUAGES"]&.split(","), - *os_langs, - ].uniq - - # Ensure all languages are valid - @languages.select! do |lang| - Locale.parse(lang) - true - rescue Locale::ParserError - false - end - - @languages + @languages = os_langs end def language diff --git a/Library/Homebrew/reinstall.rb b/Library/Homebrew/reinstall.rb index be7f9c847e..b7916a94a7 100644 --- a/Library/Homebrew/reinstall.rb +++ b/Library/Homebrew/reinstall.rb @@ -7,7 +7,7 @@ require "messages" module Homebrew module_function - def reinstall_formula(f, build_from_source: false) + def reinstall_formula(f, build_from_source: false, args:) return if args.dry_run? if f.opt_prefix.directory? @@ -23,11 +23,14 @@ module Homebrew options |= f.build.used_options options &= f.options - fi = FormulaInstaller.new(f) + fi = FormulaInstaller.new(f, force_bottle: args.force_bottle?, include_test: args.include_test?, + build_from_source: args.build_from_source?) fi.options = options - fi.build_bottle = Homebrew.args.build_bottle? - fi.interactive = Homebrew.args.interactive? - fi.git = Homebrew.args.git? + fi.force = args.force? + fi.keep_tmp = args.keep_tmp? + fi.build_bottle = args.build_bottle? + fi.interactive = args.interactive? + fi.git = args.git? fi.link_keg ||= keg_was_linked if keg_had_linked_opt fi.build_from_source = true if build_from_source if tab diff --git a/Library/Homebrew/requirement.rb b/Library/Homebrew/requirement.rb index f593ca5753..0c42c3721a 100644 --- a/Library/Homebrew/requirement.rb +++ b/Library/Homebrew/requirement.rb @@ -53,16 +53,15 @@ class Requirement # Overriding {#satisfied?} is unsupported. # Pass a block or boolean to the satisfy DSL method instead. - def satisfied? + def satisfied?(args: nil) satisfy = self.class.satisfy return true unless satisfy - @satisfied_result = satisfy.yielder { |p| instance_eval(&p) } + @satisfied_result = satisfy.yielder(args: args) { |p| instance_eval(&p) } return false unless @satisfied_result true end - alias installed? satisfied? # Overriding {#fatal?} is unsupported. # Pass a boolean to the fatal DSL method instead. @@ -82,8 +81,8 @@ class Requirement # Overriding {#modify_build_environment} is unsupported. # Pass a block to the env DSL method instead. - def modify_build_environment - satisfied? + def modify_build_environment(args:) + satisfied?(args: args) instance_eval(&env_proc) if env_proc # XXX If the satisfy block returns a Pathname, then make sure that it @@ -182,12 +181,12 @@ class Requirement @proc = block end - def yielder + def yielder(args:) if instance_variable_defined?(:@satisfied) @satisfied elsif @options[:build_env] require "extend/ENV" - ENV.with_build_environment { yield @proc } + ENV.with_build_environment(args: args) { yield @proc } else yield @proc end diff --git a/Library/Homebrew/sorbet/files.yaml b/Library/Homebrew/sorbet/files.yaml index e970dab466..a1adf058a8 100644 --- a/Library/Homebrew/sorbet/files.yaml +++ b/Library/Homebrew/sorbet/files.yaml @@ -82,7 +82,6 @@ false: - ./cask/verify.rb - ./caveats.rb - ./cleanup.rb - - ./cli/args.rb - ./cli/parser.rb - ./cmd/--cache.rb - ./cmd/--cellar.rb @@ -212,11 +211,8 @@ false: - ./formula_versions.rb - ./formulary.rb - ./global.rb - - ./help.rb - ./install.rb - ./keg.rb - - ./language/go.rb - - ./language/java.rb - ./language/node.rb - ./language/python.rb - ./linkage_checker.rb @@ -460,13 +456,8 @@ false: - ./cask/dsl/version.rb - ./cask/topological_hash.rb - ./cmd/cask.rb - - ./compat/extend/nil.rb - - ./compat/extend/string.rb - - ./compat/formula.rb - ./compat/language/haskell.rb - ./compat/language/java.rb - - ./compat/os/mac.rb - - ./dependable.rb - ./extend/git_repository.rb - ./extend/hash_validator.rb - ./extend/io.rb @@ -484,12 +475,7 @@ false: - ./extend/os/mac/requirements/osxfuse_requirement.rb - ./extend/predicable.rb - ./extend/string.rb - - ./fetch.rb - - ./formula_pin.rb - - ./hardware.rb - ./keg_relocate.rb - - ./language/perl.rb - - ./messages.rb - ./mktemp.rb - ./options.rb - ./os/linux/elf.rb @@ -618,6 +604,7 @@ false: - ./test/options_spec.rb - ./test/os/linux/diagnostic_spec.rb - ./test/os/linux/formula_spec.rb + - ./test/os/linux/pathname_spec.rb - ./test/os/mac/dependency_collector_spec.rb - ./test/os/mac/java_requirement_spec.rb - ./test/os/mac/keg_spec.rb @@ -837,7 +824,6 @@ false: - ./test/version_spec.rb - ./unpack_strategy/uncompressed.rb - ./utils/gems.rb - - ./utils/inreplace.rb - ./version.rb true: @@ -849,8 +835,14 @@ true: - ./cask/url.rb - ./checksum.rb - ./cleaner.rb + - ./cli/args.rb + - ./compat/extend/nil.rb + - ./compat/extend/string.rb + - ./compat/formula.rb + - ./compat/os/mac.rb - ./compilers.rb - ./config.rb + - ./dependable.rb - ./dependency_collector.rb - ./description_cache_store.rb - ./descriptions.rb @@ -865,14 +857,22 @@ true: - ./extend/os/mac/keg.rb - ./extend/os/mac/resource.rb - ./extend/os/mac/utils/analytics.rb + - ./fetch.rb - ./formula_free_port.rb + - ./formula_pin.rb - ./formula_support.rb + - ./hardware.rb + - ./help.rb - ./install_renamed.rb + - ./language/go.rb + - ./language/java.rb + - ./language/perl.rb - ./lazy_object.rb - ./linkage_cache_store.rb - ./livecheck.rb - ./load_path.rb - ./locale.rb + - ./messages.rb - ./metafiles.rb - ./official_taps.rb - ./os.rb @@ -888,6 +888,7 @@ true: - ./test/support/helper/fixtures.rb - ./test/support/lib/config.rb - ./utils/bottles.rb + - ./utils/inreplace.rb - ./utils/link.rb - ./utils/notability.rb - ./utils/shebang.rb diff --git a/Library/Homebrew/sorbet/rbi/cli.rbi b/Library/Homebrew/sorbet/rbi/cli.rbi new file mode 100644 index 0000000000..c9ec5b3cb0 --- /dev/null +++ b/Library/Homebrew/sorbet/rbi/cli.rbi @@ -0,0 +1,19 @@ +# typed: strict + +module Homebrew::CLI + class Args < OpenStruct + def devel?; end + + def HEAD?; end + + def include_test?; end + + def build_bottle?; end + + def build_universal?; end + + def build_from_source?; end + + def named_args; end + end +end diff --git a/Library/Homebrew/sorbet/rbi/gems/bindata@2.4.8.rbi b/Library/Homebrew/sorbet/rbi/gems/bindata@2.4.8.rbi new file mode 100644 index 0000000000..ec2a9f3d63 --- /dev/null +++ b/Library/Homebrew/sorbet/rbi/gems/bindata@2.4.8.rbi @@ -0,0 +1,1137 @@ +# This file is autogenerated. Do not edit it by hand. Regenerate it with: +# tapioca sync --exclude json + +# typed: true + +module BinData + extend(::BinData::BitFieldFactory) + extend(::BinData::IntFactory) + + + private + + def trace_message; end + def trace_reading(io = _); end + + def self.trace_message; end + def self.trace_reading(io = _); end +end + +module BinData::AcceptedParametersPlugin + def accepted_parameters; end + def default_parameter(*args); end + def default_parameters(*args); end + def mandatory_parameter(*args); end + def mandatory_parameters(*args); end + def mutually_exclusive_parameters(*args); end + def optional_parameter(*args); end + def optional_parameters(*args); end +end + +class BinData::AcceptedParametersPlugin::AcceptedParameters + def initialize(ancestor_parameters = _); end + + def all; end + def default(args = _); end + def mandatory(*args); end + def mutually_exclusive(*args); end + def optional(*args); end + + private + + def ensure_valid_names(names); end + def to_syms(args); end + + def self.invalid_parameter_names; end +end + +class BinData::Array < ::BinData::Base + include(::Enumerable) + extend(::BinData::DSLMixin) + + def <<(*args); end + def [](arg1, arg2 = _); end + def []=(index, value); end + def assign(array); end + def at(index); end + def clear?; end + def concat(array); end + def debug_name_of(child); end + def do_num_bytes; end + def do_write(io); end + def each; end + def empty?; end + def find_index(obj); end + def find_index_of(obj); end + def first(n = _); end + def index(obj); end + def initialize_instance; end + def initialize_shared_instance; end + def insert(index, *objs); end + def last(n = _); end + def length; end + def offset_of(child); end + def push(*args); end + def size; end + def slice(arg1, arg2 = _); end + def snapshot; end + def to_ary; end + def unshift(*args); end + + private + + def append_new_element; end + def elements; end + def extend_array(max_index); end + def new_element; end + def slice_index(index); end + def slice_range(range); end + def slice_start_length(start, length); end + def sum_num_bytes_below_index(index); end + def sum_num_bytes_for_all_elements; end +end + +class BinData::ArrayArgProcessor < ::BinData::BaseArgProcessor + def sanitize_parameters!(obj_class, params); end +end + +class BinData::Base + include(::BinData::Framework) + include(::BinData::RegisterNamePlugin) + extend(::BinData::AcceptedParametersPlugin) + + def initialize(*args); end + + def ==(other); end + def =~(other); end + def abs_offset; end + def base_respond_to?(*_); end + def clear; end + def debug_name; end + def eval_parameter(key, overrides = _); end + def get_parameter(key); end + def has_parameter?(key); end + def initialize_instance(*args); end + def initialize_with_warning(*args); end + def inspect; end + def lazy_evaluator; end + def new(value = _, parent = _); end + def num_bytes; end + def parent; end + def pretty_print(pp); end + def read(io, &block); end + def rel_offset; end + def safe_respond_to?(symbol, include_private = _); end + def to_binary_s(&block); end + def to_hex(&block); end + def to_s; end + def write(io, &block); end + + protected + + def parent=(_); end + + private + + def binary_string(str); end + def extract_args(args); end + def initialize_without_warning(*args); end + def reading?; end + def start_read; end + def top_level; end + def top_level_get(sym); end + def top_level_set(sym, value); end + + def self.arg_processor(name = _); end + def self.auto_call_delayed_io; end + def self.bindata_name; end + def self.inherited(subclass); end + def self.read(io, *args, &block); end +end + +module BinData::Base::AutoCallDelayedIO + def initialize_shared_instance; end + def num_bytes; end + def read(io); end + def write(io, *_); end +end + +class BinData::BaseArgProcessor + def extract_args(obj_class, obj_args); end + def sanitize_parameters!(obj_class, obj_params); end + def separate_args(_obj_class, obj_args); end +end + +class BinData::BasePrimitive < ::BinData::Base + def <=>(other); end + def assign(val); end + def clear?; end + def do_num_bytes; end + def do_read(io); end + def do_read_with_hook(io); end + def do_write(io); end + def eql?(other); end + def hash; end + def initialize_instance; end + def initialize_shared_instance; end + def method_missing(symbol, *args, &block); end + def respond_to?(symbol, include_private = _); end + def snapshot; end + def trace_value; end + def value; end + def value=(val); end + + private + + def _value; end + def read_and_return_value(io); end + def sensible_default; end + def value_to_binary_string(val); end + + def self.bit_aligned; end + def self.inherited(subclass); end + def self.turn_off_tracing; end + def self.turn_on_tracing; end +end + +module BinData::BasePrimitive::AssertPlugin + def assert!; end + def assign(val); end + def do_read(io); end +end + +module BinData::BasePrimitive::AssertedValuePlugin + def _value; end + def assert!; end + def assert_value(current_value); end + def assign(val); end + def do_read(io); end +end + +module BinData::BasePrimitive::InitialValuePlugin + def _value; end +end + +module BinData::BasePrimitive::ValuePlugin + def _value; end + def assign(val); end +end + +class BinData::Bit < ::BinData::BasePrimitive + def assign(val); end + def bit_aligned?; end + def do_num_bytes; end + def do_write(io); end + + private + + def read_and_return_value(io); end + def sensible_default; end +end + +module BinData::BitAligned + def bit_aligned?; end + def do_num_bytes; end + def do_write(io); end + def read_and_return_value(io); end +end + +class BinData::BitAligned::BitAlignedIO + def initialize(io); end + + def readbytes(n); end +end + +module BinData::BitField + def self.create_clamp_code(nbits, signed); end + def self.create_do_num_bytes_code(nbits); end + def self.create_dynamic_clamp_code(signed); end + def self.create_fixed_clamp_code(nbits, signed); end + def self.create_int2uint_code(nbits, signed); end + def self.create_nbits_code(nbits); end + def self.create_params_code(nbits); end + def self.create_uint2int_code(nbits, signed); end + def self.define_class(name, nbits, endian, signed = _); end + def self.define_methods(bit_class, nbits, endian, signed); end +end + +module BinData::BitFieldFactory + def const_missing(name); end +end + +class BinData::BitLe < ::BinData::BasePrimitive + def assign(val); end + def bit_aligned?; end + def do_num_bytes; end + def do_write(io); end + + private + + def read_and_return_value(io); end + def sensible_default; end +end + +class BinData::Buffer < ::BinData::Base + extend(::BinData::DSLMixin) + + def assign(val); end + def clear?; end + def do_num_bytes; end + def do_read(io); end + def do_write(io); end + def initialize_instance; end + def method_missing(symbol, *args, &block); end + def raw_num_bytes; end + def respond_to?(symbol, include_private = _); end + def snapshot; end +end + +class BinData::BufferArgProcessor < ::BinData::BaseArgProcessor + include(::BinData::MultiFieldArgSeparator) + + def sanitize_parameters!(obj_class, params); end +end + +module BinData::ByteAlignPlugin + def align_obj?(obj); end + def bytes_to_align(obj, rel_offset); end + def do_read(io); end + def do_write(io); end + def sum_num_bytes_below_index(index); end +end + +class BinData::Choice < ::BinData::Base + extend(::BinData::DSLMixin) + + def assign(*args); end + def clear?(*args); end + def do_num_bytes(*args); end + def do_read(*args); end + def do_read_with_hook(io); end + def do_write(*args); end + def initialize_instance; end + def initialize_shared_instance; end + def method_missing(symbol, *args, &block); end + def respond_to?(symbol, include_private = _); end + def selection; end + def snapshot(*args); end + def trace_selection; end + + private + + def current_choice; end + def instantiate_choice(selection); end + + def self.turn_off_tracing; end + def self.turn_on_tracing; end +end + +class BinData::ChoiceArgProcessor < ::BinData::BaseArgProcessor + def sanitize_parameters!(obj_class, params); end + + private + + def choices_as_hash(choices); end + def ensure_valid_keys(choices); end + def key_array_by_index(array); end +end + +module BinData::CopyOnChangePlugin + def copy_previous_value(obj); end + def current_choice; end + def get_previous_choice(selection); end + def remember_current_selection(selection); end +end + +class BinData::CountBytesRemaining < ::BinData::BasePrimitive + + private + + def read_and_return_value(io); end + def sensible_default; end + def value_to_binary_string(val); end +end + +module BinData::DSLMixin + def dsl_parser(parser_type = _); end + def method_missing(symbol, *args, &block); end + def to_ary; end + def to_str; end +end + +class BinData::DSLMixin::DSLBigAndLittleEndianHandler + def self.class_with_endian(class_name, endian); end + def self.create_subclasses_with_endian(bnl_class); end + def self.delegate_field_creation(bnl_class); end + def self.fixup_subclass_hierarchy(bnl_class); end + def self.handle(bnl_class); end + def self.make_class_abstract(bnl_class); end + def self.obj_attribute(obj, attr); end + def self.override_new_in_class(bnl_class); end +end + +class BinData::DSLMixin::DSLFieldParser + def initialize(hints, symbol, *args, &block); end + + def name; end + def name_from_field_declaration(args); end + def params; end + def params_from_args(args); end + def params_from_block(&block); end + def params_from_field_declaration(args, &block); end + def type; end +end + +class BinData::DSLMixin::DSLFieldValidator + def initialize(the_class, parser); end + + def all_or_none_names_failed?(name); end + def duplicate_name?(name); end + def ensure_valid_name(name); end + def fields; end + def malformed_name?(name); end + def must_have_a_name_failed?(name); end + def must_not_have_a_name_failed?(name); end + def name_is_reserved?(name); end + def name_shadows_method?(name); end + def option?(opt); end + def validate_field(name); end +end + +class BinData::DSLMixin::DSLParser + def initialize(the_class, parser_type); end + + def dsl_params; end + def endian(endian = _); end + def fields; end + def hide(*args); end + def method_missing(*args, &block); end + def parser_type; end + def search_prefix(*args); end + + private + + def append_field(type, name, params); end + def dsl_raise(exception, msg); end + def ensure_hints; end + def fields?; end + def hints; end + def option?(opt); end + def parent_attribute(attr, default = _); end + def parent_fields; end + def parse_and_append_field(*args, &block); end + def parser_abilities; end + def set_endian(endian); end + def to_choice_params(key); end + def to_object_params(key); end + def to_struct_params(*unused); end + def valid_endian?(endian); end +end + +class BinData::DelayedIO < ::BinData::Base + extend(::BinData::DSLMixin) + + def abs_offset; end + def abs_offset=(offset); end + def assign(val); end + def clear?; end + def do_num_bytes; end + def do_read(io); end + def do_write(io); end + def initialize_instance; end + def method_missing(symbol, *args, &block); end + def num_bytes; end + def read_now!; end + def rel_offset; end + def respond_to?(symbol, include_private = _); end + def snapshot; end + def write_now!; end +end + +class BinData::DelayedIoArgProcessor < ::BinData::BaseArgProcessor + include(::BinData::MultiFieldArgSeparator) + + def sanitize_parameters!(obj_class, params); end +end + +class BinData::DoubleBe < ::BinData::BasePrimitive + def do_num_bytes; end + + private + + def read_and_return_value(io); end + def sensible_default; end + def value_to_binary_string(val); end +end + +class BinData::DoubleLe < ::BinData::BasePrimitive + def do_num_bytes; end + + private + + def read_and_return_value(io); end + def sensible_default; end + def value_to_binary_string(val); end +end + +class BinData::FloatBe < ::BinData::BasePrimitive + def do_num_bytes; end + + private + + def read_and_return_value(io); end + def sensible_default; end + def value_to_binary_string(val); end +end + +class BinData::FloatLe < ::BinData::BasePrimitive + def do_num_bytes; end + + private + + def read_and_return_value(io); end + def sensible_default; end + def value_to_binary_string(val); end +end + +module BinData::FloatingPoint + def self.create_num_bytes_code(precision); end + def self.create_read_code(precision, endian); end + def self.create_to_binary_s_code(precision, endian); end + def self.define_methods(float_class, precision, endian); end +end + +module BinData::Framework + def assign(val); end + def bit_aligned?; end + def clear?; end + def debug_name_of(child); end + def offset_of(child); end + def snapshot; end + + protected + + def do_num_bytes; end + def do_read(io); end + def do_write(io); end + def initialize_instance; end + def initialize_shared_instance; end +end + +module BinData::IO + def self.create_string_io(str = _); end +end + +module BinData::IO::Common + def initialize(io); end + + + private + + def buffer_limited_n(n); end + def seek(n); end + def seekable?; end + def with_buffer_common(n); end +end + +module BinData::IO::Common::SeekableStream + def num_bytes_remaining; end + def with_readahead; end + + private + + def offset_raw; end + def read_raw(n); end + def seek_raw(n); end + def stream_init; end + def write_raw(data); end +end + +module BinData::IO::Common::UnSeekableStream + def num_bytes_remaining; end + def offset_raw; end + def with_readahead; end + + private + + def read_raw(n); end + def read_raw_with_readahead(n); end + def seek_raw(n); end + def stream_init; end + def write_raw(data); end +end + +class BinData::IO::Read + include(::BinData::IO::Common) + + def initialize(io); end + + def offset; end + def read_all_bytes; end + def readbits(nbits, endian); end + def readbytes(n); end + def reset_read_bits; end + def seekbytes(n); end + def with_buffer(n); end + + private + + def accumulate_big_endian_bits; end + def accumulate_little_endian_bits; end + def mask(nbits); end + def read(n = _); end + def read_big_endian_bits(nbits); end + def read_little_endian_bits(nbits); end +end + +class BinData::IO::Write + include(::BinData::IO::Common) + + def initialize(io); end + + def flush; end + def flushbits; end + def offset; end + def seekbytes(n); end + def with_buffer(n); end + def writebits(val, nbits, endian); end + def writebytes(str); end + + private + + def mask(nbits); end + def write(data); end + def write_big_endian_bits(val, nbits); end + def write_little_endian_bits(val, nbits); end +end + +module BinData::InitialLengthPlugin + def do_read(io); end + def elements; end +end + +module BinData::Int + def self.define_class(name, nbits, endian, signed); end + def self.define_methods(int_class, nbits, endian, signed); end +end + +class BinData::Int32be < ::BinData::BasePrimitive + def assign(val); end + def do_num_bytes; end + + private + + def read_and_return_value(io); end + def sensible_default; end + def value_to_binary_string(val); end +end + +class BinData::Int32le < ::BinData::BasePrimitive + def assign(val); end + def do_num_bytes; end + + private + + def read_and_return_value(io); end + def sensible_default; end + def value_to_binary_string(val); end +end + +class BinData::Int64be < ::BinData::BasePrimitive + def assign(val); end + def do_num_bytes; end + + private + + def read_and_return_value(io); end + def sensible_default; end + def value_to_binary_string(val); end +end + +class BinData::Int64le < ::BinData::BasePrimitive + def assign(val); end + def do_num_bytes; end + + private + + def read_and_return_value(io); end + def sensible_default; end + def value_to_binary_string(val); end +end + +class BinData::Int8 < ::BinData::BasePrimitive + def assign(val); end + def do_num_bytes; end + + private + + def read_and_return_value(io); end + def sensible_default; end + def value_to_binary_string(val); end +end + +module BinData::IntFactory + def const_missing(name); end +end + +class BinData::LazyEvaluator + def initialize(obj); end + + def index; end + def lazy_eval(val, overrides = _); end + def method_missing(symbol, *args); end + def parent; end + + private + + def callable?(obj); end + def eval_symbol_in_parent_context(symbol, args); end + def recursively_eval(val, args); end + def resolve_symbol_in_parent_context(symbol, args); end +end + +module BinData::MultiFieldArgSeparator + def field_names_in_parameters?(obj_class, parameters); end + def parameters_is_value?(obj_class, value, parameters); end + def separate_args(obj_class, obj_args); end +end + +class BinData::Primitive < ::BinData::BasePrimitive + extend(::BinData::DSLMixin) + + def assign(val); end + def debug_name_of(child); end + def do_num_bytes; end + def do_write(io); end + def initialize_instance; end + def method_missing(symbol, *args, &block); end + def respond_to?(symbol, include_private = _); end + + private + + def get; end + def read_and_return_value(io); end + def sensible_default; end + def set(v); end + + def self.bit_aligned; end +end + +class BinData::PrimitiveArgProcessor < ::BinData::BaseArgProcessor + def sanitize_parameters!(obj_class, params); end +end + +module BinData::ReadUntilEOFPlugin + def do_read(io); end +end + +module BinData::ReadUntilPlugin + def do_read(io); end +end + +class BinData::Record < ::BinData::Struct + extend(::BinData::DSLMixin) + + def self.inherited(subclass); end +end + +class BinData::RecordArgProcessor < ::BinData::StructArgProcessor + include(::BinData::MultiFieldArgSeparator) + + def sanitize_parameters!(obj_class, params); end +end + +module BinData::RegisterNamePlugin + def initialize_shared_instance; end + + def self.included(base); end +end + +BinData::RegisteredClasses = T.let(T.unsafe(nil), BinData::Registry) + +class BinData::Registry + def initialize; end + + def lookup(name, hints = _); end + def register(name, class_to_register); end + def underscore_name(name); end + def unregister(name); end + + private + + def name_with_endian(name, endian); end + def name_with_prefix(name, prefix); end + def normalize_name(name, hints); end + def register_dynamic_class(name); end + def registered?(name); end + def warn_if_name_is_already_registered(name, class_to_register); end +end + +class BinData::Rest < ::BinData::BasePrimitive + + private + + def read_and_return_value(io); end + def sensible_default; end + def value_to_binary_string(val); end +end + +class BinData::ResumeByteAlignment < ::BinData::Base + def assign(val); end + def clear?; end + def do_num_bytes; end + def do_read(io); end + def do_write(io); end + def snapshot; end +end + +class BinData::SanitizedBigEndian < ::BinData::SanitizedParameter + def endian; end +end + +class BinData::SanitizedChoices < ::BinData::SanitizedParameter + def initialize(choices, hints); end + + def [](key); end +end + +class BinData::SanitizedField < ::BinData::SanitizedParameter + def initialize(name, field_type, field_params, hints); end + + def has_parameter?(param); end + def instantiate(value = _, parent = _); end + def name; end + def name_as_sym; end + def prototype; end +end + +class BinData::SanitizedFields < ::BinData::SanitizedParameter + include(::Enumerable) + + def initialize(hints, base_fields = _); end + + def [](idx); end + def add_field(type, name, params); end + def all_field_names_blank?; end + def any_field_has_parameter?(parameter); end + def each(&block); end + def empty?; end + def field_name?(name); end + def field_names; end + def length; end + def no_field_names_blank?; end + def raw_fields; end +end + +class BinData::SanitizedLittleEndian < ::BinData::SanitizedParameter + def endian; end +end + +class BinData::SanitizedParameter +end + +class BinData::SanitizedParameters < ::Hash + def initialize(parameters, the_class, hints); end + + def create_sanitized_params(params, the_class); end + def has_at_least_one_of?(*keys); end + def has_parameter?(_); end + def hints; end + def must_be_integer(*keys); end + def rename_parameter(old_key, new_key); end + def sanitize(key, &block); end + def sanitize_choices(key, &block); end + def sanitize_endian(key); end + def sanitize_fields(key, &block); end + def sanitize_object_prototype(key); end + def warn_replacement_parameter(bad_key, suggested_key); end + + private + + def create_sanitized_choices(choices); end + def create_sanitized_endian(endian); end + def create_sanitized_fields; end + def create_sanitized_object_prototype(obj_type, obj_params); end + def ensure_mandatory_parameters_exist; end + def ensure_mutual_exclusion_of_parameters; end + def ensure_no_nil_values; end + def merge_default_parameters!; end + def needs_sanitizing?(key); end + def sanitize!; end + + def self.sanitize(parameters, the_class); end +end + +BinData::SanitizedParameters::BIG_ENDIAN = T.let(T.unsafe(nil), BinData::SanitizedBigEndian) + +BinData::SanitizedParameters::LITTLE_ENDIAN = T.let(T.unsafe(nil), BinData::SanitizedLittleEndian) + +class BinData::SanitizedPrototype < ::BinData::SanitizedParameter + def initialize(obj_type, obj_params, hints); end + + def has_parameter?(param); end + def instantiate(value = _, parent = _); end +end + +class BinData::Sbit < ::BinData::BasePrimitive + def assign(val); end + def bit_aligned?; end + def do_num_bytes; end + def do_write(io); end + + private + + def read_and_return_value(io); end + def sensible_default; end +end + +class BinData::SbitLe < ::BinData::BasePrimitive + def assign(val); end + def bit_aligned?; end + def do_num_bytes; end + def do_write(io); end + + private + + def read_and_return_value(io); end + def sensible_default; end +end + +class BinData::Skip < ::BinData::BasePrimitive + def initialize_shared_instance; end + + private + + def read_and_return_value(io); end + def sensible_default; end + def value_to_binary_string(val); end +end + +class BinData::SkipArgProcessor < ::BinData::BaseArgProcessor + def sanitize_parameters!(obj_class, params); end +end + +module BinData::SkipLengthPlugin + def skip_length; end +end + +module BinData::SkipToAbsOffsetPlugin + def skip_length; end +end + +module BinData::SkipUntilValidPlugin + def read_and_return_value(io); end + def skip_length; end +end + +class BinData::String < ::BinData::BasePrimitive + def assign(val); end + def initialize_shared_instance; end + def snapshot; end + + private + + def clamp_to_length(str); end + def read_and_return_value(io); end + def sensible_default; end + def trim_padding(str); end + def value_to_binary_string(val); end +end + +class BinData::StringArgProcessor < ::BinData::BaseArgProcessor + def sanitize_parameters!(obj_class, params); end + + private + + def sanitized_pad_byte(byte); end +end + +class BinData::Stringz < ::BinData::BasePrimitive + def assign(val); end + def snapshot; end + + private + + def append_zero_byte_if_needed!(str); end + def read_and_return_value(io); end + def sensible_default; end + def trim_and_zero_terminate(str); end + def trim_to!(str, max_length = _); end + def truncate_after_first_zero_byte!(str); end + def value_to_binary_string(val); end +end + +class BinData::Struct < ::BinData::Base + def [](key); end + def []=(key, value); end + def assign(val); end + def clear; end + def clear?; end + def debug_name_of(child); end + def do_num_bytes; end + def do_read(io); end + def do_write(io); end + def each_pair; end + def field_names(include_hidden = _); end + def has_key?(key); end + def initialize_instance; end + def initialize_shared_instance; end + def key?(key); end + def offset_of(child); end + def snapshot; end + + private + + def as_stringified_hash(val); end + def assign_fields(val); end + def base_field_name(name); end + def define_field_accessors; end + def define_field_accessors_for(name, index); end + def find_index_of(obj); end + def find_obj_for_name(name); end + def include_obj?(obj); end + def instantiate_all_objs; end + def instantiate_obj_at(index); end + def sum_num_bytes_below_index(index); end + def sum_num_bytes_for_all_fields; end + + def self.inherited(subclass); end +end + +BinData::Struct::RESERVED = T.let(T.unsafe(nil), Hash) + +class BinData::Struct::Snapshot < ::Hash + def []=(key, value); end + def method_missing(symbol, *args); end + def respond_to?(symbol, include_private = _); end +end + +class BinData::StructArgProcessor < ::BinData::BaseArgProcessor + def sanitize_parameters!(obj_class, params); end + + private + + def ensure_field_names_are_valid(obj_class, field_names); end + def hidden_field_names(hidden); end + def sanitize_endian(params); end + def sanitize_fields(obj_class, params); end + def sanitize_hide(params); end + def sanitize_search_prefix(params); end + def sanitized_field_names(sanitized_fields); end +end + +class BinData::Tracer + def initialize(io); end + + def trace(msg); end + def trace_obj(obj_name, val); end +end + +class BinData::Uint16be < ::BinData::BasePrimitive + def assign(val); end + def do_num_bytes; end + + private + + def read_and_return_value(io); end + def sensible_default; end + def value_to_binary_string(val); end +end + +class BinData::Uint16le < ::BinData::BasePrimitive + def assign(val); end + def do_num_bytes; end + + private + + def read_and_return_value(io); end + def sensible_default; end + def value_to_binary_string(val); end +end + +class BinData::Uint32be < ::BinData::BasePrimitive + def assign(val); end + def do_num_bytes; end + + private + + def read_and_return_value(io); end + def sensible_default; end + def value_to_binary_string(val); end +end + +class BinData::Uint32le < ::BinData::BasePrimitive + def assign(val); end + def do_num_bytes; end + + private + + def read_and_return_value(io); end + def sensible_default; end + def value_to_binary_string(val); end +end + +class BinData::Uint64be < ::BinData::BasePrimitive + def assign(val); end + def do_num_bytes; end + + private + + def read_and_return_value(io); end + def sensible_default; end + def value_to_binary_string(val); end +end + +class BinData::Uint64le < ::BinData::BasePrimitive + def assign(val); end + def do_num_bytes; end + + private + + def read_and_return_value(io); end + def sensible_default; end + def value_to_binary_string(val); end +end + +class BinData::Uint8 < ::BinData::BasePrimitive + def assign(val); end + def do_num_bytes; end + + private + + def read_and_return_value(io); end + def sensible_default; end + def value_to_binary_string(val); end +end + +class BinData::Uint8Array < ::BinData::BasePrimitive + + private + + def read_and_return_value(io); end + def sensible_default; end + def value_to_binary_string(val); end +end + +class BinData::Uint8ArrayArgProcessor < ::BinData::BaseArgProcessor + def sanitize_parameters!(obj_class, params); end +end + +class BinData::UnRegisteredTypeError < ::StandardError +end + +BinData::VERSION = T.let(T.unsafe(nil), String) + +class BinData::ValidityError < ::StandardError +end + +class BinData::Virtual < ::BinData::BasePrimitive + def do_num_bytes; end + def do_read(io); end + def do_write(io); end + def sensible_default; end +end + +module BinData::WarnNoReadLengthPlugin + def read_and_return_value(io); end +end diff --git a/Library/Homebrew/sorbet/rbi/gems/codecov@0.1.17.rbi b/Library/Homebrew/sorbet/rbi/gems/codecov@0.2.2.rbi similarity index 100% rename from Library/Homebrew/sorbet/rbi/gems/codecov@0.1.17.rbi rename to Library/Homebrew/sorbet/rbi/gems/codecov@0.2.2.rbi diff --git a/Library/Homebrew/sorbet/rbi/gems/url@0.3.2.rbi b/Library/Homebrew/sorbet/rbi/gems/colorize@0.8.1.rbi similarity index 100% rename from Library/Homebrew/sorbet/rbi/gems/url@0.3.2.rbi rename to Library/Homebrew/sorbet/rbi/gems/colorize@0.8.1.rbi diff --git a/Library/Homebrew/sorbet/rbi/gems/elftools@1.1.2.rbi b/Library/Homebrew/sorbet/rbi/gems/elftools@1.1.2.rbi new file mode 100644 index 0000000000..5f2e51557d --- /dev/null +++ b/Library/Homebrew/sorbet/rbi/gems/elftools@1.1.2.rbi @@ -0,0 +1,724 @@ +# This file is autogenerated. Do not edit it by hand. Regenerate it with: +# tapioca sync --exclude json + +# typed: true + +module ELFTools +end + +module ELFTools::Constants + include(::ELFTools::Constants::DF) + include(::ELFTools::Constants::DT) + include(::ELFTools::Constants::EM) + include(::ELFTools::Constants::ET) + include(::ELFTools::Constants::PT) + include(::ELFTools::Constants::SHT) + include(::ELFTools::Constants::STB) + include(::ELFTools::Constants::STT) +end + +module ELFTools::Constants::DF +end + +ELFTools::Constants::DF::DF_1_CONFALT = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_DIRECT = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_DISPRELDNE = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_DISPRELPND = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_EDITED = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_ENDFILTEE = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_GLOBAL = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_GLOBAUDIT = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_GROUP = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_IGNMULDEF = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_INITFIRST = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_INTERPOSE = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_LOADFLTR = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_NODEFLIB = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_NODELETE = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_NODIRECT = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_NODUMP = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_NOHDR = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_NOKSYMS = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_NOOPEN = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_NORELOC = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_NOW = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_ORIGIN = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_SINGLETON = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_SYMINTPOSE = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_1_TRANS = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_BIND_NOW = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_ORIGIN = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_STATIC_TLS = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_SYMBOLIC = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DF::DF_TEXTREL = T.let(T.unsafe(nil), Integer) + +module ELFTools::Constants::DT +end + +ELFTools::Constants::DT::DT_ADDRRNGHI = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_ADDRRNGLO = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_BIND_NOW = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_DEBUG = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_ENCODING = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_FINI = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_FINI_ARRAY = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_FINI_ARRAYSZ = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_FLAGS = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_FLAGS_1 = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_GNU_HASH = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_HASH = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_HIOS = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_HIPROC = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_INIT = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_INIT_ARRAY = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_INIT_ARRAYSZ = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_JMPREL = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_LOOS = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_LOPROC = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_NEEDED = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_NULL = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_PLTGOT = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_PLTREL = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_PLTRELSZ = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_REL = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_RELA = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_RELACOUNT = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_RELAENT = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_RELASZ = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_RELCOUNT = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_RELENT = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_RELSZ = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_RPATH = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_RUNPATH = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_SONAME = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_STRSZ = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_STRTAB = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_SYMBOLIC = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_SYMENT = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_SYMTAB = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_TEXTREL = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_VALRNGHI = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_VALRNGLO = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_VERDEF = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_VERDEFNUM = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_VERNEED = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::DT::DT_VERNEEDNUM = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::ELFMAG = T.let(T.unsafe(nil), String) + +module ELFTools::Constants::EM + def self.mapping(val); end +end + +ELFTools::Constants::EM::EM_386 = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_486 = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_68K = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_860 = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_88K = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_AARCH64 = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_ALPHA = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_ALTERA_NIOS2 = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_ARM = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_AVR32 = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_BLACKFIN = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_BPF = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_CRIS = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_CYGNUS_M32R = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_CYGNUS_MN10300 = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_FRV = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_H8_300 = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_IA_64 = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_M32 = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_M32R = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_MICROBLAZE = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_MIPS = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_MIPS_RS3_LE = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_MIPS_RS4_BE = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_MN10300 = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_NONE = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_OPENRISC = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_PARISC = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_PPC = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_PPC64 = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_S390 = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_S390_OLD = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_SH = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_SPARC = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_SPARC32PLUS = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_SPARCV9 = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_SPU = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_TILEGX = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_TILEPRO = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_TI_C6000 = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::EM::EM_X86_64 = T.let(T.unsafe(nil), Integer) + +module ELFTools::Constants::ET + def self.mapping(type); end +end + +ELFTools::Constants::ET::ET_CORE = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::ET::ET_DYN = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::ET::ET_EXEC = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::ET::ET_NONE = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::ET::ET_REL = T.let(T.unsafe(nil), Integer) + +module ELFTools::Constants::PT +end + +ELFTools::Constants::PT::PT_DYNAMIC = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::PT::PT_GNU_EH_FRAME = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::PT::PT_GNU_RELRO = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::PT::PT_GNU_STACK = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::PT::PT_HIOS = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::PT::PT_HIPROC = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::PT::PT_INTERP = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::PT::PT_LOAD = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::PT::PT_LOOS = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::PT::PT_LOPROC = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::PT::PT_NOTE = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::PT::PT_NULL = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::PT::PT_PHDR = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::PT::PT_SHLIB = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::PT::PT_TLS = T.let(T.unsafe(nil), Integer) + +module ELFTools::Constants::SHT +end + +ELFTools::Constants::SHT::SHT_DYNAMIC = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::SHT::SHT_DYNSYM = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::SHT::SHT_HASH = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::SHT::SHT_HIPROC = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::SHT::SHT_HIUSER = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::SHT::SHT_LOPROC = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::SHT::SHT_LOUSER = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::SHT::SHT_NOBITS = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::SHT::SHT_NOTE = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::SHT::SHT_NULL = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::SHT::SHT_PROGBITS = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::SHT::SHT_REL = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::SHT::SHT_RELA = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::SHT::SHT_SHLIB = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::SHT::SHT_STRTAB = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::SHT::SHT_SYMTAB = T.let(T.unsafe(nil), Integer) + +module ELFTools::Constants::STB +end + +ELFTools::Constants::STB::STB_GLOBAL = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::STB::STB_GNU_UNIQUE = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::STB::STB_HIOS = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::STB::STB_HIPROC = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::STB::STB_LOCAL = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::STB::STB_LOOS = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::STB::STB_LOPROC = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::STB::STB_NUM = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::STB::STB_WEAK = T.let(T.unsafe(nil), Integer) + +module ELFTools::Constants::STT +end + +ELFTools::Constants::STT::STT_ARM_TFUNC = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::STT::STT_COMMON = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::STT::STT_FILE = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::STT::STT_FUNC = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::STT::STT_GNU_IFUNC = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::STT::STT_HIOS = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::STT::STT_HIPROC = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::STT::STT_LOOS = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::STT::STT_LOPROC = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::STT::STT_NOTYPE = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::STT::STT_NUM = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::STT::STT_OBJECT = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::STT::STT_SECTION = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::STT::STT_SPARC_REGISTER = T.let(T.unsafe(nil), Integer) + +ELFTools::Constants::STT::STT_TLS = T.let(T.unsafe(nil), Integer) + +module ELFTools::Dynamic + def each_tags(&block); end + def tag_at(n); end + def tag_by_type(type); end + def tags; end + def tags_by_type(type); end + + private + + def endian; end + def str_offset; end +end + +class ELFTools::Dynamic::Tag + def initialize(header, stream, str_offset); end + + def header; end + def name; end + def name?; end + def stream; end + def value; end +end + +ELFTools::Dynamic::Tag::TYPE_WITH_NAME = T.let(T.unsafe(nil), Array) + +class ELFTools::ELFClassError < ::ELFTools::ELFError +end + +class ELFTools::ELFDataError < ::ELFTools::ELFError +end + +class ELFTools::ELFError < ::StandardError +end + +class ELFTools::ELFFile + def initialize(stream); end + + def build_id; end + def each_sections(&block); end + def each_segments(&block); end + def elf_class; end + def elf_type; end + def endian; end + def header; end + def machine; end + def num_sections; end + def num_segments; end + def offset_from_vma(vma, size = _); end + def patches; end + def save(filename); end + def section_at(n); end + def section_by_name(name); end + def sections; end + def sections_by_type(type, &block); end + def segment_at(n); end + def segment_by_type(type); end + def segments; end + def segments_by_type(type, &block); end + def stream; end + def strtab_section; end + + private + + def create_section(n); end + def create_segment(n); end + def identify; end + def loaded_headers; end +end + +class ELFTools::ELFMagicError < ::ELFTools::ELFError +end + +class ELFTools::LazyArray + def initialize(size, &block); end + + def [](i); end +end + +module ELFTools::Note + def each_notes; end + def notes; end + + private + + def create_note(cur); end + def endian; end +end + +class ELFTools::Note::Note + def initialize(header, stream, offset); end + + def desc; end + def description; end + def header; end + def name; end + def offset; end + def stream; end +end + +ELFTools::Note::SIZE_OF_NHDR = T.let(T.unsafe(nil), Integer) + +class ELFTools::Relocation + def initialize(header, stream); end + + def header; end + def r_info_sym; end + def r_info_type; end + def stream; end + def symbol_index; end + def type; end + + private + + def mask_bit; end +end + +module ELFTools::Sections +end + +class ELFTools::Sections::DynamicSection < ::ELFTools::Sections::Section + include(::ELFTools::Dynamic) + + def tag_start; end +end + +class ELFTools::Sections::NoteSection < ::ELFTools::Sections::Section + include(::ELFTools::Note) + + def note_start; end + def note_total_size; end +end + +class ELFTools::Sections::NullSection < ::ELFTools::Sections::Section + def null?; end +end + +class ELFTools::Sections::RelocationSection < ::ELFTools::Sections::Section + def each_relocations(&block); end + def num_relocations; end + def rela?; end + def relocation_at(n); end + def relocations; end + + private + + def create_relocation(n); end +end + +class ELFTools::Sections::Section + def initialize(header, stream, offset_from_vma: _, strtab: _, **_kwargs); end + + def data; end + def header; end + def name; end + def null?; end + def stream; end + def type; end + + def self.create(header, stream, *args, **kwargs); end +end + +class ELFTools::Sections::StrTabSection < ::ELFTools::Sections::Section + def name_at(offset); end +end + +class ELFTools::Sections::SymTabSection < ::ELFTools::Sections::Section + def initialize(header, stream, section_at: _, **_kwargs); end + + def each_symbols(&block); end + def num_symbols; end + def symbol_at(n); end + def symbol_by_name(name); end + def symbols; end + def symstr; end + + private + + def create_symbol(n); end +end + +class ELFTools::Sections::Symbol + def initialize(header, stream, symstr: _); end + + def header; end + def name; end + def stream; end +end + +module ELFTools::Segments +end + +class ELFTools::Segments::DynamicSegment < ::ELFTools::Segments::Segment + include(::ELFTools::Dynamic) + + def tag_start; end +end + +class ELFTools::Segments::InterpSegment < ::ELFTools::Segments::Segment + def interp_name; end +end + +class ELFTools::Segments::LoadSegment < ::ELFTools::Segments::Segment + def file_head; end + def file_tail; end + def mem_head; end + def mem_size; end + def mem_tail; end + def offset_in?(offset, size = _); end + def offset_to_vma(offset); end + def size; end + def vma_in?(vma, size = _); end + def vma_to_offset(vma); end +end + +class ELFTools::Segments::NoteSegment < ::ELFTools::Segments::Segment + include(::ELFTools::Note) + + def note_start; end + def note_total_size; end +end + +class ELFTools::Segments::Segment + def initialize(header, stream, offset_from_vma: _); end + + def data; end + def executable?; end + def header; end + def readable?; end + def stream; end + def type; end + def writable?; end + + def self.create(header, stream, *args, **kwargs); end +end + +module ELFTools::Structs +end + +class ELFTools::Structs::ELF32_Phdr < ::ELFTools::Structs::ELFStruct + def self.inherited(subclass); end + def self.new(*args); end +end + +class ELFTools::Structs::ELF32_sym < ::ELFTools::Structs::ELFStruct + def self.inherited(subclass); end + def self.new(*args); end +end + +class ELFTools::Structs::ELF64_Phdr < ::ELFTools::Structs::ELFStruct + def self.inherited(subclass); end + def self.new(*args); end +end + +class ELFTools::Structs::ELF64_sym < ::ELFTools::Structs::ELFStruct + def self.inherited(subclass); end + def self.new(*args); end +end + +class ELFTools::Structs::ELFStruct < ::BinData::Record + def elf_class; end + def elf_class=(_); end + def offset; end + def offset=(_); end + def patches; end + + def self.inherited(subclass); end + def self.new(*args); end + def self.pack(val, bytes); end + def self.self_endian; end +end + +ELFTools::Structs::ELFStruct::CHOICE_SIZE_T = T.let(T.unsafe(nil), Hash) + +class ELFTools::Structs::ELF_Dyn < ::ELFTools::Structs::ELFStruct + def self.inherited(subclass); end + def self.new(*args); end +end + +class ELFTools::Structs::ELF_Ehdr < ::ELFTools::Structs::ELFStruct + def self.inherited(subclass); end + def self.new(*args); end +end + +class ELFTools::Structs::ELF_Nhdr < ::ELFTools::Structs::ELFStruct + def self.inherited(subclass); end + def self.new(*args); end +end + +ELFTools::Structs::ELF_Phdr = T.let(T.unsafe(nil), Hash) + +class ELFTools::Structs::ELF_Rel < ::ELFTools::Structs::ELFStruct + def self.inherited(subclass); end + def self.new(*args); end +end + +class ELFTools::Structs::ELF_Rela < ::ELFTools::Structs::ELFStruct + def self.inherited(subclass); end + def self.new(*args); end +end + +class ELFTools::Structs::ELF_Shdr < ::ELFTools::Structs::ELFStruct + def self.inherited(subclass); end + def self.new(*args); end +end + +ELFTools::Structs::ELF_sym = T.let(T.unsafe(nil), Hash) + +module ELFTools::Util + extend(::ELFTools::Util::ClassMethods) +end + +module ELFTools::Util::ClassMethods + def align(num, bit); end + def cstring(stream, offset); end + def select_by_type(enum, type); end + def to_constant(mod, val); end +end diff --git a/Library/Homebrew/sorbet/rbi/gems/zeitwerk@2.3.1.rbi b/Library/Homebrew/sorbet/rbi/gems/i18n@1.8.5.rbi similarity index 100% rename from Library/Homebrew/sorbet/rbi/gems/zeitwerk@2.3.1.rbi rename to Library/Homebrew/sorbet/rbi/gems/i18n@1.8.5.rbi diff --git a/Library/Homebrew/sorbet/rbi/gems/parallel_tests@3.0.0.rbi b/Library/Homebrew/sorbet/rbi/gems/parallel_tests@3.1.0.rbi similarity index 98% rename from Library/Homebrew/sorbet/rbi/gems/parallel_tests@3.0.0.rbi rename to Library/Homebrew/sorbet/rbi/gems/parallel_tests@3.1.0.rbi index af1353e250..4a2558461a 100644 --- a/Library/Homebrew/sorbet/rbi/gems/parallel_tests@3.0.0.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/parallel_tests@3.1.0.rbi @@ -1,5 +1,5 @@ # This file is autogenerated. Do not edit it by hand. Regenerate it with: -# tapioca sync +# tapioca sync --exclude json # typed: true diff --git a/Library/Homebrew/sorbet/rbi/gems/patchelf@1.1.1.rbi b/Library/Homebrew/sorbet/rbi/gems/patchelf@1.1.1.rbi new file mode 100644 index 0000000000..be883d2256 --- /dev/null +++ b/Library/Homebrew/sorbet/rbi/gems/patchelf@1.1.1.rbi @@ -0,0 +1,134 @@ +# This file is autogenerated. Do not edit it by hand. Regenerate it with: +# tapioca sync --exclude json + +# typed: true + +module PatchELF +end + +module PatchELF::Helper + + private + + def aligndown(val, align = _); end + def alignup(val, align = _); end + def color_enabled?; end + def colorize(str, type); end + + def self.aligndown(val, align = _); end + def self.alignup(val, align = _); end + def self.color_enabled?; end + def self.colorize(str, type); end +end + +PatchELF::Helper::COLOR_CODE = T.let(T.unsafe(nil), Hash) + +PatchELF::Helper::PAGE_SIZE = T.let(T.unsafe(nil), Integer) + +module PatchELF::Logger + + private + + def error(msg); end + def info(msg); end + def warn(msg); end + + def self.error(msg); end + def self.info(msg); end + def self.warn(msg); end +end + +class PatchELF::MM + def initialize(elf); end + + def dispatch!; end + def extend_size; end + def extended?; end + def extended_offset(off); end + def malloc(size, &block); end + def threshold; end + + private + + def abnormal_elf(msg); end + def extend_backward(seg, size = _); end + def extend_forward(seg, size = _); end + def fgap_method; end + def find_gap(check_sz: _); end + def invoke_callbacks(seg, start); end + def load_segments; end + def mgap_method; end + def new_load_method; end + def shift_attributes; end + def writable?(seg); end +end + +class PatchELF::MissingSegmentError < ::PatchELF::PatchError +end + +class PatchELF::MissingTagError < ::PatchELF::PatchError +end + +class PatchELF::PatchError < ::ELFTools::ELFError +end + +class PatchELF::Patcher + def initialize(filename, logging: _); end + + def add_needed(need); end + def elf; end + def interpreter; end + def interpreter=(interp); end + def needed; end + def needed=(needs); end + def remove_needed(need); end + def replace_needed(src, tar); end + def rpath; end + def rpath=(rpath); end + def runpath; end + def runpath=(runpath); end + def save(out_file = _); end + def soname; end + def soname=(name); end + def use_rpath!; end + + private + + def dirty?; end + def dynamic_or_log; end + def interpreter_; end + def log_or_raise(msg, exception = _); end + def needed_; end + def runpath_(rpath_sym = _); end + def soname_; end + def tag_name_or_log(type, log_msg); end +end + +class PatchELF::Saver + def initialize(in_file, out_file, set); end + + def in_file; end + def out_file; end + def save!; end + + private + + def dynamic; end + def expand_dynamic!; end + def inline_patch(off, str); end + def lazy_dyn(sym); end + def malloc_strtab!; end + def patch_dynamic; end + def patch_interpreter; end + def patch_needed; end + def patch_out(out_file); end + def patch_runpath(sym = _); end + def patch_soname; end + def reg_str_table(str, &block); end + def section_header(name); end + def strtab_string; end +end + +PatchELF::Saver::IGNORE = T.let(T.unsafe(nil), Integer) + +PatchELF::VERSION = T.let(T.unsafe(nil), String) diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop-ast@0.1.0.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop-ast@0.2.0.rbi similarity index 98% rename from Library/Homebrew/sorbet/rbi/gems/rubocop-ast@0.1.0.rbi rename to Library/Homebrew/sorbet/rbi/gems/rubocop-ast@0.2.0.rbi index e43fc405c9..42c899a54c 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop-ast@0.1.0.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rubocop-ast@0.2.0.rbi @@ -265,7 +265,6 @@ class RuboCop::AST::DefNode < ::RuboCop::AST::Node def arguments; end def body; end def method_name; end - def node_parts; end def receiver; end def void_context?; end end @@ -530,6 +529,7 @@ class RuboCop::AST::Node < ::Parser::AST::Node def chained?; end def child_nodes; end def class_constructor?(node = _); end + def class_definition?(node = _); end def class_type?; end def complete!; end def complete?; end @@ -570,6 +570,7 @@ class RuboCop::AST::Node < ::Parser::AST::Node def forward_arg_type?; end def forward_args_type?; end def forwarded_args_type?; end + def global_const?(node = _, param1); end def guard_clause?; end def gvar_type?; end def gvasgn_type?; end @@ -615,6 +616,7 @@ class RuboCop::AST::Node < ::Parser::AST::Node def match_with_lvasgn_type?; end def match_with_trailing_comma_type?; end def mlhs_type?; end + def module_definition?(node = _); end def module_type?; end def mrasgn_type?; end def multiline?; end @@ -679,6 +681,7 @@ class RuboCop::AST::Node < ::Parser::AST::Node def splat_type?; end def str_content(node = _); end def str_type?; end + def struct_constructor?(node = _); end def super_type?; end def sym_type?; end def true_type?; end @@ -779,6 +782,12 @@ module RuboCop::AST::NodePattern::Macros def def_node_search(method_name, pattern_str, **keyword_defaults); end end +class RuboCop::AST::NodePattern::Matcher + def initialize(&block); end + + def ===(compare); end +end + module RuboCop::AST::NumericNode def sign?; end end @@ -849,6 +858,7 @@ class RuboCop::AST::ProcessedSource def commented?(source_range); end def comments; end def comments_before_line(line); end + def contains_comment?(source_range); end def current_line(token); end def diagnostics; end def each_comment; end @@ -858,6 +868,7 @@ class RuboCop::AST::ProcessedSource def find_token; end def following_line(token); end def line_indentation(line_number); end + def line_with_comment?(line); end def lines; end def parser_error; end def path; end @@ -1034,6 +1045,7 @@ module RuboCop::AST::Traversal def on_ensure(node); end def on_erange(node); end def on_false(node); end + def on_find_pattern(node); end def on_float(node); end def on_for(node); end def on_forward_arg(node); end @@ -1199,10 +1211,14 @@ RuboCop::AST::NodePattern::Compiler::META = T.let(T.unsafe(nil), Regexp) RuboCop::AST::NodePattern::Compiler::METHOD_NAME = T.let(T.unsafe(nil), Regexp) +RuboCop::AST::NodePattern::Compiler::MULTIPLE_CUR_PLACEHOLDER = T.let(T.unsafe(nil), Regexp) + RuboCop::AST::NodePattern::Compiler::NODE = T.let(T.unsafe(nil), Regexp) RuboCop::AST::NodePattern::Compiler::NUMBER = T.let(T.unsafe(nil), Regexp) +RuboCop::AST::NodePattern::Compiler::ONLY_SEPARATOR = T.let(T.unsafe(nil), Regexp) + RuboCop::AST::NodePattern::Compiler::PARAM = T.let(T.unsafe(nil), Regexp) RuboCop::AST::NodePattern::Compiler::PARAM_CONST = T.let(T.unsafe(nil), Regexp) diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.7.0.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.7.1.rbi similarity index 99% rename from Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.7.0.rbi rename to Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.7.1.rbi index 975a4bb844..583f91b0e8 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.7.0.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rubocop-performance@1.7.1.rbi @@ -26,6 +26,10 @@ class RuboCop::Cop::Performance::BigDecimalWithNumericArgument < ::RuboCop::Cop: def autocorrect(node); end def big_decimal_with_numeric_argument?(node = _); end def on_send(node); end + + private + + def specifies_precision?(node); end end RuboCop::Cop::Performance::BigDecimalWithNumericArgument::MSG = T.let(T.unsafe(nil), String) diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop-rspec@1.41.0.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop-rspec@1.42.0.rbi similarity index 94% rename from Library/Homebrew/sorbet/rbi/gems/rubocop-rspec@1.41.0.rbi rename to Library/Homebrew/sorbet/rbi/gems/rubocop-rspec@1.42.0.rbi index dfdaf6e4ce..780df93b35 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop-rspec@1.41.0.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rubocop-rspec@1.42.0.rbi @@ -50,12 +50,9 @@ module RuboCop::Cop::RSpec end class RuboCop::Cop::RSpec::AlignLeftLetBrace < ::RuboCop::Cop::RSpec::Cop - def autocorrect(let); end - def investigate(_processed_source); end + extend(::RuboCop::Cop::AutoCorrector) - private - - def token_aligner; end + def on_new_investigation; end def self.autocorrect_incompatible_with; end end @@ -63,12 +60,9 @@ end RuboCop::Cop::RSpec::AlignLeftLetBrace::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::AlignRightLetBrace < ::RuboCop::Cop::RSpec::Cop - def autocorrect(let); end - def investigate(_processed_source); end + extend(::RuboCop::Cop::AutoCorrector) - private - - def token_aligner; end + def on_new_investigation; end def self.autocorrect_incompatible_with; end end @@ -105,7 +99,8 @@ end RuboCop::Cop::RSpec::Be::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::BeEql < ::RuboCop::Cop::RSpec::Cop - def autocorrect(node); end + extend(::RuboCop::Cop::AutoCorrector) + def eql_type_with_identity(node = _); end def on_send(node); end end @@ -123,8 +118,9 @@ module RuboCop::Cop::RSpec::Capybara end class RuboCop::Cop::RSpec::Capybara::CurrentPathExpectation < ::RuboCop::Cop::RSpec::Cop + extend(::RuboCop::Cop::AutoCorrector) + def as_is_matcher(node = _); end - def autocorrect(node); end def expectation_set_on_current_path(node = _); end def on_send(node); end def regexp_str_matcher(node = _); end @@ -132,6 +128,7 @@ class RuboCop::Cop::RSpec::Capybara::CurrentPathExpectation < ::RuboCop::Cop::RS private def add_ignore_query_options(corrector, node); end + def autocorrect(corrector, node); end def convert_regexp_str_to_literal(corrector, matcher_node, regexp_str); end def rewrite_expectation(corrector, node, to_symbol, matcher_node); end end @@ -139,8 +136,10 @@ end RuboCop::Cop::RSpec::Capybara::CurrentPathExpectation::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::Capybara::FeatureMethods < ::RuboCop::Cop::RSpec::Cop - def autocorrect(node); end + extend(::RuboCop::Cop::AutoCorrector) + def feature_method(node = _); end + def message(range); end def on_block(node); end def spec?(node = _); end @@ -174,7 +173,8 @@ RuboCop::Cop::RSpec::Capybara::VisibilityMatcher::MSG_FALSE = T.let(T.unsafe(nil RuboCop::Cop::RSpec::Capybara::VisibilityMatcher::MSG_TRUE = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::ContextMethod < ::RuboCop::Cop::RSpec::Cop - def autocorrect(node); end + extend(::RuboCop::Cop::AutoCorrector) + def context_method(node = _); end def on_block(node); end @@ -198,7 +198,7 @@ end RuboCop::Cop::RSpec::ContextWording::MSG = T.let(T.unsafe(nil), String) -class RuboCop::Cop::RSpec::Cop < ::RuboCop::Cop::Cop +class RuboCop::Cop::RSpec::Cop < ::RuboCop::Cop::Base include(::RuboCop::RSpec::Language) include(::RuboCop::RSpec::Language::NodePattern) @@ -251,8 +251,8 @@ RuboCop::Cop::RSpec::DescribeSymbol::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::DescribedClass < ::RuboCop::Cop::RSpec::Cop include(::RuboCop::Cop::ConfigurableEnforcedStyle) + extend(::RuboCop::Cop::AutoCorrector) - def autocorrect(node); end def common_instance_exec_closure?(node = _); end def contains_described_class?(node0); end def described_constant(node = _); end @@ -262,6 +262,7 @@ class RuboCop::Cop::RSpec::DescribedClass < ::RuboCop::Cop::RSpec::Cop private + def autocorrect(corrector, match); end def collapse_namespace(namespace, const); end def const_name(node); end def find_usage(node, &block); end @@ -288,14 +289,10 @@ RuboCop::Cop::RSpec::DescribedClassModuleWrapping::MSG = T.let(T.unsafe(nil), St class RuboCop::Cop::RSpec::Dialect < ::RuboCop::Cop::RSpec::Cop include(::RuboCop::Cop::MethodPreference) + extend(::RuboCop::Cop::AutoCorrector) - def autocorrect(node); end def on_send(node); end def rspec_method?(node = _); end - - private - - def message(node); end end RuboCop::Cop::RSpec::Dialect::MSG = T.let(T.unsafe(nil), String) @@ -314,8 +311,8 @@ RuboCop::Cop::RSpec::EmptyExampleGroup::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::EmptyHook < ::RuboCop::Cop::RSpec::Cop include(::RuboCop::Cop::RangeHelp) + extend(::RuboCop::Cop::AutoCorrector) - def autocorrect(node); end def empty_hook?(node = _); end def on_block(node); end end @@ -326,6 +323,7 @@ class RuboCop::Cop::RSpec::EmptyLineAfterExample < ::RuboCop::Cop::RSpec::Cop include(::RuboCop::RSpec::FinalEndLocation) include(::RuboCop::Cop::RangeHelp) include(::RuboCop::RSpec::BlankLineSeparation) + extend(::RuboCop::Cop::AutoCorrector) def allow_consecutive_one_liners?; end def allowed_one_liner?(node); end @@ -341,6 +339,7 @@ class RuboCop::Cop::RSpec::EmptyLineAfterExampleGroup < ::RuboCop::Cop::RSpec::C include(::RuboCop::RSpec::FinalEndLocation) include(::RuboCop::Cop::RangeHelp) include(::RuboCop::RSpec::BlankLineSeparation) + extend(::RuboCop::Cop::AutoCorrector) def on_block(node); end end @@ -351,6 +350,7 @@ class RuboCop::Cop::RSpec::EmptyLineAfterFinalLet < ::RuboCop::Cop::RSpec::Cop include(::RuboCop::RSpec::FinalEndLocation) include(::RuboCop::Cop::RangeHelp) include(::RuboCop::RSpec::BlankLineSeparation) + extend(::RuboCop::Cop::AutoCorrector) def on_block(node); end end @@ -361,6 +361,7 @@ class RuboCop::Cop::RSpec::EmptyLineAfterHook < ::RuboCop::Cop::RSpec::Cop include(::RuboCop::RSpec::FinalEndLocation) include(::RuboCop::Cop::RangeHelp) include(::RuboCop::RSpec::BlankLineSeparation) + extend(::RuboCop::Cop::AutoCorrector) def on_block(node); end end @@ -371,6 +372,7 @@ class RuboCop::Cop::RSpec::EmptyLineAfterSubject < ::RuboCop::Cop::RSpec::Cop include(::RuboCop::RSpec::FinalEndLocation) include(::RuboCop::Cop::RangeHelp) include(::RuboCop::RSpec::BlankLineSeparation) + extend(::RuboCop::Cop::AutoCorrector) def on_block(node); end @@ -412,7 +414,8 @@ RuboCop::Cop::RSpec::ExampleWithoutDescription::MSG_ADD_DESCRIPTION = T.let(T.un RuboCop::Cop::RSpec::ExampleWithoutDescription::MSG_DEFAULT_ARGUMENT = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::ExampleWording < ::RuboCop::Cop::RSpec::Cop - def autocorrect(node); end + extend(::RuboCop::Cop::AutoCorrector) + def it_description(node = _); end def on_block(node); end @@ -435,7 +438,8 @@ RuboCop::Cop::RSpec::ExampleWording::MSG_SHOULD = T.let(T.unsafe(nil), String) RuboCop::Cop::RSpec::ExampleWording::SHOULD_PREFIX = T.let(T.unsafe(nil), Regexp) class RuboCop::Cop::RSpec::ExpectActual < ::RuboCop::Cop::RSpec::Cop - def autocorrect(node); end + extend(::RuboCop::Cop::AutoCorrector) + def expect_literal(node = _); end def on_send(node); end @@ -457,17 +461,12 @@ RuboCop::Cop::RSpec::ExpectActual::SUPPORTED_MATCHERS = T.let(T.unsafe(nil), Arr class RuboCop::Cop::RSpec::ExpectChange < ::RuboCop::Cop::RSpec::Cop include(::RuboCop::Cop::ConfigurableEnforcedStyle) + extend(::RuboCop::Cop::AutoCorrector) - def autocorrect(node); end def expect_change_with_arguments(node = _); end def expect_change_with_block(node = _); end def on_block(node); end def on_send(node); end - - private - - def autocorrect_block_to_method_call(node); end - def autocorrect_method_call_to_block(node); end end RuboCop::Cop::RSpec::ExpectChange::MSG_BLOCK = T.let(T.unsafe(nil), String) @@ -505,11 +504,8 @@ module RuboCop::Cop::RSpec::ExplicitHelper private def allowed_explicit_matchers; end - def autocorrect_explicit(node); end - def autocorrect_explicit_block(node); end - def autocorrect_explicit_send(node); end def check_explicit(node); end - def corrector_explicit(to_node, actual, matcher, block_child); end + def corrector_explicit(corrector, to_node, actual, matcher, block_child); end def message_explicit(matcher); end def move_predicate(corrector, actual, matcher, block_child); end def predicate_matcher_name?(name); end @@ -525,8 +521,9 @@ module RuboCop::Cop::RSpec::FactoryBot end class RuboCop::Cop::RSpec::FactoryBot::AttributeDefinedStatically < ::RuboCop::Cop::RSpec::Cop + extend(::RuboCop::Cop::AutoCorrector) + def association?(node = _); end - def autocorrect(node); end def factory_attributes(node = _); end def on_block(node); end def value_matcher(node = _); end @@ -534,8 +531,9 @@ class RuboCop::Cop::RSpec::FactoryBot::AttributeDefinedStatically < ::RuboCop::C private def attribute_defining_method?(method_name); end - def autocorrect_replacing_parens(node); end - def autocorrect_without_parens(node); end + def autocorrect(corrector, node); end + def autocorrect_replacing_parens(corrector, node); end + def autocorrect_without_parens(corrector, node); end def braces(node); end def offensive_receiver?(receiver, node); end def proc?(attribute); end @@ -548,8 +546,8 @@ RuboCop::Cop::RSpec::FactoryBot::AttributeDefinedStatically::MSG = T.let(T.unsaf class RuboCop::Cop::RSpec::FactoryBot::CreateList < ::RuboCop::Cop::RSpec::Cop include(::RuboCop::Cop::ConfigurableEnforcedStyle) + extend(::RuboCop::Cop::AutoCorrector) - def autocorrect(node); end def factory_call(node = _); end def factory_list_call(node = _); end def n_times_block_without_arg?(node = _); end @@ -602,7 +600,8 @@ class RuboCop::Cop::RSpec::FactoryBot::CreateList::TimesCorrector < ::RuboCop::C end class RuboCop::Cop::RSpec::FactoryBot::FactoryClassName < ::RuboCop::Cop::RSpec::Cop - def autocorrect(node); end + extend(::RuboCop::Cop::AutoCorrector) + def class_name(node = _); end def on_send(node); end @@ -655,8 +654,8 @@ RuboCop::Cop::RSpec::Focus::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::HookArgument < ::RuboCop::Cop::RSpec::Cop include(::RuboCop::Cop::ConfigurableEnforcedStyle) + extend(::RuboCop::Cop::AutoCorrector) - def autocorrect(node); end def on_block(node); end def scoped_hook(node = _); end def unscoped_hook(node = _); end @@ -677,12 +676,14 @@ RuboCop::Cop::RSpec::HookArgument::HOOKS = T.let(T.unsafe(nil), String) RuboCop::Cop::RSpec::HookArgument::IMPLICIT_MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::HooksBeforeExamples < ::RuboCop::Cop::RSpec::Cop - def autocorrect(node); end + extend(::RuboCop::Cop::AutoCorrector) + def example_or_group?(node = _); end def on_block(node); end private + def autocorrect(corrector, node, first_example); end def check_hooks(node); end def find_first_example(node); end def multiline_block?(block); end @@ -707,8 +708,8 @@ RuboCop::Cop::RSpec::ImplicitBlockExpectation::MSG = T.let(T.unsafe(nil), String class RuboCop::Cop::RSpec::ImplicitExpect < ::RuboCop::Cop::RSpec::Cop include(::RuboCop::Cop::ConfigurableEnforcedStyle) + extend(::RuboCop::Cop::AutoCorrector) - def autocorrect(node); end def implicit_expect(node = _); end def on_send(node); end @@ -726,14 +727,15 @@ RuboCop::Cop::RSpec::ImplicitExpect::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::ImplicitSubject < ::RuboCop::Cop::RSpec::Cop include(::RuboCop::Cop::ConfigurableEnforcedStyle) + extend(::RuboCop::Cop::AutoCorrector) - def autocorrect(node); end def implicit_subject?(node = _); end def on_send(node); end private def allowed_by_style?(example); end + def autocorrect(corrector, node); end def valid_usage?(node); end end @@ -749,7 +751,6 @@ module RuboCop::Cop::RSpec::InflectedHelper private - def autocorrect_inflected(node); end def boolean_matcher?(node); end def check_inflected(node); end def message_inflected(predicate); end @@ -763,10 +764,15 @@ end RuboCop::Cop::RSpec::InflectedHelper::MSG_INFLECTED = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::InstanceSpy < ::RuboCop::Cop::RSpec::Cop - def autocorrect(node); end + extend(::RuboCop::Cop::AutoCorrector) + def have_received_usage(node0); end def null_double(node0); end def on_block(node); end + + private + + def autocorrect(corrector, node); end end RuboCop::Cop::RSpec::InstanceSpy::MSG = T.let(T.unsafe(nil), String) @@ -794,7 +800,6 @@ class RuboCop::Cop::RSpec::InvalidPredicateMatcher < ::RuboCop::Cop::RSpec::Cop private - def message(predicate); end def predicate?(name); end end @@ -802,8 +807,8 @@ RuboCop::Cop::RSpec::InvalidPredicateMatcher::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::ItBehavesLike < ::RuboCop::Cop::RSpec::Cop include(::RuboCop::Cop::ConfigurableEnforcedStyle) + extend(::RuboCop::Cop::AutoCorrector) - def autocorrect(node); end def example_inclusion_offense(node = _, param1); end def on_send(node); end @@ -828,12 +833,14 @@ end RuboCop::Cop::RSpec::IteratedExpectation::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::LeadingSubject < ::RuboCop::Cop::RSpec::Cop - def autocorrect(node); end + extend(::RuboCop::Cop::AutoCorrector) + def check_previous_nodes(node); end def on_block(node); end private + def autocorrect(corrector, node); end def find_first_offending_node(node); end def in_spec_block?(node); end def offending?(node); end @@ -858,12 +865,14 @@ RuboCop::Cop::RSpec::LeakyConstantDeclaration::MSG_CONST = T.let(T.unsafe(nil), RuboCop::Cop::RSpec::LeakyConstantDeclaration::MSG_MODULE = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::LetBeforeExamples < ::RuboCop::Cop::RSpec::Cop - def autocorrect(node); end + extend(::RuboCop::Cop::AutoCorrector) + def example_or_group?(node = _); end def on_block(node); end private + def autocorrect(corrector, node, first_example); end def check_let_declarations(node); end def find_first_example(node); end def multiline_block?(block); end @@ -886,7 +895,6 @@ end RuboCop::Cop::RSpec::LetSetup::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::MessageChain < ::RuboCop::Cop::RSpec::Cop - def message(node); end def message_chain(node = _); end def on_send(node); end end @@ -965,15 +973,16 @@ RuboCop::Cop::RSpec::MultipleExpectations::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::MultipleSubjects < ::RuboCop::Cop::RSpec::Cop include(::RuboCop::Cop::RangeHelp) + extend(::RuboCop::Cop::AutoCorrector) - def autocorrect(node); end def on_block(node); end private + def autocorrect(corrector, subject); end def named_subject?(node); end - def remove_autocorrect(node); end - def rename_autocorrect(node); end + def remove_autocorrect(corrector, node); end + def rename_autocorrect(corrector, node); end end RuboCop::Cop::RSpec::MultipleSubjects::MSG = T.let(T.unsafe(nil), String) @@ -1010,8 +1019,8 @@ RuboCop::Cop::RSpec::NestedGroups::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::NotToNot < ::RuboCop::Cop::RSpec::Cop include(::RuboCop::Cop::ConfigurableEnforcedStyle) + extend(::RuboCop::Cop::AutoCorrector) - def autocorrect(node); end def not_to_not_offense(node = _, param1); end def on_send(node); end @@ -1057,6 +1066,7 @@ class RuboCop::Cop::RSpec::PredicateMatcher < ::RuboCop::Cop::RSpec::Cop include(::RuboCop::Cop::ConfigurableEnforcedStyle) include(::RuboCop::Cop::RSpec::InflectedHelper) include(::RuboCop::Cop::RSpec::ExplicitHelper) + extend(::RuboCop::Cop::AutoCorrector) def autocorrect(node); end def on_block(node); end @@ -1069,13 +1079,15 @@ class RuboCop::Cop::RSpec::PredicateMatcher < ::RuboCop::Cop::RSpec::Cop end class RuboCop::Cop::RSpec::ReceiveCounts < ::RuboCop::Cop::RSpec::Cop - def autocorrect(node); end + extend(::RuboCop::Cop::AutoCorrector) + def on_send(node); end def receive_counts(node = _); end def stub?(node0); end private + def autocorrect(corrector, node, range); end def matcher_for(method, count); end def message_for(node, source); end def range(node, offending_node); end @@ -1084,9 +1096,14 @@ end RuboCop::Cop::RSpec::ReceiveCounts::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::ReceiveNever < ::RuboCop::Cop::RSpec::Cop - def autocorrect(node); end + extend(::RuboCop::Cop::AutoCorrector) + def method_on_stub?(node0); end def on_send(node); end + + private + + def autocorrect(corrector, node); end end RuboCop::Cop::RSpec::ReceiveNever::MSG = T.let(T.unsafe(nil), String) @@ -1149,9 +1166,9 @@ RuboCop::Cop::RSpec::RepeatedExampleGroupDescription::MSG = T.let(T.unsafe(nil), class RuboCop::Cop::RSpec::ReturnFromStub < ::RuboCop::Cop::RSpec::Cop include(::RuboCop::Cop::ConfigurableEnforcedStyle) + extend(::RuboCop::Cop::AutoCorrector) def and_return_value(node0); end - def autocorrect(node); end def contains_stub?(node0); end def on_block(node); end def on_send(node); end @@ -1200,7 +1217,8 @@ RuboCop::Cop::RSpec::ReturnFromStub::MSG_AND_RETURN = T.let(T.unsafe(nil), Strin RuboCop::Cop::RSpec::ReturnFromStub::MSG_BLOCK = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::ScatteredLet < ::RuboCop::Cop::RSpec::Cop - def autocorrect(node); end + extend(::RuboCop::Cop::AutoCorrector) + def on_block(node); end private @@ -1220,7 +1238,8 @@ end RuboCop::Cop::RSpec::ScatteredSetup::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::SharedContext < ::RuboCop::Cop::RSpec::Cop - def autocorrect(node); end + extend(::RuboCop::Cop::AutoCorrector) + def context?(node0); end def examples?(node0); end def on_block(node); end @@ -1229,7 +1248,6 @@ class RuboCop::Cop::RSpec::SharedContext < ::RuboCop::Cop::RSpec::Cop private - def add_shared_item_offense(node, message); end def context_with_only_examples(node); end def examples_with_only_context(node); end end @@ -1239,7 +1257,8 @@ RuboCop::Cop::RSpec::SharedContext::MSG_CONTEXT = T.let(T.unsafe(nil), String) RuboCop::Cop::RSpec::SharedContext::MSG_EXAMPLES = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::SharedExamples < ::RuboCop::Cop::RSpec::Cop - def autocorrect(node); end + extend(::RuboCop::Cop::AutoCorrector) + def on_send(node); end def shared_examples(node = _); end end @@ -1260,17 +1279,18 @@ end RuboCop::Cop::RSpec::SharedExamples::Checker::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::SingleArgumentMessageChain < ::RuboCop::Cop::RSpec::Cop - def autocorrect(node); end + extend(::RuboCop::Cop::AutoCorrector) + def message_chain(node = _); end def on_send(node); end def single_key_hash?(node = _); end private + def autocorrect(corrector, node, method, arg); end def autocorrect_array_arg(corrector, arg); end def autocorrect_hash_arg(corrector, arg); end def key_to_arg(node); end - def message(node); end def replacement(method); end def single_element_array?(node); end def valid_usage?(node); end @@ -1360,8 +1380,8 @@ RuboCop::Cop::RSpec::VoidExpect::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::RSpec::Yield < ::RuboCop::Cop::RSpec::Cop include(::RuboCop::Cop::RangeHelp) + extend(::RuboCop::Cop::AutoCorrector) - def autocorrect(node); end def block_arg(node = _); end def block_call?(node = _, param1); end def method_on_stub?(node0); end @@ -1369,6 +1389,7 @@ class RuboCop::Cop::RSpec::Yield < ::RuboCop::Cop::RSpec::Cop private + def autocorrect(corrector, node, range); end def block_range(node); end def calling_block?(node, block); end def convert_block_to_yield(node); end @@ -1407,7 +1428,6 @@ module RuboCop::RSpec::BlankLineSeparation include(::RuboCop::RSpec::FinalEndLocation) include(::RuboCop::Cop::RangeHelp) - def autocorrect(node); end def last_child?(node); end def missing_separating_line(node); end def offending_loc(last_line); end diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop@0.87.0.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop@0.88.0.rbi similarity index 98% rename from Library/Homebrew/sorbet/rbi/gems/rubocop@0.87.0.rbi rename to Library/Homebrew/sorbet/rbi/gems/rubocop@0.88.0.rbi index 67e0482a29..defd5528c7 100644 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop@0.87.0.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/rubocop@0.88.0.rbi @@ -289,6 +289,8 @@ class RuboCop::ConfigLoader def self.merge(base_hash, derived_hash); end def self.merge_with_default(config, config_file, unset_nil: _); end def self.possible_new_cops?(config); end + def self.project_root; end + def self.project_root=(_); end def self.warn_on_pending_cops(pending_cops); end end @@ -363,6 +365,7 @@ class RuboCop::ConfigStore def for(file_or_dir); end def for_dir(dir); end def for_file(file); end + def for_pwd; end def force_default_config!; end def options_config=(options_config); end end @@ -549,6 +552,8 @@ class RuboCop::Cop::Base def complete_investigation; end def correct(range); end def correction_strategy; end + def current_offense_locations; end + def currently_disabled_lines; end def custom_severity; end def default_severity; end def disable_uncorrectable(range); end @@ -749,6 +754,7 @@ class RuboCop::Cop::Commissioner def on_ensure(node); end def on_erange(node); end def on_false(node); end + def on_find_pattern(node); end def on_float(node); end def on_for(node); end def on_forward_arg(node); end @@ -1602,9 +1608,10 @@ end RuboCop::Cop::Layout::CaseIndentation::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Layout::ClassStructure < ::RuboCop::Cop::Cop + include(::RuboCop::Cop::VisibilityHelp) + def autocorrect(node); end def on_class(class_node); end - def visibility_block?(node = _); end private @@ -1616,14 +1623,8 @@ class RuboCop::Cop::Layout::ClassStructure < ::RuboCop::Cop::Cop def end_position_for(node); end def expected_order; end def find_category(node); end - def find_visibility_end(node); end - def find_visibility_start(node); end def humanize_node(node); end def ignore?(classification); end - def left_siblings_of(node); end - def node_visibility(node); end - def right_siblings_of(node); end - def siblings_of(node); end def source_range_with_comment(node); end def start_line_position(node); end def walk_over_nested_class_definition(class_node); end @@ -1633,8 +1634,6 @@ RuboCop::Cop::Layout::ClassStructure::HUMANIZED_NODE_TYPE = T.let(T.unsafe(nil), RuboCop::Cop::Layout::ClassStructure::MSG = T.let(T.unsafe(nil), String) -RuboCop::Cop::Layout::ClassStructure::VISIBILITY_SCOPES = T.let(T.unsafe(nil), Array) - class RuboCop::Cop::Layout::ClosingHeredocIndentation < ::RuboCop::Cop::Cop include(::RuboCop::Cop::Heredoc) @@ -2625,8 +2624,10 @@ class RuboCop::Cop::Layout::MultilineBlockLayout < ::RuboCop::Cop::Cop def autocorrect_arguments(corrector, node); end def autocorrect_body(corrector, node, block_body); end def block_arg_string(node, args); end + def characters_needed_for_space_and_pipes(node); end def include_trailing_comma?(args); end def line_break_necessary_in_args?(node); end + def needed_length_for_args(node); end end RuboCop::Cop::Layout::MultilineBlockLayout::ARG_MSG = T.let(T.unsafe(nil), String) @@ -2964,30 +2965,26 @@ RuboCop::Cop::Layout::SpaceAroundKeyword::NAMESPACE_OPERATOR = T.let(T.unsafe(ni RuboCop::Cop::Layout::SpaceAroundKeyword::SAFE_NAVIGATION = T.let(T.unsafe(nil), String) -class RuboCop::Cop::Layout::SpaceAroundMethodCallOperator < ::RuboCop::Cop::Cop +class RuboCop::Cop::Layout::SpaceAroundMethodCallOperator < ::RuboCop::Cop::Base include(::RuboCop::Cop::RangeHelp) - include(::RuboCop::Cop::SurroundingSpace) + extend(::RuboCop::Cop::AutoCorrector) - def autocorrect(node); end def on_const(node); end def on_csend(node); end def on_send(node); end private - def check_and_add_offense(node, add_left_offense = _); end - def dot_or_safe_navigation_operator?(node); end - def left_token_for_auto_correction(node, operator); end - def next_token(current_token); end - def operator_token(node); end - def previous_token(current_token); end - def right_token_for_auto_correction(operator); end - def valid_left_token?(left, operator); end - def valid_right_token?(right, operator); end + def check_space(begin_pos, end_pos); end + def check_space_after_dot(node); end + def check_space_after_double_colon(node); end + def check_space_before_dot(node); end end RuboCop::Cop::Layout::SpaceAroundMethodCallOperator::MSG = T.let(T.unsafe(nil), String) +RuboCop::Cop::Layout::SpaceAroundMethodCallOperator::SPACES_REGEXP = T.let(T.unsafe(nil), Regexp) + class RuboCop::Cop::Layout::SpaceAroundOperators < ::RuboCop::Cop::Cop include(::RuboCop::Cop::PrecedingFollowingAlignment) include(::RuboCop::Cop::RangeHelp) @@ -3570,7 +3567,9 @@ end RuboCop::Cop::Lint::DeprecatedOpenSSLConstant::MSG = T.let(T.unsafe(nil), String) -class RuboCop::Cop::Lint::DisjunctiveAssignmentInConstructor < ::RuboCop::Cop::Cop +class RuboCop::Cop::Lint::DisjunctiveAssignmentInConstructor < ::RuboCop::Cop::Base + extend(::RuboCop::Cop::AutoCorrector) + def on_def(node); end private @@ -3593,6 +3592,12 @@ end RuboCop::Cop::Lint::DuplicateCaseCondition::MSG = T.let(T.unsafe(nil), String) +class RuboCop::Cop::Lint::DuplicateElsifCondition < ::RuboCop::Cop::Base + def on_if(node); end +end + +RuboCop::Cop::Lint::DuplicateElsifCondition::MSG = T.let(T.unsafe(nil), String) + class RuboCop::Cop::Lint::DuplicateHashKey < ::RuboCop::Cop::Cop include(::RuboCop::Cop::Duplication) @@ -3852,6 +3857,8 @@ end RuboCop::Cop::Lint::InterpolationCheck::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Lint::LiteralAsCondition < ::RuboCop::Cop::Cop + include(::RuboCop::Cop::RangeHelp) + def message(node); end def on_case(case_node); end def on_if(node); end @@ -3870,6 +3877,7 @@ class RuboCop::Cop::Lint::LiteralAsCondition < ::RuboCop::Cop::Cop def condition(node); end def handle_node(node); end def primitive_array?(node); end + def when_conditions_range(when_node); end end RuboCop::Cop::Lint::LiteralAsCondition::MSG = T.let(T.unsafe(nil), String) @@ -3950,7 +3958,6 @@ class RuboCop::Cop::Lint::NestedMethodDefinition < ::RuboCop::Cop::Cop private - def find_nested_defs(node, &block); end def scoping_method_call?(child); end end @@ -3988,14 +3995,21 @@ RuboCop::Cop::Lint::NextWithoutAccumulator::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Lint::NonDeterministicRequireOrder < ::RuboCop::Cop::Cop def autocorrect(node); end def loop_variable(node = _); end + def method_require?(node = _); end def on_block(node); end + def on_block_pass(node); end def unsorted_dir_block?(node = _); end def unsorted_dir_each?(node = _); end + def unsorted_dir_each_pass?(node = _); end + def unsorted_dir_glob_pass?(node = _); end def var_is_required?(node0, param1); end private + def correct_block_pass(node); end + def last_arg_range(node); end def unsorted_dir_loop?(node); end + def unsorted_dir_pass?(node); end end RuboCop::Cop::Lint::NonDeterministicRequireOrder::MSG = T.let(T.unsafe(nil), String) @@ -5087,12 +5101,15 @@ class RuboCop::Cop::MultilineLiteralBraceCorrector private + def content_if_comment_present(corrector, node); end def correct_next_line_brace(corrector); end def correct_same_line_brace(corrector); end def last_element_range_with_trailing_comma(node); end def last_element_trailing_comma_range(node); end def node; end def processed_source; end + def remove_trailing_content_of_comment(corrector, range); end + def select_content_to_be_inserted_after_last_element(corrector, node); end end module RuboCop::Cop::MultilineLiteralBraceLayout @@ -5873,10 +5890,12 @@ RuboCop::Cop::Style::AccessModifierDeclarations::INLINE_STYLE_MESSAGE = T.let(T. class RuboCop::Cop::Style::AccessorGrouping < ::RuboCop::Cop::Cop include(::RuboCop::Cop::ConfigurableEnforcedStyle) + include(::RuboCop::Cop::VisibilityHelp) def autocorrect(node); end def on_class(node); end def on_module(node); end + def on_sclass(node); end private @@ -5887,6 +5906,7 @@ class RuboCop::Cop::Style::AccessorGrouping < ::RuboCop::Cop::Cop def group_accessors(node, accessors); end def grouped_style?; end def message(send_node); end + def previous_line_comment?(node); end def separate_accessors(node); end def separated_style?; end def sibling_accessors(send_node); end @@ -5964,6 +5984,19 @@ module RuboCop::Cop::Style::AnnotationComment def split_comment(comment); end end +class RuboCop::Cop::Style::ArrayCoercion < ::RuboCop::Cop::Base + extend(::RuboCop::Cop::AutoCorrector) + + def array_splat?(node = _); end + def on_array(node); end + def on_if(node); end + def unless_array?(node = _); end +end + +RuboCop::Cop::Style::ArrayCoercion::CHECK_MSG = T.let(T.unsafe(nil), String) + +RuboCop::Cop::Style::ArrayCoercion::SPLAT_MSG = T.let(T.unsafe(nil), String) + class RuboCop::Cop::Style::ArrayJoin < ::RuboCop::Cop::Cop def autocorrect(node); end def join_candidate?(node = _); end @@ -6038,19 +6071,25 @@ end RuboCop::Cop::Style::BeginBlock::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Style::BisectedAttrAccessor < ::RuboCop::Cop::Cop + include(::RuboCop::Cop::VisibilityHelp) + def autocorrect(node); end def on_class(class_node); end def on_module(class_node); end + def on_sclass(class_node); end private - def accessor_macroses(class_node); end - def accessor_names(class_node); end + def accessor_macroses(class_node, visibility); end + def accessor_names(class_node, visibility); end def attr_reader?(send_node); end + def attr_reader_replacement(macro, node, rest_args); end + def attr_within_visibility_scope?(node, visibility); end def attr_writer?(send_node); end def check(macro, reader_names, writer_names); end def indent(node); end def replacement(macro, node); end + def rest_args(args, reader_names, writer_names); end end RuboCop::Cop::Style::BisectedAttrAccessor::MSG = T.let(T.unsafe(nil), String) @@ -6136,6 +6175,31 @@ end RuboCop::Cop::Style::CaseEquality::MSG = T.let(T.unsafe(nil), String) +class RuboCop::Cop::Style::CaseLikeIf < ::RuboCop::Cop::Cop + include(::RuboCop::Cop::RangeHelp) + + def autocorrect(node); end + def on_if(node); end + + private + + def branch_conditions(node); end + def collect_conditions(node, target, conditions); end + def condition_from_binary_op(lhs, rhs, target); end + def condition_from_send_node(node, target); end + def const_reference?(node); end + def correction_range(node); end + def deparenthesize(node); end + def find_target(node); end + def find_target_in_equality_node(node); end + def find_target_in_match_node(node); end + def find_target_in_send_node(node); end + def indent(node); end + def should_check?(node); end +end + +RuboCop::Cop::Style::CaseLikeIf::MSG = T.let(T.unsafe(nil), String) + class RuboCop::Cop::Style::CharacterLiteral < ::RuboCop::Cop::Cop include(::RuboCop::Cop::StringHelp) @@ -6303,8 +6367,12 @@ end RuboCop::Cop::Style::CommentedKeyword::ALLOWED_COMMENTS = T.let(T.unsafe(nil), Array) +RuboCop::Cop::Style::CommentedKeyword::ALLOWED_COMMENT_REGEXES = T.let(T.unsafe(nil), Array) + RuboCop::Cop::Style::CommentedKeyword::KEYWORDS = T.let(T.unsafe(nil), Array) +RuboCop::Cop::Style::CommentedKeyword::KEYWORD_REGEXES = T.let(T.unsafe(nil), Array) + RuboCop::Cop::Style::CommentedKeyword::MSG = T.let(T.unsafe(nil), String) class RuboCop::Cop::Style::ConditionalAssignment < ::RuboCop::Cop::Cop @@ -6791,6 +6859,8 @@ class RuboCop::Cop::Style::ExponentialNotation < ::RuboCop::Cop::Cop def scientific?(node); end end +RuboCop::Cop::Style::ExponentialNotation::MESSAGES = T.let(T.unsafe(nil), Hash) + class RuboCop::Cop::Style::FloatDivision < ::RuboCop::Cop::Cop include(::RuboCop::Cop::ConfigurableEnforcedStyle) @@ -6806,6 +6876,8 @@ class RuboCop::Cop::Style::FloatDivision < ::RuboCop::Cop::Cop def offense_condition?(node); end end +RuboCop::Cop::Style::FloatDivision::MESSAGES = T.let(T.unsafe(nil), Hash) + class RuboCop::Cop::Style::For < ::RuboCop::Cop::Cop include(::RuboCop::Cop::ConfigurableEnforcedStyle) include(::RuboCop::Cop::RangeHelp) @@ -6930,6 +7002,19 @@ end RuboCop::Cop::Style::GuardClause::MSG = T.let(T.unsafe(nil), String) +class RuboCop::Cop::Style::HashAsLastArrayItem < ::RuboCop::Cop::Base + include(::RuboCop::Cop::ConfigurableEnforcedStyle) + extend(::RuboCop::Cop::AutoCorrector) + + def on_hash(node); end + + private + + def braces_style?; end + def check_braces(node); end + def check_no_braces(node); end +end + class RuboCop::Cop::Style::HashEachMethods < ::RuboCop::Cop::Cop include(::RuboCop::Cop::Lint::UnusedArgument) @@ -6950,6 +7035,18 @@ end RuboCop::Cop::Style::HashEachMethods::MSG = T.let(T.unsafe(nil), String) +class RuboCop::Cop::Style::HashLikeCase < ::RuboCop::Cop::Base + def hash_like_case?(node = _); end + def on_case(node); end + + private + + def min_branches_count; end + def nodes_of_same_type?(nodes); end +end + +RuboCop::Cop::Style::HashLikeCase::MSG = T.let(T.unsafe(nil), String) + class RuboCop::Cop::Style::HashSyntax < ::RuboCop::Cop::Cop include(::RuboCop::Cop::ConfigurableEnforcedStyle) include(::RuboCop::Cop::RangeHelp) @@ -7055,12 +7152,12 @@ class RuboCop::Cop::Style::IfUnlessModifier < ::RuboCop::Cop::Cop private def another_statement_on_same_line?(node); end - def eligible_node?(node); end def first_line_comment(node); end def ignored_patterns; end def line_length_enabled_at_line?(line); end def named_capture_in_condition?(node); end - def non_eligible_if?(node); end + def non_eligible_node?(node); end + def non_simple_if_unless?(node); end def parenthesize?(node); end def to_modifier_form(node); end def to_normal_form(node); end @@ -7071,8 +7168,6 @@ class RuboCop::Cop::Style::IfUnlessModifier < ::RuboCop::Cop::Cop def too_long_single_line?(node); end end -RuboCop::Cop::Style::IfUnlessModifier::ASSIGNMENT_TYPES = T.let(T.unsafe(nil), Array) - RuboCop::Cop::Style::IfUnlessModifier::MSG_USE_MODIFIER = T.let(T.unsafe(nil), String) RuboCop::Cop::Style::IfUnlessModifier::MSG_USE_NORMAL = T.let(T.unsafe(nil), String) @@ -8310,6 +8405,14 @@ end RuboCop::Cop::Style::RedundantFetchBlock::MSG = T.let(T.unsafe(nil), String) +class RuboCop::Cop::Style::RedundantFileExtensionInRequire < ::RuboCop::Cop::Cop + def autocorrect(node); end + def on_send(node); end + def require_call?(node = _); end +end + +RuboCop::Cop::Style::RedundantFileExtensionInRequire::MSG = T.let(T.unsafe(nil), String) + class RuboCop::Cop::Style::RedundantFreeze < ::RuboCop::Cop::Cop include(::RuboCop::Cop::FrozenStringLiteral) @@ -9147,19 +9250,14 @@ class RuboCop::Cop::Style::TrailingCommaInHashLiteral < ::RuboCop::Cop::Cop def on_hash(node); end end -class RuboCop::Cop::Style::TrailingMethodEndStatement < ::RuboCop::Cop::Cop - include(::RuboCop::Cop::Alignment) +class RuboCop::Cop::Style::TrailingMethodEndStatement < ::RuboCop::Cop::Base + extend(::RuboCop::Cop::AutoCorrector) - def autocorrect(node); end def on_def(node); end private def body_and_end_on_same_line?(node); end - def break_line_before_end(node, corrector); end - def end_token(node); end - def remove_semicolon(node, corrector); end - def token_before_end(node); end def trailing_end?(node); end end @@ -9978,6 +10076,23 @@ end RuboCop::Cop::VariableForce::ZERO_ARITY_SUPER_TYPE = T.let(T.unsafe(nil), Symbol) +module RuboCop::Cop::VisibilityHelp + extend(::RuboCop::AST::NodePattern::Macros) + + def visibility_block?(node = _); end + + private + + def find_visibility_end(node); end + def find_visibility_start(node); end + def left_siblings_of(node); end + def node_visibility(node); end + def right_siblings_of(node); end + def siblings_of(node); end +end + +RuboCop::Cop::VisibilityHelp::VISIBILITY_SCOPES = T.let(T.unsafe(nil), Array) + class RuboCop::Error < ::StandardError end @@ -10000,15 +10115,15 @@ module RuboCop::Ext::ProcessedSource end module RuboCop::FileFinder - def find_file_upwards(filename, start_dir); end - def find_files_upwards(filename, start_dir); end + def find_file_upwards(filename, start_dir, stop_dir = _); end + def find_last_file_upwards(filename, start_dir, stop_dir = _); end private - def traverse_files_upwards(filename, start_dir); end + def traverse_files_upwards(filename, start_dir, stop_dir); end def self.root_level=(level); end - def self.root_level?(path); end + def self.root_level?(path, stop_dir); end end module RuboCop::Formatter @@ -10488,13 +10603,10 @@ module RuboCop::PathUtil def smart_path(path); end def self.absolute?(path); end - def self.chdir(dir, &block); end def self.hidden_dir?(path); end def self.hidden_file_in_not_hidden_dir?(pattern, path); end def self.match_path?(pattern, path); end - def self.pwd; end def self.relative_path(path, base_dir = _); end - def self.reset_pwd; end def self.smart_path(path); end end @@ -10569,7 +10681,7 @@ class RuboCop::Runner def check_for_infinite_loop(processed_source, offenses); end def check_for_redundant_disables?(source); end def considered_failure?(offense); end - def do_inspection_loop(file, processed_source); end + def do_inspection_loop(file); end def each_inspected_file(files); end def file_finished(file, offenses); end def file_offense_cache(file); end diff --git a/Library/Homebrew/sorbet/rbi/gems/i18n@1.8.3.rbi b/Library/Homebrew/sorbet/rbi/gems/zeitwerk@2.4.0.rbi similarity index 73% rename from Library/Homebrew/sorbet/rbi/gems/i18n@1.8.3.rbi rename to Library/Homebrew/sorbet/rbi/gems/zeitwerk@2.4.0.rbi index 27b1fb4bc6..198c6b42fc 100644 --- a/Library/Homebrew/sorbet/rbi/gems/i18n@1.8.3.rbi +++ b/Library/Homebrew/sorbet/rbi/gems/zeitwerk@2.4.0.rbi @@ -1,5 +1,5 @@ # This file is autogenerated. Do not edit it by hand. Regenerate it with: -# tapioca sync +# tapioca sync --exclude json # typed: true diff --git a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi index ccb3e8a6ba..555e26f550 100644 --- a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi +++ b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi @@ -5621,6 +5621,10 @@ class Cask::Cmd::List def full_name?(); end + def json=(value); end + + def json?(); end + def one=(value); end def one?(); end @@ -6243,6 +6247,48 @@ module CodeRay def self.scanner(lang, options=T.unsafe(nil), &block); end end +module Colorize +end + +module Colorize::ClassMethods + def color_codes(); end + + def color_matrix(_=T.unsafe(nil)); end + + def color_methods(); end + + def color_samples(); end + + def colors(); end + + def disable_colorization(value=T.unsafe(nil)); end + + def disable_colorization=(value); end + + def mode_codes(); end + + def modes(); end + + def modes_methods(); end +end + +module Colorize::ClassMethods +end + +module Colorize::InstanceMethods + def colorize(params); end + + def colorized?(); end + + def uncolorize(); end +end + +module Colorize::InstanceMethods +end + +module Colorize +end + class CompilerSelector::Compiler def self.[](*_); end @@ -6794,6 +6840,130 @@ module Docile def self.dsl_eval_with_block_return(dsl, *args, &block); end end +module ELFTools + VERSION = ::T.let(nil, ::T.untyped) +end + +class ELFTools::Structs::ELF32_PhdrBe +end + +class ELFTools::Structs::ELF32_PhdrBe +end + +class ELFTools::Structs::ELF32_PhdrLe +end + +class ELFTools::Structs::ELF32_PhdrLe +end + +class ELFTools::Structs::ELF32_symBe +end + +class ELFTools::Structs::ELF32_symBe +end + +class ELFTools::Structs::ELF32_symLe +end + +class ELFTools::Structs::ELF32_symLe +end + +class ELFTools::Structs::ELF64_PhdrBe +end + +class ELFTools::Structs::ELF64_PhdrBe +end + +class ELFTools::Structs::ELF64_PhdrLe +end + +class ELFTools::Structs::ELF64_PhdrLe +end + +class ELFTools::Structs::ELF64_symBe +end + +class ELFTools::Structs::ELF64_symBe +end + +class ELFTools::Structs::ELF64_symLe +end + +class ELFTools::Structs::ELF64_symLe +end + +class ELFTools::Structs::ELF_DynBe +end + +class ELFTools::Structs::ELF_DynBe +end + +class ELFTools::Structs::ELF_DynLe +end + +class ELFTools::Structs::ELF_DynLe +end + +class ELFTools::Structs::ELF_EhdrBe +end + +class ELFTools::Structs::ELF_EhdrBe +end + +class ELFTools::Structs::ELF_EhdrLe +end + +class ELFTools::Structs::ELF_EhdrLe +end + +class ELFTools::Structs::ELF_NhdrBe +end + +class ELFTools::Structs::ELF_NhdrBe +end + +class ELFTools::Structs::ELF_NhdrLe +end + +class ELFTools::Structs::ELF_NhdrLe +end + +class ELFTools::Structs::ELF_RelBe +end + +class ELFTools::Structs::ELF_RelBe +end + +class ELFTools::Structs::ELF_RelLe +end + +class ELFTools::Structs::ELF_RelLe +end + +class ELFTools::Structs::ELF_RelaBe +end + +class ELFTools::Structs::ELF_RelaBe +end + +class ELFTools::Structs::ELF_RelaLe +end + +class ELFTools::Structs::ELF_RelaLe +end + +class ELFTools::Structs::ELF_ShdrBe +end + +class ELFTools::Structs::ELF_ShdrBe +end + +class ELFTools::Structs::ELF_ShdrLe +end + +class ELFTools::Structs::ELF_ShdrLe +end + class ERB def def_method(mod, methodname, fname=T.unsafe(nil)); end @@ -7969,6 +8139,8 @@ module Homebrew::EnvConfig def self.fail_log_lines(); end + def self.forbidden_licenses(); end + def self.force_brewed_curl?(); end def self.force_brewed_git?(); end @@ -12951,6 +13123,8 @@ end class Net::HTTPAlreadyReported end +Net::HTTPClientError::EXCEPTION_TYPE = Net::HTTPServerException + Net::HTTPClientErrorCode = Net::HTTPClientError Net::HTTPClientException = Net::HTTPServerException @@ -13021,6 +13195,8 @@ end class Net::HTTPRangeNotSatisfiable end +Net::HTTPRedirection::EXCEPTION_TYPE = Net::HTTPRetriableError + Net::HTTPRedirectionCode = Net::HTTPRedirection class Net::HTTPRequestTimeout @@ -13036,6 +13212,8 @@ Net::HTTPResponceReceiver = Net::HTTPResponse Net::HTTPRetriableCode = Net::HTTPRedirection +Net::HTTPServerError::EXCEPTION_TYPE = Net::HTTPFatalError + Net::HTTPServerErrorCode = Net::HTTPServerError Net::HTTPSession = Net::HTTP @@ -19415,6 +19593,10 @@ class RuboCop::Cop::FormulaAudit::Miscellaneous def languageNodeModule?(node0); end end +class RuboCop::Cop::FormulaAudit::OptionDeclarations + def depends_on_build_with(node0); end +end + class RuboCop::Cop::FormulaAudit::Patches def patch_data?(node0); end end @@ -19423,6 +19605,16 @@ class RuboCop::Cop::FormulaAudit::Test def test_calls(node0); end end +class RuboCop::Cop::FormulaAudit::Text + def prefix_path(node0); end +end + +class RuboCop::Cop::FormulaAuditStrict::Text + def interpolated_share_path_starts_with(node0, param1); end + + def share_path_starts_with(node0, param1); end +end + class RuboCop::Cop::FormulaCop def dependency_name_hash_match?(node0, param1); end @@ -19446,11 +19638,20 @@ module RuboCop::RSpec::ExpectOffense end class RuboCop::RSpec::ExpectOffense::AnnotatedSource + def ==(other); end + + def annotations(); end + def initialize(lines, annotations); end + def lines(); end + + def match_annotations?(other); end + def plain_source(); end def with_offense_annotations(offenses); end + ABBREV = ::T.let(nil, ::T.untyped) ANNOTATION_PATTERN = ::T.let(nil, ::T.untyped) end @@ -20756,13 +20957,25 @@ end class SimpleCov::Formatter::Codecov def build_params(ci); end + def create_report(report); end + def detect_ci(); end def display_header(); end - def format(result); end + def format(result, disable_net_blockers=T.unsafe(nil)); end - def upload_to_codecov(req, https); end + def gzip_report(report); end + + def handle_report_response(report); end + + def retry_request(req, https); end + + def upload_to_codecov(ci, report); end + + def upload_to_v2(url, report, query, query_without_token); end + + def upload_to_v4(url, report, query, query_without_token); end APPVEYOR = ::T.let(nil, ::T.untyped) AZUREPIPELINES = ::T.let(nil, ::T.untyped) BITBUCKET = ::T.let(nil, ::T.untyped) @@ -21389,11 +21602,20 @@ module Stdenv end class String + include ::Colorize::InstanceMethods include ::String::Compat def acts_like_string?(); end def at(position); end + def black(); end + + def blink(); end + + def blue(); end + + def bold(); end + def camelcase(first_letter=T.unsafe(nil)); end def camelize(first_letter=T.unsafe(nil)); end @@ -21402,6 +21624,8 @@ class String def constantize(); end + def cyan(); end + def dasherize(); end def deconstantize(); end @@ -21418,6 +21642,10 @@ class String def from(position); end + def green(); end + + def hide(); end + def html_safe(); end def humanize(capitalize: T.unsafe(nil), keep_id_suffix: T.unsafe(nil)); end @@ -21432,16 +21660,70 @@ class String def isutf8(); end + def italic(); end + def kconv(to_enc, from_enc=T.unsafe(nil)); end def last(limit=T.unsafe(nil)); end + def light_black(); end + + def light_blue(); end + + def light_cyan(); end + + def light_green(); end + + def light_magenta(); end + + def light_red(); end + + def light_white(); end + + def light_yellow(); end + + def magenta(); end + def mb_chars(); end + def on_black(); end + + def on_blue(); end + + def on_cyan(); end + + def on_green(); end + + def on_light_black(); end + + def on_light_blue(); end + + def on_light_cyan(); end + + def on_light_green(); end + + def on_light_magenta(); end + + def on_light_red(); end + + def on_light_white(); end + + def on_light_yellow(); end + + def on_magenta(); end + + def on_red(); end + + def on_white(); end + + def on_yellow(); end + def parameterize(separator: T.unsafe(nil), preserve_case: T.unsafe(nil), locale: T.unsafe(nil)); end def pluralize(count=T.unsafe(nil), locale=T.unsafe(nil)); end + def red(); end + def remove(*patterns); end def remove!(*patterns); end @@ -21460,6 +21742,8 @@ class String def starts_with?(*_); end + def swap(); end + def tableize(); end def titlecase(keep_id_suffix: T.unsafe(nil)); end @@ -21502,13 +21786,23 @@ class String def truncate_words(words_count, options=T.unsafe(nil)); end + def underline(); end + def underscore(); end def upcase_first(); end + + def white(); end + + def yellow(); end BLANK_RE = ::T.let(nil, ::T.untyped) ENCODED_BLANKS = ::T.let(nil, ::T.untyped) end +class String + extend ::Colorize::ClassMethods +end + class StringScanner def bol?(); end @@ -23158,86 +23452,28 @@ module URI end class URL - def =~(reg); end - - def [](*args, &block); end - - def []=(*args, &block); end - - def add_to_path(val); end - def branch(); end def cookies(); end def data(); end - def delete(*args); end - - def domain(); end - - def domain=(domain); end - - def format(); end - - def format=(format); end - - def get(*args); end - - def hash=(hash); end - - def host(); end - - def host_with_port(); end - - def params(); end - - def params=(p); end - def path(*args, &block); end - def path=(str); end - - def port(); end - - def port=(port); end - - def post(*args); end - - def put(*args); end - def referer(); end - def req_handler(); end - - def req_handler=(r); end - def revision(); end def revisions(); end def scheme(*args, &block); end - def scheme=(scheme); end - def specs(); end - def string(); end - - def subdomain(); end - - def subdomain=(s); end - - def subdomains(); end - - def subdomains=(s); end - def tag(); end def to_s(*args, &block); end - def to_uri(); end - def trust_cert(); end def uri(); end @@ -23245,122 +23481,6 @@ class URL def user_agent(); end def using(); end - VERSION = ::T.let(nil, ::T.untyped) -end - -class URL::ASJSONHandler -end - -class URL::ASJSONHandler -end - -class URL::BaseJSONHandler -end - -class URL::BaseJSONHandler -end - -class URL::JSONHandler - def initialize(str); end - - def parse(); end - - def str(); end -end - -class URL::JSONHandler -end - -class URL::Mash - def [](k); end - - def []=(k, v); end -end - -class URL::Mash -end - -class URL::NetHandler -end - -class URL::NetHandler -end - -class URL::ParamsHash - def reverse_merge!(other); end - - def to_s(questionmark=T.unsafe(nil)); end - - def |(other); end -end - -class URL::ParamsHash - def self.from_string(str); end -end - -class URL::RequestHandler - def delete(args=T.unsafe(nil)); end - - def get(args=T.unsafe(nil)); end - - def initialize(url); end - - def post(args=T.unsafe(nil)); end - - def put(args=T.unsafe(nil)); end - - def url(); end -end - -class URL::RequestHandler -end - -class URL::Response - def code(); end - - def connection_refused(); end - - def initialize(str, args=T.unsafe(nil)); end - - def json(); end - - def response(); end - - def success?(); end - - def successful?(); end - - def time(); end - - def url(); end - - def url_obj(); end -end - -class URL::Response -end - -class URL::TyHandler - def head(args=T.unsafe(nil)); end -end - -class URL::TyHandler -end - -class URL::YajlHandler -end - -class URL::YajlHandler -end - -class URL - def self.json_handler(); end - - def self.json_handler=(r); end - - def self.req_handler(); end - - def self.req_handler=(r); end end class UnboundMethod @@ -23496,7 +23616,7 @@ class Zeitwerk::Loader def preloads(); end - def push_dir(path); end + def push_dir(path, namespace: T.unsafe(nil)); end def reload(); end diff --git a/Library/Homebrew/sorbet/rbi/homebrew.rbi b/Library/Homebrew/sorbet/rbi/homebrew.rbi new file mode 100644 index 0000000000..a92dcd0165 --- /dev/null +++ b/Library/Homebrew/sorbet/rbi/homebrew.rbi @@ -0,0 +1,47 @@ +# typed: strict + +module Homebrew + include Kernel +end + +module Homebrew::Help + include Kernel +end + +module Homebrew::Fetch + def args; end +end + +module Language::Perl::Shebang + include Kernel +end + +module Dependable + def tags; end +end + +class Formula + module Compat + include Kernel + + def latest_version_installed?; end + + def active_spec; end + + def patches; end + end +end + +class NilClass + module Compat + include Kernel + end +end + +class String + module Compat + include Kernel + + def chomp; end + end +end diff --git a/Library/Homebrew/sorbet/rbi/os.rbi b/Library/Homebrew/sorbet/rbi/os.rbi index af39ccea3a..f4b85f1f7e 100644 --- a/Library/Homebrew/sorbet/rbi/os.rbi +++ b/Library/Homebrew/sorbet/rbi/os.rbi @@ -12,3 +12,11 @@ module OS include Kernel end end + +module OS::Mac + class << self + module Compat + include Kernel + end + end +end diff --git a/Library/Homebrew/sorbet/rbi/utils/inreplace.rbi b/Library/Homebrew/sorbet/rbi/utils/inreplace.rbi new file mode 100644 index 0000000000..6c9bfb5b3e --- /dev/null +++ b/Library/Homebrew/sorbet/rbi/utils/inreplace.rbi @@ -0,0 +1,30 @@ +# typed: strict + +module Utils::Inreplace + include Kernel + + sig { params(paths: T::Array[T.untyped], before: T.nilable(String), after: T.nilable(String), audit_result: T::Boolean).void } + def inreplace(paths, before = nil, after = nil, audit_result = true); end + +end + +class StringInreplaceExtension + sig { params(before: String, after: String).returns(T.nilable(String)) } + def sub!(before, after) + end + + sig { params(before: T.nilable(String), after: T.nilable(String), audit_result: T::Boolean).returns(T.nilable(String)) } + def gsub!(before, after, audit_result = true); end + + sig {params(flag: String, new_value: String).void} + def change_make_var!(flag, new_value) + end + + sig {params(flags: T::Array[String]).void} + def remove_make_var!(flags) + end + + sig {params(flag: String).returns(String)} + def get_make_var(flag) + end +end diff --git a/Library/Homebrew/test.rb b/Library/Homebrew/test.rb index 561ddafd03..8f91b983e0 100644 --- a/Library/Homebrew/test.rb +++ b/Library/Homebrew/test.rb @@ -16,23 +16,23 @@ require "dev-cmd/test" TEST_TIMEOUT_SECONDS = 5 * 60 begin - Homebrew.test_args.parse + args = Homebrew.test_args.parse error_pipe = UNIXSocket.open(ENV["HOMEBREW_ERROR_PIPE"], &:recv_io) error_pipe.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) trap("INT", old_trap) - formula = Homebrew.args.resolved_formulae.first + formula = args.resolved_formulae.first formula.extend(Homebrew::Assertions) formula.extend(Homebrew::FreePort) formula.extend(Debrew::Formula) if Homebrew.args.debug? ENV.extend(Stdenv) - ENV.setup_build_environment(formula) + ENV.setup_build_environment(formula, args: args) # tests can also return false to indicate failure Timeout.timeout TEST_TIMEOUT_SECONDS do - raise "test returned false" if formula.run_test == false + raise "test returned false" if formula.run_test(keep_tmp: args.keep_tmp?) == false end rescue Exception => e # rubocop:disable Lint/RescueException error_pipe.puts e.to_json diff --git a/Library/Homebrew/test/ENV_spec.rb b/Library/Homebrew/test/ENV_spec.rb index 27b1258e0a..11e6df4196 100644 --- a/Library/Homebrew/test/ENV_spec.rb +++ b/Library/Homebrew/test/ENV_spec.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require "cli/args" require "extend/ENV" shared_examples EnvActivation do @@ -14,10 +15,12 @@ shared_examples EnvActivation do end describe "#with_build_environment" do + let(:args) { Homebrew::CLI::Args.new } + it "restores the environment" do before = subject.dup - subject.with_build_environment do + subject.with_build_environment(args: args) do subject["foo"] = "bar" end @@ -29,7 +32,7 @@ shared_examples EnvActivation do before = subject.dup expect { - subject.with_build_environment do + subject.with_build_environment(args: args) do subject["foo"] = "bar" raise StandardError end @@ -40,13 +43,13 @@ shared_examples EnvActivation do end it "returns the value of the block" do - expect(subject.with_build_environment { 1 }).to eq(1) + expect(subject.with_build_environment(args: args) { 1 }).to eq(1) end it "does not mutate the interface" do expected = subject.methods - subject.with_build_environment do + subject.with_build_environment(args: args) do expect(subject.methods).to eq(expected) end diff --git a/Library/Homebrew/test/bintray_spec.rb b/Library/Homebrew/test/bintray_spec.rb index 6e3a017dee..2a61f8d476 100644 --- a/Library/Homebrew/test/bintray_spec.rb +++ b/Library/Homebrew/test/bintray_spec.rb @@ -3,7 +3,13 @@ require "bintray" describe Bintray, :needs_network do - bintray = described_class.new(user: "BrewTestBot", key: "deadbeef", org: "homebrew") + subject(:bintray) { described_class.new(org: "homebrew") } + + before do + ENV["HOMEBREW_BINTRAY_USER"] = "BrewTestBot" + ENV["HOMEBREW_BINTRAY_KEY"] = "deadbeef" + end + describe "::file_published?" do it "detects a published file" do results = bintray.file_published?(repo: "bottles", remote_file: "hello-2.10.catalina.bottle.tar.gz") diff --git a/Library/Homebrew/test/cask/audit_spec.rb b/Library/Homebrew/test/cask/audit_spec.rb index 122913370b..3ddfdcc7ea 100644 --- a/Library/Homebrew/test/cask/audit_spec.rb +++ b/Library/Homebrew/test/cask/audit_spec.rb @@ -15,16 +15,6 @@ describe Cask::Audit, :cask do end end - matcher :fail do - match(&:errors?) - end - - matcher :warn do - match do |audit| - audit.warnings? && !audit.errors? - end - end - matcher :fail_with do |error_msg| match do |audit| include_msg?(audit.errors, error_msg) @@ -764,23 +754,27 @@ describe Cask::Audit, :cask do describe "audit of downloads" do let(:cask_token) { "with-binary" } let(:cask) { Cask::CaskLoader.load(cask_token) } - let(:download) { instance_double(Cask::Download) } + let(:download_double) { instance_double(Cask::Download) } let(:verify) { class_double(Cask::Verify).as_stubbed_const } let(:error_msg) { "Download Failed" } + before do + allow(audit).to receive(:download).and_return(download_double) + end + it "when download and verification succeed it does not fail" do - expect(download).to receive(:perform) + expect(download_double).to receive(:perform) expect(verify).to receive(:all) expect(subject).not_to fail_with(/#{error_msg}/) end it "when download fails it does not fail" do - expect(download).to receive(:perform).and_raise(StandardError.new(error_msg)) + expect(download_double).to receive(:perform).and_raise(StandardError.new(error_msg)) expect(subject).to fail_with(/#{error_msg}/) end it "when verification fails it does not fail" do - expect(download).to receive(:perform) + expect(download_double).to receive(:perform) expect(verify).to receive(:all).and_raise(StandardError.new(error_msg)) expect(subject).to fail_with(/#{error_msg}/) end diff --git a/Library/Homebrew/test/cask/cmd_spec.rb b/Library/Homebrew/test/cask/cmd_spec.rb index bd6b9d9795..6e5c3be828 100644 --- a/Library/Homebrew/test/cask/cmd_spec.rb +++ b/Library/Homebrew/test/cask/cmd_spec.rb @@ -15,12 +15,6 @@ describe Cask::Cmd, :cask do ]) end - it "ignores the `--language` option, which is handled in `OS::Mac`" do - cli = described_class.new("--language=en") - expect(cli).to receive(:detect_internal_command).with(no_args) - cli.run - end - context "when given no arguments" do it "exits successfully" do expect(subject).not_to receive(:exit).with(be_nonzero) diff --git a/Library/Homebrew/test/cask/dsl_spec.rb b/Library/Homebrew/test/cask/dsl_spec.rb index 24b4a06dc2..949a1c804f 100644 --- a/Library/Homebrew/test/cask/dsl_spec.rb +++ b/Library/Homebrew/test/cask/dsl_spec.rb @@ -118,8 +118,8 @@ describe Cask::DSL, :cask do end describe "language stanza" do - it "allows multilingual casks" do - cask = lambda do + context "when language is set explicitly" do + subject(:cask) { Cask::Cask.new("cask-with-apps") do language "zh" do sha256 "abc123" @@ -133,37 +133,65 @@ describe Cask::DSL, :cask do url "https://example.org/#{language}.zip" end + } + + matcher :be_the_chinese_version do + match do |cask| + expect(cask.language).to eq("zh-CN") + expect(cask.sha256).to eq("abc123") + expect(cask.url.to_s).to eq("https://example.org/zh-CN.zip") + end end - allow(MacOS).to receive(:languages).and_return(["zh"]) - expect(cask.call.language).to eq("zh-CN") - expect(cask.call.sha256).to eq("abc123") - expect(cask.call.url.to_s).to eq("https://example.org/zh-CN.zip") + matcher :be_the_english_version do + match do |cask| + expect(cask.language).to eq("en-US") + expect(cask.sha256).to eq("xyz789") + expect(cask.url.to_s).to eq("https://example.org/en-US.zip") + end + end - allow(MacOS).to receive(:languages).and_return(["zh-XX"]) - expect(cask.call.language).to eq("zh-CN") - expect(cask.call.sha256).to eq("abc123") - expect(cask.call.url.to_s).to eq("https://example.org/zh-CN.zip") + before do + config = cask.config + config.languages = languages + cask.config = config + end - allow(MacOS).to receive(:languages).and_return(["en"]) - expect(cask.call.language).to eq("en-US") - expect(cask.call.sha256).to eq("xyz789") - expect(cask.call.url.to_s).to eq("https://example.org/en-US.zip") + context "to 'zh'" do + let(:languages) { ["zh"] } - allow(MacOS).to receive(:languages).and_return(["xx-XX"]) - expect(cask.call.language).to eq("en-US") - expect(cask.call.sha256).to eq("xyz789") - expect(cask.call.url.to_s).to eq("https://example.org/en-US.zip") + it { is_expected.to be_the_chinese_version } + end - allow(MacOS).to receive(:languages).and_return(["xx-XX", "zh", "en"]) - expect(cask.call.language).to eq("zh-CN") - expect(cask.call.sha256).to eq("abc123") - expect(cask.call.url.to_s).to eq("https://example.org/zh-CN.zip") + context "to 'zh-XX'" do + let(:languages) { ["zh-XX"] } - allow(MacOS).to receive(:languages).and_return(["xx-XX", "en-US", "zh"]) - expect(cask.call.language).to eq("en-US") - expect(cask.call.sha256).to eq("xyz789") - expect(cask.call.url.to_s).to eq("https://example.org/en-US.zip") + it { is_expected.to be_the_chinese_version } + end + + context "to 'en'" do + let(:languages) { ["en"] } + + it { is_expected.to be_the_english_version } + end + + context "to 'xx-XX'" do + let(:languages) { ["xx-XX"] } + + it { is_expected.to be_the_english_version } + end + + context "to 'xx-XX,zh,en'" do + let(:languages) { ["xx-XX", "zh", "en"] } + + it { is_expected.to be_the_chinese_version } + end + + context "to 'xx-XX,en-US,zh'" do + let(:languages) { ["xx-XX", "en-US", "zh"] } + + it { is_expected.to be_the_english_version } + end end it "returns an empty array if no languages are specified" do diff --git a/Library/Homebrew/test/cmd/readall_spec.rb b/Library/Homebrew/test/cmd/readall_spec.rb index 03f3b2ae5c..ad073df9ee 100644 --- a/Library/Homebrew/test/cmd/readall_spec.rb +++ b/Library/Homebrew/test/cmd/readall_spec.rb @@ -6,7 +6,7 @@ describe "Homebrew.readall_args" do it_behaves_like "parseable arguments" end -describe "brew readall", :integration_test do +describe "brew readall", :integration_test, timeout: 240 do it "imports all Formulae for a given Tap" do formula_file = setup_test_formula "testball" diff --git a/Library/Homebrew/test/dev-cmd/audit_spec.rb b/Library/Homebrew/test/dev-cmd/audit_spec.rb index 9b80945ebf..9c78bde60f 100644 --- a/Library/Homebrew/test/dev-cmd/audit_spec.rb +++ b/Library/Homebrew/test/dev-cmd/audit_spec.rb @@ -195,6 +195,20 @@ module Homebrew end end + describe "#audit_github_repository_archived" do + specify "#audit_github_repository_archived when HOMEBREW_NO_GITHUB_API is set" do + fa = formula_auditor "foo", <<~RUBY, strict: true, online: true + class Foo < Formula + homepage "https://github.com/example/example" + url "https://brew.sh/foo-1.0.tgz" + end + RUBY + + fa.audit_github_repository_archived + expect(fa.problems).to eq([]) + end + end + describe "#audit_gitlab_repository" do specify "#audit_gitlab_repository for stars, forks and creation date" do fa = formula_auditor "foo", <<~RUBY, strict: true, online: true @@ -209,6 +223,20 @@ module Homebrew end end + describe "#audit_gitlab_repository_archived" do + specify "#audit gitlab repository for archived status" do + fa = formula_auditor "foo", <<~RUBY, strict: true, online: true + class Foo < Formula + homepage "https://gitlab.com/libtiff/libtiff" + url "https://brew.sh/foo-1.0.tgz" + end + RUBY + + fa.audit_gitlab_repository_archived + expect(fa.problems).to eq([]) + end + end + describe "#audit_bitbucket_repository" do specify "#audit_bitbucket_repository for stars, forks and creation date" do fa = formula_auditor "foo", <<~RUBY, strict: true, online: true @@ -541,7 +569,7 @@ module Homebrew include_examples "formulae exist", described_class::VERSIONED_KEG_ONLY_ALLOWLIST include_examples "formulae exist", described_class::VERSIONED_HEAD_SPEC_ALLOWLIST - include_examples "formulae exist", described_class::USES_FROM_MACOS_ALLOWLIST + include_examples "formulae exist", described_class::PROVIDED_BY_MACOS_DEPENDS_ON_ALLOWLIST include_examples "formulae exist", described_class::THROTTLED_FORMULAE.keys include_examples "formulae exist", described_class::UNSTABLE_ALLOWLIST.keys include_examples "formulae exist", described_class::GNOME_DEVEL_ALLOWLIST.keys diff --git a/Library/Homebrew/test/formula_installer_spec.rb b/Library/Homebrew/test/formula_installer_spec.rb index cf15e5ba1a..bffafdfe7e 100644 --- a/Library/Homebrew/test/formula_installer_spec.rb +++ b/Library/Homebrew/test/formula_installer_spec.rb @@ -17,10 +17,10 @@ describe FormulaInstaller do match(&:poured_from_bottle) end - def temporary_install(formula) + def temporary_install(formula, **options) expect(formula).not_to be_latest_version_installed - installer = described_class.new(formula) + installer = described_class.new(formula, **options) installer.fetch installer.install @@ -89,9 +89,7 @@ describe FormulaInstaller do end specify "Formula is not poured from bottle when compiler specified" do - expect(Homebrew.args.cc).to be nil - Homebrew.install_args.parse(["--cc=clang", "testball_bottle"]) - temporary_install(TestballBottle.new) do |f| + temporary_install(TestballBottle.new, cc: "clang") do |f| tab = Tab.for_formula(f) expect(tab.compiler).to eq("clang") end diff --git a/Library/Homebrew/test/inreplace_spec.rb b/Library/Homebrew/test/inreplace_spec.rb index 965cd0035b..e35e5bd3ae 100644 --- a/Library/Homebrew/test/inreplace_spec.rb +++ b/Library/Homebrew/test/inreplace_spec.rb @@ -5,7 +5,7 @@ require "tempfile" require "utils/inreplace" describe StringInreplaceExtension do - subject { string.dup.extend(described_class) } + subject { described_class.new(string.dup) } describe "#change_make_var!" do context "flag" do @@ -20,7 +20,7 @@ describe StringInreplaceExtension do it "is successfully replaced" do subject.change_make_var! "FLAG", "def" - expect(subject).to eq <<~EOS + expect(subject.inreplace_string).to eq <<~EOS OTHER=def FLAG=def FLAG2=abc @@ -29,7 +29,7 @@ describe StringInreplaceExtension do it "is successfully appended" do subject.change_make_var! "FLAG", "\\1 def" - expect(subject).to eq <<~EOS + expect(subject.inreplace_string).to eq <<~EOS OTHER=def FLAG=abc def FLAG2=abc @@ -47,7 +47,7 @@ describe StringInreplaceExtension do it "is successfully replaced" do subject.change_make_var! "CFLAGS", "-O3" - expect(subject).to eq <<~EOS + expect(subject.inreplace_string).to eq <<~EOS CFLAGS=-O3 LDFLAGS\t=\t-lcrypto -lssl EOS @@ -65,7 +65,7 @@ describe StringInreplaceExtension do it "is successfully replaced" do subject.change_make_var! "CFLAGS", "-O3" - expect(subject).to eq <<~EOS + expect(subject.inreplace_string).to eq <<~EOS CFLAGS=-O3 LDFLAGS = -lcrypto -lssl EOS @@ -84,7 +84,7 @@ describe StringInreplaceExtension do it "is successfully replaced" do subject.change_make_var! "FLAG", "def" - expect(subject).to eq <<~EOS + expect(subject.inreplace_string).to eq <<~EOS OTHER=def FLAG=def FLAG2=abc @@ -102,7 +102,7 @@ describe StringInreplaceExtension do it "is successfully replaced" do subject.change_make_var! "FLAG", "def" - expect(subject).to eq <<~EOS + expect(subject.inreplace_string).to eq <<~EOS FLAG=def mv file_a file_b EOS @@ -120,7 +120,7 @@ describe StringInreplaceExtension do it "is successfully replaced" do subject.change_make_var! "FLAG", "def" - expect(subject).to eq <<~EOS + expect(subject.inreplace_string).to eq <<~EOS OTHER=def FLAG=def FLAG2=abc @@ -142,7 +142,7 @@ describe StringInreplaceExtension do it "is successfully removed" do subject.remove_make_var! "FLAG" - expect(subject).to eq <<~EOS + expect(subject.inreplace_string).to eq <<~EOS OTHER=def FLAG2 = def EOS @@ -159,7 +159,7 @@ describe StringInreplaceExtension do it "is successfully removed" do subject.remove_make_var! "LDFLAGS" - expect(subject).to eq <<~EOS + expect(subject.inreplace_string).to eq <<~EOS CFLAGS\t=\t-Wall -O2 EOS end @@ -176,7 +176,7 @@ describe StringInreplaceExtension do it "is successfully removed" do subject.remove_make_var! "CFLAGS" - expect(subject).to eq <<~EOS + expect(subject.inreplace_string).to eq <<~EOS LDFLAGS = -lcrypto -lssl EOS end @@ -195,7 +195,7 @@ describe StringInreplaceExtension do specify "are be successfully removed" do subject.remove_make_var! ["FLAG", "FLAG2"] - expect(subject).to eq <<~EOS + expect(subject.inreplace_string).to eq <<~EOS OTHER=def OTHER2=def EOS @@ -250,7 +250,7 @@ describe StringInreplaceExtension do it "replaces the first occurrence" do subject.sub!("o", "e") - expect(subject).to eq("feo") + expect(subject.inreplace_string).to eq("feo") end end @@ -259,7 +259,7 @@ describe StringInreplaceExtension do it "replaces all occurrences" do subject.gsub!("o", "e") # rubocop:disable Performance/StringReplacement - expect(subject).to eq("fee") + expect(subject.inreplace_string).to eq("fee") end end end diff --git a/Library/Homebrew/test/java_requirement_spec.rb b/Library/Homebrew/test/java_requirement_spec.rb index ea911f584e..694fe2f91d 100644 --- a/Library/Homebrew/test/java_requirement_spec.rb +++ b/Library/Homebrew/test/java_requirement_spec.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require "cli/args" require "requirements/java_requirement" describe JavaRequirement do @@ -40,14 +41,16 @@ describe JavaRequirement do describe "#satisfied?" do subject { described_class.new(%w[1.8]) } + let(:args) { Homebrew::CLI::Args.new } + it "returns false if no `java` executable can be found" do allow(File).to receive(:executable?).and_return(false) - expect(subject).not_to be_satisfied + expect(subject).not_to be_satisfied(args: args) end it "returns true if #preferred_java returns a path" do allow(subject).to receive(:preferred_java).and_return(Pathname.new("/usr/bin/java")) - expect(subject).to be_satisfied + expect(subject).to be_satisfied(args: args) end context "when #possible_javas contains paths" do @@ -71,17 +74,17 @@ describe JavaRequirement do it "returns false if all are lower" do setup_java_with_version "1.6.0_5" - expect(subject).not_to be_satisfied + expect(subject).not_to be_satisfied(args: args) end it "returns true if one is equal" do setup_java_with_version "1.7.0_5" - expect(subject).to be_satisfied + expect(subject).to be_satisfied(args: args) end it "returns false if all are higher" do setup_java_with_version "1.8.0_5" - expect(subject).not_to be_satisfied + expect(subject).not_to be_satisfied(args: args) end end @@ -90,17 +93,17 @@ describe JavaRequirement do it "returns false if all are lower" do setup_java_with_version "1.6.0_5" - expect(subject).not_to be_satisfied + expect(subject).not_to be_satisfied(args: args) end it "returns true if one is equal" do setup_java_with_version "1.7.0_5" - expect(subject).to be_satisfied + expect(subject).to be_satisfied(args: args) end it "returns true if one is higher" do setup_java_with_version "1.8.0_5" - expect(subject).to be_satisfied + expect(subject).to be_satisfied(args: args) end end end diff --git a/Library/Homebrew/test/os/linux/pathname_spec.rb b/Library/Homebrew/test/os/linux/pathname_spec.rb new file mode 100644 index 0000000000..d614b98204 --- /dev/null +++ b/Library/Homebrew/test/os/linux/pathname_spec.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +require "extend/pathname" + +describe Pathname, skip: HOMEBREW_PATCHELF_RB.blank? do + let(:elf_dir) { described_class.new "#{TEST_FIXTURE_DIR}/elf" } + let(:sho) { elf_dir/"libhello.so.0" } + let(:exec) { elf_dir/"hello" } + + describe "#interpreter" do + it "returns interpreter" do + expect(exec.interpreter).to eq "/lib64/ld-linux-x86-64.so.2" + end + end + + describe "#rpath" do + it "returns nil when absent" do + expect(exec.rpath).to be_nil + expect(sho.rpath).to be_nil + end + end +end diff --git a/Library/Homebrew/test/os/mac/java_requirement_spec.rb b/Library/Homebrew/test/os/mac/java_requirement_spec.rb index 97c8606f90..190b7c1aba 100644 --- a/Library/Homebrew/test/os/mac/java_requirement_spec.rb +++ b/Library/Homebrew/test/os/mac/java_requirement_spec.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require "cli/args" require "requirements/java_requirement" require "fileutils" @@ -8,6 +9,8 @@ describe JavaRequirement do let(:java_home) { mktmpdir } + let(:args) { Homebrew::CLI::Args.new } + before do FileUtils.mkdir java_home/"bin" FileUtils.touch java_home/"bin/java" @@ -15,23 +18,23 @@ describe JavaRequirement do end specify "Apple Java environment" do - expect(subject).to be_satisfied + expect(subject).to be_satisfied(args: args) expect(ENV).to receive(:prepend_path) expect(ENV).to receive(:append_to_cflags) - subject.modify_build_environment + subject.modify_build_environment(args: args) expect(ENV["JAVA_HOME"]).to eq(java_home.to_s) end specify "Oracle Java environment" do - expect(subject).to be_satisfied + expect(subject).to be_satisfied(args: args) FileUtils.mkdir java_home/"include" expect(ENV).to receive(:prepend_path) expect(ENV).to receive(:append_to_cflags).twice - subject.modify_build_environment + subject.modify_build_environment(args: args) expect(ENV["JAVA_HOME"]).to eq(java_home.to_s) end end diff --git a/Library/Homebrew/test/os/mac_spec.rb b/Library/Homebrew/test/os/mac_spec.rb index dcb04a77a8..e3c1aa8cbb 100644 --- a/Library/Homebrew/test/os/mac_spec.rb +++ b/Library/Homebrew/test/os/mac_spec.rb @@ -5,10 +5,8 @@ require "os/mac" describe OS::Mac do describe "::languages" do - specify "all languages can be parsed by Locale::parse" do - subject.languages.each do |language| - expect { Locale.parse(language) }.not_to raise_error - end + it "returns a list of all languages" do + expect(subject.languages).not_to be_empty end end @@ -16,10 +14,6 @@ describe OS::Mac do it "returns the first item from #languages" do expect(subject.language).to eq(subject.languages.first) end - - it "can be parsed by Locale::parse" do - expect { Locale.parse(subject.language) }.not_to raise_error - end end describe "::sdk_path_if_needed" do diff --git a/Library/Homebrew/test/requirement_spec.rb b/Library/Homebrew/test/requirement_spec.rb index 22f43d8a2b..12a0e302b3 100644 --- a/Library/Homebrew/test/requirement_spec.rb +++ b/Library/Homebrew/test/requirement_spec.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require "cli/args" require "extend/ENV" require "requirement" @@ -10,6 +11,8 @@ describe Requirement do let(:klass) { Class.new(described_class) } + let(:args) { Homebrew::CLI::Args.new } + describe "#tags" do subject { described_class.new(tags) } @@ -64,7 +67,7 @@ describe Requirement do end end - it { is_expected.to be_satisfied } + it { is_expected.to be_satisfied(args: args) } end describe "#satisfy with block and build_env returns false" do @@ -76,7 +79,7 @@ describe Requirement do end end - it { is_expected.not_to be_satisfied } + it { is_expected.not_to be_satisfied(args: args) } end describe "#satisfy returns true" do @@ -86,7 +89,7 @@ describe Requirement do end end - it { is_expected.to be_satisfied } + it { is_expected.to be_satisfied(args: args) } end describe "#satisfy returns false" do @@ -96,7 +99,7 @@ describe Requirement do end end - it { is_expected.not_to be_satisfied } + it { is_expected.not_to be_satisfied(args: args) } end describe "#satisfy with block returning true and without :build_env" do @@ -110,7 +113,7 @@ describe Requirement do it "sets up build environment" do expect(ENV).to receive(:with_build_environment).and_call_original - subject.satisfied? + subject.satisfied?(args: args) end end @@ -125,7 +128,7 @@ describe Requirement do it "skips setting up build environment" do expect(ENV).not_to receive(:with_build_environment) - subject.satisfied? + subject.satisfied?(args: args) end end @@ -140,8 +143,8 @@ describe Requirement do it "infers path from #satisfy result" do expect(ENV).to receive(:prepend_path).with("PATH", Pathname.new("/foo/bar")) - subject.satisfied? - subject.modify_build_environment + subject.satisfied?(args: args) + subject.modify_build_environment(args: args) end end end @@ -179,7 +182,7 @@ describe Requirement do let(:klass) { Class.new(described_class) } it "returns nil" do - expect(subject.modify_build_environment).to be nil + expect(subject.modify_build_environment(args: args)).to be nil end end end diff --git a/Library/Homebrew/test/requirements/linux_requirement_spec.rb b/Library/Homebrew/test/requirements/linux_requirement_spec.rb index cb8d3a34d5..a6857365df 100644 --- a/Library/Homebrew/test/requirements/linux_requirement_spec.rb +++ b/Library/Homebrew/test/requirements/linux_requirement_spec.rb @@ -1,13 +1,16 @@ # frozen_string_literal: true +require "cli/args" require "requirements/linux_requirement" describe LinuxRequirement do subject(:requirement) { described_class.new } describe "#satisfied?" do + let(:args) { Homebrew::CLI::Args.new } + it "returns true on Linux" do - expect(requirement.satisfied?).to eq(OS.linux?) + expect(requirement.satisfied?(args: args)).to eq(OS.linux?) end end end diff --git a/Library/Homebrew/test/requirements/macos_requirement_spec.rb b/Library/Homebrew/test/requirements/macos_requirement_spec.rb index c4dc2affbf..ff160e560f 100644 --- a/Library/Homebrew/test/requirements/macos_requirement_spec.rb +++ b/Library/Homebrew/test/requirements/macos_requirement_spec.rb @@ -1,23 +1,26 @@ # frozen_string_literal: true +require "cli/args" require "requirements/macos_requirement" describe MacOSRequirement do subject(:requirement) { described_class.new } describe "#satisfied?" do + let(:args) { Homebrew::CLI::Args.new } + it "returns true on macOS" do - expect(requirement.satisfied?).to eq OS.mac? + expect(requirement.satisfied?(args: args)).to eq OS.mac? end it "supports version symbols", :needs_macos do requirement = described_class.new([MacOS.version.to_sym]) - expect(requirement).to be_satisfied + expect(requirement).to be_satisfied(args: args) end it "supports maximum versions", :needs_macos do requirement = described_class.new([:catalina], comparator: "<=") - expect(requirement.satisfied?).to eq MacOS.version <= :catalina + expect(requirement.satisfied?(args: args)).to eq MacOS.version <= :catalina end end end diff --git a/Library/Homebrew/test/requirements/osxfuse_requirement_spec.rb b/Library/Homebrew/test/requirements/osxfuse_requirement_spec.rb index 0737bd8e54..a5ceb17909 100644 --- a/Library/Homebrew/test/requirements/osxfuse_requirement_spec.rb +++ b/Library/Homebrew/test/requirements/osxfuse_requirement_spec.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require "cli/args" require "requirements/osxfuse_requirement" describe OsxfuseRequirement do @@ -21,21 +22,23 @@ describe OsxfuseRequirement do end describe "#modify_build_environment", :needs_macos do + let(:args) { Homebrew::CLI::Args.new } + it "adds the fuse directories to PKG_CONFIG_PATH" do allow(ENV).to receive(:append_path) - requirement.modify_build_environment + requirement.modify_build_environment(args: args) expect(ENV).to have_received(:append_path).with("PKG_CONFIG_PATH", any_args) end it "adds the fuse directories to HOMEBREW_LIBRARY_PATHS" do allow(ENV).to receive(:append_path) - requirement.modify_build_environment + requirement.modify_build_environment(args: args) expect(ENV).to have_received(:append_path).with("HOMEBREW_LIBRARY_PATHS", any_args) end it "adds the fuse directories to HOMEBREW_INCLUDE_PATHS" do allow(ENV).to receive(:append_path) - requirement.modify_build_environment + requirement.modify_build_environment(args: args) expect(ENV).to have_received(:append_path).with("HOMEBREW_INCLUDE_PATHS", any_args) end end diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index 337569b431..9e6ee3e826 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -29,6 +29,7 @@ require "rubocop" require "rubocop/rspec/support" require "find" require "byebug" +require "timeout" $LOAD_PATH.push(File.expand_path("#{ENV["HOMEBREW_LIBRARY"]}/Homebrew/test/support/lib")) @@ -181,7 +182,19 @@ RSpec.configure do |config| $stderr.reopen(File::NULL) end - example.run + begin + timeout = example.metadata.fetch(:timeout, 60) + inner_timeout = nil + Timeout.timeout(timeout) do + example.run + rescue Timeout::Error => e + inner_timeout = e + end + rescue Timeout::Error + raise "Example exceeded maximum runtime of #{timeout} seconds." + end + + raise inner_timeout if inner_timeout rescue SystemExit => e raise "Unexpected exit with status #{e.status}." ensure diff --git a/Library/Homebrew/test/string_spec.rb b/Library/Homebrew/test/string_spec.rb index ed9cdc2deb..646d53765a 100644 --- a/Library/Homebrew/test/string_spec.rb +++ b/Library/Homebrew/test/string_spec.rb @@ -3,7 +3,7 @@ require "extend/string" describe StringInreplaceExtension do - subject { string.extend(described_class) } + subject { described_class.new(string) } let(:string) { +"foobar" } diff --git a/Library/Homebrew/test/x11_requirement_spec.rb b/Library/Homebrew/test/x11_requirement_spec.rb index c4b9ce8ddd..133135eb0b 100644 --- a/Library/Homebrew/test/x11_requirement_spec.rb +++ b/Library/Homebrew/test/x11_requirement_spec.rb @@ -1,10 +1,13 @@ # frozen_string_literal: true +require "cli/args" require "requirements/x11_requirement" describe X11Requirement do let(:default_name) { "x11" } + let(:args) { Homebrew::CLI::Args.new } + describe "#name" do it "defaults to x11" do expect(subject.name).to eq(default_name) @@ -22,7 +25,7 @@ describe X11Requirement do it "calls ENV#x11" do allow(subject).to receive(:satisfied?).and_return(true) expect(ENV).to receive(:x11) - subject.modify_build_environment + subject.modify_build_environment(args: args) end end @@ -30,12 +33,12 @@ describe X11Requirement do it "returns true if X11 is installed" do expect(MacOS::XQuartz).to receive(:version).and_return("2.7.5") expect(MacOS::XQuartz).to receive(:installed?).and_return(true) - expect(subject).to be_satisfied + expect(subject).to be_satisfied(args: args) end it "returns false if X11 is not installed" do expect(MacOS::XQuartz).to receive(:installed?).and_return(false) - expect(subject).not_to be_satisfied + expect(subject).not_to be_satisfied(args: args) end end end diff --git a/Library/Homebrew/upgrade.rb b/Library/Homebrew/upgrade.rb index 3a730eccc8..2e4ccb8d58 100644 --- a/Library/Homebrew/upgrade.rb +++ b/Library/Homebrew/upgrade.rb @@ -9,7 +9,7 @@ require "cleanup" module Homebrew module_function - def upgrade_formulae(formulae_to_install) + def upgrade_formulae(formulae_to_install, args:) return if formulae_to_install.empty? return if args.dry_run? @@ -28,7 +28,7 @@ module Homebrew formulae_to_install.each do |f| Migrator.migrate_if_needed(f) begin - upgrade_formula(f) + upgrade_formula(f, args: args) Cleanup.install_formula_clean!(f) rescue UnsatisfiedRequirements => e Homebrew.failed = true @@ -37,7 +37,7 @@ module Homebrew end end - def upgrade_formula(f) + def upgrade_formula(f, args:) return if args.dry_run? if f.opt_prefix.directory? @@ -63,8 +63,11 @@ module Homebrew options |= f.build.used_options options &= f.options - fi = FormulaInstaller.new(f) + fi = FormulaInstaller.new(f, force_bottle: args.force_bottle?, include_test: args.include_test?, + build_from_source: args.build_from_source?) fi.options = options + fi.force = args.force? + fi.keep_tmp = args.keep_tmp? fi.build_bottle = args.build_bottle? fi.installed_on_request = args.named.present? fi.link_keg ||= keg_was_linked if keg_had_linked_opt @@ -112,7 +115,7 @@ module Homebrew end end - def check_installed_dependents + def check_installed_dependents(args:) installed_formulae = FormulaInstaller.installed.to_a return if installed_formulae.empty? @@ -156,7 +159,7 @@ module Homebrew puts formulae_upgrades.join(", ") end - upgrade_formulae(upgradeable_dependents) + upgrade_formulae(upgradeable_dependents, args: args) # Assess the dependents tree again now we've upgraded. oh1 "Checking for dependents of upgraded formulae..." unless args.dry_run? @@ -213,7 +216,7 @@ module Homebrew return if args.dry_run? reinstallable_broken_dependents.each do |f| - reinstall_formula(f, build_from_source: true) + reinstall_formula(f, build_from_source: true, args: args) rescue FormulaInstallationAlreadyAttemptedError # We already attempted to reinstall f as part of the dependency tree of # another formula. In that case, don't generate an error, just move on. diff --git a/Library/Homebrew/utils/analytics.rb b/Library/Homebrew/utils/analytics.rb index 3c27ae4e9d..7921136a5c 100644 --- a/Library/Homebrew/utils/analytics.rb +++ b/Library/Homebrew/utils/analytics.rb @@ -116,9 +116,9 @@ module Utils config_delete(:analyticsuuid) end - def output(filter: nil) - days = Homebrew.args.days || "30" - category = Homebrew.args.category || "install" + def output(filter: nil, args:) + days = args.days || "30" + category = args.category || "install" json = formulae_brew_sh_json("analytics/#{category}/#{days}d.json") return if json.blank? || json["items"].blank? @@ -147,8 +147,8 @@ module Utils table_output(category, days, results, os_version: os_version, cask_install: cask_install) end - def get_analytics(json) - full_analytics = Homebrew.args.analytics? || Homebrew.args.verbose? + def get_analytics(json, args:) + full_analytics = args.analytics? || Homebrew.args.verbose? ohai "Analytics" json["analytics"].each do |category, value| @@ -158,11 +158,11 @@ module Utils value.each do |days, results| days = days.to_i if full_analytics - if Homebrew.args.days.present? - next if Homebrew.args.days&.to_i != days + if args.days.present? + next if args.days&.to_i != days end - if Homebrew.args.category.present? - next if Homebrew.args.category != category + if args.category.present? + next if args.category != category end table_output(category, days, results) @@ -176,18 +176,18 @@ module Utils end end - def formula_output(f) + def formula_output(f, args:) json = formulae_brew_sh_json("#{formula_path}/#{f}.json") return if json.blank? || json["analytics"].blank? - get_analytics(json) + get_analytics(json, args: args) end - def cask_output(cask) + def cask_output(cask, args:) json = formulae_brew_sh_json("#{cask_path}/#{cask}.json") return if json.blank? || json["analytics"].blank? - get_analytics(json) + get_analytics(json, args: args) end def custom_prefix_label diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index f767fdb0e3..cb944b5a73 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -127,6 +127,8 @@ def curl_check_http_content(url, user_agents: [:default], check_content: false, return "The URL #{url} is not reachable" end + return "#{url} permanently redirects to #{details[:permanent_redirect]}" if url != details[:permanent_redirect] + unless http_status_ok?(details[:status]) return "The URL #{url} is not reachable (HTTP status code #{details[:status]})" end @@ -201,21 +203,25 @@ def curl_http_content_headers_and_checksum(url, hash_needed: false, user_agent: while status_code == :unknown || status_code.to_s.start_with?("3") headers, _, output = output.partition("\r\n\r\n") status_code = headers[%r{HTTP/.* (\d+)}, 1] - final_url = headers[/^Location:\s*(.*)$/i, 1]&.chomp + location = headers[/^Location:\s*(.*)$/i, 1] + final_url = location.chomp if location + permanent_redirect = location.chomp if status_code == "301" end output_hash = Digest::SHA256.file(file.path) if hash_needed final_url ||= url + permanent_redirect ||= url { - url: url, - final_url: final_url, - status: status_code, - etag: headers[%r{ETag: ([wW]/)?"(([^"]|\\")*)"}, 2], - content_length: headers[/Content-Length: (\d+)/, 1], - file_hash: output_hash, - file: output, + url: url, + final_url: final_url, + permanent_redirect: permanent_redirect, + status: status_code, + etag: headers[%r{ETag: ([wW]/)?"(([^"]|\\")*)"}, 2], + content_length: headers[/Content-Length: (\d+)/, 1], + file_hash: output_hash, + file: output, } ensure file.unlink diff --git a/Library/Homebrew/utils/inreplace.rb b/Library/Homebrew/utils/inreplace.rb index 59f2552679..bf0aeb7add 100644 --- a/Library/Homebrew/utils/inreplace.rb +++ b/Library/Homebrew/utils/inreplace.rb @@ -25,7 +25,8 @@ module Utils errors["`paths` (first) parameter"] = ["`paths` was empty"] if paths.blank? Array(paths).each do |path| - s = File.open(path, "rb", &:read).extend(StringInreplaceExtension) + str = File.open(path, "rb", &:read) || "" + s = StringInreplaceExtension.new(str) if before.nil? && after.nil? yield s @@ -36,7 +37,7 @@ module Utils errors[path] = s.errors unless s.errors.empty? - Pathname(path).atomic_write(s) + Pathname(path).atomic_write(s.inreplace_string) end raise InreplaceError, errors unless errors.empty? diff --git a/Library/Homebrew/utils/notability.rb b/Library/Homebrew/utils/notability.rb index ef6099844d..86e801202c 100644 --- a/Library/Homebrew/utils/notability.rb +++ b/Library/Homebrew/utils/notability.rb @@ -5,13 +5,30 @@ require "utils/curl" module SharedAudits module_function - def github(user, repo) - begin - metadata = GitHub.repository(user, repo) - rescue GitHub::HTTPNotFoundError - return + def github_repo_data(user, repo) + @github_repo_data ||= {} + @github_repo_data["#{user}/#{repo}"] ||= GitHub.repository(user, repo) + + @github_repo_data["#{user}/#{repo}"] + rescue GitHub::HTTPNotFoundError + nil + end + + def gitlab_repo_data(user, repo) + @gitlab_repo_data ||= {} + @gitlab_repo_data["#{user}/#{repo}"] ||= begin + out, _, status= curl_output("--request", "GET", "https://gitlab.com/api/v4/projects/#{user}%2F#{repo}") + return unless status.success? + + JSON.parse(out) end + @gitlab_repo_data["#{user}/#{repo}"] + end + + def github(user, repo) + metadata = github_repo_data(user, repo) + return if metadata.nil? return "GitHub fork (not canonical repository)" if metadata["fork"] @@ -26,10 +43,8 @@ module SharedAudits end def gitlab(user, repo) - out, _, status= curl_output("--request", "GET", "https://gitlab.com/api/v4/projects/#{user}%2F#{repo}") - return unless status.success? + metadata = gitlab_repo_data(user, repo) - metadata = JSON.parse(out) return if metadata.nil? return "GitLab fork (not canonical repository)" if metadata["fork"] diff --git a/Library/Homebrew/vendor/README.md b/Library/Homebrew/vendor/README.md deleted file mode 100644 index 39bbdb4dbf..0000000000 --- a/Library/Homebrew/vendor/README.md +++ /dev/null @@ -1,80 +0,0 @@ -Vendored Dependencies -===================== - -* [plist](https://github.com/patsplat/plist), version 3.3.0 - -* [ruby-macho](https://github.com/Homebrew/ruby-macho), version 2.0.0 - -* [backports](https://github.com/marcandre/backports), version 3.8.0 - -## Licenses: - -### plist - -> Copyright (c) 2006-2010, Ben Bleything and Patrick May -> -> Permission is hereby granted, free of charge, to any person obtaining -> a copy of this software and associated documentation files (the -> "Software"), to deal in the Software without restriction, including -> without limitation the rights to use, copy, modify, merge, publish, -> distribute, sublicense, and/or sell copies of the Software, and to -> permit persons to whom the Software is furnished to do so, subject to -> the following conditions: -> -> The above copyright notice and this permission notice shall be included -> in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -> KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -> WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -> LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -### ruby-macho - -> The MIT License -> Copyright (c) 2015, 2016, 2017, 2018 William Woodruff -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in -> all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -> THE SOFTWARE. - -### backports - -> Copyright (c) 2009 Marc-Andre Lafortune - -> Permission is hereby granted, free of charge, to any person obtaining -> a copy of this software and associated documentation files (the -> "Software"), to deal in the Software without restriction, including -> without limitation the rights to use, copy, modify, merge, publish, -> distribute, sublicense, and/or sell copies of the Software, and to -> permit persons to whom the Software is furnished to do so, subject to -> the following conditions: - -> The above copyright notice and this permission notice shall be -> included in all copies or substantial portions of the Software. - -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -> LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index 3d2f7b12e9..b1f775dbe2 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -4,14 +4,14 @@ ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby' ruby_version = RbConfig::CONFIG["ruby_version"] path = File.expand_path('..', __FILE__) $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.8.4/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.8.5/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.14.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/thread_safe-0.3.6/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-1.2.7/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/zeitwerk-2.4.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-6.0.3.2/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ast-2.4.1/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/bindata-2.4.7/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/bindata-2.4.8/lib" $:.unshift "#{path}/" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-19/2.6.0/byebug-11.1.3" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/byebug-11.1.3/lib" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/base.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/base.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/base.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/base.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/cache.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/cache.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/cache.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/cache.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/cache_file.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/cache_file.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/cache_file.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/cache_file.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/cascade.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/cascade.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/cascade.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/cascade.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/chain.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/chain.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/chain.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/chain.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/fallbacks.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/fallbacks.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/fallbacks.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/fallbacks.rb index 40ff12202e..ce8635bb0a 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/fallbacks.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/fallbacks.rb @@ -20,7 +20,7 @@ module I18n # Sets the current fallbacks implementation. Use this to set a different fallbacks implementation. def fallbacks=(fallbacks) - @@fallbacks = fallbacks.is_a?(I18n::Locale::Fallbacks) ? fallbacks : I18n::Locale::Fallbacks.new(fallbacks) + @@fallbacks = fallbacks.is_a?(Array) ? I18n::Locale::Fallbacks.new(fallbacks) : fallbacks end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/flatten.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/flatten.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/flatten.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/flatten.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/gettext.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/gettext.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/gettext.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/gettext.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/interpolation_compiler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/interpolation_compiler.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/interpolation_compiler.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/interpolation_compiler.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/key_value.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/key_value.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/key_value.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/key_value.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/memoize.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/memoize.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/memoize.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/memoize.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/metadata.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/metadata.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/metadata.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/metadata.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/pluralization.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/pluralization.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/pluralization.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/pluralization.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/simple.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/simple.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/simple.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/simple.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/transliterator.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/transliterator.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/backend/transliterator.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/backend/transliterator.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/config.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/config.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/config.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/config.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/core_ext/hash.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/core_ext/hash.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/core_ext/hash.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/core_ext/hash.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/exceptions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/exceptions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/exceptions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/exceptions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/gettext.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/gettext.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/gettext.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/gettext.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/gettext/helpers.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/gettext/helpers.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/gettext/helpers.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/gettext/helpers.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/gettext/po_parser.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/gettext/po_parser.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/gettext/po_parser.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/gettext/po_parser.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/interpolate/ruby.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/interpolate/ruby.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/interpolate/ruby.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/interpolate/ruby.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/locale.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/locale.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/locale.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/locale.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/locale/fallbacks.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/locale/fallbacks.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/locale/fallbacks.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/locale/fallbacks.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/locale/tag.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/locale/tag.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/locale/tag.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/locale/tag.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/locale/tag/parents.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/locale/tag/parents.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/locale/tag/parents.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/locale/tag/parents.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/locale/tag/rfc4646.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/locale/tag/rfc4646.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/locale/tag/rfc4646.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/locale/tag/rfc4646.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/locale/tag/simple.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/locale/tag/simple.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/locale/tag/simple.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/locale/tag/simple.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/middleware.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/middleware.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/middleware.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/middleware.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/version.rb similarity index 70% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/version.rb index d41fbf55b5..3781c938f6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.4/lib/i18n/version.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.8.5/lib/i18n/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module I18n - VERSION = "1.8.4" + VERSION = "1.8.5" end diff --git a/docs/Manpage.md b/docs/Manpage.md index 171c0d290e..c6dd06227e 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -559,10 +559,10 @@ the upgraded formulae or, every 30 days, for all formulae. ### `uses` [*`options`*] *`formula`* -Show formulae that specify *`formula`* as a dependency. When given multiple -formula arguments, show the intersection of formulae that use *`formula`*. By -default, `uses` shows all formulae that specify *`formula`* as a required or -recommended dependency for their stable builds. +Show formulae that specify *`formula`* as a dependency (i.e. show dependents of +*`formula`*). When given multiple formula arguments, show the intersection of +formulae that use *`formula`*. By default, `uses` shows all formulae that specify +*`formula`* as a required or recommended dependency for their stable builds. * `--recursive`: Resolve more than one level of dependencies. @@ -724,8 +724,6 @@ URL-and-SHA-256 style specification into a tag-and-revision style specification, nor vice versa. It must use whichever style specification the formula already uses. -* `--devel`: - Bump the development rather than stable version. The development spec must already exist. * `-n`, `--dry-run`: Print what would be done rather than doing it. * `--write`: @@ -776,8 +774,7 @@ Display the path to the file being used when invoking `brew` *`cmd`*. Generate a formula for the downloadable file at *`URL`* and open it in the editor. Homebrew will attempt to automatically derive the formula name and version, but if it fails, you'll have to make your own template. The `wget` formula serves as -a simple example. For the complete API, see: - +a simple example. For the complete API, see: * `--autotools`: Create a basic template for an Autotools-style build. diff --git a/manpages/brew.1 b/manpages/brew.1 index 73d23a365a..c9614038de 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -723,7 +723,7 @@ Print install times for each formula at the end of the run\. Show what would be upgraded, but do not actually upgrade anything\. . .SS "\fBuses\fR [\fIoptions\fR] \fIformula\fR" -Show formulae that specify \fIformula\fR as a dependency\. When given multiple formula arguments, show the intersection of formulae that use \fIformula\fR\. By default, \fBuses\fR shows all formulae that specify \fIformula\fR as a required or recommended dependency for their stable builds\. +Show formulae that specify \fIformula\fR as a dependency (i\.e\. show dependents of \fIformula\fR)\. When given multiple formula arguments, show the intersection of formulae that use \fIformula\fR\. By default, \fBuses\fR shows all formulae that specify \fIformula\fR as a required or recommended dependency for their stable builds\. . .TP \fB\-\-recursive\fR @@ -929,10 +929,6 @@ If a \fIversion\fR is specified, a best effort to determine the \fIURL\fR and \f \fINote:\fR this command cannot be used to transition a formula from a URL\-and\-SHA\-256 style specification into a tag\-and\-revision style specification, nor vice versa\. It must use whichever style specification the formula already uses\. . .TP -\fB\-\-devel\fR -Bump the development rather than stable version\. The development spec must already exist\. -. -.TP \fB\-n\fR, \fB\-\-dry\-run\fR Print what would be done rather than doing it\. . @@ -1002,7 +998,7 @@ Display the source of \fIformula\fR\. Display the path to the file being used when invoking \fBbrew\fR \fIcmd\fR\. . .SS "\fBcreate\fR [\fIoptions\fR] \fIURL\fR" -Generate a formula for the downloadable file at \fIURL\fR and open it in the editor\. Homebrew will attempt to automatically derive the formula name and version, but if it fails, you\'ll have to make your own template\. The \fBwget\fR formula serves as a simple example\. For the complete API, see: \fIhttp://www\.rubydoc\.info/github/Homebrew/brew/master/Formula\fR +Generate a formula for the downloadable file at \fIURL\fR and open it in the editor\. Homebrew will attempt to automatically derive the formula name and version, but if it fails, you\'ll have to make your own template\. The \fBwget\fR formula serves as a simple example\. For the complete API, see: \fIhttps://rubydoc\.brew\.sh/Formula\fR . .TP \fB\-\-autotools\fR