From c43d1e5549f548efd221043bbc8069700ee22183 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 4 Feb 2014 15:30:48 +0100 Subject: [PATCH] gitian: Make windows dependencies outputs fully deterministic Sort .zip order, and other determinism changes to make sure builds are repeatable for windows deps. --- contrib/gitian-descriptors/boost-win.yml | 10 ++++------ contrib/gitian-descriptors/deps-win.yml | 6 ++++-- contrib/gitian-descriptors/protobuf-win.yml | 6 +++--- contrib/gitian-descriptors/qt-win.yml | 17 +++++------------ 4 files changed, 16 insertions(+), 23 deletions(-) diff --git a/contrib/gitian-descriptors/boost-win.yml b/contrib/gitian-descriptors/boost-win.yml index 15aeccf54..420a7ce76 100644 --- a/contrib/gitian-descriptors/boost-win.yml +++ b/contrib/gitian-descriptors/boost-win.yml @@ -16,6 +16,8 @@ files: - "boost-mingw-gas-cross-compile-2013-03-03.patch" script: | # Defines + export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 + export FAKETIME=$REFERENCE_DATETIME export TZ=UTC INDIR=$HOME/build # Input Integrity Check @@ -35,7 +37,7 @@ script: | mkdir -p $INSTALLPREFIX $BUILDDIR cd $BUILDDIR # - tar xjf $INDIR/boost_1_55_0.tar.bz2 + tar --warning=no-timestamp -xjf $INDIR/boost_1_55_0.tar.bz2 cd boost_1_55_0 GCCVERSION=$($HOST-g++ -E -dM $(mktemp --suffix=.h) | grep __VERSION__ | cut -d ' ' -f 3 | cut -d '"' -f 2) echo "using gcc : $GCCVERSION : $HOST-g++ @@ -70,10 +72,6 @@ script: | ./bjam toolset=gcc binary-format=pe target-os=windows threadapi=win32 address-model=$BITS threading=multi variant=release link=static runtime-link=static --user-config=user-config.jam --without-mpi --without-python -sNO_BZIP2=1 -sNO_ZLIB=1 --layout=tagged --build-type=complete --prefix="$INSTALLPREFIX" $MAKEOPTS install # cd "$INSTALLPREFIX" - export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 - export FAKETIME=$REFERENCE_DATETIME - zip -r $OUTDIR/boost-win$BITS-1.55.0-gitian-r6.zip * - unset LD_PRELOAD - unset FAKETIME + find | sort | zip -@ $OUTDIR/boost-win$BITS-1.55.0-gitian-r6.zip done # for BITS in diff --git a/contrib/gitian-descriptors/deps-win.yml b/contrib/gitian-descriptors/deps-win.yml index 13d3a86fd..ef0f8f331 100644 --- a/contrib/gitian-descriptors/deps-win.yml +++ b/contrib/gitian-descriptors/deps-win.yml @@ -107,11 +107,13 @@ script: | # tar xjf $INDIR/qrencode-3.4.3.tar.bz2 cd qrencode-3.4.3 - png_CFLAGS="-I$INSTALLPREFIX/include" png_LIBS="-L$INSTALLPREFIX/lib -lpng" ./configure --prefix=$INSTALLPREFIX --host=$HOST --enable-static --disable-shared --without-tools --disable-maintainer-mode --disable-dependency-tracking + png_CFLAGS="-I$INSTALLPREFIX/include" png_LIBS="-L$INSTALLPREFIX/lib -lpng" ./configure --prefix=$INSTALLPREFIX --host=$HOST --enable-static --disable-shared --without-tools --disable-dependency-tracking + # Workaround to prevent re-configuring by make (resulting in missing m4 error); make all files have a date in the past + find . -print0 | xargs -r0 touch -t 200001010000 make make install cd .. # cd $INSTALLPREFIX - zip -r $OUTDIR/bitcoin-deps-win$BITS-gitian-r10.zip include lib + find include lib | sort | zip -@ $OUTDIR/bitcoin-deps-win$BITS-gitian-r10.zip done # for BITS in diff --git a/contrib/gitian-descriptors/protobuf-win.yml b/contrib/gitian-descriptors/protobuf-win.yml index 7fcac72fe..11dd50de1 100644 --- a/contrib/gitian-descriptors/protobuf-win.yml +++ b/contrib/gitian-descriptors/protobuf-win.yml @@ -44,13 +44,13 @@ script: | # Now recompile with the mingw cross-compiler: make distclean ./configure --prefix=$INSTALLPREFIX --enable-shared=no --disable-dependency-tracking --with-protoc=$INSTALLPREFIX/host/bin/protoc --host=$HOST CXXFLAGS="-frandom-seed=11 ${OPTFLAGS}" + export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 + export FAKETIME=$REFERENCE_DATETIME make make install # cd $INSTALLPREFIX - export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 - export FAKETIME=$REFERENCE_DATETIME - zip -r $OUTDIR/protobuf-win$BITS-2.5.0-gitian-r4.zip include lib host + find include lib host | sort | zip -@ $OUTDIR/protobuf-win$BITS-2.5.0-gitian-r4.zip unset LD_PRELOAD unset FAKETIME done # for BITS in diff --git a/contrib/gitian-descriptors/qt-win.yml b/contrib/gitian-descriptors/qt-win.yml index fed39cbc7..0352f4ff9 100644 --- a/contrib/gitian-descriptors/qt-win.yml +++ b/contrib/gitian-descriptors/qt-win.yml @@ -55,18 +55,9 @@ script: | cd qt-everywhere-opensource-src-5.2.0 SPECNAME="win32-g++" SPECFILE="qtbase/mkspecs/${SPECNAME}/qmake.conf" - sed 's/$TODAY/2011-01-30/' -i configure + sed 's/qt_instdate=`date +%Y-%m-%d`/qt_instdate=2011-01-30/' -i qtbase/configure sed --posix "s|QMAKE_CFLAGS = -pipe -fno-keep-inline-dllexport|QMAKE_CFLAGS\t\t= -pipe -fno-keep-inline-dllexport -isystem /usr/$HOST/include/ -frandom-seed=qtbuild -I$DEPSDIR/include|" -i ${SPECFILE} sed --posix "s|QMAKE_LFLAGS =|QMAKE_LFLAGS\t\t= -L$DEPSDIR/lib|" -i ${SPECFILE} - # ar adds timestamps to every object file included in the static library - # providing -D as ar argument is supposed to solve it, but doesn't work as qmake strips off the arguments and adds -M to pass a script... - # which somehow cannot be combined with other flags. - # use faketime only for ar, as it confuses make/qmake into hanging sometimes - sed --posix "s|QMAKE_LIB = \\\$\\\${CROSS_COMPILE}ar -ru|QMAKE_LIB\t\t= $HOME/ar -Dr|" -i ${SPECFILE} - echo '#!/bin/bash' > $HOME/ar - echo 'export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1' >> $HOME/ar - echo "$HOST-ar \"\$@\"" >> $HOME/ar - chmod +x $HOME/ar # Don't load faketime while compiling Qt, qmake will get stuck in nearly infinite loops #export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 export FAKETIME=$REFERENCE_DATETIME @@ -76,10 +67,12 @@ script: | make $MAKEOPTS install # cd $INSTALLPREFIX - + # Remove unused non-deterministic stuff + rm host/bin/qtpaths.exe lib/libQt5Bootstrap.a lib/libQt5Bootstrap.la # as zip stores file timestamps, use faketime to intercept stat calls to set dates for all files to reference date export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 - zip -r $OUTDIR/qt-win${BITS}-5.2.0-gitian-r2.zip * + find -print0 | xargs -r0 touch # fix up timestamps before packaging + find | sort | zip -@ $OUTDIR/qt-win${BITS}-5.2.0-gitian-r2.zip unset LD_PRELOAD unset FAKETIME done # for BITS in