software_spec: fix handling of default non-host Cellar

This commit is contained in:
Bo Anderson 2021-04-08 01:56:05 +01:00
parent f1e9f8c46e
commit 2ed3339478
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65
2 changed files with 10 additions and 3 deletions

View File

@ -430,7 +430,6 @@ class BottleSpecification
def initialize def initialize
@rebuild = 0 @rebuild = 0
@prefix = Homebrew::DEFAULT_PREFIX @prefix = Homebrew::DEFAULT_PREFIX
@all_tags_cellar = Homebrew::DEFAULT_CELLAR
@repository = Homebrew::DEFAULT_REPOSITORY @repository = Homebrew::DEFAULT_REPOSITORY
@collector = Utils::Bottles::Collector.new @collector = Utils::Bottles::Collector.new
@root_url_specs = {} @root_url_specs = {}
@ -472,7 +471,7 @@ class BottleSpecification
# ) # )
# end # end
return collector.dig(Utils::Bottles.tag, :cellar) || @all_tags_cellar if val.nil? return collector.dig(Utils::Bottles.tag, :cellar) || @all_tags_cellar || Homebrew::DEFAULT_CELLAR if val.nil?
@all_tags_cellar = val @all_tags_cellar = val
end end
@ -534,6 +533,14 @@ class BottleSpecification
end end
cellar ||= all_tags_cellar cellar ||= all_tags_cellar
cellar ||= if tag.to_s.end_with?("_linux")
Homebrew::DEFAULT_LINUX_CELLAR
elsif tag.to_s.start_with?("arm64_")
Homebrew::DEFAULT_MACOS_ARM_CELLAR
else
Homebrew::DEFAULT_MACOS_CELLAR
end
collector[tag] = { checksum: Checksum.new(digest), cellar: cellar } collector[tag] = { checksum: Checksum.new(digest), cellar: cellar }
end end

View File

@ -586,7 +586,7 @@ describe "brew bottle" do
new_catalina_sha256 = "ec6d7f08412468f28dee2be17ad8cd8b883b16b34329efcecce019b8c9736428" new_catalina_sha256 = "ec6d7f08412468f28dee2be17ad8cd8b883b16b34329efcecce019b8c9736428"
new_hash = { "tags" => { "catalina" => { "sha256" => new_catalina_sha256 } } } new_hash = { "tags" => { "catalina" => { "sha256" => new_catalina_sha256 } } }
expected_checksum_hash = { mojave: "7571772bf7a0c9fe193e70e521318b53993bee6f351976c9b6e01e00d13d6c3f" } expected_checksum_hash = { mojave: "7571772bf7a0c9fe193e70e521318b53993bee6f351976c9b6e01e00d13d6c3f" }
expected_checksum_hash[:cellar] = Homebrew::DEFAULT_CELLAR expected_checksum_hash[:cellar] = Homebrew::DEFAULT_MACOS_CELLAR
expect(homebrew.merge_bottle_spec([:sha256], old_spec, new_hash)).to eq [ expect(homebrew.merge_bottle_spec([:sha256], old_spec, new_hash)).to eq [
["sha256 catalina: old: #{old_catalina_sha256.inspect}, new: #{new_catalina_sha256.inspect}"], ["sha256 catalina: old: #{old_catalina_sha256.inspect}, new: #{new_catalina_sha256.inspect}"],
[expected_checksum_hash], [expected_checksum_hash],