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

Fixes openjdk_dep_name_if_applicable when not using CurlGitHubPackagesDownloadStrategy #16439

Merged
merged 2 commits into from
Jan 31, 2024

Commits on Jan 29, 2024

  1. Fixes openjdk_dep_name_if_applicable when not using `CurlGitHubPack…

    …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)
    ```
    Arian Faurtosh committed Jan 29, 2024
    Configuration menu
    Copy the full SHA
    9088cf9 View commit details
    Browse the repository at this point in the history

Commits on Jan 30, 2024

  1. Configuration menu
    Copy the full SHA
    176095a View commit details
    Browse the repository at this point in the history