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
Fixes openjdk_dep_name_if_applicable
when not using CurlGitHubPackagesDownloadStrategy
#16439
Conversation
Thanks for taking a look at this. It's interesting that we already update the runtime dependency field in the tab when finishing up the install and this is essentially just moving that work earlier in the process so that keg relocation works here. brew/Library/Homebrew/formula_installer.rb Lines 820 to 825 in 3821fab
Does this have to wait until after the keg is installed or can we just do it for all of them earlier on in the install process? |
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.
Thanks for great PR @arianf and comprehensive explanation, wonderful work. Have a few questions and interested in answers to @apainintheneck's too.
|
||
describe ".load_tab" do | ||
context "when tab_attributes and tabfile are missing" do | ||
it "includes runtime_dependencies", :integration_test do |
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.
Are you sure this needs to be an :integration_test
? Would like to avoid adding new ones whenever possible because they are so slow 🐌
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.
I added :integration_test
, because I needed install_test_formula
and setup_test_formula
to perform the tests with the formulas. I'd be open to other ways of testing this.
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.
Search for temporarily_install_bottle
or when it can't remove a keg
or eligible_kegs_for_cleanup
for some examples of tests that do installation without an integration test.
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.
@MikeMcQuaid sorry for the delay, I have fixed this and made the test a non :integration_test
Thank you both for reviewing this PR.
Yea, that's something I was wondering as well. To be honest, I'm not sure why the runtime dependency are always overwritten in the That block above is reason why @carlocab observed the correct value within https://github.com/orgs/Homebrew/discussions/2530#discussioncomment-1696893
|
We always want to calculate the actual formula linkage based on current dependencies rather than using the one in the tab. |
…agesDownloadStrategy` When installing a formula, `FormulaInstaller` calls `#pour`, which in turn calls: https://github.com/Homebrew/brew/blob/6f20c0300aee2ab0feae3132d13f859d91cf295b/Library/Homebrew/formula_installer.rb#L1260 This `tab` is expected to have `#runtime_dependencies`, and it typically will because most packages come from http://ghcr.io https://github.com/Homebrew/brew/blob/6f20c0300aee2ab0feae3132d13f859d91cf295b/Library/Homebrew/utils/bottles.rb#L111 Any `DownloadStrategy` that does not match `CurlGitHubPackagesDownloadStrategy` will lead here: https://github.com/Homebrew/brew/blob/6f20c0300aee2ab0feae3132d13f859d91cf295b/Library/Homebrew/software_spec.rb#L463 Causing this branch to be executed for creating the `tab`: https://github.com/Homebrew/brew/blob/6f20c0300aee2ab0feae3132d13f859d91cf295b/Library/Homebrew/utils/bottles.rb#L119 This causes a slight issue because `openjdk_dep_name_if_applicable` calls `keg.runtime_dependencies` when it's still `nil`. https://github.com/Homebrew/brew/blob/6f20c0300aee2ab0feae3132d13f859d91cf295b/Library/Homebrew/keg_relocate.rb#L134-L140 And if it's blank, it won't do the regex replacement on `@@HOMEBREW_JAVA@@`, resulting in the following error when running `Kafka`: ```console $ tail -f /opt/homebrew/var/log/kafka/kafka_output.log /opt/homebrew/Cellar/kafka/3.6.0/libexec/bin/kafka-run-class.sh: line 346: /opt/homebrew/@@HOMEBREW_JAVA@@/bin/java: No such file or directory /opt/homebrew/Cellar/kafka/3.6.0/libexec/bin/kafka-run-class.sh: line 346: exec: /opt/homebrew/@@HOMEBREW_JAVA@@/bin/java: cannot execute: No such file or directory ``` As mentioned by: https://github.com/orgs/Homebrew/discussions/2530#discussioncomment-2002374 > Installing Java-dependent formulae from bottle mirrors doesn't work properly at the moment. The issue is that brew needs the manifest in order to correctly replace @@HOMEBREW_JAVA@@ but brew only knows how to fetch manifests from ghcr.io. > Pull requests to fix this welcome. This should fix this issue, by getting the `runtime_dependencies` directly from the formula for those cases that it can't get it from https://ghcr.io or tabfile ```ruby f_runtime_deps = formula.runtime_dependencies(read_from_tab: false) tab.runtime_dependencies = Tab.runtime_deps_hash(formula, f_runtime_deps) ```
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.
Thanks so much for your first contribution! Without people like you submitting PRs we couldn't run this project. You rock, @arianf!
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?Fixes
openjdk_dep_name_if_applicable
when not usingCurlGitHubPackagesDownloadStrategy
When installing a formula,
FormulaInstaller
calls#pour
, which in turn calls:brew/Library/Homebrew/formula_installer.rb
Line 1260 in 6f20c03
This
tab
is expected to have#runtime_dependencies
, and it typically will because most packages come from http://ghcr.iobrew/Library/Homebrew/utils/bottles.rb
Line 111 in 6f20c03
Any
DownloadStrategy
that does not matchCurlGitHubPackagesDownloadStrategy
will lead here:brew/Library/Homebrew/software_spec.rb
Line 463 in 6f20c03
Causing this branch to be executed for creating the
tab
, without#runtime_dependencies
:brew/Library/Homebrew/utils/bottles.rb
Line 119 in 6f20c03
This causes a slight issue because
openjdk_dep_name_if_applicable
callskeg.runtime_dependencies
when it's stillnil
.brew/Library/Homebrew/keg_relocate.rb
Lines 134 to 140 in 6f20c03
And if it's blank, it won't do the regex replacement on
@@HOMEBREW_JAVA@@
, resulting in the following error when runningKafka
:As mentioned by: https://github.com/orgs/Homebrew/discussions/2530#discussioncomment-2002374
This should fix this issue, by getting the
runtime_dependencies
directly from the formula for those cases that it can't get it from https://ghcr.io or tabfile