Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Error treating custom/tap/formula as a formula when there is a cask with the same name #1082

Closed
cdalvaro opened this issue May 27, 2024 · 14 comments · Fixed by #1083
Closed

Comments

@cdalvaro
Copy link

cdalvaro commented May 27, 2024

I'm having the following issue with the Run brew test-bot --only-formulae stage in my custom tap:

==> Running Formulae#formula!(cdalvaro/tap/salt)
==> brew deps --tree --annotate --include-build --include-test cdalvaro/tap/salt
==> Determining dependencies...
==> brew fetch --retry ::warning::Treating cdalvaro/tap/salt as a formula. For the cask, use cdalvaro/tap/salt or specify the `--cask` flag. asciidoc asciidoctor autoconf automake boost ca-certificates cmake docbook docbook-xsl gdbm gnu-getopt icu4c libgit2 libsodium libssh2 libtool libyaml llvm lz4 m4 mpdecimal ninja openssl@3 pcre2 pkg-config python@3.10 python@3.11 python@3.12 readline ruby rust six source-highlight sqlite swig xmlto xz z3 zeromq zstd
==> FAILED
Full fetch ::warning::Treating cdalvaro/tap/salt as a formula. For the cask, use cdalvaro/tap/salt or specify the `--cask` flag. asciidoc asciidoctor autoconf automake boost ca-certificates cmake docbook docbook-xsl gdbm gnu-getopt icu4c libgit2 libsodium libssh2 libtool libyaml llvm lz4 m4 mpdecimal ninja openssl@3 pcre2 pkg-config python@3.10 python@3.11 python@3.12 readline ruby rust six source-highlight sqlite swig xmlto xz z3 zeromq zstd output
  Error: No available formula or cask with the name "::warning::treating cdalvaro/tap/salt as a formula. for the cask, use cdalvaro/tap/salt or specify the `--cask` flag.".
  Please tap it and then try again: brew tap ::warning::treating cdalvaro/tap
  Error: No available formula or cask with the name "::warning::treating cdalvaro/tap/salt as a formula. for the cask, use cdalvaro/tap/salt or specify the `--cask` flag.".
  Please tap it and then try again: brew tap ::warning::treating cdalvaro/tap

I currently have a formula and a cask, both with the same name: salt.

Actions have been working fine until now.

These are my definitions:

And this is the PR that is currently failing: cdalvaro/homebrew-tap#106

Am I doing something wrong?

Thank you for your help in advance!

@carlocab carlocab transferred this issue from Homebrew/actions May 27, 2024
@carlocab
Copy link
Member

I think this is a bug in Homebrew/homebrew-test-bot. I've transferred your issue accordingly.

@MikeMcQuaid
Copy link
Member

I suspect the issue is conflicts_with cask: "cdalvaro/tap/salt". Try to remove that.

@MikeMcQuaid
Copy link
Member

(note: if this is the problem: this should probably be a Homebrew/brew issue that should be fixed)

@cdalvaro
Copy link
Author

I suspect the issue is conflicts_with cask: "cdalvaro/tap/salt". Try to remove that.

Thank you for the suggestion, @MikeMcQuaid! I've tried the formula removing the conflicts_with statement but the error persists:

==> Running Formulae#formula!(cdalvaro/tap/salt)
==> brew deps --tree --annotate --include-build --include-test cdalvaro/tap/salt
==> Determining dependencies...
==> brew fetch --retry ::warning::Treating cdalvaro/tap/salt as a formula. For the cask, use cdalvaro/tap/salt or specify the `--cask` flag. asciidoc asciidoctor autoconf automake boost ca-certificates cmake docbook docbook-xsl gdbm gnu-getopt icu4c libgit2 libsodium libssh2 libtool libyaml llvm lz4 m4 mpdecimal ninja openssl@3 pcre2 pkg-config python@3.10 python@3.11 python@3.12 readline ruby rust six source-highlight sqlite swig xmlto xz z3 zeromq zstd
==> FAILED
Full fetch ::warning::Treating cdalvaro/tap/salt as a formula. For the cask, use cdalvaro/tap/salt or specify the `--cask` flag. asciidoc asciidoctor autoconf automake boost ca-certificates cmake docbook docbook-xsl gdbm gnu-getopt icu4c libgit2 libsodium libssh2 libtool libyaml llvm lz4 m4 mpdecimal ninja openssl@3 pcre2 pkg-config python@3.10 python@3.11 python@3.12 readline ruby rust six source-highlight sqlite swig xmlto xz z3 zeromq zstd output
  Error: No available formula or cask with the name "::warning::treating cdalvaro/tap/salt as a formula. for the cask, use cdalvaro/tap/salt or specify the `--cask` flag.".
  Please tap it and then try again: brew tap ::warning::treating cdalvaro/tap
  Error: No available formula or cask with the name "::warning::treating cdalvaro/tap/salt as a formula. for the cask, use cdalvaro/tap/salt or specify the `--cask` flag.".
  Please tap it and then try again: brew tap ::warning::treating cdalvaro/tap

