diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index f31224ab25..d571f7e5c6 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -14,12 +14,13 @@ end require "pathname" HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.parent + require "English" unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s) $LOAD_PATH.unshift(HOMEBREW_LIBRARY_PATH.to_s) end + require "global" -require "tap" if ARGV == %w[--version] || ARGV == %w[-v] puts "Homebrew #{HOMEBREW_VERSION}" diff --git a/Library/Homebrew/build_environment.rb b/Library/Homebrew/build_environment.rb index 3c494428f0..da7d63cdf7 100644 --- a/Library/Homebrew/build_environment.rb +++ b/Library/Homebrew/build_environment.rb @@ -1,4 +1,3 @@ -require "set" class BuildEnvironment def initialize(*settings) diff --git a/Library/Homebrew/cask/lib/hbc.rb b/Library/Homebrew/cask/lib/hbc.rb index d865b31f2f..7547ea1e23 100644 --- a/Library/Homebrew/cask/lib/hbc.rb +++ b/Library/Homebrew/cask/lib/hbc.rb @@ -1,5 +1,4 @@ require "hardware" -require "utils" require "hbc/artifact" require "hbc/audit" diff --git a/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb b/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb index d299733d89..9776a42ae7 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb @@ -1,4 +1,3 @@ -require "pathname" require "timeout" require "hbc/artifact/abstract_artifact" diff --git a/Library/Homebrew/cask/lib/hbc/container/bzip2.rb b/Library/Homebrew/cask/lib/hbc/container/bzip2.rb index 9f2a59bb8a..efa95376a2 100644 --- a/Library/Homebrew/cask/lib/hbc/container/bzip2.rb +++ b/Library/Homebrew/cask/lib/hbc/container/bzip2.rb @@ -1,5 +1,3 @@ -require "tmpdir" - require "hbc/container/base" module Hbc diff --git a/Library/Homebrew/cask/lib/hbc/container/cab.rb b/Library/Homebrew/cask/lib/hbc/container/cab.rb index 327aece6ea..403abcc0fd 100644 --- a/Library/Homebrew/cask/lib/hbc/container/cab.rb +++ b/Library/Homebrew/cask/lib/hbc/container/cab.rb @@ -1,4 +1,3 @@ -require "tmpdir" require "hbc/container/base" diff --git a/Library/Homebrew/cask/lib/hbc/container/dmg.rb b/Library/Homebrew/cask/lib/hbc/container/dmg.rb index c0e43f68a0..fcb9b5739d 100644 --- a/Library/Homebrew/cask/lib/hbc/container/dmg.rb +++ b/Library/Homebrew/cask/lib/hbc/container/dmg.rb @@ -1,4 +1,3 @@ -require "set" require "tempfile" require "hbc/container/base" diff --git a/Library/Homebrew/cask/lib/hbc/container/generic_unar.rb b/Library/Homebrew/cask/lib/hbc/container/generic_unar.rb index 63ab917ea2..6a05edb8d0 100644 --- a/Library/Homebrew/cask/lib/hbc/container/generic_unar.rb +++ b/Library/Homebrew/cask/lib/hbc/container/generic_unar.rb @@ -1,4 +1,3 @@ -require "tmpdir" require "hbc/container/base" diff --git a/Library/Homebrew/cask/lib/hbc/container/gpg.rb b/Library/Homebrew/cask/lib/hbc/container/gpg.rb index 09c75468ac..ae162565e8 100644 --- a/Library/Homebrew/cask/lib/hbc/container/gpg.rb +++ b/Library/Homebrew/cask/lib/hbc/container/gpg.rb @@ -1,4 +1,3 @@ -require "tmpdir" require "hbc/container/base" diff --git a/Library/Homebrew/cask/lib/hbc/container/gzip.rb b/Library/Homebrew/cask/lib/hbc/container/gzip.rb index d3dd7b8fd0..4f91c3879c 100644 --- a/Library/Homebrew/cask/lib/hbc/container/gzip.rb +++ b/Library/Homebrew/cask/lib/hbc/container/gzip.rb @@ -1,4 +1,3 @@ -require "tmpdir" require "hbc/container/base" diff --git a/Library/Homebrew/cask/lib/hbc/container/lzma.rb b/Library/Homebrew/cask/lib/hbc/container/lzma.rb index 1e165ba2a7..7d50199bc8 100644 --- a/Library/Homebrew/cask/lib/hbc/container/lzma.rb +++ b/Library/Homebrew/cask/lib/hbc/container/lzma.rb @@ -1,4 +1,3 @@ -require "tmpdir" require "hbc/container/base" diff --git a/Library/Homebrew/cask/lib/hbc/container/tar.rb b/Library/Homebrew/cask/lib/hbc/container/tar.rb index eb646c816f..f5340174e4 100644 --- a/Library/Homebrew/cask/lib/hbc/container/tar.rb +++ b/Library/Homebrew/cask/lib/hbc/container/tar.rb @@ -1,4 +1,3 @@ -require "tmpdir" require "hbc/container/base" diff --git a/Library/Homebrew/cask/lib/hbc/container/xar.rb b/Library/Homebrew/cask/lib/hbc/container/xar.rb index a0165ca57e..9121e726d8 100644 --- a/Library/Homebrew/cask/lib/hbc/container/xar.rb +++ b/Library/Homebrew/cask/lib/hbc/container/xar.rb @@ -1,4 +1,3 @@ -require "tmpdir" require "hbc/container/base" diff --git a/Library/Homebrew/cask/lib/hbc/container/xz.rb b/Library/Homebrew/cask/lib/hbc/container/xz.rb index 4086ae1886..408e0917a5 100644 --- a/Library/Homebrew/cask/lib/hbc/container/xz.rb +++ b/Library/Homebrew/cask/lib/hbc/container/xz.rb @@ -1,4 +1,3 @@ -require "tmpdir" require "hbc/container/base" diff --git a/Library/Homebrew/cask/lib/hbc/dsl.rb b/Library/Homebrew/cask/lib/hbc/dsl.rb index 9a88f1b624..9d229e2880 100644 --- a/Library/Homebrew/cask/lib/hbc/dsl.rb +++ b/Library/Homebrew/cask/lib/hbc/dsl.rb @@ -1,4 +1,3 @@ -require "set" require "locale" require "hbc/artifact" diff --git a/Library/Homebrew/cask/lib/hbc/locations.rb b/Library/Homebrew/cask/lib/hbc/locations.rb index 40ba2989f0..fea696e5b0 100644 --- a/Library/Homebrew/cask/lib/hbc/locations.rb +++ b/Library/Homebrew/cask/lib/hbc/locations.rb @@ -1,4 +1,3 @@ -require "tap" module Hbc module Locations diff --git a/Library/Homebrew/cask/lib/hbc/macos.rb b/Library/Homebrew/cask/lib/hbc/macos.rb index d47e04fb24..a9e9e0a243 100644 --- a/Library/Homebrew/cask/lib/hbc/macos.rb +++ b/Library/Homebrew/cask/lib/hbc/macos.rb @@ -1,4 +1,3 @@ -require "set" require "os/mac/version" diff --git a/Library/Homebrew/caveats.rb b/Library/Homebrew/caveats.rb index a289a12202..9fb788a46f 100644 --- a/Library/Homebrew/caveats.rb +++ b/Library/Homebrew/caveats.rb @@ -1,4 +1,3 @@ -require "forwardable" require "language/python" class Caveats diff --git a/Library/Homebrew/cmd/--repository.rb b/Library/Homebrew/cmd/--repository.rb index 006d4cd5d3..6f6f8d31ec 100644 --- a/Library/Homebrew/cmd/--repository.rb +++ b/Library/Homebrew/cmd/--repository.rb @@ -4,8 +4,6 @@ #: * `--repository` `/`: #: Display where tap `/`'s directory is located. -require "tap" - module Homebrew module_function diff --git a/Library/Homebrew/cmd/cleanup.rb b/Library/Homebrew/cmd/cleanup.rb index 290b748de2..2fba06e20f 100644 --- a/Library/Homebrew/cmd/cleanup.rb +++ b/Library/Homebrew/cmd/cleanup.rb @@ -12,7 +12,6 @@ #: deleted. If you want to delete those too: `rm -rf $(brew --cache)` require "cleanup" -require "utils" module Homebrew module_function diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index 392c299a06..8fce1d60a6 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -71,7 +71,6 @@ require "missing_formula" require "diagnostic" require "cmd/search" require "formula_installer" -require "tap" require "hardware" require "development_tools" diff --git a/Library/Homebrew/cmd/leaves.rb b/Library/Homebrew/cmd/leaves.rb index 42fa18a28a..ec5238c2a1 100644 --- a/Library/Homebrew/cmd/leaves.rb +++ b/Library/Homebrew/cmd/leaves.rb @@ -3,7 +3,6 @@ require "formula" require "tab" -require "set" module Homebrew module_function diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb index 4ba5247f12..25c602b124 100644 --- a/Library/Homebrew/cmd/search.rb +++ b/Library/Homebrew/cmd/search.rb @@ -15,8 +15,6 @@ require "formula" require "missing_formula" -require "utils" -require "official_taps" require "descriptions" module Homebrew diff --git a/Library/Homebrew/cmd/style.rb b/Library/Homebrew/cmd/style.rb index 76d961a7fe..e41f10f97a 100644 --- a/Library/Homebrew/cmd/style.rb +++ b/Library/Homebrew/cmd/style.rb @@ -19,7 +19,6 @@ #: #: Exits with a non-zero status if any style violations are found. -require "utils" require "json" require "open3" diff --git a/Library/Homebrew/cmd/tap-info.rb b/Library/Homebrew/cmd/tap-info.rb index 26daa1a8ae..b2d9ee5088 100644 --- a/Library/Homebrew/cmd/tap-info.rb +++ b/Library/Homebrew/cmd/tap-info.rb @@ -15,8 +15,6 @@ #: See the docs for examples of using the JSON output: #: -require "tap" - module Homebrew module_function diff --git a/Library/Homebrew/cmd/tap-pin.rb b/Library/Homebrew/cmd/tap-pin.rb index 41957f2652..505720f30d 100644 --- a/Library/Homebrew/cmd/tap-pin.rb +++ b/Library/Homebrew/cmd/tap-pin.rb @@ -2,8 +2,6 @@ #: Pin , prioritizing its formulae over core when formula names are supplied #: by the user. See also `tap-unpin`. -require "tap" - module Homebrew module_function diff --git a/Library/Homebrew/cmd/tap-unpin.rb b/Library/Homebrew/cmd/tap-unpin.rb index 05bfc7c8b9..0c7c9ee020 100644 --- a/Library/Homebrew/cmd/tap-unpin.rb +++ b/Library/Homebrew/cmd/tap-unpin.rb @@ -1,8 +1,6 @@ #: * `tap-unpin` : #: Unpin so its formulae are no longer prioritized. See also `tap-pin`. -require "tap" - module Homebrew module_function diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb index 847d355dcf..21d05d768e 100644 --- a/Library/Homebrew/cmd/tap.rb +++ b/Library/Homebrew/cmd/tap.rb @@ -28,8 +28,6 @@ #: * `tap` `--list-pinned`: #: List all pinned taps. -require "tap" - module Homebrew module_function diff --git a/Library/Homebrew/cmd/untap.rb b/Library/Homebrew/cmd/untap.rb index 0d363b7b58..1b4bf109dd 100644 --- a/Library/Homebrew/cmd/untap.rb +++ b/Library/Homebrew/cmd/untap.rb @@ -1,8 +1,6 @@ #: * `untap` : #: Remove a tapped repository. -require "tap" - module Homebrew module_function diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb index d241d17b06..b2d5dfdbed 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -7,7 +7,6 @@ require "migrator" require "formulary" require "descriptions" require "cleanup" -require "utils" module Homebrew module_function diff --git a/Library/Homebrew/compat/gpg.rb b/Library/Homebrew/compat/gpg.rb index e802d939cf..cdcbe2018d 100644 --- a/Library/Homebrew/compat/gpg.rb +++ b/Library/Homebrew/compat/gpg.rb @@ -1,4 +1,3 @@ -require "utils" module Gpg module_function diff --git a/Library/Homebrew/compat/tap.rb b/Library/Homebrew/compat/tap.rb index a1e3ce1727..9f4384da0e 100644 --- a/Library/Homebrew/compat/tap.rb +++ b/Library/Homebrew/compat/tap.rb @@ -1,4 +1,3 @@ -require "tap" class Tap def core_formula_repository? diff --git a/Library/Homebrew/config.rb b/Library/Homebrew/config.rb index 30b7bc6c9c..38d7c80438 100644 --- a/Library/Homebrew/config.rb +++ b/Library/Homebrew/config.rb @@ -2,8 +2,6 @@ unless ENV["HOMEBREW_BREW_FILE"] raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!" end -require "constants" - # Path to `bin/brew` main executable in HOMEBREW_PREFIX HOMEBREW_BREW_FILE = Pathname.new(ENV["HOMEBREW_BREW_FILE"]) diff --git a/Library/Homebrew/dependency_collector.rb b/Library/Homebrew/dependency_collector.rb index 74f42a6aaf..1a00c72012 100644 --- a/Library/Homebrew/dependency_collector.rb +++ b/Library/Homebrew/dependency_collector.rb @@ -2,7 +2,6 @@ require "dependency" require "dependencies" require "requirement" require "requirements" -require "set" require "extend/cachable" ## A dependency is a formula that another formula needs to install. diff --git a/Library/Homebrew/descriptions.rb b/Library/Homebrew/descriptions.rb index bc19826731..4db47e77f1 100644 --- a/Library/Homebrew/descriptions.rb +++ b/Library/Homebrew/descriptions.rb @@ -1,4 +1,3 @@ -require "set" require "formula" require "formula_versions" diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 5eaffe2afa..99f9fffe77 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -39,11 +39,9 @@ require "formula" require "formula_versions" -require "utils" require "utils/curl" require "extend/ENV" require "formula_cellar_checks" -require "official_taps" require "cmd/search" require "cmd/style" require "date" diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index b05277d054..ff01e24beb 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -37,7 +37,6 @@ require "formula_versions" require "cli_parser" require "utils/inreplace" require "erb" -require "extend/pathname" BOTTLE_ERB = <<-EOS.freeze bottle do diff --git a/Library/Homebrew/dev-cmd/pull.rb b/Library/Homebrew/dev-cmd/pull.rb index c8006d7781..318d119aa4 100644 --- a/Library/Homebrew/dev-cmd/pull.rb +++ b/Library/Homebrew/dev-cmd/pull.rb @@ -50,12 +50,10 @@ require "net/http" require "net/https" -require "utils" require "json" require "cli_parser" require "formula" require "formulary" -require "tap" require "version" require "pkg_version" diff --git a/Library/Homebrew/dev-cmd/tap-new.rb b/Library/Homebrew/dev-cmd/tap-new.rb index 31299d2b0b..b23cdef808 100644 --- a/Library/Homebrew/dev-cmd/tap-new.rb +++ b/Library/Homebrew/dev-cmd/tap-new.rb @@ -1,8 +1,6 @@ #: * `tap-new` `/`: #: Generate the template files for a new tap. -require "tap" - module Homebrew module_function diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb index 57c00dafc7..50c9ca6d15 100644 --- a/Library/Homebrew/dev-cmd/tests.rb +++ b/Library/Homebrew/dev-cmd/tests.rb @@ -17,7 +17,6 @@ require "cli_parser" require "fileutils" -require "tap" module Homebrew module_function diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index b50ae317c7..6e637baa35 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -22,6 +22,7 @@ class AbstractDownloadStrategy @url = resource.url @version = resource.version @meta = resource.specs + @shutup = false extend Pourable if meta[:bottle] end diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb index 5a6b779d0e..9ba3a244a4 100644 --- a/Library/Homebrew/extend/ENV/shared.rb +++ b/Library/Homebrew/extend/ENV/shared.rb @@ -1,7 +1,5 @@ -require "formula" require "compilers" require "development_tools" -require "PATH" # Homebrew extends Ruby's `ENV` to make our code more readable. # Implemented in {SharedEnvExtension} and either {Superenv} or diff --git a/Library/Homebrew/extend/fileutils.rb b/Library/Homebrew/extend/fileutils.rb index 6286e48c01..ea2d51c01b 100644 --- a/Library/Homebrew/extend/fileutils.rb +++ b/Library/Homebrew/extend/fileutils.rb @@ -1,5 +1,4 @@ require "fileutils" -require "tmpdir" require "etc" # Homebrew extends Ruby's `FileUtils` to make our code more readable. diff --git a/Library/Homebrew/extend/module.rb b/Library/Homebrew/extend/module.rb index f4ea4de55a..b314543739 100644 --- a/Library/Homebrew/extend/module.rb +++ b/Library/Homebrew/extend/module.rb @@ -6,7 +6,9 @@ class Module attrs.each do |attr| module_eval <<-EOS, file, line def #{attr}(val=nil) - val.nil? ? @#{attr} : @#{attr} = val + @#{attr} ||= nil + return @#{attr} if val.nil? + @#{attr} = val end EOS end diff --git a/Library/Homebrew/extend/optparse.rb b/Library/Homebrew/extend/optparse.rb index 784d6d699d..801f7baddd 100644 --- a/Library/Homebrew/extend/optparse.rb +++ b/Library/Homebrew/extend/optparse.rb @@ -1,5 +1,4 @@ require "optparse" -require "pathname" OptionParser.accept Pathname do |path| Pathname(path).expand_path if path diff --git a/Library/Homebrew/extend/os/bottles.rb b/Library/Homebrew/extend/os/bottles.rb index 146b807a4a..6ee9a2146e 100644 --- a/Library/Homebrew/extend/os/bottles.rb +++ b/Library/Homebrew/extend/os/bottles.rb @@ -1,2 +1 @@ -require "utils/bottles" require "extend/os/mac/utils/bottles" if OS.mac? diff --git a/Library/Homebrew/extend/os/dependency_collector.rb b/Library/Homebrew/extend/os/dependency_collector.rb index 56fcad31d0..10131c916d 100644 --- a/Library/Homebrew/extend/os/dependency_collector.rb +++ b/Library/Homebrew/extend/os/dependency_collector.rb @@ -1,2 +1 @@ -require "dependency_collector" require "extend/os/mac/dependency_collector" if OS.mac? diff --git a/Library/Homebrew/extend/os/development_tools.rb b/Library/Homebrew/extend/os/development_tools.rb index 5bd5cb81a0..2d748074d1 100644 --- a/Library/Homebrew/extend/os/development_tools.rb +++ b/Library/Homebrew/extend/os/development_tools.rb @@ -1,2 +1 @@ -require "development_tools" require "extend/os/mac/development_tools" if OS.mac? diff --git a/Library/Homebrew/extend/os/diagnostic.rb b/Library/Homebrew/extend/os/diagnostic.rb index f8f53b1f4f..3e0d104fc4 100644 --- a/Library/Homebrew/extend/os/diagnostic.rb +++ b/Library/Homebrew/extend/os/diagnostic.rb @@ -1,2 +1 @@ -require "diagnostic" require "extend/os/mac/diagnostic" if OS.mac? diff --git a/Library/Homebrew/extend/os/emoji.rb b/Library/Homebrew/extend/os/emoji.rb index 8fd99e1d3e..59efced1d7 100644 --- a/Library/Homebrew/extend/os/emoji.rb +++ b/Library/Homebrew/extend/os/emoji.rb @@ -1,3 +1 @@ -require "os" -require "emoji" require "extend/os/mac/emoji" if OS.mac? diff --git a/Library/Homebrew/extend/os/extend/ENV/shared.rb b/Library/Homebrew/extend/os/extend/ENV/shared.rb index e9574eb583..405c442912 100644 --- a/Library/Homebrew/extend/os/extend/ENV/shared.rb +++ b/Library/Homebrew/extend/os/extend/ENV/shared.rb @@ -1,2 +1 @@ -require "extend/ENV/shared" require "extend/os/mac/extend/ENV/shared" if OS.mac? diff --git a/Library/Homebrew/extend/os/extend/ENV/std.rb b/Library/Homebrew/extend/os/extend/ENV/std.rb index 18ede5b9ed..7d117c626e 100644 --- a/Library/Homebrew/extend/os/extend/ENV/std.rb +++ b/Library/Homebrew/extend/os/extend/ENV/std.rb @@ -1,4 +1,3 @@ -require "extend/ENV/std" if OS.mac? require "extend/os/mac/extend/ENV/std" elsif OS.linux? diff --git a/Library/Homebrew/extend/os/extend/ENV/super.rb b/Library/Homebrew/extend/os/extend/ENV/super.rb index 27c49eb849..a04f559f23 100644 --- a/Library/Homebrew/extend/os/extend/ENV/super.rb +++ b/Library/Homebrew/extend/os/extend/ENV/super.rb @@ -1,2 +1 @@ -require "extend/ENV/super" require "extend/os/mac/extend/ENV/super" if OS.mac? diff --git a/Library/Homebrew/extend/os/formula_cellar_checks.rb b/Library/Homebrew/extend/os/formula_cellar_checks.rb index 66b5b80d3d..7198179563 100644 --- a/Library/Homebrew/extend/os/formula_cellar_checks.rb +++ b/Library/Homebrew/extend/os/formula_cellar_checks.rb @@ -1,2 +1 @@ -require "formula_cellar_checks" require "extend/os/mac/formula_cellar_checks" if OS.mac? diff --git a/Library/Homebrew/extend/os/keg_relocate.rb b/Library/Homebrew/extend/os/keg_relocate.rb index 25a74286a4..7c805a7ae1 100644 --- a/Library/Homebrew/extend/os/keg_relocate.rb +++ b/Library/Homebrew/extend/os/keg_relocate.rb @@ -1,2 +1 @@ -require "keg_relocate" require "extend/os/mac/keg_relocate" if OS.mac? diff --git a/Library/Homebrew/extend/os/mac/caveats.rb b/Library/Homebrew/extend/os/mac/caveats.rb index d912a83075..7ddfb5fb4d 100644 --- a/Library/Homebrew/extend/os/mac/caveats.rb +++ b/Library/Homebrew/extend/os/mac/caveats.rb @@ -1,4 +1,6 @@ class Caveats + undef plist_caveats + def plist_caveats s = [] if f.plist || (keg&.plist_installed?) diff --git a/Library/Homebrew/extend/os/mac/cleaner.rb b/Library/Homebrew/extend/os/mac/cleaner.rb index 74f627b48e..69d82814d7 100644 --- a/Library/Homebrew/extend/os/mac/cleaner.rb +++ b/Library/Homebrew/extend/os/mac/cleaner.rb @@ -1,6 +1,8 @@ class Cleaner private + undef executable_path? + def executable_path?(path) path.mach_o_executable? || path.text_executable? end diff --git a/Library/Homebrew/extend/os/mac/dependency_collector.rb b/Library/Homebrew/extend/os/mac/dependency_collector.rb index a7e5d7ffc8..543c2494ec 100644 --- a/Library/Homebrew/extend/os/mac/dependency_collector.rb +++ b/Library/Homebrew/extend/os/mac/dependency_collector.rb @@ -1,6 +1,10 @@ require "os/mac/ld64_dependency" class DependencyCollector + undef git_dep_if_needed, subversion_dep_if_needed, cvs_dep_if_needed, + xz_dep_if_needed, unzip_dep_if_needed, bzip2_dep_if_needed, + ld64_dep_if_needed + def git_dep_if_needed(tags) return if MacOS.version >= :lion Dependency.new("git", tags) @@ -18,7 +22,7 @@ class DependencyCollector Dependency.new("xz", tags) end - def zip_dep_if_needed(tags); end + def unzip_dep_if_needed(tags); end def bzip2_dep_if_needed(tags); end diff --git a/Library/Homebrew/extend/os/mac/development_tools.rb b/Library/Homebrew/extend/os/mac/development_tools.rb index d37e778ca5..ab2cfe90ea 100644 --- a/Library/Homebrew/extend/os/mac/development_tools.rb +++ b/Library/Homebrew/extend/os/mac/development_tools.rb @@ -3,10 +3,13 @@ require "os/mac/xcode" # @private class DevelopmentTools class << self - alias original_locate locate + alias generic_locate locate + undef installed?, default_compiler, curl_handles_most_https_certificates?, + subversion_handles_most_https_certificates? + def locate(tool) (@locate ||= {}).fetch(tool) do |key| - @locate[key] = if (located_tool = original_locate(tool)) + @locate[key] = if (located_tool = generic_locate(tool)) located_tool elsif MacOS.version > :tiger path = Utils.popen_read("/usr/bin/xcrun", "-no-cache", "-find", tool, err: :close).chomp @@ -22,6 +25,35 @@ class DevelopmentTools MacOS::Xcode.installed? || MacOS::CLT.installed? end + def default_compiler + case default_cc + # if GCC 4.2 is installed, e.g. via Tigerbrew, prefer it + # over the system's GCC 4.0 + when /^gcc-4\.0/ then gcc_4_2_build_version ? :gcc_4_2 : :gcc_4_0 + when /^gcc/ then :gcc_4_2 + when "clang" then :clang + else + # guess :( + if MacOS::Xcode.version >= "4.3" + :clang + else + :gcc_4_2 + end + end + end + + def curl_handles_most_https_certificates? + # The system Curl is too old for some modern HTTPS certificates on + # older macOS versions. + ENV["HOMEBREW_SYSTEM_CURL_TOO_OLD"].nil? + end + + def subversion_handles_most_https_certificates? + # The system Subversion is too old for some HTTPS certificates on + # older macOS versions. + MacOS.version >= :sierra + end + def installation_instructions if MacOS.version >= "10.9" <<~EOS @@ -64,34 +96,5 @@ class DevelopmentTools EOS end end - - def default_compiler - case default_cc - # if GCC 4.2 is installed, e.g. via Tigerbrew, prefer it - # over the system's GCC 4.0 - when /^gcc-4\.0/ then gcc_4_2_build_version ? :gcc_4_2 : :gcc_4_0 - when /^gcc/ then :gcc_4_2 - when "clang" then :clang - else - # guess :( - if MacOS::Xcode.version >= "4.3" - :clang - else - :gcc_4_2 - end - end - end - - def curl_handles_most_https_certificates? - # The system Curl is too old for some modern HTTPS certificates on - # older macOS versions. - ENV["HOMEBREW_SYSTEM_CURL_TOO_OLD"].nil? - end - - def subversion_handles_most_https_certificates? - # The system Subversion is too old for some HTTPS certificates on - # older macOS versions. - MacOS.version >= :sierra - end end end diff --git a/Library/Homebrew/extend/os/mac/diagnostic.rb b/Library/Homebrew/extend/os/mac/diagnostic.rb index 78eeae904e..92fb3f315f 100644 --- a/Library/Homebrew/extend/os/mac/diagnostic.rb +++ b/Library/Homebrew/extend/os/mac/diagnostic.rb @@ -1,6 +1,9 @@ module Homebrew module Diagnostic class Checks + undef development_tools_checks, fatal_development_tools_checks, + build_error_checks + def development_tools_checks %w[ check_for_unsupported_macos diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/std.rb b/Library/Homebrew/extend/os/mac/extend/ENV/std.rb index 1a6d10f3b6..370bea2cf2 100644 --- a/Library/Homebrew/extend/os/mac/extend/ENV/std.rb +++ b/Library/Homebrew/extend/os/mac/extend/ENV/std.rb @@ -1,5 +1,39 @@ module Stdenv # @private + + undef homebrew_extra_pkg_config_paths, x11 + + def homebrew_extra_pkg_config_paths + ["#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.version}"] + end + + def x11 + # There are some config scripts here that should go in the PATH + append_path "PATH", MacOS::X11.bin.to_s + + # Append these to PKG_CONFIG_LIBDIR so they are searched + # *after* our own pkgconfig directories, as we dupe some of the + # libs in XQuartz. + append_path "PKG_CONFIG_LIBDIR", "#{MacOS::X11.lib}/pkgconfig" + append_path "PKG_CONFIG_LIBDIR", "#{MacOS::X11.share}/pkgconfig" + + append "LDFLAGS", "-L#{MacOS::X11.lib}" + append_path "CMAKE_PREFIX_PATH", MacOS::X11.prefix.to_s + append_path "CMAKE_INCLUDE_PATH", MacOS::X11.include.to_s + append_path "CMAKE_INCLUDE_PATH", "#{MacOS::X11.include}/freetype2" + + append "CPPFLAGS", "-I#{MacOS::X11.include}" + append "CPPFLAGS", "-I#{MacOS::X11.include}/freetype2" + + append_path "ACLOCAL_PATH", "#{MacOS::X11.share}/aclocal" + + if MacOS::XQuartz.provided_by_apple? && !MacOS::CLT.installed? + append_path "CMAKE_PREFIX_PATH", "#{MacOS.sdk_path}/usr/X11" + end + + append "CFLAGS", "-I#{MacOS::X11.include}" unless MacOS::CLT.installed? + end + def setup_build_environment(formula = nil) generic_setup_build_environment formula @@ -29,10 +63,6 @@ module Stdenv ld64 if Formula["ld64"].installed? end - def homebrew_extra_pkg_config_paths - ["#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.version}"] - end - # Sets architecture-specific flags for every environment variable # given in the list `flags`. # @private @@ -110,33 +140,6 @@ module Stdenv end end - def x11 - # There are some config scripts here that should go in the PATH - append_path "PATH", MacOS::X11.bin.to_s - - # Append these to PKG_CONFIG_LIBDIR so they are searched - # *after* our own pkgconfig directories, as we dupe some of the - # libs in XQuartz. - append_path "PKG_CONFIG_LIBDIR", "#{MacOS::X11.lib}/pkgconfig" - append_path "PKG_CONFIG_LIBDIR", "#{MacOS::X11.share}/pkgconfig" - - append "LDFLAGS", "-L#{MacOS::X11.lib}" - append_path "CMAKE_PREFIX_PATH", MacOS::X11.prefix.to_s - append_path "CMAKE_INCLUDE_PATH", MacOS::X11.include.to_s - append_path "CMAKE_INCLUDE_PATH", "#{MacOS::X11.include}/freetype2" - - append "CPPFLAGS", "-I#{MacOS::X11.include}" - append "CPPFLAGS", "-I#{MacOS::X11.include}/freetype2" - - append_path "ACLOCAL_PATH", "#{MacOS::X11.share}/aclocal" - - if MacOS::XQuartz.provided_by_apple? && !MacOS::CLT.installed? - append_path "CMAKE_PREFIX_PATH", "#{MacOS.sdk_path}/usr/X11" - end - - append "CFLAGS", "-I#{MacOS::X11.include}" unless MacOS::CLT.installed? - end - def no_weak_imports append "LDFLAGS", "-Wl,-no_weak_imports" if no_weak_imports_support? end diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb index f233002ea0..c60c9ab193 100644 --- a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb +++ b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb @@ -1,16 +1,24 @@ module Superenv + class << self + undef bin + + # @private + def bin + return unless DevelopmentTools.installed? + + (HOMEBREW_SHIMS_PATH/"super").realpath + end + end + alias x11? x11 - # @private - def self.bin - return unless DevelopmentTools.installed? - - (HOMEBREW_SHIMS_PATH/"super").realpath - end - - def effective_sysroot - MacOS.sdk_path.to_s if MacOS::Xcode.without_clt? - end + undef homebrew_extra_paths, + homebrew_extra_pkg_config_paths, homebrew_extra_aclocal_paths, + homebrew_extra_isystem_paths, homebrew_extra_library_paths, + homebrew_extra_cmake_include_paths, + homebrew_extra_cmake_library_paths, + homebrew_extra_cmake_frameworks_paths, + determine_cccfg, set_x11_env_if_installed def homebrew_extra_paths paths = [] @@ -86,6 +94,14 @@ module Superenv s end + def effective_sysroot + MacOS.sdk_path.to_s if MacOS::Xcode.without_clt? + end + + def set_x11_env_if_installed + ENV.x11 = MacOS::X11.installed? + end + # @private def setup_build_environment(formula = nil) generic_setup_build_environment(formula) @@ -115,10 +131,6 @@ module Superenv self["HOMEBREW_PREFER_CLT_PROXIES"] = "1" if MacOS.version >= "10.9" end - def set_x11_env_if_installed - ENV.x11 = MacOS::X11.installed? - end - def no_weak_imports append "HOMEBREW_CCCFG", "w" if no_weak_imports_support? end diff --git a/Library/Homebrew/extend/os/mac/hardware/cpu.rb b/Library/Homebrew/extend/os/mac/hardware/cpu.rb index cc41ae9112..14ee2fd9ae 100644 --- a/Library/Homebrew/extend/os/mac/hardware/cpu.rb +++ b/Library/Homebrew/extend/os/mac/hardware/cpu.rb @@ -1,6 +1,9 @@ module Hardware class CPU class << self + undef optimization_flags, type, family, universal_archs, can_run?, + features, sse4? + PPC_OPTIMIZATION_FLAGS = { g3: "-mcpu=750", g4: "-mcpu=7400", @@ -8,6 +11,7 @@ module Hardware g5: "-mcpu=970", g5_64: "-mcpu=970 -arch ppc64", }.freeze + def optimization_flags OPTIMIZATION_FLAGS.merge(PPC_OPTIMIZATION_FLAGS) end @@ -71,10 +75,6 @@ module Hardware end end - def extmodel - sysctl_int("machdep.cpu.extmodel") - end - # Returns an array that's been extended with ArchitectureListExtension, # which provides helpers like #as_arch_flags and #as_cmake_arch_flags. def universal_archs @@ -113,6 +113,14 @@ module Hardware ).split(" ").map { |s| s.downcase.to_sym } end + def sse4? + sysctl_bool("hw.optional.sse4_1") + end + + def extmodel + sysctl_int("machdep.cpu.extmodel") + end + def aes? sysctl_bool("hw.optional.aes") end @@ -137,10 +145,6 @@ module Hardware sysctl_bool("hw.optional.supplementalsse3") end - def sse4? - sysctl_bool("hw.optional.sse4_1") - end - def sse4_2? sysctl_bool("hw.optional.sse4_2") end diff --git a/Library/Homebrew/extend/os/mac/keg_relocate.rb b/Library/Homebrew/extend/os/mac/keg_relocate.rb index 707710be61..f92134e5a4 100644 --- a/Library/Homebrew/extend/os/mac/keg_relocate.rb +++ b/Library/Homebrew/extend/os/mac/keg_relocate.rb @@ -1,24 +1,20 @@ class Keg - def fix_dynamic_linkage - mach_o_files.each do |file| - file.ensure_writable do - change_dylib_id(dylib_id_for(file), file) if file.dylib? + class << self + undef file_linked_libraries - each_install_name_for(file) do |bad_name| - # Don't fix absolute paths unless they are rooted in the build directory - next if bad_name.start_with?("/") && - !bad_name.start_with?(HOMEBREW_TEMP.to_s) && - !bad_name.start_with?(HOMEBREW_TEMP.realpath.to_s) - - new_name = fixed_name(file, bad_name) - change_install_name(bad_name, new_name, file) unless new_name == bad_name - end + def file_linked_libraries(file, string) + # Check dynamic library linkage. Importantly, do not perform for static + # libraries, which will falsely report "linkage" to themselves. + if file.mach_o_executable? || file.dylib? || file.mach_o_bundle? + file.dynamically_linked_libraries.select { |lib| lib.include? string } + else + [] end end - - generic_fix_dynamic_linkage end + undef relocate_dynamic_linkage, detect_cxx_stdlibs + def relocate_dynamic_linkage(relocation) mach_o_files.each do |file| file.ensure_writable do @@ -58,6 +54,26 @@ class Keg results.to_a end + def fix_dynamic_linkage + mach_o_files.each do |file| + file.ensure_writable do + change_dylib_id(dylib_id_for(file), file) if file.dylib? + + each_install_name_for(file) do |bad_name| + # Don't fix absolute paths unless they are rooted in the build directory + next if bad_name.start_with?("/") && + !bad_name.start_with?(HOMEBREW_TEMP.to_s) && + !bad_name.start_with?(HOMEBREW_TEMP.realpath.to_s) + + new_name = fixed_name(file, bad_name) + change_install_name(bad_name, new_name, file) unless new_name == bad_name + end + end + end + + generic_fix_dynamic_linkage + end + # If file is a dylib or bundle itself, look for the dylib named by # bad_name relative to the lib directory, so that we can skip the more # expensive recursive search if possible. @@ -130,14 +146,4 @@ class Keg # it's wrong. -O is a BSD-grep-only option. "-lrO" end - - def self.file_linked_libraries(file, string) - # Check dynamic library linkage. Importantly, do not perform for static - # libraries, which will falsely report "linkage" to themselves. - if file.mach_o_executable? || file.dylib? || file.mach_o_bundle? - file.dynamically_linked_libraries.select { |lib| lib.include? string } - else - [] - end - end end diff --git a/Library/Homebrew/extend/os/mac/requirements/java_requirement.rb b/Library/Homebrew/extend/os/mac/requirements/java_requirement.rb index b8cf502a5e..6f0608fe7a 100644 --- a/Library/Homebrew/extend/os/mac/requirements/java_requirement.rb +++ b/Library/Homebrew/extend/os/mac/requirements/java_requirement.rb @@ -20,6 +20,8 @@ class JavaRequirement < Requirement private + undef possible_javas, oracle_java_os + JAVA_CASK_MAP = { "1.8" => "caskroom/versions/java8", "10.0" => "java", @@ -35,6 +37,10 @@ class JavaRequirement < Requirement javas end + def oracle_java_os + :darwin + end + def java_home_cmd return nil unless File.executable?("/usr/libexec/java_home") args = %w[--failfast] @@ -47,8 +53,4 @@ class JavaRequirement < Requirement def env_apple ENV.append_to_cflags "-I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/" end - - def oracle_java_os - :darwin - end end diff --git a/Library/Homebrew/extend/os/mac/requirements/x11_requirement.rb b/Library/Homebrew/extend/os/mac/requirements/x11_requirement.rb index 0c319d1de3..6b1c5b13b4 100644 --- a/Library/Homebrew/extend/os/mac/requirements/x11_requirement.rb +++ b/Library/Homebrew/extend/os/mac/requirements/x11_requirement.rb @@ -4,15 +4,17 @@ class X11Requirement < Requirement cask "xquartz" download "https://xquartz.macosforge.org" - def min_version - MacOS::XQuartz.minimum_version - end - satisfy build_env: false do next false unless MacOS::XQuartz.installed? min_version <= MacOS::XQuartz.version end + undef min_version, message + + def min_version + MacOS::XQuartz.minimum_version + end + def message "XQuartz #{min_version} (or newer) is required to install this formula. #{super}" end diff --git a/Library/Homebrew/extend/os/mac/system_config.rb b/Library/Homebrew/extend/os/mac/system_config.rb index 66a96bd659..20f04c0abd 100644 --- a/Library/Homebrew/extend/os/mac/system_config.rb +++ b/Library/Homebrew/extend/os/mac/system_config.rb @@ -1,24 +1,6 @@ class SystemConfig class << self - def xcode - @xcode ||= if MacOS::Xcode.installed? - xcode = MacOS::Xcode.version.to_s - xcode += " => #{MacOS::Xcode.prefix}" unless MacOS::Xcode.default_prefix? - xcode - end - end - - def clt - @clt ||= if MacOS::CLT.installed? && MacOS::Xcode.version >= "4.3" - MacOS::CLT.version - end - end - - def xquartz - @xquartz ||= if MacOS::XQuartz.installed? - "#{MacOS::XQuartz.version} => #{describe_path(MacOS::XQuartz.prefix)}" - end - end + undef describe_java, describe_homebrew_ruby def describe_java # java_home doesn't exist on all macOSs; it might be missing on older versions. @@ -43,6 +25,26 @@ class SystemConfig end end + def xcode + @xcode ||= if MacOS::Xcode.installed? + xcode = MacOS::Xcode.version.to_s + xcode += " => #{MacOS::Xcode.prefix}" unless MacOS::Xcode.default_prefix? + xcode + end + end + + def clt + @clt ||= if MacOS::CLT.installed? && MacOS::Xcode.version >= "4.3" + MacOS::CLT.version + end + end + + def xquartz + @xquartz ||= if MacOS::XQuartz.installed? + "#{MacOS::XQuartz.version} => #{describe_path(MacOS::XQuartz.prefix)}" + end + end + def dump_verbose_config(f = $stdout) dump_generic_verbose_config(f) f.puts "macOS: #{MacOS.full_version}-#{kernel}" diff --git a/Library/Homebrew/extend/os/mac/utils/bottles.rb b/Library/Homebrew/extend/os/mac/utils/bottles.rb index 03980aab0c..80d6afe78a 100644 --- a/Library/Homebrew/extend/os/mac/utils/bottles.rb +++ b/Library/Homebrew/extend/os/mac/utils/bottles.rb @@ -1,6 +1,8 @@ module Utils class Bottles class << self + undef tag + def tag if MacOS.version >= :lion MacOS.cat @@ -21,9 +23,10 @@ module Utils class Collector private - alias original_find_matching_tag find_matching_tag + alias generic_find_matching_tag find_matching_tag + def find_matching_tag(tag) - original_find_matching_tag(tag) || find_altivec_tag(tag) || find_or_later_tag(tag) + generic_find_matching_tag(tag) || find_altivec_tag(tag) || find_or_later_tag(tag) end # This allows generic Altivec PPC bottles to be supported in some diff --git a/Library/Homebrew/extend/os/missing_formula.rb b/Library/Homebrew/extend/os/missing_formula.rb index 02c59f4e4c..c589925764 100644 --- a/Library/Homebrew/extend/os/missing_formula.rb +++ b/Library/Homebrew/extend/os/missing_formula.rb @@ -1,2 +1 @@ -require "missing_formula" require "extend/os/mac/missing_formula" if OS.mac? diff --git a/Library/Homebrew/extend/os/requirements/java_requirement.rb b/Library/Homebrew/extend/os/requirements/java_requirement.rb index b512ada476..673d53079b 100644 --- a/Library/Homebrew/extend/os/requirements/java_requirement.rb +++ b/Library/Homebrew/extend/os/requirements/java_requirement.rb @@ -1,5 +1,3 @@ -require "requirements/java_requirement" - if OS.mac? require "extend/os/mac/requirements/java_requirement" elsif OS.linux? diff --git a/Library/Homebrew/extend/os/requirements/osxfuse_requirement.rb b/Library/Homebrew/extend/os/requirements/osxfuse_requirement.rb index 5f56d48c4a..ab491aa1e4 100644 --- a/Library/Homebrew/extend/os/requirements/osxfuse_requirement.rb +++ b/Library/Homebrew/extend/os/requirements/osxfuse_requirement.rb @@ -1,5 +1,3 @@ -require "requirements/osxfuse_requirement" - if OS.mac? require "extend/os/mac/requirements/osxfuse_requirement" elsif OS.linux? diff --git a/Library/Homebrew/extend/os/system_config.rb b/Library/Homebrew/extend/os/system_config.rb index fec31f1fa6..b80eec5e8e 100644 --- a/Library/Homebrew/extend/os/system_config.rb +++ b/Library/Homebrew/extend/os/system_config.rb @@ -1,5 +1,3 @@ -require "system_config" - if OS.mac? require "extend/os/mac/system_config" elsif OS.linux? diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index baf47b2764..159c90d198 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -1,7 +1,5 @@ -require "pathname" require "resource" require "metafiles" -require "utils" module DiskUsageExtension def disk_usage diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 9078557890..157dad1fca 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -10,7 +10,6 @@ require "formulary" require "software_spec" require "install_renamed" require "pkg_version" -require "tap" require "keg" require "migrator" require "extend/ENV" @@ -173,7 +172,9 @@ class Formula @name = name @path = path @alias_path = alias_path - @alias_name = File.basename(alias_path) if alias_path + @alias_name = if alias_path + File.basename(alias_path) + end @revision = self.class.revision || 0 @version_scheme = self.class.version_scheme || 0 @@ -203,6 +204,7 @@ class Formula @pin = FormulaPin.new(self) @follow_installed_alias = true @prefix_returns_versioned_prefix = false + @oldname_lock = nil end # @private diff --git a/Library/Homebrew/formula_cellar_checks.rb b/Library/Homebrew/formula_cellar_checks.rb index 471a5ea2fe..91a559dfad 100644 --- a/Library/Homebrew/formula_cellar_checks.rb +++ b/Library/Homebrew/formula_cellar_checks.rb @@ -154,6 +154,8 @@ module FormulaCellarChecks end def audit_installed + @new_formula ||= false + problem_if_output(check_manpages) problem_if_output(check_infopages) problem_if_output(check_jars) diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 8c7efc978b..7ed473ee89 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -1,5 +1,4 @@ require "cxxstdlib" -require "exceptions" require "formula" require "keg" require "tab" @@ -59,7 +58,8 @@ class FormulaInstaller @invalid_option_names = [] @requirement_messages = [] @poured_bottle = false - @pour_failed = false + @pour_failed = false + @start_time = nil end def self.attempted diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index 5f6ae0723b..508611ac80 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -1,5 +1,4 @@ require "digest/md5" -require "tap" require "extend/cachable" # The Formulary is responsible for creating instances of Formula. diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index 32b5377a0e..70707b247a 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -1,21 +1,9 @@ -require "forwardable" -require "extend/module" -require "extend/predicable" -require "extend/fileutils" -require "extend/pathname" -require "extend/git_repository" -require "extend/ARGV" -require "PATH" -require "extend/string" -require "os" -require "utils" -require "exceptions" -require "set" -require "rbconfig" -require "official_taps" -require "pp" +require "pathname" require "English" +require "pp" +require "extend/ARGV" + ARGV.extend(HomebrewArgvExtension) HOMEBREW_PRODUCT = ENV["HOMEBREW_PRODUCT"] @@ -23,9 +11,12 @@ HOMEBREW_VERSION = ENV["HOMEBREW_VERSION"] HOMEBREW_WWW = "https://brew.sh".freeze require "config" +require "extend/git_repository" HOMEBREW_REPOSITORY.extend(GitRepositoryExtension) +require "rbconfig" + RUBY_PATH = Pathname.new(RbConfig.ruby) RUBY_BIN = RUBY_PATH.dirname @@ -33,7 +24,7 @@ HOMEBREW_USER_AGENT_CURL = ENV["HOMEBREW_USER_AGENT_CURL"] HOMEBREW_USER_AGENT_RUBY = "#{ENV["HOMEBREW_USER_AGENT"]} ruby/#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}".freeze HOMEBREW_USER_AGENT_FAKE_SAFARI = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8".freeze -require "tap_constants" +require "extend/fileutils" module Homebrew extend FileUtils @@ -42,6 +33,7 @@ module Homebrew attr_writer :failed def failed? + @failed ||= false @failed == true end @@ -60,7 +52,8 @@ end HOMEBREW_PULL_API_REGEX = %r{https://api\.github\.com/repos/([\w-]+)/([\w-]+)?/pulls/(\d+)} HOMEBREW_PULL_OR_COMMIT_URL_REGEX = %r[https://github\.com/([\w-]+)/([\w-]+)?/(?:pull/(\d+)|commit/[0-9a-fA-F]{4,40})] -require "compat" unless ARGV.include?("--no-compat") || ENV["HOMEBREW_NO_COMPAT"] +require "forwardable" +require "PATH" ENV["HOMEBREW_PATH"] ||= ENV["PATH"] ORIGINAL_PATHS = PATH.new(ENV["HOMEBREW_PATH"]).map do |p| @@ -88,3 +81,24 @@ HOMEBREW_INTERNAL_COMMAND_ALIASES = { "environment" => "--env", "--config" => "config", }.freeze + +require "set" + +require "os" +require "extend/pathname" + +require "extend/module" +require "extend/predicable" +require "extend/string" + +require "constants" +require "exceptions" +require "utils" + +require "official_taps" +require "tap" +require "tap_constants" + +if !ARGV.include?("--no-compat") && !ENV["HOMEBREW_NO_COMPAT"] + require "compat" +end diff --git a/Library/Homebrew/hardware.rb b/Library/Homebrew/hardware.rb index 0559ae694c..b2a559d59c 100644 --- a/Library/Homebrew/hardware.rb +++ b/Library/Homebrew/hardware.rb @@ -1,5 +1,3 @@ -require "os" - module Hardware class CPU INTEL_32BIT_ARCHS = [:i386].freeze diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index d40be299c1..cf8d1b177e 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -1,4 +1,3 @@ -require "extend/pathname" require "keg_relocate" require "lock_file" require "ostruct" diff --git a/Library/Homebrew/language/python.rb b/Library/Homebrew/language/python.rb index de373efda4..171d7e8244 100644 --- a/Library/Homebrew/language/python.rb +++ b/Library/Homebrew/language/python.rb @@ -1,4 +1,3 @@ -require "utils" require "language/python_virtualenv_constants" module Language diff --git a/Library/Homebrew/linkage_checker.rb b/Library/Homebrew/linkage_checker.rb index a33454a039..f77a6c4a6b 100644 --- a/Library/Homebrew/linkage_checker.rb +++ b/Library/Homebrew/linkage_checker.rb @@ -1,4 +1,3 @@ -require "set" require "keg" require "formula" diff --git a/Library/Homebrew/metafiles.rb b/Library/Homebrew/metafiles.rb index 96fa086f49..51d64ad8d0 100644 --- a/Library/Homebrew/metafiles.rb +++ b/Library/Homebrew/metafiles.rb @@ -1,4 +1,3 @@ -require "set" module Metafiles # https://github.com/github/markup#markups diff --git a/Library/Homebrew/migrator.rb b/Library/Homebrew/migrator.rb index 503f889852..9b295c1a43 100644 --- a/Library/Homebrew/migrator.rb +++ b/Library/Homebrew/migrator.rb @@ -1,4 +1,3 @@ -require "formula" require "lock_file" require "keg" require "tab" diff --git a/Library/Homebrew/missing_formula.rb b/Library/Homebrew/missing_formula.rb index 31dfa94efa..8a80e90d57 100644 --- a/Library/Homebrew/missing_formula.rb +++ b/Library/Homebrew/missing_formula.rb @@ -1,6 +1,4 @@ require "formulary" -require "tap" -require "utils" module Homebrew module MissingFormula diff --git a/Library/Homebrew/options.rb b/Library/Homebrew/options.rb index 05dd643ffe..11f8df3a54 100644 --- a/Library/Homebrew/options.rb +++ b/Library/Homebrew/options.rb @@ -1,4 +1,3 @@ -require "set" class Option attr_reader :name, :description, :flag diff --git a/Library/Homebrew/os.rb b/Library/Homebrew/os.rb index cc6c865375..ed12ea734f 100644 --- a/Library/Homebrew/os.rb +++ b/Library/Homebrew/os.rb @@ -1,5 +1,3 @@ -require "rbconfig" - module OS def self.mac? return false if ENV["HOMEBREW_TEST_GENERIC_OS"] diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index ade801c42a..c299d2816a 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -1,5 +1,3 @@ -require "hardware" -require "development_tools" require "os/mac/version" require "os/mac/xcode" require "os/mac/xquartz" diff --git a/Library/Homebrew/os/mac/architecture_list.rb b/Library/Homebrew/os/mac/architecture_list.rb index 6f498c51f6..6373aed44d 100644 --- a/Library/Homebrew/os/mac/architecture_list.rb +++ b/Library/Homebrew/os/mac/architecture_list.rb @@ -1,4 +1,4 @@ -require "extend/os/hardware" +require "hardware" module ArchitectureListExtension # @private diff --git a/Library/Homebrew/readall.rb b/Library/Homebrew/readall.rb index 1b6ae016e0..249987b33b 100644 --- a/Library/Homebrew/readall.rb +++ b/Library/Homebrew/readall.rb @@ -1,5 +1,4 @@ require "formula" -require "tap" module Readall class << self diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index df7b86770c..9ef63adbaf 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -42,6 +42,7 @@ class SoftwareSpec @deprecated_options = [] @build = BuildOptions.new(Options.create(@flags), options) @compiler_failures = [] + @bottle_disable_reason = nil end def owner=(owner) diff --git a/Library/Homebrew/system_config.rb b/Library/Homebrew/system_config.rb index 1cbd774de6..f42572add0 100644 --- a/Library/Homebrew/system_config.rb +++ b/Library/Homebrew/system_config.rb @@ -1,7 +1,6 @@ require "hardware" require "software_spec" require "rexml/document" -require "tap" require "development_tools" class SystemConfig @@ -116,6 +115,7 @@ class SystemConfig HOMEBREW_REPOSITORY: "/usr/local/Homebrew", HOMEBREW_CELLAR: "/usr/local/Cellar", HOMEBREW_CACHE: "#{ENV["HOME"]}/Library/Caches/Homebrew", + HOMEBREW_RUBY_WARNINGS: "-W0", }.freeze boring_keys = %w[ HOMEBREW_BROWSER @@ -131,7 +131,6 @@ class SystemConfig HOMEBREW_LIBRARY HOMEBREW_MACOS_VERSION HOMEBREW_RUBY_PATH - HOMEBREW_RUBY_WARNINGS HOMEBREW_SYSTEM HOMEBREW_OS_VERSION HOMEBREW_PATH @@ -151,6 +150,9 @@ class SystemConfig if defaults_hash[:HOMEBREW_CACHE] != HOMEBREW_CACHE.to_s f.puts "HOMEBREW_CACHE: #{HOMEBREW_CACHE}" end + if defaults_hash[:HOMEBREW_RUBY_WARNINGS] != ENV["HOMEBREW_RUBY_WARNINGS"].to_s + f.puts "HOMEBREW_RUBY_WARNINGS: #{ENV["HOMEBREW_RUBY_WARNINGS"]}" + end unless ENV["HOMEBREW_ENV"] ENV.sort.each do |key, value| next unless key.start_with?("HOMEBREW_") diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index e13b9af754..48288e0081 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -1,4 +1,3 @@ -require "extend/string" require "extend/cachable" require "readall" @@ -78,6 +77,8 @@ class Tap @full_name = "#{@user}/homebrew-#{@repo}" @path = TAP_DIRECTORY/@full_name.downcase @path.extend(GitRepositoryExtension) + @alias_table = nil + @alias_reverse_table = nil end # clear internal cache diff --git a/Library/Homebrew/test/cleanup_spec.rb b/Library/Homebrew/test/cleanup_spec.rb index 9ec3a30479..40ab4280b7 100644 --- a/Library/Homebrew/test/cleanup_spec.rb +++ b/Library/Homebrew/test/cleanup_spec.rb @@ -1,7 +1,6 @@ require "test/support/fixtures/testball" require "cleanup" require "fileutils" -require "pathname" describe Homebrew::Cleanup do let(:ds_store) { Pathname.new("#{HOMEBREW_PREFIX}/Library/.DS_Store") } diff --git a/Library/Homebrew/test/cmd/search_spec.rb b/Library/Homebrew/test/cmd/search_spec.rb index c55a51e4fe..15c66cba31 100644 --- a/Library/Homebrew/test/cmd/search_spec.rb +++ b/Library/Homebrew/test/cmd/search_spec.rb @@ -1,7 +1,6 @@ describe "brew search", :integration_test do before do setup_test_formula "testball" - setup_remote_tap "caskroom/cask" end it "lists all available Formulae when no argument is given" do @@ -26,6 +25,8 @@ describe "brew search", :integration_test do end it "falls back to a GitHub tap search when no formula is found", :needs_network, retry: 3 do + setup_remote_tap "caskroom/cask" + expect { brew "search", "caskroom/cask/firefox" } .to output(/firefox/).to_stdout .and output(/Searching/).to_stderr diff --git a/Library/Homebrew/test/pathname_spec.rb b/Library/Homebrew/test/pathname_spec.rb index ac568d27fb..090897f6a3 100644 --- a/Library/Homebrew/test/pathname_spec.rb +++ b/Library/Homebrew/test/pathname_spec.rb @@ -1,4 +1,3 @@ -require "tmpdir" require "extend/pathname" require "install_renamed" diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index cba530736a..8719c6e584 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -1,13 +1,3 @@ -require "find" -require "pathname" -require "rspec/its" -require "rspec/wait" -require "rspec/retry" -require "rubocop" -require "rubocop/rspec/support" -require "set" -require "support/no_seed_progress_formatter" - if ENV["HOMEBREW_TESTS_COVERAGE"] require "simplecov" @@ -17,12 +7,19 @@ if ENV["HOMEBREW_TESTS_COVERAGE"] end end +require "rspec/its" +require "rspec/wait" +require "rspec/retry" +require "rubocop" +require "rubocop/rspec/support" +require "find" + $LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_LIBRARY"]}/Homebrew")) $LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_LIBRARY"]}/Homebrew/test/support/lib")) require "global" -require "tap" +require "test/support/no_seed_progress_formatter" require "test/support/helper/fixtures" require "test/support/helper/formula" require "test/support/helper/mktmpdir" diff --git a/Library/Homebrew/test/support/lib/config.rb b/Library/Homebrew/test/support/lib/config.rb index a59d80c995..7408b3e34a 100644 --- a/Library/Homebrew/test/support/lib/config.rb +++ b/Library/Homebrew/test/support/lib/config.rb @@ -2,9 +2,6 @@ unless ENV["HOMEBREW_BREW_FILE"] raise "HOMEBREW_BREW_FILE was not exported! Please call bin/brew directly!" end -require "constants" - -require "tmpdir" require "pathname" HOMEBREW_BREW_FILE = Pathname.new(ENV["HOMEBREW_BREW_FILE"]) diff --git a/Library/Homebrew/test/utils/tty_spec.rb b/Library/Homebrew/test/utils/tty_spec.rb index e4b61a61ca..4489b818a9 100644 --- a/Library/Homebrew/test/utils/tty_spec.rb +++ b/Library/Homebrew/test/utils/tty_spec.rb @@ -1,4 +1,3 @@ -require "utils" describe Tty do describe "::strip_ansi" do diff --git a/Library/Homebrew/test/utils_spec.rb b/Library/Homebrew/test/utils_spec.rb index 21fcc3249f..dbfd1c3859 100644 --- a/Library/Homebrew/test/utils_spec.rb +++ b/Library/Homebrew/test/utils_spec.rb @@ -1,4 +1,3 @@ -require "utils" describe "globally-scoped helper methods" do let(:dir) { mktmpdir } diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index dcc69ecb30..84eb8aa8cc 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -1,6 +1,4 @@ -require "pathname" require "emoji" -require "exceptions" require "utils/analytics" require "utils/curl" require "utils/fork" diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index 7b2488ec72..673e7457ff 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -1,4 +1,3 @@ -require "pathname" require "open3" def curl_executable