audit: linuxbrew-core fixes.

- special-case `adoptopenjdk@1.8`
- allow depending on versioned formulae aliases.
This commit is contained in:
Mike McQuaid 2020-07-31 16:37:39 +01:00
parent 8f4188926a
commit ea5d52e788
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70

View File

@ -269,6 +269,12 @@ module Homebrew
valid_alias_names.map! { |a| "#{formula.tap}/#{a}" } valid_alias_names.map! { |a| "#{formula.tap}/#{a}" }
end end
# Fix naming based on what people expect.
if alias_name_major_minor == "adoptopenjdk@1.8"
valid_alias_names << "adoptopenjdk@8"
valid_alias_names.delete "adoptopenjdk@1"
end
valid_versioned_aliases = versioned_aliases & valid_alias_names valid_versioned_aliases = versioned_aliases & valid_alias_names
invalid_versioned_aliases = versioned_aliases - valid_alias_names invalid_versioned_aliases = versioned_aliases - valid_alias_names
@ -284,7 +290,7 @@ module Homebrew
end end
end end
unless invalid_versioned_aliases.empty? if invalid_versioned_aliases.present?
problem <<~EOS problem <<~EOS
Formula has invalid versioned aliases: Formula has invalid versioned aliases:
#{invalid_versioned_aliases.join("\n ")} #{invalid_versioned_aliases.join("\n ")}
@ -385,7 +391,7 @@ module Homebrew
end end
if self.class.aliases.include?(dep.name) && if self.class.aliases.include?(dep.name) &&
(dep_f.core_formula? || !dep_f.versioned_formula?) dep_f.core_formula? && !dep_f.versioned_formula?
problem "Dependency '#{dep.name}' from homebrew/core is an alias; " \ problem "Dependency '#{dep.name}' from homebrew/core is an alias; " \
"use the canonical name '#{dep.to_formula.full_name}'." "use the canonical name '#{dep.to_formula.full_name}'."
end end
@ -467,6 +473,7 @@ module Homebrew
end end
end end
# openssl@1.1 only needed for Linux
VERSIONED_KEG_ONLY_ALLOWLIST = %w[ VERSIONED_KEG_ONLY_ALLOWLIST = %w[
autoconf@2.13 autoconf@2.13
bash-completion@2 bash-completion@2
@ -474,6 +481,7 @@ module Homebrew
libsigc++@2 libsigc++@2
lua@5.1 lua@5.1
numpy@1.16 numpy@1.16
openssl@1.1
python@3.8 python@3.8
].freeze ].freeze
@ -489,7 +497,9 @@ module Homebrew
end end
end end
return if VERSIONED_KEG_ONLY_ALLOWLIST.include?(formula.name) || formula.name.start_with?("gcc@") return if VERSIONED_KEG_ONLY_ALLOWLIST.include?(formula.name)
return if formula.name.start_with?("adoptopenjdk@")
return if formula.name.start_with?("gcc@")
problem "Versioned formulae in homebrew/core should use `keg_only :versioned_formula`" problem "Versioned formulae in homebrew/core should use `keg_only :versioned_formula`"
end end