Skip to content

Commit c43d1e5

Browse files
committed
gitian: Make windows dependencies outputs fully deterministic
Sort .zip order, and other determinism changes to make sure builds are repeatable for windows deps.
1 parent 23617fd commit c43d1e5

File tree

4 files changed

+16
-23
lines changed

4 files changed

+16
-23
lines changed

contrib/gitian-descriptors/boost-win.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ files:
1616
- "boost-mingw-gas-cross-compile-2013-03-03.patch"
1717
script: |
1818
# Defines
19+
export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
20+
export FAKETIME=$REFERENCE_DATETIME
1921
export TZ=UTC
2022
INDIR=$HOME/build
2123
# Input Integrity Check
@@ -35,7 +37,7 @@ script: |
3537
mkdir -p $INSTALLPREFIX $BUILDDIR
3638
cd $BUILDDIR
3739
#
38-
tar xjf $INDIR/boost_1_55_0.tar.bz2
40+
tar --warning=no-timestamp -xjf $INDIR/boost_1_55_0.tar.bz2
3941
cd boost_1_55_0
4042
GCCVERSION=$($HOST-g++ -E -dM $(mktemp --suffix=.h) | grep __VERSION__ | cut -d ' ' -f 3 | cut -d '"' -f 2)
4143
echo "using gcc : $GCCVERSION : $HOST-g++
@@ -70,10 +72,6 @@ script: |
7072
./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
7173
#
7274
cd "$INSTALLPREFIX"
73-
export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
74-
export FAKETIME=$REFERENCE_DATETIME
75-
zip -r $OUTDIR/boost-win$BITS-1.55.0-gitian-r6.zip *
76-
unset LD_PRELOAD
77-
unset FAKETIME
75+
find | sort | zip -@ $OUTDIR/boost-win$BITS-1.55.0-gitian-r6.zip
7876
done # for BITS in
7977

contrib/gitian-descriptors/deps-win.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,13 @@ script: |
107107
#
108108
tar xjf $INDIR/qrencode-3.4.3.tar.bz2
109109
cd qrencode-3.4.3
110-
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
110+
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
111+
# Workaround to prevent re-configuring by make (resulting in missing m4 error); make all files have a date in the past
112+
find . -print0 | xargs -r0 touch -t 200001010000
111113
make
112114
make install
113115
cd ..
114116
#
115117
cd $INSTALLPREFIX
116-
zip -r $OUTDIR/bitcoin-deps-win$BITS-gitian-r10.zip include lib
118+
find include lib | sort | zip -@ $OUTDIR/bitcoin-deps-win$BITS-gitian-r10.zip
117119
done # for BITS in

contrib/gitian-descriptors/protobuf-win.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ script: |
4444
# Now recompile with the mingw cross-compiler:
4545
make distclean
4646
./configure --prefix=$INSTALLPREFIX --enable-shared=no --disable-dependency-tracking --with-protoc=$INSTALLPREFIX/host/bin/protoc --host=$HOST CXXFLAGS="-frandom-seed=11 ${OPTFLAGS}"
47+
export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
48+
export FAKETIME=$REFERENCE_DATETIME
4749
make
4850
make install
4951
#
5052
cd $INSTALLPREFIX
51-
export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
52-
export FAKETIME=$REFERENCE_DATETIME
53-
zip -r $OUTDIR/protobuf-win$BITS-2.5.0-gitian-r4.zip include lib host
53+
find include lib host | sort | zip -@ $OUTDIR/protobuf-win$BITS-2.5.0-gitian-r4.zip
5454
unset LD_PRELOAD
5555
unset FAKETIME
5656
done # for BITS in

contrib/gitian-descriptors/qt-win.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,9 @@ script: |
5555
cd qt-everywhere-opensource-src-5.2.0
5656
SPECNAME="win32-g++"
5757
SPECFILE="qtbase/mkspecs/${SPECNAME}/qmake.conf"
58-
sed 's/$TODAY/2011-01-30/' -i configure
58+
sed 's/qt_instdate=`date +%Y-%m-%d`/qt_instdate=2011-01-30/' -i qtbase/configure
5959
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}
6060
sed --posix "s|QMAKE_LFLAGS =|QMAKE_LFLAGS\t\t= -L$DEPSDIR/lib|" -i ${SPECFILE}
61-
# ar adds timestamps to every object file included in the static library
62-
# 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...
63-
# which somehow cannot be combined with other flags.
64-
# use faketime only for ar, as it confuses make/qmake into hanging sometimes
65-
sed --posix "s|QMAKE_LIB = \\\$\\\${CROSS_COMPILE}ar -ru|QMAKE_LIB\t\t= $HOME/ar -Dr|" -i ${SPECFILE}
66-
echo '#!/bin/bash' > $HOME/ar
67-
echo 'export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1' >> $HOME/ar
68-
echo "$HOST-ar \"\$@\"" >> $HOME/ar
69-
chmod +x $HOME/ar
7061
# Don't load faketime while compiling Qt, qmake will get stuck in nearly infinite loops
7162
#export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
7263
export FAKETIME=$REFERENCE_DATETIME
@@ -76,10 +67,12 @@ script: |
7667
make $MAKEOPTS install
7768
#
7869
cd $INSTALLPREFIX
79-
70+
# Remove unused non-deterministic stuff
71+
rm host/bin/qtpaths.exe lib/libQt5Bootstrap.a lib/libQt5Bootstrap.la
8072
# as zip stores file timestamps, use faketime to intercept stat calls to set dates for all files to reference date
8173
export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1
82-
zip -r $OUTDIR/qt-win${BITS}-5.2.0-gitian-r2.zip *
74+
find -print0 | xargs -r0 touch # fix up timestamps before packaging
75+
find | sort | zip -@ $OUTDIR/qt-win${BITS}-5.2.0-gitian-r2.zip
8376
unset LD_PRELOAD
8477
unset FAKETIME
8578
done # for BITS in

0 commit comments

Comments
 (0)