commit 0a88a5c3919bb10e0567ddd0e6a7a4b192d3cf18
Author: Nicolas Vigier <boklm(a)torproject.org>
Date: Mon May 16 19:26:26 2016 +0200
Bug 18845: generate reproducible archives without relying on libfaketime
---
gitian/build-helpers/ddmg.sh | 3 +++
gitian/build-helpers/dtar.sh | 3 +++
gitian/build-helpers/dzip.sh | 3 +++
gitian/build-helpers/re-dzip.sh | 2 ++
4 files changed, 11 insertions(+)
diff --git a/gitian/build-helpers/ddmg.sh b/gitian/build-helpers/ddmg.sh
index cb513e8..e36fca9 100755
--- a/gitian/build-helpers/ddmg.sh
+++ b/gitian/build-helpers/ddmg.sh
@@ -11,6 +11,9 @@ shift
find $@ -executable -exec chmod 750 {} \;
find $@ ! -executable -exec chmod 640 {} \;
+[ -n "$REFERENCE_DATETIME" ] && \
+ find $@ -exec touch --date="$REFERENCE_DATETIME" {} \;
+
cd $@
find . -type f | sed -e 's/^\.\///' | sort | xargs -i echo "{}={}" > ~/build/filelist.txt
find . -type l | sed -e 's/^\.\///' | sort | xargs -i echo "{}={}" >> ~/build/filelist.txt
diff --git a/gitian/build-helpers/dtar.sh b/gitian/build-helpers/dtar.sh
index e8ec340..3aa6f0c 100755
--- a/gitian/build-helpers/dtar.sh
+++ b/gitian/build-helpers/dtar.sh
@@ -5,6 +5,9 @@ export LC_ALL=C
TARFILE=$1
shift
+[ -n "$REFERENCE_DATETIME" ] && \
+ find $@ -exec touch --date="$REFERENCE_DATETIME" {} \;
+
# No need to execute chmod on (possibly) dangling symlinks.
find $@ ! -type l -executable -exec chmod 700 {} \;
find $@ ! -type l ! -executable -exec chmod 600 {} \;
diff --git a/gitian/build-helpers/dzip.sh b/gitian/build-helpers/dzip.sh
index 2f7dc54..5772c8b 100755
--- a/gitian/build-helpers/dzip.sh
+++ b/gitian/build-helpers/dzip.sh
@@ -5,6 +5,9 @@ export LC_ALL=C
ZIPFILE=$1
shift
+[ -n "$REFERENCE_DATETIME" ] && \
+ find $@ -exec touch --date="$REFERENCE_DATETIME" {} \;
+
find $@ -executable -exec chmod 700 {} \;
find $@ ! -executable -exec chmod 600 {} \;
diff --git a/gitian/build-helpers/re-dzip.sh b/gitian/build-helpers/re-dzip.sh
index 656e225..27828e9 100755
--- a/gitian/build-helpers/re-dzip.sh
+++ b/gitian/build-helpers/re-dzip.sh
@@ -7,6 +7,8 @@ ZIPFILE=`basename $1`
mkdir tmp_dzip
cd tmp_dzip
unzip ../$1
+[ -n "$REFERENCE_DATETIME" ] && \
+ find . -exec touch --date="$REFERENCE_DATETIME" {} \;
find . -executable -exec chmod 700 {} \;
find . ! -executable -exec chmod 600 {} \;
find . | sort | zip $ZIPOPTS -X -@ $ZIPFILE