From 193d6d3ff2942aac5519a2632dc0ca9cfd2b669b Mon Sep 17 00:00:00 2001 From: xxyzz Date: Wed, 30 Mar 2022 20:25:26 +0800 Subject: [PATCH 1/2] Skip build dependencies to avoid downloading bottles Dependency.to_formula() in the following line will cause a CoreTapFormulaUnavailableError then download all dependency bottles in FormulaInstaller.verfi_deps_exist() --- Library/Homebrew/dependency.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Library/Homebrew/dependency.rb b/Library/Homebrew/dependency.rb index aa5375112afe8..2b3f9b2013885 100644 --- a/Library/Homebrew/dependency.rb +++ b/Library/Homebrew/dependency.rb @@ -112,6 +112,8 @@ def expand(dependent, deps = dependent.deps, cache_key: nil, ignore_missing: fal deps.each do |dep| next if dependent.name == dep.name + # avoid downloading build dependency bottles + next if dep.build? && dependent.pour_bottle? && Homebrew::EnvConfig.install_from_api? case action(dependent, dep, ignore_missing: ignore_missing, &block) when :prune From 990b61250af99584f608dd730aca7cb0c19bee54 Mon Sep 17 00:00:00 2001 From: xxyzz Date: Wed, 30 Mar 2022 20:37:19 +0800 Subject: [PATCH 2/2] Get gcc version from API to avoid downloading gcc bottles on Linux --- Library/Homebrew/extend/os/linux/keg_relocate.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/extend/os/linux/keg_relocate.rb b/Library/Homebrew/extend/os/linux/keg_relocate.rb index 4fafbbd6fafd5..d7a92f6acf689 100644 --- a/Library/Homebrew/extend/os/linux/keg_relocate.rb +++ b/Library/Homebrew/extend/os/linux/keg_relocate.rb @@ -84,9 +84,16 @@ def elf_files def self.bottle_dependencies @bottle_dependencies ||= begin formulae = relocation_formulae - gcc = Formulary.factory(CompilerSelector.preferred_gcc) + if Homebrew::EnvConfig.install_from_api? + gcc_hash = Homebrew::API::Formula.fetch(CompilerSelector.preferred_gcc) + preferred_gcc_version = Version.new gcc_hash["versions"]["stable"] + else + gcc = Formulary.factory(CompilerSelector.preferred_gcc) + preferred_gcc_version = gcc.version + end if !Homebrew::EnvConfig.simulate_macos_on_linux? && - DevelopmentTools.non_apple_gcc_version("gcc") < gcc.version.to_i + DevelopmentTools.non_apple_gcc_version("gcc") < preferred_gcc_version + gcc = Formulary.factory(CompilerSelector.preferred_gcc) if Homebrew::EnvConfig.install_from_api? formulae += gcc.recursive_dependencies.map(&:name) formulae << gcc.name end