Skip to content

Commit bd3461d

Browse files
authored
Merge pull request #20312 from Homebrew/development_tools_env
linux/development_tools: add undocumented environment variables.
2 parents 0c969c2 + e75d54c commit bd3461d

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Library/Homebrew/extend/os/linux/development_tools.rb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,12 @@ def default_compiler = :gcc
3434
def needs_libc_formula?
3535
return @needs_libc_formula unless @needs_libc_formula.nil?
3636

37-
@needs_libc_formula = T.let(OS::Linux::Glibc.below_ci_version?, T.nilable(T::Boolean))
38-
@needs_libc_formula = !!@needs_libc_formula
37+
@needs_libc_formula = T.let(nil, T.nilable(T::Boolean))
38+
39+
# Undocumented environment variable to make it easier to test libc
40+
# formula automatic installation.
41+
@needs_libc_formula = true if ENV["HOMEBREW_FORCE_LIBC_FORMULA"]
42+
@needs_libc_formula ||= OS::Linux::Glibc.below_ci_version?
3943
end
4044

4145
# Keep this method around for now to make it easier to add this functionality later.
@@ -52,7 +56,12 @@ def needs_compiler_formula?
5256
return @needs_compiler_formula unless @needs_compiler_formula.nil?
5357

5458
@needs_compiler_formula = T.let(nil, T.nilable(T::Boolean))
55-
@needs_compiler_formula = if host_gcc_path.exist?
59+
60+
# Undocumented environment variable to make it easier to test compiler
61+
# formula automatic installation.
62+
@needs_compiler_formula = true if ENV["HOMEBREW_FORCE_COMPILER_FORMULA"]
63+
64+
@needs_compiler_formula ||= if host_gcc_path.exist?
5665
::DevelopmentTools.gcc_version(host_gcc_path.to_s) < OS::LINUX_GCC_CI_VERSION
5766
else
5867
true

0 commit comments

Comments
 (0)