From dff7e526a60eb15985304b20e89ef05735c654a3 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 13 Nov 2019 14:23:31 +0000 Subject: [PATCH] Use standard time for depends caches streamline, remove obsolete wrappers --- contrib/gitian/gitian-android.yml | 10 +++--- contrib/gitian/gitian-freebsd.yml | 14 ++++----- contrib/gitian/gitian-linux.yml | 51 +++++++++++++++---------------- contrib/gitian/gitian-osx.yml | 3 +- contrib/gitian/gitian-win.yml | 47 ++++++++++++---------------- 5 files changed, 59 insertions(+), 66 deletions(-) diff --git a/contrib/gitian/gitian-android.yml b/contrib/gitian/gitian-android.yml index bade0475f..02614b1a5 100644 --- a/contrib/gitian/gitian-android.yml +++ b/contrib/gitian/gitian-android.yml @@ -46,7 +46,6 @@ script: | HOST_LDFLAGS=-static-libstdc++ export GZIP="-9n" - export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME"" export TZ="UTC" export BUILD_DIR=`pwd` mkdir -p ${WRAP_DIR} @@ -89,14 +88,13 @@ script: | } # Faketime for depends so intermediate results are comparable - DUMMYTIME="2000-01-01 12:00:00" export PATH_orig=${PATH} - create_global_faketime_wrappers "$DUMMYTIME" - create_per-host_faketime_wrappers "$DUMMYTIME" + create_global_faketime_wrappers "2000-01-01 12:00:00" + create_per-host_faketime_wrappers "2000-01-01 12:00:00" export PATH=${WRAP_DIR}:${PATH} # gcc 7+ honors SOURCE_DATE_EPOCH, no faketime needed - export SOURCE_DATE_EPOCH=`date -d "$DUMMYTIME" +%s` + export SOURCE_DATE_EPOCH=`date -d 2000-01-01T12:00:00 +%s` git config --global core.abbrev 9 cd monero @@ -109,6 +107,7 @@ script: | BASEPREFIX=`pwd`/contrib/depends # Build dependencies for each host + export TAR_OPTIONS=--mtime=2000-01-01T12:00:00 for i in $HOSTS; do make ${MAKEOPTS} -C ${BASEPREFIX} HOST="${i}" done @@ -119,6 +118,7 @@ script: | create_per-host_faketime_wrappers "${REFERENCE_DATETIME}" # Build in a new dir for each host + export TAR_OPTIONS=--mtime=${REFERENCE_DATE}T${REFERENCE_TIME} for i in ${HOSTS}; do export PATH=${WRAP_DIR}:${BASEPREFIX}/${i}/native/bin:${PATH_orig} mkdir build && cd build diff --git a/contrib/gitian/gitian-freebsd.yml b/contrib/gitian/gitian-freebsd.yml index 3402a2b6c..0220b82a5 100644 --- a/contrib/gitian/gitian-freebsd.yml +++ b/contrib/gitian/gitian-freebsd.yml @@ -8,7 +8,6 @@ architectures: packages: - "curl" - "clang-8" -- "llvm-8" - "gperf" - "gcc-7" - "g++-7" @@ -41,13 +40,12 @@ script: | WRAP_DIR=$HOME/wrapped HOSTS="x86_64-unknown-freebsd" FAKETIME_HOST_PROGS="" - FAKETIME_PROGS="clang-8 clang++-8 llvm-ar-8 llvm-ranlib-8 date" + FAKETIME_PROGS="clang-8 clang++-8 date" HOST_CFLAGS="-O2 -g" HOST_CXXFLAGS="-O2 -g" HOST_LDFLAGS=-static-libstdc++ export GZIP="-9n" - export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME"" export TZ="UTC" export BUILD_DIR=`pwd` mkdir -p ${WRAP_DIR} @@ -85,14 +83,13 @@ script: | } # Faketime for depends so intermediate results are comparable - DUMMYTIME="2000-01-01 12:00:00" export PATH_orig=${PATH} - create_global_faketime_wrappers "$DUMMYTIME" - create_per-host_faketime_wrappers "$DUMMYTIME" + create_global_faketime_wrappers "2000-01-01 12:00:00" + create_per-host_faketime_wrappers "2000-01-01 12:00:00" export PATH=${WRAP_DIR}:${PATH} # gcc 7+ honors SOURCE_DATE_EPOCH, no faketime needed - export SOURCE_DATE_EPOCH=`date -d "$DUMMYTIME" +%s` + export SOURCE_DATE_EPOCH=`date -d 2000-01-01T12:00:00 +%s` git config --global core.abbrev 9 cd monero @@ -105,6 +102,7 @@ script: | BASEPREFIX=`pwd`/contrib/depends # Build dependencies for each host + export TAR_OPTIONS=--mtime=2000-01-01T12:00:00 for i in $HOSTS; do make ${MAKEOPTS} -C ${BASEPREFIX} HOST="${i}" done @@ -116,6 +114,8 @@ script: | ORIGPATH="$PATH" # Build in a new dir for each host + export SOURCE_DATE_EPOCH=`date -d ${REFERENCE_DATE}T${REFERENCE_TIME} +%s` + export TAR_OPTIONS=--mtime=${REFERENCE_DATE}T${REFERENCE_TIME} for i in ${HOSTS}; do export PATH=${WRAP_DIR}:${BASEPREFIX}/${i}/native/bin:${ORIGPATH} mkdir build && cd build diff --git a/contrib/gitian/gitian-linux.yml b/contrib/gitian/gitian-linux.yml index d2124e45c..9c2ebac9b 100644 --- a/contrib/gitian/gitian-linux.yml +++ b/contrib/gitian/gitian-linux.yml @@ -50,14 +50,13 @@ script: | WRAP_DIR=$HOME/wrapped HOSTS="x86_64-linux-gnu arm-linux-gnueabihf aarch64-linux-gnu i686-linux-gnu" - FAKETIME_HOST_PROGS="gcc g++" - FAKETIME_PROGS="date ar ranlib nm" + FAKETIME_HOST_PROGS="" + FAKETIME_PROGS="date" HOST_CFLAGS="-O2 -g" HOST_CXXFLAGS="-O2 -g" HOST_LDFLAGS=-static-libstdc++ export GZIP="-9n" - export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME"" export TZ="UTC" export BUILD_DIR=`pwd` mkdir -p ${WRAP_DIR} @@ -105,29 +104,15 @@ script: | # x86 needs /usr/include/i386-linux-gnu/asm pointed to /usr/include/x86_64-linux-gnu/asm, # but we can't write there. Instead, create a link here and force it to be included in the - # search paths by wrapping gcc/g++. + # search paths. + # This problem goes away if linux-libc-dev:i386 pkg exists, but it's not in bionic. - mkdir -p $EXTRA_INCLUDES_BASE/i686-pc-linux-gnu - rm -f $WRAP_DIR/extra_includes/i686-pc-linux-gnu/asm - ln -s /usr/include/x86_64-linux-gnu/asm $EXTRA_INCLUDES_BASE/i686-pc-linux-gnu/asm + mkdir -p $EXTRA_INCLUDES_BASE/i686-linux-gnu + rm -f $WRAP_DIR/extra_includes/i686-linux-gnu/asm + ln -s /usr/include/x86_64-linux-gnu/asm $EXTRA_INCLUDES_BASE/i686-linux-gnu/asm - for prog in gcc g++; do - rm -f ${WRAP_DIR}/${prog} - cat << EOF > ${WRAP_DIR}/${prog} - #!/usr/bin/env bash - REAL="`which -a ${prog}-7 | grep -v ${WRAP_DIR}/${prog} | head -1`" - for var in "\$@" - do - if [ "\$var" = "-m32" ]; then - export C_INCLUDE_PATH="$EXTRA_INCLUDES_BASE/i686-pc-linux-gnu" - export CPLUS_INCLUDE_PATH="$EXTRA_INCLUDES_BASE/i686-pc-linux-gnu" - break - fi - done - \$REAL \$@ - EOF - chmod +x ${WRAP_DIR}/${prog} - done + # gcc 7+ honors SOURCE_DATE_EPOCH, no faketime needed + export SOURCE_DATE_EPOCH=`date -d 2000-01-01T12:00:00 +%s` git config --global core.abbrev 9 cd monero @@ -140,13 +125,17 @@ script: | BASEPREFIX=`pwd`/contrib/depends # Build dependencies for each host + export TAR_OPTIONS=--mtime=2000-01-01T12:00:00 for i in $HOSTS; do EXTRA_INCLUDES="$EXTRA_INCLUDES_BASE/$i" if [ -d "$EXTRA_INCLUDES" ]; then - export HOST_ID_SALT="$EXTRA_INCLUDES" + export C_INCLUDE_PATH="$EXTRA_INCLUDES" + export CPLUS_INCLUDE_PATH="$EXTRA_INCLUDES" + else + unset C_INCLUDE_PATH + unset CPLUS_INCLUDE_PATH fi make ${MAKEOPTS} -C ${BASEPREFIX} HOST="${i}" V=1 - unset HOST_ID_SALT done # Faketime for binaries @@ -157,9 +146,19 @@ script: | ORIGPATH="$PATH" # Build in a new dir for each host + export SOURCE_DATE_EPOCH=`date -d ${REFERENCE_DATE}T${REFERENCE_TIME} +%s` + export TAR_OPTIONS=--mtime=${REFERENCE_DATE}T${REFERENCE_TIME} for i in ${HOSTS}; do export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH} mkdir build && cd build + EXTRA_INCLUDES="$EXTRA_INCLUDES_BASE/$i" + if [ -d "$EXTRA_INCLUDES" ]; then + export C_INCLUDE_PATH="$EXTRA_INCLUDES" + export CPLUS_INCLUDE_PATH="$EXTRA_INCLUDES" + else + unset C_INCLUDE_PATH + unset CPLUS_INCLUDE_PATH + fi cmake .. -DCMAKE_TOOLCHAIN_FILE=${BASEPREFIX}/${i}/share/toolchain.cmake -DBACKCOMPAT=ON make ${MAKEOPTS} chmod 755 bin/* diff --git a/contrib/gitian/gitian-osx.yml b/contrib/gitian/gitian-osx.yml index 1f9928bb5..62913cb3e 100644 --- a/contrib/gitian/gitian-osx.yml +++ b/contrib/gitian/gitian-osx.yml @@ -35,7 +35,6 @@ script: | FAKETIME_PROGS="ar ranlib date dmg genisoimage" export GZIP="-9n" - export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME"" export TZ="UTC" export BUILD_DIR=`pwd` mkdir -p ${WRAP_DIR} @@ -92,6 +91,7 @@ script: | tar -C ${BASEPREFIX}/SDKs -xf ${BUILD_DIR}/MacOSX10.11.sdk.tar.gz # Build dependencies for each host + export TAR_OPTIONS=--mtime=2000-01-01T12:00:00 for i in $HOSTS; do make ${MAKEOPTS} -C ${BASEPREFIX} HOST="${i}" done @@ -104,6 +104,7 @@ script: | ORIGPATH="$PATH" # Build in a new dir for each host + export TAR_OPTIONS=--mtime=${REFERENCE_DATE}T${REFERENCE_TIME} for i in ${HOSTS}; do export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH} mkdir build && cd build diff --git a/contrib/gitian/gitian-win.yml b/contrib/gitian/gitian-win.yml index 7bfb14a95..bd85695c1 100644 --- a/contrib/gitian/gitian-win.yml +++ b/contrib/gitian/gitian-win.yml @@ -22,6 +22,19 @@ packages: - "python" - "rename" - "cmake" +alternatives: +- + package: "i686-w64-mingw32-g++" + path: "/usr/bin/i686-w64-mingw32-g++-posix" +- + package: "i686-w64-mingw32-gcc" + path: "/usr/bin/i686-w64-mingw32-gcc-posix" +- + package: "x86_64-w64-mingw32-g++" + path: "/usr/bin/x86_64-w64-mingw32-g++-posix" +- + package: "x86_64-w64-mingw32-gcc" + path: "/usr/bin/x86_64-w64-mingw32-gcc-posix" remotes: - "url": "https://github.com/monero-project/monero.git" "dir": "monero" @@ -29,13 +42,12 @@ files: [] script: | WRAP_DIR=$HOME/wrapped HOSTS="i686-w64-mingw32 x86_64-w64-mingw32" - FAKETIME_HOST_PROGS="ar ranlib nm windres strip objcopy" + FAKETIME_HOST_PROGS="windres objcopy" FAKETIME_PROGS="date zip" HOST_CFLAGS="-O2 -g" HOST_CXXFLAGS="-O2 -g" export GZIP="-9n" - export TAR_OPTIONS="--mtime="$REFERENCE_DATE\\\ $REFERENCE_TIME"" export TZ="UTC" export BUILD_DIR=`pwd` mkdir -p ${WRAP_DIR} @@ -69,37 +81,15 @@ script: | done } - function create_per-host_linker_wrapper { - # This is only needed for trusty, as the mingw linker leaks a few bytes of - # heap, causing non-determinism. See discussion in https://github.com/bitcoin/bitcoin/pull/6900 - for i in $HOSTS; do - mkdir -p ${WRAP_DIR}/${i} - for prog in collect2; do - echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${i}/${prog} - REAL=$(${i}-gcc -print-prog-name=${prog}) - echo "export MALLOC_PERTURB_=255" >> ${WRAP_DIR}/${i}/${prog} - echo "${REAL} \$@" >> $WRAP_DIR/${i}/${prog} - chmod +x ${WRAP_DIR}/${i}/${prog} - done - for prog in gcc g++; do - echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${i}-${prog} - echo "REAL=\`which -a ${i}-${prog}-posix | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog} - echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog} - echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog} - echo "export COMPILER_PATH=${WRAP_DIR}/${i}" >> ${WRAP_DIR}/${i}-${prog} - echo "\$REAL \$@" >> $WRAP_DIR/${i}-${prog} - chmod +x ${WRAP_DIR}/${i}-${prog} - done - done - } - # Faketime for depends so intermediate results are comparable export PATH_orig=${PATH} create_global_faketime_wrappers "2000-01-01 12:00:00" create_per-host_faketime_wrappers "2000-01-01 12:00:00" - create_per-host_linker_wrapper "2000-01-01 12:00:00" export PATH=${WRAP_DIR}:${PATH} + # gcc 7+ honors SOURCE_DATE_EPOCH, no faketime needed + export SOURCE_DATE_EPOCH=`date -d 2000-01-01T12:00:00 +%s` + git config --global core.abbrev 9 cd monero # Set the version string that gets added to the tar archive name @@ -111,6 +101,7 @@ script: | BASEPREFIX=`pwd`/contrib/depends # Build dependencies for each host + export TAR_OPTIONS=--mtime=2000-01-01T12:00:00 for i in $HOSTS; do EXTRA_INCLUDES="$EXTRA_INCLUDES_BASE/$i" if [ -d "$EXTRA_INCLUDES" ]; then @@ -129,6 +120,8 @@ script: | ORIGPATH="$PATH" # Run cmake and make, for each create a new build/ directory, # compile from there, archive, export and delete the archive again + export SOURCE_DATE_EPOCH=`date -d ${REFERENCE_DATE}T${REFERENCE_TIME} +%s` + export TAR_OPTIONS=--mtime=${REFERENCE_DATE}T${REFERENCE_TIME} for i in ${HOSTS}; do export PATH=${BASEPREFIX}/${i}/native/bin:${ORIGPATH} mkdir build && cd build