Skip to content
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

tap_auditor: check renamed formula exists #18741

Merged
merged 1 commit into from
Nov 11, 2024
Merged

Conversation

cho-m
Copy link
Member

@cho-m cho-m commented Nov 8, 2024

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Audit renames so we remove old ones that can no longer be resolved to an actual formula/alias, further renames, or a tap migration. EDIT: remove support for latter and instead require cleaning those old renames.

brew audit --tap homebrew/core --only tap_formula_lists
homebrew/core
  * formula_renames.json references
    formulae or casks that are not found in the homebrew/core tap.
    Invalid formulae or casks: antlr@2, elasticsearch@6, gcc@5, gcc@6, gnuplot@4, [email protected], tomcat@7, [email protected], [email protected]
Error: 1 problem in 1 tap detected.

@cho-m cho-m marked this pull request as ready for review November 9, 2024 01:18
@cho-m cho-m marked this pull request as draft November 9, 2024 01:19
@cho-m
Copy link
Member Author

cho-m commented Nov 9, 2024

I guess tap audit isn't tested in brew CI.

Locally, before Homebrew/homebrew-core#197128:

brew audit --tap homebrew/core --only tap_formula_lists
homebrew/core
  * formula_renames.json references
    formulae or casks that are not found in the homebrew/core tap.
    Invalid formulae or casks: antlr@2, elasticsearch@6, gcc@5, gcc@6, gnuplot@4, [email protected], tomcat@7, [email protected], [email protected]
Error: 1 problem in 1 tap detected.

And after:

brew audit --tap homebrew/core --only tap_formula_listsecho $?
0

EDIT: I allowed references via chains of renames and/or tap migrations. An alternative is failing and forcing these to be squashed to 1-level, e.g.

  • a -> b -> c becomes { a -> c and b -> c }
  • a -> b -> homebrew/cask becomes { a -> homebrew/cask/b and b -> homebrew/cask }

Didn't seem that important to fail tap audit on.

@cho-m cho-m marked this pull request as ready for review November 9, 2024 03:12
@Bo98
Copy link
Member

Bo98 commented Nov 9, 2024

I guess tap audit isn't tested in brew CI.

It should be: https://github.com/Homebrew/brew/actions/runs/11751234155/job/32740921538?pr=18741#step:5:1

Sounds like the audit might not be working correctly?

Copy link
Member

@Bo98 Bo98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK with this when CI is fixed

@cho-m
Copy link
Member Author

cho-m commented Nov 9, 2024

Sounds like the audit might not be working correctly?

Not sure if it is running off of API or something as can't reproduce locally. Adding back one of the old renames and running same command:

brew audit --skip-style --except=version --tap=homebrew/core
homebrew/core
  * formula_renames.json references
    formulae or casks that are not found in the homebrew/core tap.
    Invalid formulae or casks: [email protected]

Bit tricky now to test CI as Homebrew/core side has already been merged so there are no more renames that trigger audit.

@Bo98
Copy link
Member

Bo98 commented Nov 9, 2024

Not sure if it is running off of API or something as can't reproduce locally

CI intentionally doesn't set HOMEBREW_NO_INSTALL_FROM_API as brew audit should do so automatically (see Homebrew.with_no_api_env in TapAuditor#initialize). It was part of the work to reduce the need for manual HOMEBREW_NO_INSTALL_FROM_API.

@cho-m
Copy link
Member Author

cho-m commented Nov 9, 2024

I locally tried running without and with HOMEBREW_NO_INSTALL_FROM_API but still can't reproduce.

Can try re-running CI with all rename values, which should still fail on chained renames:

homebrew/core
  * formula_renames.json references
    formulae or casks that are not found in the homebrew/core tap.
    Invalid formulae or casks: tepl, gnome-latex

@cho-m cho-m marked this pull request as draft November 9, 2024 15:47
Library/Homebrew/tap_auditor.rb Outdated Show resolved Hide resolved
Library/Homebrew/tap_auditor.rb Outdated Show resolved Hide resolved
@cho-m
Copy link
Member Author

cho-m commented Nov 9, 2024

Probably good to remove the recursive names as looks like we never implemented support in some commands, e.g.

brew info gtef
Warning: Formula gtef was renamed to tepl.
Warning: Formula gtef was renamed to tepl.
Warning: Formula gtef was renamed to tepl.
Error: No available formula with the name "gtef".
Warning: Formula gtef was renamed to tepl.
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.

And I guess API may prune out some of these?

unset HOMEBREW_NO_INSTALL_FROM_APIbrew info gtef
Error: No available formula with the name "gtef".
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.

If this approach is fine, can merge Homebrew/core PR and then re-run CI here.

@cho-m cho-m marked this pull request as ready for review November 9, 2024 17:23
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed on ✅ when CI is 🟢

@cho-m cho-m merged commit 1cb90c6 into master Nov 11, 2024
28 checks passed
@cho-m cho-m deleted the tap_auditor-renames-exist branch November 11, 2024 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants