2020-10-10 14:16:11 +02:00
|
|
|
# typed: false
|
2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-03-27 11:49:56 +00:00
|
|
|
require "cmd/shared_examples/args_parse"
|
2020-12-01 19:08:59 +01:00
|
|
|
require "dev-cmd/bottle"
|
2019-03-27 11:49:56 +00:00
|
|
|
|
|
|
|
describe "Homebrew.bottle_args" do
|
|
|
|
it_behaves_like "parseable arguments"
|
|
|
|
end
|
|
|
|
|
2017-02-23 05:58:30 +01:00
|
|
|
describe "brew bottle", :integration_test do
|
|
|
|
it "builds a bottle for the given Formula" do
|
2019-03-27 09:45:48 +00:00
|
|
|
# create stub patchelf
|
|
|
|
if OS.linux?
|
2018-06-22 16:56:37 -07:00
|
|
|
setup_test_formula "patchelf"
|
2019-03-27 09:45:48 +00:00
|
|
|
patchelf = HOMEBREW_CELLAR/"patchelf/1.0/bin/patchelf"
|
|
|
|
patchelf.dirname.mkpath
|
|
|
|
patchelf.write <<~EOS
|
|
|
|
#!/bin/sh
|
|
|
|
exit 0
|
|
|
|
EOS
|
|
|
|
FileUtils.chmod "+x", patchelf
|
|
|
|
FileUtils.ln_s patchelf, HOMEBREW_PREFIX/"bin/patchelf"
|
|
|
|
end
|
2017-02-23 05:58:30 +01:00
|
|
|
|
2019-03-27 09:45:48 +00:00
|
|
|
install_test_formula "testball", build_bottle: true
|
2017-02-23 05:58:30 +01:00
|
|
|
|
2019-03-27 09:45:48 +00:00
|
|
|
# `brew bottle` should not fail with dead symlink
|
|
|
|
# https://github.com/Homebrew/legacy-homebrew/issues/49007
|
|
|
|
(HOMEBREW_CELLAR/"testball/0.1").cd do
|
|
|
|
FileUtils.ln_s "not-exist", "symlink"
|
2017-02-23 05:58:30 +01:00
|
|
|
end
|
2019-03-27 09:45:48 +00:00
|
|
|
|
2019-03-27 11:49:56 +00:00
|
|
|
begin
|
|
|
|
expect { brew "bottle", "--no-rebuild", "testball" }
|
|
|
|
.to output(/testball--0\.1.*\.bottle\.tar\.gz/).to_stdout
|
|
|
|
.and not_to_output.to_stderr
|
|
|
|
.and be_a_success
|
|
|
|
ensure
|
|
|
|
FileUtils.rm_f Dir.glob("testball--0.1*.bottle.tar.gz")
|
|
|
|
end
|
2017-02-23 05:58:30 +01:00
|
|
|
end
|
|
|
|
end
|
2020-12-01 19:08:59 +01:00
|
|
|
|
2020-12-09 23:02:31 +01:00
|
|
|
def stub_hash(parameters)
|
|
|
|
<<~EOS
|
|
|
|
{
|
|
|
|
"#{parameters[:name]}":{
|
|
|
|
"formula":{
|
|
|
|
"pkg_version":"#{parameters[:version]}",
|
|
|
|
"path":"#{parameters[:path]}"
|
|
|
|
},
|
|
|
|
"bottle":{
|
|
|
|
"root_url":"#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}",
|
|
|
|
"prefix":"/usr/local",
|
|
|
|
"cellar":"#{parameters[:cellar]}",
|
|
|
|
"rebuild":0,
|
|
|
|
"tags":{
|
|
|
|
"#{parameters[:os]}":{
|
|
|
|
"filename":"#{parameters[:filename]}",
|
|
|
|
"local_filename":"#{parameters[:local_filename]}",
|
|
|
|
"sha256":"#{parameters[:sha256]}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"bintray":{
|
|
|
|
"package":"#{parameters[:name]}",
|
|
|
|
"repository":"bottles"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
2020-12-01 19:08:59 +01:00
|
|
|
describe Homebrew do
|
|
|
|
subject(:homebrew) { described_class }
|
|
|
|
|
|
|
|
let(:hello_hash_big_sur) {
|
2020-12-25 13:10:10 -08:00
|
|
|
JSON.parse stub_hash(
|
|
|
|
"name": "hello",
|
|
|
|
"version": "1.0",
|
|
|
|
"path": "/home/hello.rb",
|
|
|
|
"cellar": "any_skip_relocation",
|
|
|
|
"os": "big_sur",
|
|
|
|
"filename": "hello-1.0.big_sur.bottle.tar.gz",
|
|
|
|
"local_filename": "hello--1.0.big_sur.bottle.tar.gz",
|
|
|
|
"sha256": "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f",
|
2020-12-01 19:08:59 +01:00
|
|
|
)
|
|
|
|
}
|
|
|
|
let(:hello_hash_catalina) {
|
2020-12-25 13:10:10 -08:00
|
|
|
JSON.parse stub_hash(
|
|
|
|
"name": "hello",
|
|
|
|
"version": "1.0",
|
|
|
|
"path": "/home/hello.rb",
|
|
|
|
"cellar": "any_skip_relocation",
|
|
|
|
"os": "catalina",
|
|
|
|
"filename": "hello-1.0.catalina.bottle.tar.gz",
|
|
|
|
"local_filename": "hello--1.0.catalina.bottle.tar.gz",
|
|
|
|
"sha256": "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac",
|
2020-12-01 19:08:59 +01:00
|
|
|
)
|
|
|
|
}
|
|
|
|
let(:unzip_hash_big_sur) {
|
2020-12-25 13:10:10 -08:00
|
|
|
JSON.parse stub_hash(
|
|
|
|
"name": "unzip",
|
|
|
|
"version": "2.0",
|
|
|
|
"path": "/home/unzip.rb",
|
|
|
|
"cellar": "any_skip_relocation",
|
|
|
|
"os": "big_sur",
|
|
|
|
"filename": "unzip-2.0.big_sur.bottle.tar.gz",
|
|
|
|
"local_filename": "unzip--2.0.big_sur.bottle.tar.gz",
|
|
|
|
"sha256": "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72",
|
2020-12-01 19:08:59 +01:00
|
|
|
)
|
|
|
|
}
|
|
|
|
let(:unzip_hash_catalina) {
|
2020-12-25 13:10:10 -08:00
|
|
|
JSON.parse stub_hash(
|
|
|
|
"name": "unzip",
|
|
|
|
"version": "2.0",
|
|
|
|
"path": "/home/unzip.rb",
|
|
|
|
"cellar": "any",
|
|
|
|
"os": "catalina",
|
|
|
|
"filename": "unzip-2.0.catalina.bottle.tar.gz",
|
|
|
|
"local_filename": "unzip--2.0.catalina.bottle.tar.gz",
|
|
|
|
"sha256": "d9cc50eec8ac243148a121049c236cba06af4a0b1156ab397d0a2850aa79c137",
|
2020-12-01 19:08:59 +01:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
specify "::parse_json_files" do
|
|
|
|
Tempfile.open("hello--1.0.big_sur.bottle.json") do |f|
|
2020-12-25 13:10:10 -08:00
|
|
|
f.write stub_hash(
|
|
|
|
"name": "hello",
|
|
|
|
"version": "1.0",
|
|
|
|
"path": "/home/hello.rb",
|
|
|
|
"cellar": "any_skip_relocation",
|
|
|
|
"os": "big_sur",
|
|
|
|
"filename": "hello-1.0.big_sur.bottle.tar.gz",
|
|
|
|
"local_filename": "hello--1.0.big_sur.bottle.tar.gz",
|
|
|
|
"sha256": "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f",
|
2020-12-01 19:08:59 +01:00
|
|
|
)
|
|
|
|
f.close
|
|
|
|
expect(
|
|
|
|
homebrew.parse_json_files([f.path]).first["hello"]["bottle"]["tags"]["big_sur"]["filename"],
|
|
|
|
).to eq("hello-1.0.big_sur.bottle.tar.gz")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
specify "::merge_json_files" do
|
|
|
|
bottles_hash = homebrew.merge_json_files(
|
|
|
|
[hello_hash_big_sur, hello_hash_catalina, unzip_hash_big_sur, unzip_hash_catalina],
|
|
|
|
)
|
|
|
|
|
|
|
|
hello_hash = bottles_hash["hello"]
|
|
|
|
expect(hello_hash["bottle"]["cellar"]).to eq("any_skip_relocation")
|
|
|
|
expect(hello_hash["bottle"]["tags"]["big_sur"]["filename"]).to eq("hello-1.0.big_sur.bottle.tar.gz")
|
|
|
|
expect(hello_hash["bottle"]["tags"]["big_sur"]["local_filename"]).to eq("hello--1.0.big_sur.bottle.tar.gz")
|
|
|
|
expect(hello_hash["bottle"]["tags"]["big_sur"]["sha256"]).to eq(
|
|
|
|
"a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f",
|
|
|
|
)
|
|
|
|
expect(hello_hash["bottle"]["tags"]["catalina"]["filename"]).to eq("hello-1.0.catalina.bottle.tar.gz")
|
|
|
|
expect(hello_hash["bottle"]["tags"]["catalina"]["local_filename"]).to eq("hello--1.0.catalina.bottle.tar.gz")
|
|
|
|
expect(hello_hash["bottle"]["tags"]["catalina"]["sha256"]).to eq(
|
|
|
|
"5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac",
|
|
|
|
)
|
|
|
|
unzip_hash = bottles_hash["unzip"]
|
|
|
|
expect(unzip_hash["bottle"]["cellar"]).to eq("any")
|
|
|
|
expect(unzip_hash["bottle"]["tags"]["big_sur"]["filename"]).to eq("unzip-2.0.big_sur.bottle.tar.gz")
|
|
|
|
expect(unzip_hash["bottle"]["tags"]["big_sur"]["local_filename"]).to eq("unzip--2.0.big_sur.bottle.tar.gz")
|
|
|
|
expect(unzip_hash["bottle"]["tags"]["big_sur"]["sha256"]).to eq(
|
|
|
|
"16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72",
|
|
|
|
)
|
|
|
|
expect(unzip_hash["bottle"]["tags"]["catalina"]["filename"]).to eq("unzip-2.0.catalina.bottle.tar.gz")
|
|
|
|
expect(unzip_hash["bottle"]["tags"]["catalina"]["local_filename"]).to eq("unzip--2.0.catalina.bottle.tar.gz")
|
|
|
|
expect(unzip_hash["bottle"]["tags"]["catalina"]["sha256"]).to eq(
|
|
|
|
"d9cc50eec8ac243148a121049c236cba06af4a0b1156ab397d0a2850aa79c137",
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
2020-12-09 23:02:31 +01:00
|
|
|
|
|
|
|
describe "brew bottle --merge", :integration_test, :needs_linux do
|
2020-12-24 11:55:19 -08:00
|
|
|
let(:core_tap) { CoreTap.new }
|
2020-12-22 16:18:51 +01:00
|
|
|
let(:tarball) do
|
|
|
|
if OS.linux?
|
|
|
|
TEST_FIXTURE_DIR/"tarballs/testball-0.1-linux.tbz"
|
|
|
|
else
|
|
|
|
TEST_FIXTURE_DIR/"tarballs/testball-0.1.tbz"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-12-24 11:55:19 -08:00
|
|
|
before do
|
2020-12-25 13:10:10 -08:00
|
|
|
Pathname("#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json").write stub_hash(
|
2020-12-24 11:55:19 -08:00
|
|
|
"name": "testball",
|
|
|
|
"version": "1.0",
|
|
|
|
"path": "#{core_tap.path}/Formula/testball.rb",
|
|
|
|
"cellar": "any_skip_relocation",
|
|
|
|
"os": "big_sur",
|
|
|
|
"filename": "hello-1.0.big_sur.bottle.tar.gz",
|
|
|
|
"local_filename": "hello--1.0.big_sur.bottle.tar.gz",
|
|
|
|
"sha256": "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f",
|
|
|
|
)
|
|
|
|
|
2020-12-25 13:10:10 -08:00
|
|
|
Pathname("#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json").write stub_hash(
|
2020-12-24 11:55:19 -08:00
|
|
|
"name": "testball",
|
|
|
|
"version": "1.0",
|
|
|
|
"path": "#{core_tap.path}/Formula/testball.rb",
|
|
|
|
"cellar": "any_skip_relocation",
|
|
|
|
"os": "catalina",
|
|
|
|
"filename": "testball-1.0.catalina.bottle.tar.gz",
|
|
|
|
"local_filename": "testball--1.0.catalina.bottle.tar.gz",
|
|
|
|
"sha256": "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac",
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
after do
|
2020-12-25 13:10:10 -08:00
|
|
|
FileUtils.rm_f "#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
|
|
|
|
FileUtils.rm_f "#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json"
|
2020-12-24 11:55:19 -08:00
|
|
|
end
|
|
|
|
|
2020-12-09 23:02:31 +01:00
|
|
|
it "adds the bottle block to a formula that has none" 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
|
|
|
|
|
2020-12-24 11:55:19 -08:00
|
|
|
expect {
|
|
|
|
brew "bottle",
|
|
|
|
"--merge",
|
|
|
|
"--write",
|
2020-12-25 13:10:10 -08:00
|
|
|
"#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json",
|
|
|
|
"#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
|
|
|
|
}.to output(<<~EOS).to_stdout
|
|
|
|
==> testball
|
|
|
|
bottle do
|
|
|
|
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
|
|
|
cellar :any_skip_relocation
|
|
|
|
sha256 "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" => :big_sur
|
|
|
|
sha256 "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" => :catalina
|
|
|
|
end
|
|
|
|
EOS
|
2020-12-22 16:18:51 +01:00
|
|
|
|
2020-12-25 13:10:10 -08:00
|
|
|
expect((core_tap.path/"Formula/testball.rb").read).to eq <<~EOS
|
|
|
|
class Testball < Formula
|
|
|
|
desc "Some test"
|
|
|
|
homepage "https://brew.sh/testball"
|
|
|
|
url "file://#{tarball}"
|
|
|
|
sha256 "#{tarball.sha256}"
|
2020-12-22 16:18:51 +01:00
|
|
|
|
2020-12-25 13:10:10 -08:00
|
|
|
bottle do
|
|
|
|
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
|
|
|
cellar :any_skip_relocation
|
|
|
|
sha256 "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" => :big_sur
|
|
|
|
sha256 "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" => :catalina
|
|
|
|
end
|
2020-12-22 16:18:51 +01:00
|
|
|
|
2020-12-25 13:10:10 -08:00
|
|
|
option "with-foo", "Build with foo"
|
2020-12-22 16:18:51 +01:00
|
|
|
|
2020-12-25 13:10:10 -08:00
|
|
|
def install
|
|
|
|
(prefix/"foo"/"test").write("test") if build.with? "foo"
|
|
|
|
prefix.install Dir["*"]
|
|
|
|
(buildpath/"test.c").write \
|
|
|
|
"#include <stdio.h>\\nint main(){printf(\\"test\\");return 0;}"
|
|
|
|
bin.mkpath
|
|
|
|
system ENV.cc, "test.c", "-o", bin/"test"
|
|
|
|
end
|
2020-12-22 16:18:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-25 13:10:10 -08:00
|
|
|
# something here
|
2020-12-22 16:18:51 +01:00
|
|
|
|
2020-12-25 13:10:10 -08:00
|
|
|
end
|
|
|
|
EOS
|
2020-12-22 16:18:51 +01:00
|
|
|
end
|
2020-12-09 23:02:31 +01:00
|
|
|
|
2020-12-22 16:18:51 +01:00
|
|
|
it "replaces the bottle block in a formula that already has a bottle block" do
|
|
|
|
core_tap.path.cd do
|
|
|
|
system "git", "init"
|
2020-12-25 13:10:10 -08:00
|
|
|
setup_test_formula "testball", bottle_block: <<~EOS
|
2020-12-09 23:02:31 +01:00
|
|
|
|
2020-12-22 16:18:51 +01:00
|
|
|
bottle do
|
|
|
|
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
|
|
|
cellar :any_skip_relocation
|
|
|
|
sha256 "6b276491297d4052538bd2fd22d5129389f27d90a98f831987236a5b90511b98" => :big_sur
|
|
|
|
sha256 "16cf230afdfcb6306c208d169549cf8773c831c8653d2c852315a048960d7e72" => :catalina
|
|
|
|
end
|
|
|
|
EOS
|
|
|
|
system "git", "add", "--all"
|
|
|
|
system "git", "commit", "-m", "testball 0.1"
|
|
|
|
end
|
|
|
|
|
2020-12-24 11:55:19 -08:00
|
|
|
expect {
|
|
|
|
brew "bottle",
|
|
|
|
"--merge",
|
|
|
|
"--write",
|
2020-12-25 13:10:10 -08:00
|
|
|
"#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json",
|
|
|
|
"#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
|
|
|
|
}.to output(<<~EOS).to_stdout
|
|
|
|
==> testball
|
|
|
|
bottle do
|
|
|
|
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
|
|
|
cellar :any_skip_relocation
|
|
|
|
sha256 "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" => :big_sur
|
|
|
|
sha256 "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" => :catalina
|
|
|
|
end
|
|
|
|
EOS
|
2020-12-09 23:02:31 +01:00
|
|
|
|
2020-12-25 13:10:10 -08:00
|
|
|
expect((core_tap.path/"Formula/testball.rb").read).to eq <<~EOS
|
|
|
|
class Testball < Formula
|
|
|
|
desc "Some test"
|
|
|
|
homepage "https://brew.sh/testball"
|
|
|
|
url "file://#{tarball}"
|
|
|
|
sha256 "#{tarball.sha256}"
|
2020-12-09 23:02:31 +01:00
|
|
|
|
2020-12-25 13:10:10 -08:00
|
|
|
option "with-foo", "Build with foo"
|
2020-12-22 16:18:51 +01:00
|
|
|
|
2020-12-25 13:10:10 -08:00
|
|
|
bottle do
|
|
|
|
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
|
|
|
cellar :any_skip_relocation
|
|
|
|
sha256 "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" => :big_sur
|
|
|
|
sha256 "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" => :catalina
|
|
|
|
end
|
2020-12-09 23:02:31 +01:00
|
|
|
|
2020-12-25 13:10:10 -08:00
|
|
|
def install
|
|
|
|
(prefix/"foo"/"test").write("test") if build.with? "foo"
|
|
|
|
prefix.install Dir["*"]
|
|
|
|
(buildpath/"test.c").write \
|
|
|
|
"#include <stdio.h>\\nint main(){printf(\\"test\\");return 0;}"
|
|
|
|
bin.mkpath
|
|
|
|
system ENV.cc, "test.c", "-o", bin/"test"
|
|
|
|
end
|
2020-12-22 16:18:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-25 13:10:10 -08:00
|
|
|
# something here
|
2020-12-22 16:18:51 +01:00
|
|
|
|
2020-12-25 13:10:10 -08:00
|
|
|
end
|
|
|
|
EOS
|
2020-12-22 16:18:51 +01:00
|
|
|
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
|
|
|
|
|
2020-12-24 11:55:19 -08:00
|
|
|
expect {
|
|
|
|
brew "bottle",
|
|
|
|
"--merge",
|
|
|
|
"--write",
|
|
|
|
"--keep-old",
|
2020-12-25 13:10:10 -08:00
|
|
|
"#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json",
|
|
|
|
"#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
|
2020-12-24 11:55:19 -08:00
|
|
|
}.to output("Error: --keep-old was passed but there was no existing bottle block!\n").to_stderr
|
2020-12-22 16:18:51 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
it "updates the bottle block in a formula that already has a bottle block when using --keep-old" do
|
|
|
|
core_tap.path.cd do
|
|
|
|
system "git", "init"
|
2020-12-25 13:10:10 -08:00
|
|
|
setup_test_formula "testball", bottle_block: <<~EOS
|
2020-12-22 16:18:51 +01:00
|
|
|
|
|
|
|
bottle do
|
|
|
|
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
|
|
|
cellar :any_skip_relocation
|
|
|
|
sha256 "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059" => :high_sierra
|
|
|
|
end
|
|
|
|
EOS
|
|
|
|
system "git", "add", "--all"
|
|
|
|
system "git", "commit", "-m", "testball 0.1"
|
|
|
|
end
|
|
|
|
|
2020-12-24 11:55:19 -08:00
|
|
|
expect {
|
|
|
|
brew "bottle",
|
|
|
|
"--merge",
|
|
|
|
"--write",
|
|
|
|
"--keep-old",
|
2020-12-25 13:10:10 -08:00
|
|
|
"#{TEST_TMPDIR}/testball-1.0.big_sur.bottle.json",
|
|
|
|
"#{TEST_TMPDIR}/testball-1.0.catalina.bottle.json"
|
|
|
|
}.to output(<<~EOS).to_stdout
|
|
|
|
==> testball
|
|
|
|
bottle do
|
|
|
|
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
|
|
|
cellar :any_skip_relocation
|
|
|
|
sha256 "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" => :big_sur
|
|
|
|
sha256 "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" => :catalina
|
|
|
|
sha256 "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059" => :high_sierra
|
|
|
|
end
|
|
|
|
EOS
|
2020-12-22 16:18:51 +01:00
|
|
|
|
2020-12-25 13:10:10 -08:00
|
|
|
expect((core_tap.path/"Formula/testball.rb").read).to eq <<~EOS
|
|
|
|
class Testball < Formula
|
|
|
|
desc "Some test"
|
|
|
|
homepage "https://brew.sh/testball"
|
|
|
|
url "file://#{tarball}"
|
|
|
|
sha256 "#{tarball.sha256}"
|
2020-12-22 16:18:51 +01:00
|
|
|
|
2020-12-25 13:10:10 -08:00
|
|
|
option "with-foo", "Build with foo"
|
2020-12-09 23:02:31 +01:00
|
|
|
|
2020-12-25 13:10:10 -08:00
|
|
|
bottle do
|
|
|
|
root_url "#{HOMEBREW_BOTTLE_DEFAULT_DOMAIN}"
|
|
|
|
cellar :any_skip_relocation
|
|
|
|
sha256 "a0af7dcbb5c83f6f3f7ecd507c2d352c1a018f894d51ad241ce8492fa598010f" => :big_sur
|
|
|
|
sha256 "5334dd344986e46b2aa4f0471cac7b0914bd7de7cb890a34415771788d03f2ac" => :catalina
|
|
|
|
sha256 "6971b6eebf4c00eaaed72a1104a49be63861eabc95d679a0c84040398e320059" => :high_sierra
|
|
|
|
end
|
2020-12-22 16:18:51 +01:00
|
|
|
|
2020-12-25 13:10:10 -08:00
|
|
|
def install
|
|
|
|
(prefix/"foo"/"test").write("test") if build.with? "foo"
|
|
|
|
prefix.install Dir["*"]
|
|
|
|
(buildpath/"test.c").write \
|
|
|
|
"#include <stdio.h>\\nint main(){printf(\\"test\\");return 0;}"
|
|
|
|
bin.mkpath
|
|
|
|
system ENV.cc, "test.c", "-o", bin/"test"
|
|
|
|
end
|
2020-12-09 23:02:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-25 13:10:10 -08:00
|
|
|
# something here
|
2020-12-09 23:02:31 +01:00
|
|
|
|
2020-12-25 13:10:10 -08:00
|
|
|
end
|
|
|
|
EOS
|
2020-12-09 23:02:31 +01:00
|
|
|
end
|
|
|
|
end
|