Port Homebrew::DevCmd::Bottle

This commit is contained in:
Douglas Eichelberger 2024-03-18 12:31:44 -07:00
parent 0f2efd3939
commit ee0c967ce0
3 changed files with 792 additions and 786 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2,23 +2,25 @@
# frozen_string_literal: true # frozen_string_literal: true
module Homebrew module Homebrew
class << self module DevCmd
undef tar_args class Bottle < AbstractCommand
undef tar_args
sig { returns(T::Array[String]) } sig { returns(T::Array[String]) }
def tar_args def tar_args
if MacOS.version >= :catalina if MacOS.version >= :catalina
["--no-mac-metadata", "--no-acls", "--no-xattrs"].freeze ["--no-mac-metadata", "--no-acls", "--no-xattrs"].freeze
else else
[].freeze [].freeze
end
end end
end
undef gnu_tar undef gnu_tar
sig { params(gnu_tar_formula: Formula).returns(String) } sig { params(gnu_tar_formula: Formula).returns(String) }
def gnu_tar(gnu_tar_formula) def gnu_tar(gnu_tar_formula)
"#{gnu_tar_formula.opt_bin}/gtar" "#{gnu_tar_formula.opt_bin}/gtar"
end
end end
end end
end end

View File

@ -3,7 +3,7 @@
require "cmd/shared_examples/args_parse" require "cmd/shared_examples/args_parse"
require "dev-cmd/bottle" require "dev-cmd/bottle"
RSpec.describe "brew bottle" do RSpec.describe Homebrew::DevCmd::Bottle do
def stub_hash(parameters) def stub_hash(parameters)
<<~EOS <<~EOS
{ {
@ -30,7 +30,7 @@ RSpec.describe "brew bottle" do
EOS EOS
end end
it_behaves_like "parseable arguments" it_behaves_like "parseable arguments", argv: ["foo"]
it "builds a bottle for the given Formula", :integration_test do it "builds a bottle for the given Formula", :integration_test do
install_test_formula "testball", build_bottle: true install_test_formula "testball", build_bottle: true
@ -308,8 +308,8 @@ RSpec.describe "brew bottle" do
end end
end end
describe Homebrew do describe "bottle_cmd" do
subject(:homebrew) { described_class } subject(:homebrew) { described_class.new(["foo"]) }
let(:hello_hash_big_sur) do let(:hello_hash_big_sur) do
JSON.parse stub_hash( JSON.parse stub_hash(