From 4a0b860973a8f7224429943050864ebd61b53331 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 16 Apr 2021 14:04:49 +0100 Subject: [PATCH] dev-cmd/bottle: improve reproducibility, comment. Setting a consistent owner/group results in more consistent bottles. --- Library/Homebrew/dev-cmd/bottle.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/bottle.rb b/Library/Homebrew/dev-cmd/bottle.rb index a2c2a4f0bb..a9e75c6034 100644 --- a/Library/Homebrew/dev-cmd/bottle.rb +++ b/Library/Homebrew/dev-cmd/bottle.rb @@ -377,6 +377,7 @@ module Homebrew end keg.find do |file| + # Set the times for reproducible bottles. if file.symlink? File.lutime(tab.source_modified_time, tab.source_modified_time, file) else @@ -386,8 +387,11 @@ module Homebrew cd cellar do sudo_purge - safe_system "tar", "cf", tar_path, "#{f.name}/#{f.pkg_version}" + # Unset the owner/group for reproducible bottles. + # Tar then gzip for reproducible bottles. + safe_system "tar", "--create", "--numeric-owner", "--file", tar_path, "#{f.name}/#{f.pkg_version}" sudo_purge + # Set more times for reproducible bottles. tar_path.utime(tab.source_modified_time, tab.source_modified_time) relocatable_tar_path = "#{f}-bottle.tar" mv tar_path, relocatable_tar_path