add new method: gnutar_args

This commit is contained in:
hyuraku 2023-02-07 19:17:00 +09:00
parent ec1a1566bc
commit ade7118057
3 changed files with 12 additions and 18 deletions

View File

@ -242,6 +242,16 @@ module Homebrew
alias generic_setup_tar_and_args! setup_tar_and_args!
def gnutar_args(mtime)
# Ensure tar is set up for reproducibility.
# https://reproducible-builds.org/docs/archives/
[
"--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
end
def formula_ignores(f)
ignores = []
cellar_regex = Regexp.escape(HOMEBREW_CELLAR)

View File

@ -9,15 +9,7 @@ module Homebrew
def setup_tar_and_args!(args, mtime)
generic_setup_tar_and_args!(args, mtime)
# 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
["tar", gnutar_args].freeze
["tar", gnutar_args(mtime)].freeze
end
def formula_ignores(f)

View File

@ -18,14 +18,6 @@ module Homebrew
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
["#{gnu_tar.opt_bin}/gtar", gnutar_args(mtime)].freeze
end
end