summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémy Bobbio <lunar@debian.org>2015-06-01 18:09:47 +0200
committerJérémy Bobbio <lunar@debian.org>2015-06-01 18:09:47 +0200
commit3ac63335cda3292eb811af54e7d728a239540ef7 (patch)
treea1ef461e0fd8edf7a0b36a84f85c3b4d86899cbd
parent1419d0226868500f869a42940382970921c56794 (diff)
Use UTC as timezone when calling zip or unzip
Zip standard specify that files are stored with localtime. This unfortunately make the builds vary needlessly when run on different timezone.
-rwxr-xr-xinstall-xpi3
-rwxr-xr-xxpi-pack6
-rwxr-xr-xxpi-unpack4
3 files changed, 8 insertions, 5 deletions
diff --git a/install-xpi b/install-xpi
index 3601038..4e7c674 100755
--- a/install-xpi
+++ b/install-xpi
@@ -156,6 +156,9 @@ def install_xpi(script_name, package, xpi_file, exclude, install_dir, links,
# create directory and extract xpi file
if not os.path.isdir(copy_dir):
os.makedirs(copy_dir)
+ # With unzip, the mtime of created files will depend on the timezone,
+ # which prevents reproducible builds. Let's make it UTC before unzipping.
+ os.environ['TZ'] = 'UTC'
command = ["unzip", "-o", "-d", copy_dir, xpi_file]
if len(exclude) > 0:
command.append("-x")
diff --git a/xpi-pack b/xpi-pack
index 88c0dd4..9f3714a 100755
--- a/xpi-pack
+++ b/xpi-pack
@@ -71,19 +71,19 @@ for JAR_DIR in `find . -type d -name '*.jar\!'` ; do
ABS_CUR_DIR=`pwd`;
cd $ABS_JAR_PATH;
echo "Packing $JAR_FILE";
- zip -q -X -r $ABS_JAR_FILE .;
+ TZ=UTC zip -q -X -r $ABS_JAR_FILE .;
cd $ABS_CUR_DIR;
PACK_JAR_PATHS="$ABS_JAR_FILE $PACK_JAR_PATHS";
rm -rf $ABS_JAR_PATH;
done;
echo "Packing $XPIFILE";
-zip -q -X -r $START_DIR/$XPIFILE * -x debian/\* temp-*/\*;
+TC=UTC zip -q -X -r $START_DIR/$XPIFILE * -x debian/\* temp-*/\*;
[ -f $START_DIR/$XPIFILE ] && XPIDIR=`dirname $START_DIR/$XPIFILE`
ABS_XPIDIR=`cd $XPIDIR; pwd`;
echo "Packed XPI file. It is located in $ABS_XPIDIR";
for JAR_PATH in $PACK_JAR_PATHS ; do
echo "Unpacking and removing $JAR_PATH";
- unzip -q $JAR_PATH -d $JAR_PATH!;
+ TC=UTC unzip -q $JAR_PATH -d $JAR_PATH!;
rm -f $JAR_PATH;
done;
cd $START_DIR;
diff --git a/xpi-unpack b/xpi-unpack
index 6468b15..b4ebf06 100755
--- a/xpi-unpack
+++ b/xpi-unpack
@@ -64,11 +64,11 @@ fi;
mkdir $OUTDIR;
echo "Unpacking $XPIFILE";
-unzip -q $XPIFILE -d $OUTDIR;
+TZ=UTC unzip -q $XPIFILE -d $OUTDIR;
cd $OUTDIR;
for JAR_PATH in `find . -name '*.jar'` ; do
echo "Unpacking $JAR_PATH";
- unzip -q $JAR_PATH -d $JAR_PATH!;
+ TZ=UTC unzip -q $JAR_PATH -d $JAR_PATH!;
rm -f $JAR_PATH;
done;
cd ..;