From e75d54cbff5437da050ffcf5768e4808cd652896 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 25 Jul 2025 15:56:33 +0000 Subject: [PATCH] linux/development_tools: add undocumented environment variables. This makes it easier to test the automatic installation of the libc and compiler formulae without having to change the code. This is particularly useful now we don't have any official Docker images for this. --- .../Homebrew/extend/os/linux/development_tools.rb | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/extend/os/linux/development_tools.rb b/Library/Homebrew/extend/os/linux/development_tools.rb index 1036d79d5e..04827adee3 100644 --- a/Library/Homebrew/extend/os/linux/development_tools.rb +++ b/Library/Homebrew/extend/os/linux/development_tools.rb @@ -34,8 +34,12 @@ module OS def needs_libc_formula? return @needs_libc_formula unless @needs_libc_formula.nil? - @needs_libc_formula = T.let(OS::Linux::Glibc.below_ci_version?, T.nilable(T::Boolean)) - @needs_libc_formula = !!@needs_libc_formula + @needs_libc_formula = T.let(nil, T.nilable(T::Boolean)) + + # Undocumented environment variable to make it easier to test libc + # formula automatic installation. + @needs_libc_formula = true if ENV["HOMEBREW_FORCE_LIBC_FORMULA"] + @needs_libc_formula ||= OS::Linux::Glibc.below_ci_version? end # Keep this method around for now to make it easier to add this functionality later. @@ -52,7 +56,12 @@ module OS return @needs_compiler_formula unless @needs_compiler_formula.nil? @needs_compiler_formula = T.let(nil, T.nilable(T::Boolean)) - @needs_compiler_formula = if host_gcc_path.exist? + + # Undocumented environment variable to make it easier to test compiler + # formula automatic installation. + @needs_compiler_formula = true if ENV["HOMEBREW_FORCE_COMPILER_FORMULA"] + + @needs_compiler_formula ||= if host_gcc_path.exist? ::DevelopmentTools.gcc_version(host_gcc_path.to_s) < OS::LINUX_GCC_CI_VERSION else true