-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
formula_auditor: do not allow depending on aliases #10115
Conversation
Review period will end on 2020-12-24 at 15:02:00 UTC. |
f5ecb62
to
1e68ce5
Compare
Library/Homebrew/formula_auditor.rb
Outdated
@@ -235,8 +235,7 @@ def audit_deps | |||
problem "Dependency '#{dep.name}' was renamed; use new name '#{dep_f.name}'." | |||
end | |||
|
|||
if self.class.aliases.include?(dep.name) && | |||
dep_f.core_formula? && !dep_f.versioned_formula? | |||
if self.class.aliases.include?(dep.name) && dep_f.core_formula? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're checking here whether the formula being depended on is a core formula but I think we should be checking for both the dependency and the main formula because depending on a versioned alias is actively desirable outside of homebrew/core. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right!
I've actually misread the condition, in my head exactly what you're saying 😄
I'll put this check after next unless @core_tap
. And then we don't really need to check dep_f.core_formula?
because formulae from homebrew-core can depend only on formulae from homebrew-core
Does this mean they are a false positive, false negative or produce an error? Thanks! |
It's a false negative, I guess. Current logic says: a formula can't depend on aliases unless it's an alias to a versioned formula. So it allows aliases to versioned formulae ( |
Assuming that means "we should complain but we don't": fine with me 👍🏻 |
Review period ended. |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?brew man
locally and committed any changes?This PR makes dependency audit more strict and prohibits using aliases (at all) in
depends_on
in homebrew-core:Motivation:
openjdk@15
as a dependency will not allow us making this switch (to the nextopenjdk@16
) automatically and will require manual formula tuning. Also, we don't have such kind of examples in homebrew-core;[email protected]
and[email protected]
(these are special cases when an unversioned formula is an alias to versioned one). And it was easier to make this audit more strict than add tuning for these special cases 🙂Existing violations fixed: