Closed slonopotamus closed 1 year ago
Do
HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source bla
Thanks for the quick response, that works. I guess it should be documented on the page I'm referring to.
Now, when I know about HOMEBREW_NO_INSTALL_FROM_API
existense, it looks that the source of current issue is https://github.com/Homebrew/brew/pull/14520. Before that commit, I would at least get an error message that would refer to HOMEBREW_NO_INSTALL_FROM_API
, but now it's gone.
CC @Bo98
Also, possibly related to https://github.com/Homebrew/brew/pull/14480. It's title talks about automatically enabling HOMEBREW_NO_INSTALL_FROM_API=1
when building from source, but that PR does something different. --build-from-source
doesn't automatically enable HOMEBREW_NO_INSTALL_FROM_API=1
as we can see in current issue.
This is somewhat intentional. This is because when you pass --build-from-source
you are in one of two scenarios and your intention isn't clear from that flag alone. You either:
The former scenario is far more common and is one that is more likely to be automated - so we break a lot by disrupting that. Personally: I also want as many people using the API where possible as the security & performance benefits of the API is substantial - if you use it you have bigger guarantees you are using what we are shipping.
However I recognise it may be confusing for contributors so I think we can do something smarter and show an env hint to anyone who passes and --build-from-source
and either:
master
branch in that repoIn terms of new formulae: there's also an open PR that will help here too. The current conditions are it does the current route if it's a core formula and API mode is enabled. This is slightly incorrect: it will be adjusted to only happen if the formulae has actually been loaded from API - which is not the case for your particular example so should hopefully work as expected automatically after that (will test to confirm).
you are in one of two scenarios and your intention isn't clear from that flag alone
Well, you can easily make it explicit by adding some kind of brew install --local <formula>
or brew install --file <path/to/formula>
or brew install --dev <formula>
.
However I recognise it may be confusing for contributors
Exactly. My main concern is not that HOMEBREW_NO_INSTALL_FROM_API
exists (though I'd say that HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>
command could be a bit shorter). What concerns me is that Homebrew has multiple docs on how to create a new formula and neither of them mentions HOMEBREW_NO_INSTALL_FROM_API
. Even PR checklist in https://github.com/Homebrew/homebrew-core just tells contributors to do brew install --build-from-source <formula>
.
BTW, this is how brew 4.0.3
behaves when given a full path to formula file:
% brew install --build-from-source /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/octobuild.rb
Error: Failed to load cask: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/octobuild.rb
Cask 'octobuild' is unreadable: wrong constant name #<Class:0x00007f8e0329d8b0>
Warning: Treating /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/octobuild.rb as a formula.
==> Fetching octobuild
curl: (22) The requested URL returned error: 404
Error: Failure while executing; `/usr/bin/env /usr/local/Homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/4.0.3-32-ga3207a0\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 12.6.3\)\ curl/7.79.1 --header Accept-Language:\ en --fail --progress-bar --retry 3 --location --remote-time --output /Users/cucumber/Library/Caches/Homebrew/Formula/octobuild.rb https://raw.githubusercontent.com/Homebrew/homebrew-core/b416edcb1e2fba0793ff74ef3875f24174678b63/Formula/octobuild.rb` exited with 22. Here's the output:
curl: (22) The requested URL returned error: 404
It
brew doctor
outputVerification
brew doctor
output" above saysYour system is ready to brew.
and am still able to reproduce my issue.brew update
twice and am still able to reproduce my issue.brew install wget
. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.brew config
outputWhat were you trying to do (and why)?
I'm trying to follow the basic formula creation procedure and absolutely fail.
The simplest thing that I try is:
However, I observe brew fully ignores the file I've created and instead tries to download formula with the same name from the internets (where it obviously doesn't exist, because I've just created it).
What happened (include all command output)?
What did you expect to happen?
I expected brew to use the formula file that I've just created.
Either I'm missing some step when following docs (this is the very first time I'm working with brew), or docs are not complete, or there's a bug in brew.
Step-by-step reproduction instructions (by running
brew
commands)