mirror of
https://github.com/Homebrew/brew.git
synced 2026-10-28 09:34:42 +08:00
Merge pull request #21501 from Homebrew/preferred_perl_version_stricter
os/mac/keg_relocate: be stricter about `preferred_perl`
This commit is contained in:
1 file changed
+5
-7
@@ -230,13 +230,11 @@ module OS
|
||||
brewed_perl = runtime_dependencies&.any? { |dep| dep["full_name"] == "perl" && dep["declared_directly"] }
|
||||
perl_path = if brewed_perl || name == "perl"
|
||||
"#{HOMEBREW_PREFIX}/opt/perl/bin/perl"
|
||||
elsif tab.built_on.present?
|
||||
perl_path = "/usr/bin/perl#{tab.built_on["preferred_perl"]}"
|
||||
|
||||
# For `:all` bottles, we could have built this bottle with a Perl we don't have.
|
||||
# Such bottles typically don't have strict version requirements.
|
||||
perl_path = "/usr/bin/perl#{MacOS.preferred_perl_version}" unless File.exist?(perl_path)
|
||||
|
||||
elsif tab.built_on.present? &&
|
||||
(preferred_perl_version = tab.built_on["preferred_perl"].presence) &&
|
||||
preferred_perl_version.match?(/^\d+\.\d+$/) &&
|
||||
(perl_path = "/usr/bin/perl#{preferred_perl_version}") &&
|
||||
File.exist?(perl_path)
|
||||
perl_path
|
||||
else
|
||||
"/usr/bin/perl#{MacOS.preferred_perl_version}"
|
||||
|
||||
Reference in new issue
Block a user