Skip to content

Commit

Permalink
Merge pull request #16439 from arianf/fix-non-ghcr
Browse files Browse the repository at this point in the history
Fixes `openjdk_dep_name_if_applicable` when not using `CurlGitHubPackagesDownloadStrategy`
  • Loading branch information
MikeMcQuaid committed Jan 31, 2024
2 parents bc056d2 + 176095a commit 3707c90
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
40 changes: 40 additions & 0 deletions Library/Homebrew/test/utils/bottles/bottles_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,44 @@
end
end
end

describe ".load_tab" do
context "when tab_attributes and tabfile are missing" do
before do
# setup a testball1
dep_name = "testball1"
dep_path = CoreTap.new.new_formula_path(dep_name)
dep_path.write <<~RUBY
class #{Formulary.class_s(dep_name)} < Formula
url "testball1"
version "0.1"
end
RUBY
Formulary.cache.delete(dep_path)

# setup a testball2, that depends on testball1
formula_name = "testball2"
formula_path = CoreTap.new.new_formula_path(formula_name)
formula_path.write <<~RUBY
class #{Formulary.class_s(formula_name)} < Formula
url "testball2"
version "0.1"
depends_on "testball1"
end
RUBY
Formulary.cache.delete(formula_path)
end

it "includes runtime_dependencies" do
formula = Formula["testball2"]
formula.prefix.mkpath

runtime_dependencies = described_class.load_tab(formula).runtime_dependencies

expect(runtime_dependencies).not_to be_nil
expect(runtime_dependencies.size).to eq(1)
expect(runtime_dependencies.first).to include("full_name" => "testball1")
end
end
end
end
9 changes: 8 additions & 1 deletion Library/Homebrew/utils/bottles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,14 @@ def load_tab(formula)
tab_json = bottle_hash[formula.full_name]["bottle"]["tags"][tag]["tab"].to_json
Tab.from_file_content(tab_json, tabfile)
else
Tab.for_keg(keg)
tab = Tab.for_keg(keg)

tab.runtime_dependencies = begin
f_runtime_deps = formula.runtime_dependencies(read_from_tab: false)
Tab.runtime_deps_hash(formula, f_runtime_deps)
end

tab
end
end

Expand Down

0 comments on commit 3707c90

Please sign in to comment.