diff --git a/Library/Homebrew/homebrew_bootsnap.rb b/Library/Homebrew/homebrew_bootsnap.rb index 680acc90b8..c4d1ce33a3 100644 --- a/Library/Homebrew/homebrew_bootsnap.rb +++ b/Library/Homebrew/homebrew_bootsnap.rb @@ -1,24 +1,22 @@ # typed: false # frozen_string_literal: true -homebrew_bootsnap_enabled = !ENV["HOMEBREW_NO_BOOTSNAP"] && - ENV["HOMEBREW_BOOTSNAP"] && - # portable ruby doesn't play nice with bootsnap - !ENV["HOMEBREW_FORCE_VENDOR_RUBY"] && - (!ENV["HOMEBREW_MACOS_VERSION"] || ENV["HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH"]) && - # Apple Silicon doesn't play nice with bootsnap - (ENV["HOMEBREW_PROCESSOR"] == "Intel") +homebrew_bootsnap_enabled = !ENV["HOMEBREW_NO_BOOTSNAP"] && ENV["HOMEBREW_BOOTSNAP"] -# we need some development tools to build bootsnap native code -development_tools_installed = if !homebrew_bootsnap_enabled - false -elsif RbConfig::CONFIG["host_os"].include? "darwin" - File.directory?("/Applications/Xcode.app") || File.directory?("/Library/Developer/CommandLineTools") +# portable ruby doesn't play nice with bootsnap +# Can't use .exclude? here because we haven't required active_support yet. +homebrew_bootsnap_enabled &&= !ENV["HOMEBREW_RUBY_PATH"].to_s.include?("/vendor/portable-ruby/") # rubocop:disable Rails/NegateInclude + +homebrew_bootsnap_enabled &&= if ENV["HOMEBREW_MACOS_VERSION"] + # Apple Silicon doesn't play nice with bootsnap + ENV["HOMEBREW_PROCESSOR"] == "Intel" && + # we need some development tools to build bootsnap native code + (File.directory?("/Applications/Xcode.app") || File.directory?("/Library/Developer/CommandLineTools")) else File.executable?("/usr/bin/clang") || File.executable?("/usr/bin/gcc") end -if homebrew_bootsnap_enabled && development_tools_installed +if homebrew_bootsnap_enabled require "rubygems" begin @@ -26,7 +24,7 @@ if homebrew_bootsnap_enabled && development_tools_installed rescue LoadError unless ENV["HOMEBREW_BOOTSNAP_RETRY"] require "utils/gems" - Homebrew.install_bundler_gems! + Homebrew.install_bundler_gems!(only_warn_on_failure: true) ENV["HOMEBREW_BOOTSNAP_RETRY"] = "1" exec ENV["HOMEBREW_BREW_FILE"], *ARGV diff --git a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi index bb2b3e931a..96a9d348fd 100644 --- a/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi +++ b/Library/Homebrew/sorbet/rbi/hidden-definitions/hidden.rbi @@ -532,6 +532,14 @@ class ActiveSupport::CurrentAttributes def _reset_callbacks(); end def _run_reset_callbacks(&block); end + + def attributes(); end + + def attributes=(attributes); end + + def reset(); end + + def set(set_attributes); end end class ActiveSupport::CurrentAttributes @@ -553,9 +561,17 @@ class ActiveSupport::CurrentAttributes def self.before_reset(&block); end + def self.clear_all(); end + def self.instance(); end + def self.reset(*args, &block); end + + def self.reset_all(); end + def self.resets(&block); end + + def self.set(*args, &block); end end module ActiveSupport::Dependencies @@ -2814,12 +2830,99 @@ end class Bootsnap::CompileCache::Error end +module Bootsnap::CompileCache::ISeq +end + +module Bootsnap::CompileCache::ISeq::InstructionSequenceMixin + def compile_option=(hash); end + + def load_iseq(path); end +end + +module Bootsnap::CompileCache::ISeq::InstructionSequenceMixin +end + +module Bootsnap::CompileCache::ISeq + def self.cache_dir(); end + + def self.cache_dir=(cache_dir); end + + def self.compile_option_updated(); end + + def self.fetch(path, cache_dir: T.unsafe(nil)); end + + def self.input_to_output(_data, _kwargs); end + + def self.input_to_storage(_, path); end + + def self.install!(cache_dir); end + + def self.precompile(path, cache_dir: T.unsafe(nil)); end + + def self.storage_to_output(binary, _args); end +end + +module Bootsnap::CompileCache::Native +end + +module Bootsnap::CompileCache::Native + def self.compile_option_crc32=(compile_option_crc32); end + + def self.coverage_running?(); end + + def self.fetch(_, _1, _2, _3); end + + def self.precompile(_, _1, _2); end +end + class Bootsnap::CompileCache::PermissionError end class Bootsnap::CompileCache::PermissionError end +class Bootsnap::CompileCache::Uncompilable +end + +class Bootsnap::CompileCache::Uncompilable +end + +module Bootsnap::CompileCache::YAML +end + +module Bootsnap::CompileCache::YAML::Patch + def load_file(path, *args); end +end + +module Bootsnap::CompileCache::YAML::Patch +end + +module Bootsnap::CompileCache::YAML + def self.cache_dir(); end + + def self.cache_dir=(cache_dir); end + + def self.init!(); end + + def self.input_to_output(data, kwargs); end + + def self.input_to_storage(contents, _); end + + def self.install!(cache_dir); end + + def self.msgpack_factory(); end + + def self.msgpack_factory=(msgpack_factory); end + + def self.precompile(path, cache_dir: T.unsafe(nil)); end + + def self.storage_to_output(data, kwargs); end + + def self.supported_options(); end + + def self.supported_options=(supported_options); end +end + module Bootsnap::CompileCache def self.permission_error(path); end @@ -2950,6 +3053,13 @@ module Bootsnap::LoadPathCache::ChangeObserver def self.register(observer, arr); end end +module Bootsnap::LoadPathCache::CoreExt +end + +module Bootsnap::LoadPathCache::CoreExt + def self.make_load_error(path); end +end + class Bootsnap::LoadPathCache::FallbackScan end @@ -5574,6 +5684,15 @@ module Cask::Caskroom extend ::T::Private::Methods::SingletonMethodHooks end +class Cask::Cmd::AbstractCommand + include ::Homebrew::Search::Extension +end + +class Cask::Cmd::AbstractCommand + extend ::T::Private::Methods::MethodHooks + extend ::T::Private::Methods::SingletonMethodHooks +end + class Cask::Config def appdir(); end @@ -7021,8 +7140,6 @@ end class Errno::EBADRPC end -Errno::ECAPMODE = Errno::NOERROR - Errno::EDEADLOCK = Errno::NOERROR class Errno::EDEVERR @@ -7043,13 +7160,6 @@ end Errno::EIPSEC = Errno::NOERROR -class Errno::ELAST - Errno = ::T.let(nil, ::T.untyped) -end - -class Errno::ELAST -end - class Errno::ENEEDAUTH Errno = ::T.let(nil, ::T.untyped) end @@ -7071,8 +7181,6 @@ end class Errno::ENOPOLICY end -Errno::ENOTCAPABLE = Errno::NOERROR - class Errno::ENOTSUP Errno = ::T.let(nil, ::T.untyped) end @@ -7115,7 +7223,12 @@ end class Errno::EPWROFF end -Errno::EQFULL = Errno::ELAST +class Errno::EQFULL + Errno = ::T.let(nil, ::T.untyped) +end + +class Errno::EQFULL +end class Errno::ERPCMISMATCH Errno = ::T.let(nil, ::T.untyped) @@ -8251,6 +8364,14 @@ module Homebrew::Livecheck extend ::T::Private::Methods::SingletonMethodHooks end +module Homebrew::MissingFormula + extend ::T::Private::Methods::SingletonMethodHooks +end + +module Homebrew::Search + include ::Homebrew::Search::Extension +end + module Homebrew::Settings extend ::T::Private::Methods::MethodHooks extend ::T::Private::Methods::SingletonMethodHooks @@ -9607,11 +9728,13 @@ module Kernel extend ::T::Private::Methods::SingletonMethodHooks def self.at_exit(); end + def self.autoload(_, _1); end + def self.fork(); end def self.gem(dep, *reqs); end - def self.load(*_); end + def self.load(path, wrap=T.unsafe(nil)); end def self.require(path); end end @@ -11921,6 +12044,8 @@ class Module def anonymous?(); end + def autoload_without_bootsnap(_, _1); end + def context(*a, &b); end def deprecate(*method_names); end @@ -12275,13 +12400,9 @@ end Net::HTTPFatalErrorCode = Net::HTTPClientError -class Net::HTTPInformation -end +Net::HTTPInformation::EXCEPTION_TYPE = Net::HTTPError -Net::HTTPInformationCode::EXCEPTION_TYPE = Net::HTTPError - -class Net::HTTPInformation -end +Net::HTTPInformationCode = Net::HTTPInformation class Net::HTTPLoopDetected HAS_BODY = ::T.let(nil, ::T.untyped) @@ -12345,13 +12466,9 @@ Net::HTTPServerErrorCode = Net::HTTPServerError Net::HTTPSession = Net::HTTP -class Net::HTTPSuccess -end +Net::HTTPSuccess::EXCEPTION_TYPE = Net::HTTPError -Net::HTTPSuccessCode::EXCEPTION_TYPE = Net::HTTPError - -class Net::HTTPSuccess -end +Net::HTTPSuccessCode = Net::HTTPSuccess class Net::HTTPURITooLong HAS_BODY = ::T.let(nil, ::T.untyped) @@ -12521,6 +12638,7 @@ class Object def to_query(key); end def to_yaml(options=T.unsafe(nil)); end + APPLE_GEM_HOME = ::T.let(nil, ::T.untyped) ARGF = ::T.let(nil, ::T.untyped) ARGV = ::T.let(nil, ::T.untyped) BUG_REPORTS_URL = ::T.let(nil, ::T.untyped) @@ -12585,6 +12703,8 @@ class Object RUBY_DESCRIPTION = ::T.let(nil, ::T.untyped) RUBY_ENGINE = ::T.let(nil, ::T.untyped) RUBY_ENGINE_VERSION = ::T.let(nil, ::T.untyped) + RUBY_FRAMEWORK = ::T.let(nil, ::T.untyped) + RUBY_FRAMEWORK_VERSION = ::T.let(nil, ::T.untyped) RUBY_PATCHLEVEL = ::T.let(nil, ::T.untyped) RUBY_PATH = ::T.let(nil, ::T.untyped) RUBY_PLATFORM = ::T.let(nil, ::T.untyped) @@ -12637,11 +12757,7 @@ class OpenSSL::KDF::KDFError end module OpenSSL::KDF - def self.hkdf(*_); end - def self.pbkdf2_hmac(*_); end - - def self.scrypt(*_); end end class OpenSSL::OCSP::Request @@ -12650,29 +12766,20 @@ end OpenSSL::PKCS7::Signer = OpenSSL::PKCS7::SignerInfo -class OpenSSL::PKey::EC - EXPLICIT_CURVE = ::T.let(nil, ::T.untyped) -end - class OpenSSL::PKey::EC::Point def to_octet_string(_); end end module OpenSSL::SSL - OP_ALLOW_NO_DHE_KEX = ::T.let(nil, ::T.untyped) OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION = ::T.let(nil, ::T.untyped) OP_CRYPTOPRO_TLSEXT_BUG = ::T.let(nil, ::T.untyped) OP_LEGACY_SERVER_CONNECT = ::T.let(nil, ::T.untyped) - OP_NO_ENCRYPT_THEN_MAC = ::T.let(nil, ::T.untyped) - OP_NO_RENEGOTIATION = ::T.let(nil, ::T.untyped) - OP_NO_TLSv1_3 = ::T.let(nil, ::T.untyped) OP_SAFARI_ECDHE_ECDSA_BUG = ::T.let(nil, ::T.untyped) OP_TLSEXT_PADDING = ::T.let(nil, ::T.untyped) SSL2_VERSION = ::T.let(nil, ::T.untyped) SSL3_VERSION = ::T.let(nil, ::T.untyped) TLS1_1_VERSION = ::T.let(nil, ::T.untyped) TLS1_2_VERSION = ::T.let(nil, ::T.untyped) - TLS1_3_VERSION = ::T.let(nil, ::T.untyped) TLS1_VERSION = ::T.let(nil, ::T.untyped) end @@ -17084,6 +17191,7 @@ module Psych end module Psych + extend ::Bootsnap::CompileCache::YAML::Patch def self.add_builtin_type(type_tag, &block); end def self.add_domain_type(domain, type_tag, &block); end @@ -27855,6 +27963,10 @@ class RubyVM::AbstractSyntaxTree::Node def pretty_print_children(q, names=T.unsafe(nil)); end end +class RubyVM::InstructionSequence + extend ::Bootsnap::CompileCache::ISeq::InstructionSequenceMixin +end + module RubyVM::MJIT end @@ -28744,6 +28856,7 @@ class Socket IPV6_PATHMTU = ::T.let(nil, ::T.untyped) IPV6_RECVPATHMTU = ::T.let(nil, ::T.untyped) IPV6_USE_MIN_MTU = ::T.let(nil, ::T.untyped) + IP_DONTFRAG = ::T.let(nil, ::T.untyped) IP_PORTRANGE = ::T.let(nil, ::T.untyped) IP_RECVDSTADDR = ::T.let(nil, ::T.untyped) IP_RECVIF = ::T.let(nil, ::T.untyped) @@ -28835,6 +28948,7 @@ module Socket::Constants IPV6_PATHMTU = ::T.let(nil, ::T.untyped) IPV6_RECVPATHMTU = ::T.let(nil, ::T.untyped) IPV6_USE_MIN_MTU = ::T.let(nil, ::T.untyped) + IP_DONTFRAG = ::T.let(nil, ::T.untyped) IP_PORTRANGE = ::T.let(nil, ::T.untyped) IP_RECVDSTADDR = ::T.let(nil, ::T.untyped) IP_RECVIF = ::T.let(nil, ::T.untyped) diff --git a/Library/Homebrew/utils/gems.rb b/Library/Homebrew/utils/gems.rb index a75f0b8561..b19eb36cb3 100644 --- a/Library/Homebrew/utils/gems.rb +++ b/Library/Homebrew/utils/gems.rb @@ -34,6 +34,14 @@ module Homebrew end end + def opoo_if_defined(message) + if defined?(opoo) + $stderr.opoo message + else + $stderr.puts "Warning: #{message}" + end + end + def odie_if_defined(message) if defined?(odie) odie message @@ -105,7 +113,7 @@ module Homebrew ) end - def install_bundler_gems! + def install_bundler_gems!(only_warn_on_failure: false) install_bundler! ENV["BUNDLE_GEMFILE"] = File.join(ENV.fetch("HOMEBREW_LIBRARY"), "Homebrew", "Gemfile") @@ -117,9 +125,14 @@ module Homebrew # for some reason sometimes the exit code lies so check the output too. if bundle_check_failed || bundle_check_output.include?("Install missing gems") unless system bundle, "install" - odie_if_defined <<~EOS + message = <<~EOS failed to run `#{bundle} install`! EOS + if only_warn_on_failure + opoo_if_defined message + else + odie_if_defined message + end end else true diff --git a/Library/Homebrew/utils/gems.rbi b/Library/Homebrew/utils/gems.rbi index 47c3ced643..0aad665138 100644 --- a/Library/Homebrew/utils/gems.rbi +++ b/Library/Homebrew/utils/gems.rbi @@ -22,6 +22,6 @@ module Homebrew sig { void } def install_bundler!; end - sig { void } - def install_bundler_gems!; end + sig { params(only_warn_on_failure: T::Boolean).void } + def install_bundler_gems!(only_warn_on_failure: false); end end