From 4fd2c83fb1679e0727902600ea01512a88afb00e Mon Sep 17 00:00:00 2001 From: Alex Domingo Date: Fri, 26 Apr 2024 01:29:16 +0200 Subject: [PATCH 1/2] reset file timestamps in reproducible archives to unix epoch zero --- easybuild/tools/filetools.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/easybuild/tools/filetools.py b/easybuild/tools/filetools.py index 25813b43be..d9a88e9ff7 100644 --- a/easybuild/tools/filetools.py +++ b/easybuild/tools/filetools.py @@ -2680,8 +2680,8 @@ def get_source_tarball_from_git(filename, target_dir, git_config): tar_cmd = [ # print names of all files and folders excluding .git directory 'find', repo_name, '-name ".git"', '-prune', '-o', '-print0', - # reset access and modification timestamps - '-exec', 'touch', '-t 197001010100', '{}', r'\;', '|', + # reset access and modification timestamps to epoch 0 + '-exec', 'touch', '--date=@0', '{}', r'\;', '|', # sort file list 'LC_ALL=C', 'sort', '--zero-terminated', '|', # create tarball in GNU format with ownership reset From c588c780b8530948c119840054a9d0b8694d4564 Mon Sep 17 00:00:00 2001 From: Alex Domingo Date: Fri, 26 Apr 2024 01:49:56 +0200 Subject: [PATCH 2/2] omit irrelevant file permissions in reproducible archives --- easybuild/tools/filetools.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/easybuild/tools/filetools.py b/easybuild/tools/filetools.py index d9a88e9ff7..53ace623aa 100644 --- a/easybuild/tools/filetools.py +++ b/easybuild/tools/filetools.py @@ -2684,9 +2684,9 @@ def get_source_tarball_from_git(filename, target_dir, git_config): '-exec', 'touch', '--date=@0', '{}', r'\;', '|', # sort file list 'LC_ALL=C', 'sort', '--zero-terminated', '|', - # create tarball in GNU format with ownership reset - 'tar', '--create', '--no-recursion', '--owner=0', '--group=0', '--numeric-owner', '--format=gnu', - '--null', '--files-from', '-', '|', + # create tarball in GNU format with ownership and permissions reset + 'tar', '--create', '--no-recursion', '--owner=0', '--group=0', '--numeric-owner', '--mode="go+u,go-w"', + '--format=gnu', '--null', '--files-from', '-', '|', # compress tarball with gzip without original file name and timestamp 'gzip', '--no-name', '>', archive_path ]