[Pkg-mozext-commits] [mozilla-devscripts] 01/02: Use UTC as timezone when calling zip or unzip

Jérémy Bobbio lunar at moszumanska.debian.org
Mon Jun 1 16:23:01 UTC 2015


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch master
in repository mozilla-devscripts.

commit 3ac63335cda3292eb811af54e7d728a239540ef7
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Mon Jun 1 18:09:47 2015 +0200

    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.
---
 install-xpi | 3 +++
 xpi-pack    | 6 +++---
 xpi-unpack  | 4 ++--
 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 ..;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/mozilla-devscripts.git



More information about the Pkg-mozext-commits mailing list