dev-cmd/bottle: correct all rebuild matching logic

This commit is contained in:
Bo Anderson 2021-11-06 03:40:33 +00:00
parent f014526f1f
commit d4c33634db
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65

View File

@ -629,16 +629,15 @@ module Homebrew
old_bottle_spec = formula.bottle_specification old_bottle_spec = formula.bottle_specification
old_bottle_spec_matches = old_bottle_spec && old_bottle_spec_matches = old_bottle_spec &&
bottle_hash["formula"]["pkg_version"] == formula.pkg_version.to_s && bottle_hash["formula"]["pkg_version"] == formula.pkg_version.to_s &&
bottle.rebuild != old_bottle_spec.rebuild &&
bottle.root_url == old_bottle_spec.root_url && bottle.root_url == old_bottle_spec.root_url &&
old_bottle_spec.collector.tags.present? old_bottle_spec.collector.tags.present?
# if all the cellars and checksums are the same: we can create an # if all the cellars and checksums are the same: we can create an
# `all: $SHA256` bottle. # `all: $SHA256` bottle.
tag_hashes = bottle_hash["bottle"]["tags"].values tag_hashes = bottle_hash["bottle"]["tags"].values
all_bottle = !old_bottle_spec_matches && (tag_hashes.count > 1) && tag_hashes.uniq do |tag_hash| all_bottle = (!old_bottle_spec_matches || bottle.rebuild != old_bottle_spec.rebuild) &&
"#{tag_hash["cellar"]}-#{tag_hash["sha256"]}" tag_hashes.count > 1 &&
end.count == 1 tag_hashes.uniq { |tag_hash| "#{tag_hash["cellar"]}-#{tag_hash["sha256"]}" }.count == 1
bottle_hash["bottle"]["tags"].each do |tag, tag_hash| bottle_hash["bottle"]["tags"].each do |tag, tag_hash|
cellar = tag_hash["cellar"] cellar = tag_hash["cellar"]
@ -661,7 +660,7 @@ module Homebrew
next next
end end
no_bottle_changes = if old_bottle_spec_matches no_bottle_changes = if old_bottle_spec_matches && bottle.rebuild != old_bottle_spec.rebuild
bottle.collector.tags.all? do |tag| bottle.collector.tags.all? do |tag|
tag_spec = bottle.collector.specification_for(tag) tag_spec = bottle.collector.specification_for(tag)
next false if tag_spec.blank? next false if tag_spec.blank?