Apparently, nothing has changed from the previous log...

@MikeMcQuaid
Copy link
Member

We'd review a PR adding --formula to the relevant brew test-bot calls.

@Bo98
Copy link
Member

Bo98 commented May 27, 2024

Might also be worth issuing those ::warning:: commands over stderr instead (assuming GitHub Actions supports that - I think it does).

@carlocab
Copy link
Member

carlocab commented May 28, 2024

This error message

Error: No available formula or cask with the name "::warning::treating cdalvaro/tap/salt as a formula. for the cask, use cdalvaro/tap/salt or specify the `--cask` flag.".

makes me think that the ::warning:: output that is meant for GHA is somehow being consumed by test-bot and being used as a test-bot argument for some reason.

Not sure how that's happening, but that seems to be the bug to me.

@Bo98
Copy link
Member

Bo98 commented May 28, 2024

Not sure how that's happening, but that seems to be the bug to me.

yeah that's the stdout vs stderr thing I'm talking about. It currently outputs to stdout but should ideally be stderr.

Test bot should still pass --formula to brew deps to avoid the warning, so there's two bugs here really.

@MikeMcQuaid
Copy link
Member

@carlocab Good catch, my eyes missed that it was inside the quotes before.

Yes, it seems likely that something like brew deps or brew uses or similar is spitting out that warning output on stdout, incorrectly.

That's definitely "a bug" but it's not "the only bug" which is that --formula should be being used here because we cannot handle casks anyway.

yeah that's the stdout vs stderr thing I'm talking about. It currently outputs to stdout but should ideally be stderr

I'm not sure I agree with this; it's not the GitHub Actions output here that's the problem but the whole opoo output.

Really, I think this warning is kinda of terrible and we should probably not be printing it at all.

@Bo98
Copy link
Member

Bo98 commented May 28, 2024

I'm not sure I agree with this; it's not the GitHub Actions output here that's the problem but the whole opoo output.

opoo prints to stderr:

https://github.com/Homebrew/brew/blob/cd651094878e88cb710bc24e253bff8b3595258e/Library/Homebrew/extend/kernel.rb#L67

but our annotation currently doesn't:

https://github.com/Homebrew/brew/blob/cd651094878e88cb710bc24e253bff8b3595258e/Library/Homebrew/utils/github/actions.rb#L54

Ideally they should print to the same place IMO.

There is perhaps another discussion about that specific warning's usefulness but the point about stderr still stands overall.

@carlocab
Copy link
Member

I've opened #1083 to fix this particular problem. It doesn't fix everything discussed above, however.

@carlocab
Copy link
Member

yeah that's the stdout vs stderr thing I'm talking about. It currently outputs to stdout but should ideally be stderr

I'm not sure I agree with this; it's not the GitHub Actions output here that's the problem but the whole opoo output.

Funnily enough, I agree with both of you.

I agree that this particular opoo output is useless, and shouldn't be printed. That should be fixed by #1083, I think.

However, I also agree with @Bo98 that the ::warning:: output that comes out of opoo (in general, and not the particular one mentioned in this issue) should probably go to stderror if possible.

@cdalvaro
Copy link
Author

My PR cdalvaro/homebrew-tap#106 has been merged after the pipeline ended successfully!

So this patch has fixed my issue.

Thank you all of you!

@MikeMcQuaid
Copy link
Member

Thanks for the kind words @cdalvaro, sponsorship and great issue!

MikeMcQuaid added a commit to Homebrew/brew that referenced this issue May 31, 2024
This will mean e.g. `opoo` etc. will output to stdout and not end up
being in the stdout of `brew deps` etc.

While we're here, remove a duplicate annotation output I noticed in
`extend/kernel.rb`.

Inspired by conversation in:
Homebrew/homebrew-test-bot#1082
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 29, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants