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

PULL_REQUEST_TEMPLATE: pass --installed to brew #201146

Closed
wants to merge 1 commit into from

Conversation

marcusmueller
Copy link
Contributor

On a --new formula, after successful local brew install, brew audit --new formula_or_formula_filename will otherwise fail due to the formula not being available from a cask, and, to quote,

$ brew audit --new rpds-py.rb
Error: Calling brew audit [path ...] is disabled! Use brew audit [name ...] instead.
Please report this issue:
  https://docs.brew.sh/Troubleshooting

$ brew audit --new rpds-py
Error: These formulae are not in any locally installed taps!

  rpds-py

You may need to run `brew tap` to install additional taps.
  • Have you followed the guidelines for contributing?
  • Have you ensured that your commits follow the commit style guide?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • [-] Have you built your formula locally with HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • [-] Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • [-] Does your build pass brew audit --strict <formula> (after doing HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

On a `--new` formula, after successful local `brew install`,  `brew audit --new formula_or_formula_filename` will otherwise fail due to the formula not being available from a cask, and, to quote,

```
$ brew audit --new rpds-py.rb
Error: Calling brew audit [path ...] is disabled! Use brew audit [name ...] instead.
Please report this issue:
  https://docs.brew.sh/Troubleshooting

$ brew audit --new rpds-py
Error: These formulae are not in any locally installed taps!

  rpds-py

You may need to run `brew tap` to install additional taps.
```
@marcusmueller marcusmueller requested review from MikeMcQuaid and a team as code owners December 14, 2024 11:04
@github-actions github-actions bot added the automerge-skip `brew pr-automerge` will skip this pull request label Dec 14, 2024
@daeho-ro
Copy link
Member

I cannot get the reason of the changes. Your error is not related to the audit option --installed and why do we need that?

@marcusmueller
Copy link
Contributor Author

marcusmueller commented Dec 15, 2024

So, I definitely can't run brew audit on a freshly added, freshly built and installed formula without --installed, @daeho-ro (I did this all in the official homebrew/brew container, copy&paste following official guidance). Once I allow brew to look in the locally installed formulae instead of trying to download one that can't be anywhere else yet, it works.

So, I'm afraid it actually is related.

@Bo98
Copy link
Member

Bo98 commented Dec 16, 2024

--installed actually checks every single formula you have installed - it's not checking what you pass (e.g. rpds-py). It probably should error when an argument is passed with --installed.

I'm unable to reproduce the issue you describe so might be useful to know more about your setup. Where is rpds-py.rb located? It needs to be at the correct place in $(brew --repo homebrew/core)/Formula (or equivalent for other taps).

$ brew create --set-name testformula --set-version 1 --no-fetch https://example.com
$ brew audit --new testformula
testformula
  * Stable: Checksum is missing
  * line 1, col 1: Please remove default template comments
...

@daeho-ro
Copy link
Member

I suspect you might not tap implicitly to the homebrew/core or created a formula to the other tap?

Error: These formulae are not in any locally installed taps!

@marcusmueller
Copy link
Contributor Author

marcusmueller commented Dec 16, 2024

Where is rpds-py.rb located?

Formula/r/ ; I'm in that directory when I call brew.

I think the problem here is that the container I ran brew audit on isn't the same that added the file; the file actually came (modified, but with all other files from that PR) from an existing git branch of someone else, and I assumed that the audit only applies to the source repo state, without having to necessarily prepared anything than a local brew install of that same formula.

That would be my mistake, then!

I'm a bit confused that brew install … && brew audit … would depend on state kept outside of the installation and the homebrew-core repo, but if that's the case, the behaviour makes sense.

@daeho-ro thus: Thank you for the help! And my apologies for the time spent on this. (Now I just need to figure out how to, in the future, do things like #201147, where I saved someone else's old stale PR. Would I need to do the brew create --set-name testformula --set-version 1 --no-fetch https://example.com dance and then overwrite the generated file on the same machine, instead of being able to do the code handling on my dev machine and then audit that formula in a CI container? That seems surprising!)

@daeho-ro
Copy link
Member

Maybe you missed HOMEBREW_NO_INSTALL_FROM_API=1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge-skip `brew pr-automerge` will skip this pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants