From 6846c9f735e1cee2900c331530e3abbecf615040 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 13 Oct 2023 23:28:11 +0100 Subject: update/release: if *GNU* tar, use --mtime with --mtime, files added to the archive can be set to a static date (in this case, the unix epoch) the one used here is derived from git commit dates, and it is static; if not being handled in lbmk.git, the versiondate file never changes this is the first patch in a series of patches designed to bring about reproducible builds in libreboot a solution will need to be found, for non-GNU tar implementations, because they did not have an equivalent option according to their manpages. for example, BSD tar implementations. perhaps i could systematically go around changing file dates, on each file, as a fallback behaviour? Signed-off-by: Leah Rowe --- script/update/project/release | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'script') diff --git a/script/update/project/release b/script/update/project/release index 519efbcf..69772415 100755 --- a/script/update/project/release +++ b/script/update/project/release @@ -259,8 +259,15 @@ insert_version_files() mktarball() { + # preserve timestamps for reproducible tarballs + tar_implementation="$(tar --version)" + tar_implementation="${tar_implementation% *}" + mtime="" + [ "${tar_implementation}" = "tar (GNU tar)" ] && \ + mtime="--mtime=${versiondate}" + [ "${2%/*}" = "${2}" ] || x_ mkdir -p "${2%/*}" - x_ tar -c "${1}" | xz -T0 -9e > "${2}" + x_ tar -c "${1}" ${mtime} | xz -T0 -9e > "${2}" ( [ "${2%/*}" != "${2}" ] && x_ cd "${2%/*}" x_ sha512sum "${2##*/}" > "${2##*/}.sha512" -- cgit v1.2.1