summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-10-13 23:28:11 +0100
committerLeah Rowe <leah@libreboot.org>2023-10-13 23:29:22 +0100
commit6846c9f735e1cee2900c331530e3abbecf615040 (patch)
tree511e551e5a32866ae8bdfdf35314ef95dba05a8c /script
parentc401efdd0371aee733c8672a645baab49b3e3b86 (diff)
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 <leah@libreboot.org>
Diffstat (limited to 'script')
-rwxr-xr-xscript/update/project/release9
1 files changed, 8 insertions, 1 deletions
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"