diff --git a/Library/Homebrew/test/utils/bottles/bottles_spec.rb b/Library/Homebrew/test/utils/bottles/bottles_spec.rb index 57adf15a2f..7af427a399 100644 --- a/Library/Homebrew/test/utils/bottles/bottles_spec.rb +++ b/Library/Homebrew/test/utils/bottles/bottles_spec.rb @@ -13,4 +13,44 @@ describe Utils::Bottles do 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 diff --git a/Library/Homebrew/utils/bottles.rb b/Library/Homebrew/utils/bottles.rb index 273e9f85e8..9396226729 100644 --- a/Library/Homebrew/utils/bottles.rb +++ b/Library/Homebrew/utils/bottles.rb @@ -116,7 +116,14 @@ module Utils 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