bottle: fix --keep-old JSON generation.
Ensure that the JSON file contains all the bottle checksums when using `--keep-old`. This avoids having to use the formula DSL when merging and relies on existing integrity checks. This change does nothing differently if `--keep-old` is not passed.
This commit is contained in:
parent
327f5ca177
commit
5e9bb877d5
@ -279,10 +279,9 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
bottle.rebuild rebuild
|
bottle.rebuild rebuild
|
||||||
sha256 = bottle_path.sha256
|
sha256 = bottle_path.sha256
|
||||||
bottle.sha256 sha256 => Utils::Bottles.tag
|
|
||||||
|
|
||||||
|
if ARGV.include?("--keep-old") && !f.bottle_specification.checksums.empty?
|
||||||
old_spec = f.bottle_specification
|
old_spec = f.bottle_specification
|
||||||
if ARGV.include?("--keep-old") && !old_spec.checksums.empty?
|
|
||||||
bad_fields = [:root_url, :prefix, :cellar, :rebuild].select do |field|
|
bad_fields = [:root_url, :prefix, :cellar, :rebuild].select do |field|
|
||||||
old_spec.send(field) != bottle.send(field)
|
old_spec.send(field) != bottle.send(field)
|
||||||
end
|
end
|
||||||
@ -291,8 +290,11 @@ module Homebrew
|
|||||||
bottle_path.unlink if bottle_path.exist?
|
bottle_path.unlink if bottle_path.exist?
|
||||||
odie "--keep-old is passed but there are changes in: #{bad_fields.join ", "}"
|
odie "--keep-old is passed but there are changes in: #{bad_fields.join ", "}"
|
||||||
end
|
end
|
||||||
|
bottle = old_spec
|
||||||
end
|
end
|
||||||
|
|
||||||
|
bottle.sha256 sha256 => Utils::Bottles.tag
|
||||||
|
|
||||||
output = bottle_output bottle
|
output = bottle_output bottle
|
||||||
|
|
||||||
puts "./#{filename}"
|
puts "./#{filename}"
|
||||||
@ -323,6 +325,19 @@ module Homebrew
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
if ARGV.include?("--keep-old")
|
||||||
|
bottle.checksums.each do |hash_type, checksums|
|
||||||
|
checksums.each do |checksum_hash|
|
||||||
|
checksum_hash.each do |checksum, tag|
|
||||||
|
tag_hash = {}
|
||||||
|
tag_hash["filename"] ||= Bottle::Filename.create(f, tag, rebuild).to_s
|
||||||
|
tag_hash[hash_type.to_s] ||= checksum.hexdigest
|
||||||
|
json[f.full_name]["bottle"]["tags"][tag.to_s] ||= tag_hash
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
File.open("#{filename.prefix}.bottle.json", "w") do |file|
|
File.open("#{filename.prefix}.bottle.json", "w") do |file|
|
||||||
file.write Utils::JSON.dump json
|
file.write Utils::JSON.dump json
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user