[6/7,mkarchiso] Force all ISO timestamps to SOURCE_DATE_EPOCH if present

Message ID 20190907112240.1028433-7-git@esotericnonsense.com
State New
Headers show
Series Making archiso deterministic | expand

Commit Message

Daniel Edgecumbe Sept. 7, 2019, 11:22 a.m. UTC
xorrisofs respects SOURCE_DATE_EPOCH but only for its' own
generated fields. We need to replace all other timestamps.

Motivation: https://reproducible-builds.org

Signed-off-by: Daniel Edgecumbe <git@esotericnonsense.com>
---
 archiso/mkarchiso | 5 +++++
 1 file changed, 5 insertions(+)

Patch

diff --git a/archiso/mkarchiso b/archiso/mkarchiso
index 383a967..59fa9c4 100755
--- a/archiso/mkarchiso
+++ b/archiso/mkarchiso
@@ -307,7 +307,12 @@  command_iso () {
     if [[ ${quiet} == "y" ]]; then
         _qflag="-quiet"
     fi
+    local _rflag=""
+    if [[ ${SOURCE_DATE_EPOCH:-} ]]; then
+        _rflag="--set_all_file_dates $(date --utc --date="@${SOURCE_DATE_EPOCH}" +%Y%m%d%H%m%S00)"
+    fi
     xorriso -as mkisofs ${_qflag} \
+        ${_rflag} \
         -iso-level 3 \
         -full-iso9660-filenames \
         -volid "${iso_label}" \