From a660cb4367952d65e83656a3b621daaf72252ab1 Mon Sep 17 00:00:00 2001 From: gdm85 Date: Wed, 31 Dec 2014 11:20:00 +0100 Subject: [PATCH] Fixes to integrate with new bitcoin core dependency management & cache --- docker/gitian-bitcoin-host/Dockerfile | 2 + .../gitian-bitcoin-host/bin/build-bitcoin.sh | 75 ++++++++++++------- docker/gitian-bitcoin-host/bin/sign.sh | 5 +- docker/gitian-host/Dockerfile | 2 +- 4 files changed, 53 insertions(+), 31 deletions(-) diff --git a/docker/gitian-bitcoin-host/Dockerfile b/docker/gitian-bitcoin-host/Dockerfile index ca8358e..fc0b44a 100644 --- a/docker/gitian-bitcoin-host/Dockerfile +++ b/docker/gitian-bitcoin-host/Dockerfile @@ -7,6 +7,8 @@ FROM gdm85/gitian-host-vms MAINTAINER Giuseppe Mazzotta "gdm85@users.noreply.github.com" +RUN aptitude install make -y + COPY input-sources/ /home/debian/input-sources/ COPY bin/build-bitcoin.sh /home/debian/ COPY bin/sign.sh /home/debian/ diff --git a/docker/gitian-bitcoin-host/bin/build-bitcoin.sh b/docker/gitian-bitcoin-host/bin/build-bitcoin.sh index 0de75ad..159f494 100755 --- a/docker/gitian-bitcoin-host/bin/build-bitcoin.sh +++ b/docker/gitian-bitcoin-host/bin/build-bitcoin.sh @@ -1,7 +1,7 @@ #!/bin/bash ## automatic Gitian build of bitcoin ## @author gdm85 -## @version 0.3.0 +## @version 0.3.1 ## see also https://github.com/gdm85/tenku/blob/master/docker/gitian-bitcoin-host/ ## # @@ -13,33 +13,54 @@ fi VERSION="$1" +CLONE="$HOME/bitcoin" + +function verlte() { + [ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ] +} + +cd gitian-builder && \ +mkdir -p inputs && \ +cd .. || exit $? + if [ ! -d bitcoin ]; then - git clone https://github.com/bitcoin/bitcoin.git || exit $? + git clone https://github.com/bitcoin/bitcoin.git && \ + cd bitcoin && \ + git checkout v$VERSION && \ + cd .. || exit $? fi -cd bitcoin && \ -git checkout v${VERSION} && \ -cd ../gitian-builder && \ -mkdir -p inputs && cd inputs/ || exit $? -## get each dependency -## they are validated afterwards by gbuild -while read -r URL FNAME; do - if [ -z "$URL" ]; then - continue - fi - if [ ! -f $FNAME ]; then - echo "echo 'Downloading $FNAME'" - echo "wget -q --no-check-certificate '$URL' -O '$FNAME' || echo 'Failed to download $FNAME from $URL'" - fi -done < ../../input-sources/${VERSION}-inputs.txt | parallel -j10 || exit $? +## old logic using descriptors +if ! verlte 0.10.0rc1 ${VERSION}; then + cd gitian-builder/inputs || exit $? + ## get each dependency + ## they are validated afterwards by gbuild + while read -r URL FNAME; do + if [ -z "$URL" ]; then + continue + fi + if [ ! -f $FNAME ]; then + echo "echo 'Downloading $FNAME'" + echo "wget -q --no-check-certificate '$URL' -O '$FNAME' || echo 'Failed to download $FNAME from $URL'" + fi + done < ../../input-sources/${VERSION}-inputs.txt | parallel -j10 || exit $? -## verify that all sources are correct before continuing -md5sum -c < ../../input-sources/${VERSION}-inputs.md5 && \ -cd .. && \ -for DESC in $(<../input-sources/${VERSION}-descriptors.txt); do - ./bin/gbuild ../bitcoin/contrib/gitian-descriptors/${DESC}.yml && \ - mv -v $(find build/out -type f -name '*gz' -o -name '*.zip') inputs/ || exit $? -done && \ -./bin/gbuild --commit bitcoin=v${VERSION} ../bitcoin/contrib/gitian-descriptors/gitian-linux.yml && \ -echo "Completed successfully." && \ -echo "The output files are in: gitian-builder/build/out/" + ## verify that all sources are correct before continuing + md5sum -c < ../../input-sources/${VERSION}-inputs.md5 && \ + DESCRIPTORS="$(<../input-sources/${VERSION}-descriptors.txt)" && \ + cd .. || exit $? + + for DESC in $DESCRIPTORS; do + ./bin/gbuild ../bitcoin/contrib/gitian-descriptors/${DESC}.yml && \ + mv -v $(find build/out -type f -name '*gz' -o -name '*.zip') inputs/ || exit $? + done +else + cd bitcoin/depends && \ + make download-linux SOURCES_PATH="$HOME/gitian-builder/cache/common" && \ + cd ../.. || exit $? +fi + +## proceed to build +cd gitian-builder && \ +./bin/gbuild -u bitcoin=$CLONE $CLONE/contrib/gitian-descriptors/gitian-linux.yml && \ +echo "Build completed successfully, output files are in: ~/gitian-builder/build/out/" diff --git a/docker/gitian-bitcoin-host/bin/sign.sh b/docker/gitian-bitcoin-host/bin/sign.sh index 2086967..a661c4b 100755 --- a/docker/gitian-bitcoin-host/bin/sign.sh +++ b/docker/gitian-bitcoin-host/bin/sign.sh @@ -1,5 +1,4 @@ --#!/bin/bash -set -e +#!/bin/bash if [[ ! $# -eq 2 ]]; then echo "Please specify version and signer id" 1>&2 @@ -9,5 +8,5 @@ fi VERSION="$1" SIGNER="$2" -cd gitian-builder +cd gitian-builder && \ ./bin/gsign --signer $SIGNER --release ${VERSION} --destination ../gitian.sigs/ ../bitcoin/contrib/gitian-descriptors/gitian-linux.yml diff --git a/docker/gitian-host/Dockerfile b/docker/gitian-host/Dockerfile index 3ca4609..689bbb0 100644 --- a/docker/gitian-host/Dockerfile +++ b/docker/gitian-host/Dockerfile @@ -56,7 +56,7 @@ COPY bash_profile /home/debian/.bash_profile ## script used to build base VMs COPY bin/build-base-vms.sh /home/debian/ -RUN git clone https://github.com/devrandom/gitian-builder.git && cd gitian-builder && git checkout ffd04a46a2b3c1277937c939cdb151fcf0eac613 +RUN git clone https://github.com/devrandom/gitian-builder.git && cd gitian-builder && git checkout 2bcc06e6b75b3f7a0167cde7237331757dd559c6 COPY gitian.patch /home/debian/