formula_auditor: Having HOMEBREW_PREFIX
in keg_only
reasons is bad
- Fixes issue 14996. - The API JSON is generated with a `/usr/local` Homebrew prefix, but frequently now users have `/opt/homebrew` as their prefix. Since formulae `keg_only` reasons are generated by the API, this can lead to the confusing messaging that follows: ``` socket_vmnet is keg-only, which means it was not symlinked into /opt/homebrew, because /usr/local/bin is often writable by a non-admin user. ``` - With this change, that formula as it is now will fail `brew audit`, prompting to remove the prefix reference. ``` ❯ HOMEBREW_NO_INSTALL_FROM_API=1 brew audit --strict socket_vmnet socket_vmnet: * `keg_only` reason should not include `HOMEBREW_PREFIX` as it provides confusing output. Error: 1 problem in 1 formula detected ```
This commit is contained in:
parent
b3684e55a7
commit
bda88ce96e
@ -466,6 +466,16 @@ module Homebrew
|
||||
"They must not be upgraded to version 7.11 or newer."
|
||||
end
|
||||
|
||||
def audit_keg_only_reason
|
||||
return unless @core_tap
|
||||
return unless formula.keg_only?
|
||||
|
||||
keg_only_message = text.to_s.match(/keg_only\s+["'](.*)["']/).captures&.first
|
||||
return unless keg_only_message&.include?("HOMEBREW_PREFIX")
|
||||
|
||||
problem "`keg_only` reason should not include `HOMEBREW_PREFIX` as it provides confusing output."
|
||||
end
|
||||
|
||||
def audit_versioned_keg_only
|
||||
return unless @versioned_formula
|
||||
return unless @core_tap
|
||||
|
Loading…
x
Reference in New Issue
Block a user