bottle: write bottles in correct order

This commit is contained in:
Rylan Polster 2021-02-04 13:30:16 -05:00
parent 6df0a49fb5
commit 3dccea251f
No known key found for this signature in database
GPG Key ID: 46A744940CFF4D64
2 changed files with 62 additions and 29 deletions

View File

@ -435,7 +435,10 @@ class BottleSpecification
def checksums def checksums
tags = collector.keys.sort_by do |tag| tags = collector.keys.sort_by do |tag|
"#{OS::Mac::Version.from_symbol(tag)}_#{tag}" version = OS::Mac::Version.from_symbol(tag)
# Give arm64 bottles a higher priority so they are first
priority = version.arch == :arm64 ? "2" : "1"
"#{priority}.#{version}_#{tag}"
rescue MacOSVersionError rescue MacOSVersionError
# Sort non-MacOS tags below MacOS tags. # Sort non-MacOS tags below MacOS tags.
"0.#{tag}" "0.#{tag}"

View File

@ -50,6 +50,17 @@ describe "brew bottle" do
end end
before do before do
Pathname("#{TEST_TMPDIR}/testball-1.0.arm64_big_sur.bottle.json").write stub_hash(
name: "testball",
version: "1.0",
path: "#{core_tap.path}/Formula/testball.rb",
cellar: "any_skip_relocation",
os: "arm64_big_sur",
filename: "testball-1.0.arm64_big_sur.bottle.tar.gz",
local_filename: "testball--1.0.arm64_big_sur.bottle.tar.gz",
sha256: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149",
)
Pathname("#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json").write stub_hash( Pathname("#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json").write stub_hash(
name: "testball", name: "testball",
version: "1.0", version: "1.0",
@ -74,6 +85,7 @@ describe "brew bottle" do
end end
after do after do
FileUtils.rm_f "#{TEST_TMPDIR}/testball-1.0.arm64_big_sur.bottle.json"
FileUtils.rm_f "#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json" FileUtils.rm_f "#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
FileUtils.rm_f "#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json" FileUtils.rm_f "#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json"
end end
@ -90,12 +102,14 @@ describe "brew bottle" do
brew "bottle", brew "bottle",
"--merge", "--merge",
"--write", "--write",
"#{TEST_TMPDIR}/testball-1.0.arm64_big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json", "#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json" "#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
}.to output(<<~EOS).to_stdout }.to output(<<~EOS).to_stdout
==> testball ==> testball
bottle do bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
end end
@ -110,6 +124,7 @@ describe "brew bottle" do
bottle do bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
end end
@ -141,8 +156,9 @@ describe "brew bottle" do
bottle do bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
cellar :any_skip_relocation cellar :any_skip_relocation
sha256 big_sur: "6b276491297d4052538bd2fd22d5129389f27d90a98f831987236a5b90511b98" sha256 "6b276491297d4052538bd2fd22d5129389f27d90a98f831987236a5b90511b98" => :big_sur
sha256 catalina: "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72" sha256 "c3c650d75f5188f5d6edd351dd3215e141b73b8ec1cf9144f30e39cbc45de72e" => :arm64_big_sur
sha256 "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72" => :catalina
end end
EOS EOS
system "git", "add", "--all" system "git", "add", "--all"
@ -153,12 +169,14 @@ describe "brew bottle" do
brew "bottle", brew "bottle",
"--merge", "--merge",
"--write", "--write",
"#{TEST_TMPDIR}/testball-1.0.arm64_big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json", "#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json" "#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
}.to output(<<~EOS).to_stdout }.to output(<<~EOS).to_stdout
==> testball ==> testball
bottle do bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
end end
@ -175,6 +193,7 @@ describe "brew bottle" do
bottle do bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
end end
@ -203,6 +222,7 @@ describe "brew bottle" do
bottle do bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "c3c650d75f5188f5d6edd351dd3215e141b73b8ec1cf9144f30e39cbc45de72e"
sha256 cellar: :any_skip_relocation, big_sur: "6b276491297d4052538bd2fd22d5129389f27d90a98f831987236a5b90511b98" sha256 cellar: :any_skip_relocation, big_sur: "6b276491297d4052538bd2fd22d5129389f27d90a98f831987236a5b90511b98"
sha256 cellar: :any_skip_relocation, catalina: "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72" sha256 cellar: :any_skip_relocation, catalina: "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72"
end end
@ -215,12 +235,14 @@ describe "brew bottle" do
brew "bottle", brew "bottle",
"--merge", "--merge",
"--write", "--write",
"#{TEST_TMPDIR}/testball-1.0.arm64_big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json", "#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json" "#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
}.to output(<<~EOS).to_stdout }.to output(<<~EOS).to_stdout
==> testball ==> testball
bottle do bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
end end
@ -237,6 +259,7 @@ describe "brew bottle" do
bottle do bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
end end
@ -271,6 +294,7 @@ describe "brew bottle" do
"--merge", "--merge",
"--write", "--write",
"--keep-old", "--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.big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.catalina.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 }.to output("Error: `--keep-old` was passed but there was no existing bottle block!\n").to_stderr
@ -296,12 +320,14 @@ describe "brew bottle" do
"--merge", "--merge",
"--write", "--write",
"--keep-old", "--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.big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json" "#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
}.to output(<<~EOS).to_stdout }.to output(<<~EOS).to_stdout
==> testball ==> testball
bottle do bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059" sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059"
@ -319,6 +345,7 @@ describe "brew bottle" do
bottle do bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059" sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059"
@ -360,12 +387,14 @@ describe "brew bottle" do
"--merge", "--merge",
"--write", "--write",
"--keep-old", "--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.big_sur.bottle.json",
"#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json" "#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
}.to output(<<~EOS).to_stdout }.to output(<<~EOS).to_stdout
==> testball ==> testball
bottle do bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059" sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059"
@ -383,6 +412,7 @@ describe "brew bottle" do
bottle do bottle do
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "8f9aecd233463da6a4ea55f5f88fc5841718c013f3e2a7941350d6130f1dc149"
sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" sha256 cellar: :any_skip_relocation, big_sur: "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f"
sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" sha256 cellar: :any_skip_relocation, catalina: "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac"
sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059" sha256 cellar: :any, high_sierra: "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059"