Skip to content

Commit e75d54c

Browse files
authored
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.
1 parent 00afc6b commit e75d54c

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)