separate setup_tar_and_args method
This commit is contained in:
parent
fde7ca31b8
commit
ec1a1566bc
@ -234,30 +234,13 @@ module Homebrew
|
|||||||
system "/usr/bin/sudo", "--non-interactive", "/usr/sbin/purge"
|
system "/usr/bin/sudo", "--non-interactive", "/usr/sbin/purge"
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup_tar_and_args!(args, mtime)
|
def setup_tar_and_args!(args, _mtime)
|
||||||
# Without --only-json-tab bottles are never reproducible
|
# Without --only-json-tab bottles are never reproducible
|
||||||
default_tar_args = ["tar", [].freeze].freeze
|
default_tar_args = ["tar", [].freeze].freeze
|
||||||
return default_tar_args unless args.only_json_tab?
|
return default_tar_args unless args.only_json_tab?
|
||||||
|
|
||||||
# Use gnu-tar on macOS as it can be set up for reproducibility better than libarchive.
|
|
||||||
begin
|
|
||||||
gnu_tar = Formula["gnu-tar"]
|
|
||||||
rescue FormulaUnavailableError
|
|
||||||
return default_tar_args
|
|
||||||
end
|
end
|
||||||
|
|
||||||
ensure_formula_installed!(gnu_tar, reason: "bottling")
|
alias generic_setup_tar_and_args! setup_tar_and_args!
|
||||||
|
|
||||||
# Ensure tar is set up for reproducibility.
|
|
||||||
# https://reproducible-builds.org/docs/archives/
|
|
||||||
gnutar_args = [
|
|
||||||
"--format", "pax", "--owner", "0", "--group", "0", "--sort", "name", "--mtime=#{mtime}",
|
|
||||||
# Set exthdr names to exclude PID (for GNU tar <1.33). Also don't store atime and ctime.
|
|
||||||
"--pax-option", "globexthdr.name=/GlobalHead.%n,exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime"
|
|
||||||
].freeze
|
|
||||||
|
|
||||||
["#{gnu_tar.opt_bin}/gtar", gnutar_args].freeze
|
|
||||||
end
|
|
||||||
|
|
||||||
def formula_ignores(f)
|
def formula_ignores(f)
|
||||||
ignores = []
|
ignores = []
|
||||||
|
@ -2,3 +2,9 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "extend/os/linux/dev-cmd/bottle" if OS.linux?
|
require "extend/os/linux/dev-cmd/bottle" if OS.linux?
|
||||||
|
|
||||||
|
if OS.mac?
|
||||||
|
require "extend/os/mac/dev-cmd/bottle"
|
||||||
|
elsif OS.linux?
|
||||||
|
require "extend/os/linux/dev-cmd/bottle"
|
||||||
|
end
|
||||||
|
@ -7,9 +7,7 @@ module Homebrew
|
|||||||
module_function
|
module_function
|
||||||
|
|
||||||
def setup_tar_and_args!(args, mtime)
|
def setup_tar_and_args!(args, mtime)
|
||||||
# Without --only-json-tab bottles are never reproducible
|
generic_setup_tar_and_args!(args, mtime)
|
||||||
default_tar_args = ["tar", [].freeze].freeze
|
|
||||||
return default_tar_args unless args.only_json_tab?
|
|
||||||
|
|
||||||
# Ensure tar is set up for reproducibility.
|
# Ensure tar is set up for reproducibility.
|
||||||
# https://reproducible-builds.org/docs/archives/
|
# https://reproducible-builds.org/docs/archives/
|
||||||
|
31
Library/Homebrew/extend/os/mac/dev-cmd/bottle.rb
Normal file
31
Library/Homebrew/extend/os/mac/dev-cmd/bottle.rb
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# typed: false
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Homebrew
|
||||||
|
extend T::Sig
|
||||||
|
|
||||||
|
module_function
|
||||||
|
|
||||||
|
def setup_tar_and_args!(args, mtime)
|
||||||
|
generic_setup_tar_and_args!(args, mtime)
|
||||||
|
|
||||||
|
# Use gnu-tar on macOS as it can be set up for reproducibility better than libarchive.
|
||||||
|
begin
|
||||||
|
gnu_tar = Formula["gnu-tar"]
|
||||||
|
rescue FormulaUnavailableError
|
||||||
|
return default_tar_args
|
||||||
|
end
|
||||||
|
|
||||||
|
ensure_formula_installed!(gnu_tar, reason: "bottling")
|
||||||
|
|
||||||
|
# Ensure tar is set up for reproducibility.
|
||||||
|
# https://reproducible-builds.org/docs/archives/
|
||||||
|
gnutar_args = [
|
||||||
|
"--format", "pax", "--owner", "0", "--group", "0", "--sort", "name", "--mtime=#{mtime}",
|
||||||
|
# Set exthdr names to exclude PID (for GNU tar <1.33). Also don't store atime and ctime.
|
||||||
|
"--pax-option", "globexthdr.name=/GlobalHead.%n,exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime"
|
||||||
|
].freeze
|
||||||
|
|
||||||
|
["#{gnu_tar.opt_bin}/gtar", gnutar_args].freeze
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user