Merge pull request #9045 from MikeMcQuaid/link-no-formula

link: link kegs without formulae.
This commit is contained in:
Mike McQuaid 2020-11-04 10:18:35 +00:00 committed by GitHub
commit b2ea420e7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,10 +67,15 @@ module Homebrew
next
end
formula = keg.to_formula
formula = begin
keg.to_formula
rescue FormulaUnavailableError
# Not all kegs may belong to formulae e.g. with `brew diy`
nil
end
if keg_only
if Homebrew.default_prefix? && formula.keg_only_reason.by_macos?
if Homebrew.default_prefix? && formula.present? && formula.keg_only_reason.by_macos?
caveats = Caveats.new(formula)
opoo <<~EOS
Refusing to link macOS provided/shadowed software: #{keg.name}
@ -79,14 +84,14 @@ module Homebrew
next
end
if !formula.keg_only_reason.versioned_formula? && !args.force?
if !args.force? && (formula.blank? || !formula.keg_only_reason.versioned_formula?)
opoo "#{keg.name} is keg-only and must be linked with --force"
puts_keg_only_path_message(keg)
next
end
end
Unlink.unlink_versioned_formulae(formula, verbose: args.verbose?)
Unlink.unlink_versioned_formulae(formula, verbose: args.verbose?) if formula
keg.lock do
print "Linking #{keg}... "