diff --git a/docker/gitian-bitcoin-host/Dockerfile b/docker/gitian-bitcoin-host/Dockerfile index 77fdaf5..ca8358e 100644 --- a/docker/gitian-bitcoin-host/Dockerfile +++ b/docker/gitian-bitcoin-host/Dockerfile @@ -7,9 +7,9 @@ FROM gdm85/gitian-host-vms MAINTAINER Giuseppe Mazzotta "gdm85@users.noreply.github.com" -ADD input-sources/ /home/debian/input-sources/ -ADD build-bitcoin.sh /home/debian/ -ADD sign.sh /home/debian/ +COPY input-sources/ /home/debian/input-sources/ +COPY bin/build-bitcoin.sh /home/debian/ +COPY bin/sign.sh /home/debian/ WORKDIR /home/debian diff --git a/docker/gitian-bitcoin-host/build-bitcoin.sh b/docker/gitian-bitcoin-host/bin/build-bitcoin.sh similarity index 80% rename from docker/gitian-bitcoin-host/build-bitcoin.sh rename to docker/gitian-bitcoin-host/bin/build-bitcoin.sh index e34011b..0de75ad 100755 --- a/docker/gitian-bitcoin-host/build-bitcoin.sh +++ b/docker/gitian-bitcoin-host/bin/build-bitcoin.sh @@ -24,12 +24,13 @@ 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 - ## always remove destination. This is because we can't use --continue with SourceForge for example (infinite redirects) - rm -f "$FNAME" || exit $? - echo "wget -q --no-check-certificate '$URL' -O '$FNAME'" + 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 diff --git a/docker/gitian-bitcoin-host/sign.sh b/docker/gitian-bitcoin-host/bin/sign.sh similarity index 100% rename from docker/gitian-bitcoin-host/sign.sh rename to docker/gitian-bitcoin-host/bin/sign.sh diff --git a/docker/gitian-bitcoin-host/input-sources/0.9.3rc2-descriptors.txt b/docker/gitian-bitcoin-host/input-sources/0.9.3rc2-descriptors.txt new file mode 100644 index 0000000..0e4585f --- /dev/null +++ b/docker/gitian-bitcoin-host/input-sources/0.9.3rc2-descriptors.txt @@ -0,0 +1,3 @@ +boost-linux +deps-linux +qt-linux diff --git a/docker/gitian-bitcoin-host/input-sources/0.9.3rc2-inputs.md5 b/docker/gitian-bitcoin-host/input-sources/0.9.3rc2-inputs.md5 new file mode 100644 index 0000000..0a10df9 --- /dev/null +++ b/docker/gitian-bitcoin-host/input-sources/0.9.3rc2-inputs.md5 @@ -0,0 +1,10 @@ +d6eef4b4cacb2183f2bf265a5a03a354 boost_1_55_0.tar.bz2 +cea2d01b3206e92a8df7b079935c070b clang-llvm-3.2-x86-linux-ubuntu-12.04.tar.gz +a14a5486d6b4891d2434039a0ed4c5b7 db-4.8.30.NC.tar.gz +56b4ac6a7a3e7d64f8cfeeac87b212bc miniupnpc-1.9.20140701.tar.gz +c8dc151a671b9b92ff3e4c118b174972 openssl-1.0.1i.tar.gz +a72001a9067a4c2c4e0e836d0f92ece4 protobuf-2.5.0.tar.bz2 +89a90a3b8cbca60ac412b2e0e0c776e7 qrencode-3.4.3.tar.bz2 +8ac880cc07a130c39607b65efd5e1421 qt-everywhere-opensource-src-4.6.4.tar.gz +228b6384dfd7272de00fd8b2c144fecd qt-everywhere-opensource-src-5.2.0.tar.gz +44d667c142d7cda120332623eab69f40 zlib-1.2.8.tar.gz diff --git a/docker/gitian-bitcoin-host/input-sources/0.9.3rc2-inputs.txt b/docker/gitian-bitcoin-host/input-sources/0.9.3rc2-inputs.txt new file mode 100644 index 0000000..f6b49ad --- /dev/null +++ b/docker/gitian-bitcoin-host/input-sources/0.9.3rc2-inputs.txt @@ -0,0 +1,10 @@ +http://miniupnp.free.fr/files/download.php?file=miniupnpc-1.9.20140701.tar.gz miniupnpc-1.9.20140701.tar.gz +https://www.openssl.org/source/openssl-1.0.1i.tar.gz openssl-1.0.1i.tar.gz +http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz db-4.8.30.NC.tar.gz +http://zlib.net/zlib-1.2.8.tar.gz zlib-1.2.8.tar.gz +https://fukuchi.org/works/qrencode/qrencode-3.4.3.tar.bz2 qrencode-3.4.3.tar.bz2 +https://downloads.sourceforge.net/project/boost/boost/1.55.0/boost_1_55_0.tar.bz2 boost_1_55_0.tar.bz2 +https://download.qt-project.org/official_releases/qt/5.2/5.2.0/single/qt-everywhere-opensource-src-5.2.0.tar.gz qt-everywhere-opensource-src-5.2.0.tar.gz +https://download.qt-project.org/archive/qt/4.6/qt-everywhere-opensource-src-4.6.4.tar.gz qt-everywhere-opensource-src-4.6.4.tar.gz +https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.bz2 protobuf-2.5.0.tar.bz2 +http://llvm.org/releases/3.2/clang+llvm-3.2-x86-linux-ubuntu-12.04.tar.gz clang-llvm-3.2-x86-linux-ubuntu-12.04.tar.gz diff --git a/docker/gitian-host/Dockerfile b/docker/gitian-host/Dockerfile index d4bf645..3ca4609 100644 --- a/docker/gitian-host/Dockerfile +++ b/docker/gitian-host/Dockerfile @@ -19,8 +19,8 @@ ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && apt-get install -y htop tmux less locales openssh-server ## these 2 files can be customized -ADD etc/timezone /etc/timezone -ADD etc/locale.gen /etc/locale.gen +COPY etc/timezone /etc/ +COPY etc/locale.gen /etc/ RUN dpkg-reconfigure locales && dpkg-reconfigure tzdata ## continue installation of gitian-builder packages @@ -42,7 +42,7 @@ RUN useradd -m -s /bin/bash debian && adduser debian sudo && mkdir /home/debian/ ## provide authorized keys to allow connections inside host ## NOTE: this is placed in debian user directory by setup.sh script ## reason is that there is a Docker glitch with file permissions when adding this -ADD authorized_keys /root/ +COPY authorized_keys /root/ WORKDIR /home/debian @@ -51,17 +51,17 @@ RUN wget http://archive.ubuntu.com/ubuntu/pool/universe/v/vm-builder/vm-builder_ RUN tar -zxvf vm-builder_0.12.4+bzr489.orig.tar.gz && cd vm-builder-0.12.4+bzr489 && python setup.py install ## these must always be loaded when you login as 'debian' user -ADD bash_profile /home/debian/.bash_profile +COPY bash_profile /home/debian/.bash_profile ## script used to build base VMs -ADD build-base-vms.sh /home/debian/ +COPY bin/build-base-vms.sh /home/debian/ -RUN git clone https://github.com/devrandom/gitian-builder.git --depth=1 +RUN git clone https://github.com/devrandom/gitian-builder.git && cd gitian-builder && git checkout ffd04a46a2b3c1277937c939cdb151fcf0eac613 -ADD gitian.patch /home/debian/ +COPY gitian.patch /home/debian/ ## patch to allow paralle creation of VMs -RUN cd gitian-builder && patch -p1 < ../gitian.patch +RUN cd gitian-builder && patch -p1 < ../gitian.patch && rm ../gitian.patch RUN chown -R debian.debian .bash_profile . && chown -R apt-cacher-ng.apt-cacher-ng /var/cache/apt-cacher-ng/ ## suggested: run this image with mounted volumes for pre-downloaded inputs and apt-cacher-ng cache @@ -69,7 +69,7 @@ RUN chown -R debian.debian .bash_profile . && chown -R apt-cacher-ng.apt-cacher- ##NOTE: if you do use them, then not forget to set proper user rights for these mounted volumes ## all necessary setup instructions (SSH, LXC) -ADD setup.sh /usr/local/bin/setup.sh +COPY bin/setup.sh /usr/local/bin/setup.sh ## on run failure, check logs to see if setup failed. on success connect via SSH CMD /usr/local/bin/setup.sh && /etc/init.d/apt-cacher-ng start && /usr/sbin/sshd -D -e diff --git a/docker/gitian-host/build-base-vms.sh b/docker/gitian-host/bin/build-base-vms.sh similarity index 89% rename from docker/gitian-host/build-base-vms.sh rename to docker/gitian-host/bin/build-base-vms.sh index 50c7141..c45536a 100755 --- a/docker/gitian-host/build-base-vms.sh +++ b/docker/gitian-host/bin/build-base-vms.sh @@ -13,7 +13,9 @@ export MIRROR_HOST=$GITIAN_HOST_IP SUITE=precise ## build both VMs in parallel -echo -e "MIRROR_HOST=$GITIAN_HOST_IP bin/make-base-vm --lxc --arch i386 --suite $SUITE\nMIRROR_HOST=$GITIAN_HOST_IP bin/make-base-vm --lxc --arch amd64 --suite $SUITE" | parallel -j2 || exit $? +echo "Now building i386 and amd64 VMs..." +echo -e "MIRROR_HOST=$GITIAN_HOST_IP bin/make-base-vm --lxc --arch i386 --suite $SUITE\nMIRROR_HOST=$GITIAN_HOST_IP bin/make-base-vm --lxc --arch amd64 --suite $SUITE" \ + | parallel -j2 || exit $? function ext_partition() { local OUT=$1 diff --git a/docker/gitian-host/setup.sh b/docker/gitian-host/bin/setup.sh similarity index 100% rename from docker/gitian-host/setup.sh rename to docker/gitian-host/bin/setup.sh diff --git a/docker/gitian-host/etc/locale.gen b/docker/gitian-host/etc/locale.gen index 164d183..6a8a412 100644 --- a/docker/gitian-host/etc/locale.gen +++ b/docker/gitian-host/etc/locale.gen @@ -124,7 +124,7 @@ # en_DK.UTF-8 UTF-8 # en_GB ISO-8859-1 # en_GB.ISO-8859-15 ISO-8859-15 -en_GB.UTF-8 UTF-8 +# en_GB.UTF-8 UTF-8 # en_HK ISO-8859-1 # en_HK.UTF-8 UTF-8 # en_IE ISO-8859-1 @@ -322,7 +322,7 @@ en_US.UTF-8 UTF-8 # nl_BE.UTF-8 UTF-8 # nl_BE@euro ISO-8859-15 # nl_NL ISO-8859-1 -nl_NL.UTF-8 UTF-8 +# nl_NL.UTF-8 UTF-8 # nl_NL@euro ISO-8859-15 # nn_NO ISO-8859-1 # nn_NO.UTF-8 UTF-8 diff --git a/docker/scripts/create-gitian-host.sh b/docker/scripts/create-gitian-host.sh index 5fb56cc..2bb71ab 100755 --- a/docker/scripts/create-gitian-host.sh +++ b/docker/scripts/create-gitian-host.sh @@ -20,14 +20,14 @@ if [ ! -f authorized_keys ]; then fi function wait_for_ssh() { - local IP="$1" - local SECS="$2" - while [ $SECS -gt 0 ]; do - ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no debian@$IP ls >/dev/null 2>/dev/null && return 0 - sleep 1 - let SECS-=1 - done - return 1 + local IP="$1" + local SECS="$2" + while [ $SECS -gt 0 ]; do + ssh -o ConnectTimeout=1 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no debian@$IP ls >/dev/null 2>/dev/null && return 0 + sleep 1 + let SECS-=1 + done + return 1 } function wait_remove() { @@ -40,13 +40,13 @@ function wait_remove() { ##NOTE: can leave behind a running container of gitian-host docker build --tag=gdm85/gitian-host . && \ CID=$(docker run -d --privileged gdm85/gitian-host) && \ -echo "Now building base VMs" && \ IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $CID) && \ -wait_for_ssh $IP 10 && \ +wait_for_ssh "$IP" 10 && \ +echo "$CID is now online ($IP), building base VMs on it" && \ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no debian@$IP ./build-base-vms.sh && \ docker kill $CID && \ docker wait $CID && \ docker commit $CID gdm85/gitian-host-vms && \ -sleep 3 && wait_remove $CID && \ +wait_remove $CID && \ echo "Gitian host images created successfully!" && \ echo "You can now spawn containers with spawn-gitian-host.sh"