Merge pull request #11278 from iMichka/bottle

bottle: do not fail on missing bottle block
This commit is contained in:
Michka Popoff 2021-04-29 17:22:39 +02:00 committed by GitHub
commit 1a27e4fd4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 23 deletions

View File

@ -790,10 +790,7 @@ module Homebrew
def old_checksums(formula, formula_ast, bottle_hash, args:) def old_checksums(formula, formula_ast, bottle_hash, args:)
bottle_node = formula_ast.bottle_block bottle_node = formula_ast.bottle_block
if bottle_node.nil? return if bottle_node.nil?
odie "`--keep-old` was passed but there was no existing bottle block!" if args.keep_old?
return
end
return [] unless args.keep_old? return [] unless args.keep_old?
old_keys = Utils::AST.body_children(bottle_node.body).map(&:method_name) old_keys = Utils::AST.body_children(bottle_node.body).map(&:method_name)

View File

@ -273,25 +273,6 @@ describe "brew bottle" do
EOS EOS
end end
it "fails to add the bottle block to a formula that has no bottle block when using --keep-old" do
core_tap.path.cd do
system "git", "init"
setup_test_formula("testball")
system "git", "add", "--all"
system "git", "commit", "-m", "testball 0.1"
end
expect {
brew "bottle",
"--merge",
"--write",
"--keep-old",
"#{TEST_TMPDIR}/testball-1.0.arm64_big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
}.to output("Error: `--keep-old` was passed but there was no existing bottle block!\n").to_stderr
end
it "updates the bottle block in a formula that already has a bottle block (old format) when using --keep-old" do it "updates the bottle block in a formula that already has a bottle block (old format) when using --keep-old" do
core_tap.path.cd do core_tap.path.cd do
system "git", "init" system "git", "init"