From 7e06ba0de9f0988cd23e283e8d8d4c2da0dd7ccd Mon Sep 17 00:00:00 2001 From: orthomind Date: Sat, 12 May 2018 15:38:52 +1000 Subject: [PATCH 01/14] First pass at allowing build process to be performed through docker --- .gitignore | 1 + Dockerfile | 13 +++++++++++++ README.md | 18 ++++++++++++++++++ decredbuild.sh | 12 +++++++++++- fetch.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100755 fetch.sh diff --git a/.gitignore b/.gitignore index b25c15b..bdc5af0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *~ +build diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2ba1121 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM golang:1.10 + +WORKDIR /app + +RUN go get -u github.com/golang/dep/... + +RUN apt-get update && apt-get install -y zip && rm -rf /var/lib/apt/lists/* + +ADD decredbuild.sh . +ADD fetch.sh . + +CMD ./fetch.sh && \ + ./decredbuild.sh $TAG diff --git a/README.md b/README.md index 696a870..667824c 100644 --- a/README.md +++ b/README.md @@ -70,3 +70,21 @@ This repo only contains build archives, build scripts, and similar content. For the source code, please see the individual repositories at: https://github.com/decred/ +## Building Binaries + +To build the binaries, use the provided Docker image. First, ensure it is built on your system: + +```docker build -t decred/decred-binaries .``` + +With this image, you can build the production binaries by specifying the required tag. This will automatically fetch the specified tag from Github, build it inside the docker container, and place those packages in a directory of your choosing. Replace the TAG environment variable with the required tag, and specify the local folder you wish those packages to be placed in. The below example builds version 1.2.0, and places it into ./build on your local machine: + +```docker run --rm -ti -e TAG="v1.2.0" -e PROD=1 -v $(pwd)/build:/build decred/decred-binaries``` + +If you have local folders cloned that you want to build, instead of fetching, then mount those as well. E.g.: + +```docker run --rm -ti -e TAG="v1.2.0" -e PROD=1 -v $GOPATH/src:/go/src -v $(pwd)/build:/build decred/decred-binaries``` + +### Environment Variables + +* TAG: Specify the git tag to have it fetch these packages automatically +* PROD: Set to 1 if you want to create a production build diff --git a/decredbuild.sh b/decredbuild.sh index 93fa8b8..eb214f0 100755 --- a/decredbuild.sh +++ b/decredbuild.sh @@ -14,12 +14,22 @@ if [[ $1x = x ]]; then TAG=$DATE-$VERSION else TAG=$1 +fi + +if [[ $PROD = 1 ]]; then + echo "********************" + echo "* Production build *" + echo "********************" REL=(-ldflags "-X main.appBuild=release") DCRWALLET_REL=(-ldflags "-X github.com/decred/dcrwallet/version.BuildMetadata=release") +else + echo "*********************" + echo "* Development build *" + echo "*********************" fi PACKAGE=decred -MAINDIR=$PACKAGE-$TAG +MAINDIR=/build mkdir -p $MAINDIR cd $MAINDIR diff --git a/fetch.sh b/fetch.sh new file mode 100755 index 0000000..0527ea5 --- /dev/null +++ b/fetch.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +# Copyright (c) 2018 The Decred developers +# Use of this source code is governed by the ISC +# license. + +PROJECTS="dcrd dcrwallet" + +if [ -z "$TAG" ]; then + echo "No tag set" + BRANCH="" +else + echo "Tag set to $TAG" + BRANCH="--branch $TAG" +fi + +mkdir -p $GOPATH/src/github.com/decred + +for i in $PROJECTS; do + PROJECT=$(echo $i) + cd $GOPATH/src/github.com/decred + + # Only fetch if project doesn't exist: + if [ ! -d "$PROJECT" ]; then + echo "No repo found, so fetching $PROJECT" + git clone --depth 1 $BRANCH https://github.com/decred/$PROJECT + #git clone --depth 1 --branch $TAG https://github.com/decred/$PROJECT + fi + + cd $PROJECT + + CURRENT_TAG=$(git describe --tags 2> /dev/null) + # Check that the tag of this branch matches the provided tag: + if [ -n "$TAG" ]; then + echo "Verifying $PROJECT repo tag matches $TAG..." + if [[ "$CURRENT_TAG" != "$TAG" ]]; then + # Don't continue if tag of repo does not match + echo "Repo tag of '$CURRENT_TAG' does not match specified tag of '$TAG'" + exit 1 + else + echo "...good." + fi + fi + + dep ensure +done From f7620dd304192acc62f26427572c8042a74eb1a5 Mon Sep 17 00:00:00 2001 From: orthomind Date: Sat, 12 May 2018 15:46:20 +1000 Subject: [PATCH 02/14] cleaned up some mixed tabs and spaces to be more consistent --- decredbuild.sh | 14 ++++++------ fetch.sh | 60 +++++++++++++++++++++++++------------------------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/decredbuild.sh b/decredbuild.sh index eb214f0..8449019 100755 --- a/decredbuild.sh +++ b/decredbuild.sh @@ -17,15 +17,15 @@ else fi if [[ $PROD = 1 ]]; then - echo "********************" + echo "********************" echo "* Production build *" - echo "********************" + echo "********************" REL=(-ldflags "-X main.appBuild=release") DCRWALLET_REL=(-ldflags "-X github.com/decred/dcrwallet/version.BuildMetadata=release") else - echo "*********************" + echo "*********************" echo "* Development build *" - echo "*********************" + echo "*********************" fi PACKAGE=decred @@ -53,10 +53,10 @@ for i in $SYS; do cp $GPATH/src/github.com/decred/dcrwallet/sample-dcrwallet.conf . cd .. if [[ $OS = "windows" ]]; then - zip -r $PACKAGE-$i-$TAG.zip $PACKAGE-$i-$TAG - tar -cvzf $PACKAGE-$i-$TAG.tar.gz $PACKAGE-$i-$TAG + zip -r $PACKAGE-$i-$TAG.zip $PACKAGE-$i-$TAG + tar -cvzf $PACKAGE-$i-$TAG.tar.gz $PACKAGE-$i-$TAG else - tar -cvzf $PACKAGE-$i-$TAG.tar.gz $PACKAGE-$i-$TAG + tar -cvzf $PACKAGE-$i-$TAG.tar.gz $PACKAGE-$i-$TAG fi rm -r $PACKAGE-$i-$TAG done diff --git a/fetch.sh b/fetch.sh index 0527ea5..42a2954 100755 --- a/fetch.sh +++ b/fetch.sh @@ -7,40 +7,40 @@ PROJECTS="dcrd dcrwallet" if [ -z "$TAG" ]; then - echo "No tag set" - BRANCH="" + echo "No tag set" + BRANCH="" else - echo "Tag set to $TAG" - BRANCH="--branch $TAG" + echo "Tag set to $TAG" + BRANCH="--branch $TAG" fi mkdir -p $GOPATH/src/github.com/decred for i in $PROJECTS; do - PROJECT=$(echo $i) - cd $GOPATH/src/github.com/decred - - # Only fetch if project doesn't exist: - if [ ! -d "$PROJECT" ]; then - echo "No repo found, so fetching $PROJECT" - git clone --depth 1 $BRANCH https://github.com/decred/$PROJECT - #git clone --depth 1 --branch $TAG https://github.com/decred/$PROJECT - fi - - cd $PROJECT - - CURRENT_TAG=$(git describe --tags 2> /dev/null) - # Check that the tag of this branch matches the provided tag: - if [ -n "$TAG" ]; then - echo "Verifying $PROJECT repo tag matches $TAG..." - if [[ "$CURRENT_TAG" != "$TAG" ]]; then - # Don't continue if tag of repo does not match - echo "Repo tag of '$CURRENT_TAG' does not match specified tag of '$TAG'" - exit 1 - else - echo "...good." - fi - fi - - dep ensure + PROJECT=$(echo $i) + cd $GOPATH/src/github.com/decred + + # Only fetch if project doesn't exist: + if [ ! -d "$PROJECT" ]; then + echo "No repo found, so fetching $PROJECT" + git clone --depth 1 $BRANCH https://github.com/decred/$PROJECT + #git clone --depth 1 --branch $TAG https://github.com/decred/$PROJECT + fi + + cd $PROJECT + + CURRENT_TAG=$(git describe --tags 2> /dev/null) + # Check that the tag of this branch matches the provided tag: + if [ -n "$TAG" ]; then + echo "Verifying $PROJECT repo tag matches $TAG..." + if [[ "$CURRENT_TAG" != "$TAG" ]]; then + # Don't continue if tag of repo does not match + echo "Repo tag of '$CURRENT_TAG' does not match specified tag of '$TAG'" + exit 1 + else + echo "...good." + fi + fi + + dep ensure done From bb41e9e8bcc46bef83a880dafb00d7f0fdb0c7c9 Mon Sep 17 00:00:00 2001 From: orthomind Date: Sat, 12 May 2018 15:48:59 +1000 Subject: [PATCH 03/14] More whitespace cleaning --- decredbuild.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/decredbuild.sh b/decredbuild.sh index 8449019..9be09ad 100755 --- a/decredbuild.sh +++ b/decredbuild.sh @@ -53,10 +53,10 @@ for i in $SYS; do cp $GPATH/src/github.com/decred/dcrwallet/sample-dcrwallet.conf . cd .. if [[ $OS = "windows" ]]; then - zip -r $PACKAGE-$i-$TAG.zip $PACKAGE-$i-$TAG - tar -cvzf $PACKAGE-$i-$TAG.tar.gz $PACKAGE-$i-$TAG + zip -r $PACKAGE-$i-$TAG.zip $PACKAGE-$i-$TAG + tar -cvzf $PACKAGE-$i-$TAG.tar.gz $PACKAGE-$i-$TAG else - tar -cvzf $PACKAGE-$i-$TAG.tar.gz $PACKAGE-$i-$TAG + tar -cvzf $PACKAGE-$i-$TAG.tar.gz $PACKAGE-$i-$TAG fi rm -r $PACKAGE-$i-$TAG done From 450e4d48d5b3bb5389f48a419e089221e7e3652b Mon Sep 17 00:00:00 2001 From: orthomind Date: Sat, 12 May 2018 15:52:22 +1000 Subject: [PATCH 04/14] Updated build script to use package labelled subfolders in build folder --- decredbuild.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/decredbuild.sh b/decredbuild.sh index 9be09ad..2ad6bec 100755 --- a/decredbuild.sh +++ b/decredbuild.sh @@ -29,7 +29,7 @@ else fi PACKAGE=decred -MAINDIR=/build +MAINDIR=/build/$PACKAGE-$TAG mkdir -p $MAINDIR cd $MAINDIR From 59e0b3493bf802506912c0cd8050abf10898a564 Mon Sep 17 00:00:00 2001 From: orthomind Date: Sat, 12 May 2018 15:56:34 +1000 Subject: [PATCH 05/14] README updated to include more information on building --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 667824c..cdeb75f 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,9 @@ If you have local folders cloned that you want to build, instead of fetching, th ```docker run --rm -ti -e TAG="v1.2.0" -e PROD=1 -v $GOPATH/src:/go/src -v $(pwd)/build:/build decred/decred-binaries``` +Leave TAG unset if you wish to build the version you have already cloned without verifying it matches the specified tag. + ### Environment Variables -* TAG: Specify the git tag to have it fetch these packages automatically +* TAG: Specify the git tag to have it fetch these packages automatically. Leave unset to use latest commit (if repo's do not exist locally) or local version (if already cloned) * PROD: Set to 1 if you want to create a production build From 0ddac5258f75fb0905b242f2c01d572937f54b26 Mon Sep 17 00:00:00 2001 From: orthomind Date: Sat, 12 May 2018 16:10:57 +1000 Subject: [PATCH 06/14] Added extra output to let users know dep is running --- fetch.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fetch.sh b/fetch.sh index 42a2954..4bcf8a3 100755 --- a/fetch.sh +++ b/fetch.sh @@ -42,5 +42,7 @@ for i in $PROJECTS; do fi fi + echo "Running dep for $PROJECT..." dep ensure + echo "...done." done From cd06b6574b57b95d3921519270a95b036ef4425f Mon Sep 17 00:00:00 2001 From: orthomind Date: Mon, 14 May 2018 17:55:02 +1000 Subject: [PATCH 07/14] improvements to help with reproducible builds --- Dockerfile | 2 +- decredbuild.sh | 5 ++--- fetch.sh | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2ba1121..09a91b3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.10 +FROM golang:1.10.2 WORKDIR /app diff --git a/decredbuild.sh b/decredbuild.sh index 2ad6bec..df4a3c9 100755 --- a/decredbuild.sh +++ b/decredbuild.sh @@ -54,10 +54,9 @@ for i in $SYS; do cd .. if [[ $OS = "windows" ]]; then zip -r $PACKAGE-$i-$TAG.zip $PACKAGE-$i-$TAG - tar -cvzf $PACKAGE-$i-$TAG.tar.gz $PACKAGE-$i-$TAG - else - tar -cvzf $PACKAGE-$i-$TAG.tar.gz $PACKAGE-$i-$TAG fi + # Strip out name and timestamp data so that builds can be reproducible + tar -c --mtime='1970-01-01' $PACKAGE-$i-$TAG | gzip -9 -n > $PACKAGE-$i-$TAG.tar.gz rm -r $PACKAGE-$i-$TAG done diff --git a/fetch.sh b/fetch.sh index 4bcf8a3..8c1daca 100755 --- a/fetch.sh +++ b/fetch.sh @@ -24,14 +24,13 @@ for i in $PROJECTS; do if [ ! -d "$PROJECT" ]; then echo "No repo found, so fetching $PROJECT" git clone --depth 1 $BRANCH https://github.com/decred/$PROJECT - #git clone --depth 1 --branch $TAG https://github.com/decred/$PROJECT fi cd $PROJECT CURRENT_TAG=$(git describe --tags 2> /dev/null) - # Check that the tag of this branch matches the provided tag: if [ -n "$TAG" ]; then + # Tag provided, so check that the tag of this branch matches the provided tag: echo "Verifying $PROJECT repo tag matches $TAG..." if [[ "$CURRENT_TAG" != "$TAG" ]]; then # Don't continue if tag of repo does not match From e8e8fd792d2e68507d281c4bd869a7039b41c347 Mon Sep 17 00:00:00 2001 From: orthomind Date: Mon, 14 May 2018 22:02:54 +1000 Subject: [PATCH 08/14] first pass at a reproducible build --- decredbuild.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/decredbuild.sh b/decredbuild.sh index df4a3c9..f613fca 100755 --- a/decredbuild.sh +++ b/decredbuild.sh @@ -56,7 +56,7 @@ for i in $SYS; do zip -r $PACKAGE-$i-$TAG.zip $PACKAGE-$i-$TAG fi # Strip out name and timestamp data so that builds can be reproducible - tar -c --mtime='1970-01-01' $PACKAGE-$i-$TAG | gzip -9 -n > $PACKAGE-$i-$TAG.tar.gz + tar -c --mtime='1970-01-01' --sort=name --owner=0 --group=0 --numeric-owner $PACKAGE-$i-$TAG | gzip -9 -n > $PACKAGE-$i-$TAG.tar.gz rm -r $PACKAGE-$i-$TAG done From f3b4d4114e0de10f4ef3c941cfe28cb3177b0bed Mon Sep 17 00:00:00 2001 From: orthomind Date: Tue, 15 May 2018 06:00:41 +0000 Subject: [PATCH 09/14] zips reproducible from tests and set up times to use latest dcrd commit --- decredbuild.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/decredbuild.sh b/decredbuild.sh index f613fca..ec67cfc 100755 --- a/decredbuild.sh +++ b/decredbuild.sh @@ -16,6 +16,16 @@ else TAG=$1 fi +PARENT=$(pwd) + +# Set the unix timestamp to match that of dcrd git commit, to have a stable anchor for setting file timestamps for reproducible builds +cd $GOPATH/src/github.com/decred/dcrd +# TZ is used by date command +TZ='UTC' +UNIXTIME=$(git log -1 --format=%ct) +TOUCHTIME=$(date --date='@'$UNIXTIME +%Y%m%d%H%M.%S) +TARTIME=$(date --date='@'$UNIXTIME "+%Y%m%d %H:%M:%S") + if [[ $PROD = 1 ]]; then echo "********************" echo "* Production build *" @@ -28,6 +38,7 @@ else echo "*********************" fi +cd $PARENT PACKAGE=decred MAINDIR=/build/$PACKAGE-$TAG mkdir -p $MAINDIR @@ -53,10 +64,12 @@ for i in $SYS; do cp $GPATH/src/github.com/decred/dcrwallet/sample-dcrwallet.conf . cd .. if [[ $OS = "windows" ]]; then - zip -r $PACKAGE-$i-$TAG.zip $PACKAGE-$i-$TAG + # To enable reproducible builds, we need to change the timestamp of the files, pass those files in in a fixed order, and don't pass in extra file attributes + find $PACKAGE-$i-$TAG -exec touch -t $TOUCHTIME {} \; + find $PACKAGE-$i-$TAG | sort | zip -X $PACKAGE-$i-$TAG.zip -@ fi # Strip out name and timestamp data so that builds can be reproducible - tar -c --mtime='1970-01-01' --sort=name --owner=0 --group=0 --numeric-owner $PACKAGE-$i-$TAG | gzip -9 -n > $PACKAGE-$i-$TAG.tar.gz + tar -c --mtime="$TARTIME" --sort=name --owner=0 --group=0 --numeric-owner $PACKAGE-$i-$TAG | gzip -9 -n > $PACKAGE-$i-$TAG.tar.gz rm -r $PACKAGE-$i-$TAG done From 4a79618dc487f961530b18e0c30cc3a4e86d6bf8 Mon Sep 17 00:00:00 2001 From: orthomind Date: Thu, 17 May 2018 06:44:02 +0000 Subject: [PATCH 10/14] added comment --- fetch.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fetch.sh b/fetch.sh index 8c1daca..7fa0c5b 100755 --- a/fetch.sh +++ b/fetch.sh @@ -4,6 +4,8 @@ # Use of this source code is governed by the ISC # license. +# Script to fetch either specified TAG for dcrd and dcrwallet, or else latest comment + PROJECTS="dcrd dcrwallet" if [ -z "$TAG" ]; then From d2eb07b7c3f28713cd25cf967e996cfb6c6200db Mon Sep 17 00:00:00 2001 From: orthomind Date: Fri, 25 May 2018 16:15:24 +1000 Subject: [PATCH 11/14] added test for building v1.2.0 --- .travis.yml | 8 ++++++++ test-manifest-v1.2.0.txt | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 .travis.yml create mode 100644 test-manifest-v1.2.0.txt diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c4fa897 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +sudo: required +services: + - docker + +script: + - docker build -t decred-binaries . + - docker run --rm -ti -e TAG="v1.2.0" -e PROD=1 -v $(pwd)/build:/build decred/decred-binaries + - diff test-manifest-v1.2.0.txt ./build/decred-v1.2.0/manifest-v1.2.0.txt diff --git a/test-manifest-v1.2.0.txt b/test-manifest-v1.2.0.txt new file mode 100644 index 0000000..31afc9a --- /dev/null +++ b/test-manifest-v1.2.0.txt @@ -0,0 +1,18 @@ +2400328d286f481bc7e39dcbf072d66cf4a941fffd3b4cb399a3fbbe5c777f90 decred-darwin-amd64-v1.2.0.tar.gz +bd918fd59efc331adac032da84df4c7232c9065ee30b30e0c4c6e676c7cfd24e decred-dragonfly-amd64-v1.2.0.tar.gz +eb7bc2d1c555996cef242cc4c08a5ca92d69c7ada9a35ef127ebdafdca34f80c decred-freebsd-386-v1.2.0.tar.gz +1ca95f5c60f12eee42ae4498ac3e2104e32aa8580263b7ab22efcbbba34c0d06 decred-freebsd-amd64-v1.2.0.tar.gz +f0aae8e5ef4af677069bf32d2869668c1f88d73dbf5a37bcf3f41c220e4ee9c5 decred-freebsd-arm-v1.2.0.tar.gz +e341b499b9624205e77a89254fb99759e8aac31cd69ba3dd44c9b0bf165fabfa decred-linux-386-v1.2.0.tar.gz +88c2ce7441dd9dd01c39fdb6d0ed0e7972179807d619d12863ad8eef975bd82d decred-linux-amd64-v1.2.0.tar.gz +18fa0b7a928604a4840847e583aec83dd1997fa56c2f15f17c4aa7d2215f3a5f decred-linux-arm-v1.2.0.tar.gz +d5ed86d123863e53a5e1c5c4848a7527088bd3822f620af130967ff3cd306f9e decred-linux-arm64-v1.2.0.tar.gz +ebd5633d6658dcfd498337ba38054ce0f5b6b21ad0ba6b203a7a25cf3666ce32 decred-netbsd-386-v1.2.0.tar.gz +789a73e318af31b3916a61994e1ea0bf131b7b6c39cde3d993d5b03c85a79dd7 decred-netbsd-amd64-v1.2.0.tar.gz +9c7095af8f2e846cbff8f005613ec675b415e896df7afd81a6f5389d8225606d decred-openbsd-386-v1.2.0.tar.gz +4c98b7b6261b8b2e01406cba1686d26514cdd35bda77f7043c0c4d3cc46dc5a8 decred-openbsd-amd64-v1.2.0.tar.gz +88a1cf4e8b91235f4809b07bb7a6a9f4b6623c88798f151e700272411e6e5c57 decred-solaris-amd64-v1.2.0.tar.gz +6952888716ab7729ac718059f3e0dc4db882a34ae3cd1db5d013599c676ad4c7 decred-windows-386-v1.2.0.tar.gz +c94eb4fc8ea0c1a775e45a06cbf7f6c4ab687598f4911c82a7619dea515997c6 decred-windows-386-v1.2.0.zip +0039081fc54c5a171370a01dc5c62b9abfa790cd2f1be43753e203cccd3566fe decred-windows-amd64-v1.2.0.tar.gz +a56c7eacff6dffe574fb14719fc1382304e3f8ea5773b60148086707da490ef6 decred-windows-amd64-v1.2.0.zip From c3050a2c1e0f293e4b7e53d70a8d85cb87222ad6 Mon Sep 17 00:00:00 2001 From: orthomind Date: Fri, 25 May 2018 16:24:55 +1000 Subject: [PATCH 12/14] updated name for test built docker image --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c4fa897..d616977 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,6 @@ services: - docker script: - - docker build -t decred-binaries . + - docker build -t decred/decred-binaries . - docker run --rm -ti -e TAG="v1.2.0" -e PROD=1 -v $(pwd)/build:/build decred/decred-binaries - diff test-manifest-v1.2.0.txt ./build/decred-v1.2.0/manifest-v1.2.0.txt From cb15b0022323eb80e9b8ca57eed435cebdf17af0 Mon Sep 17 00:00:00 2001 From: orthomind Date: Sat, 26 May 2018 15:07:22 +1000 Subject: [PATCH 13/14] split lines to have most under 80 --- .travis.yml | 3 ++- README.md | 47 +++++++++++++++++++++++++++++++++++------------ decredbuild.sh | 31 ++++++++++++++++++++++--------- fetch.sh | 14 ++++++++++---- 4 files changed, 69 insertions(+), 26 deletions(-) diff --git a/.travis.yml b/.travis.yml index d616977..4be0d50 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,5 +4,6 @@ services: script: - docker build -t decred/decred-binaries . - - docker run --rm -ti -e TAG="v1.2.0" -e PROD=1 -v $(pwd)/build:/build decred/decred-binaries + - docker run --rm -ti -e TAG="v1.2.0" -e PROD=1 -v $(pwd)/build:/build \ + decred/decred-binaries - diff test-manifest-v1.2.0.txt ./build/decred-v1.2.0/manifest-v1.2.0.txt diff --git a/README.md b/README.md index cdeb75f..2e3d902 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,16 @@ Decred. This repository contains releases for the following software: -* [dcrd](https://github.com/decred/dcrd)/[dcrwallet](https://github.com/decred/dcrwallet) +* [dcrd](https://github.com/decred/dcrd)/[dcrwallet]( + https://github.com/decred/dcrwallet) * [Paymetheus](https://github.com/decred/Paymetheus) * [gominer](https://github.com/decred/gominer) * [decrediton](https://github.com/decred/decrediton) ## Release notes -Notes for the current and previous releases can be found in the [Release Notes](./release-notes.md) document. +Notes for the current and previous releases can be found in the +[Release Notes](./release-notes.md) document. ## Verifying Binaries @@ -30,8 +32,10 @@ binaries in that release. To verify these, you will need: The steps to verify the binaries are as follows: -1. Download the file manifest, the signature for the file manifest, and the zip/tarball for your OS from here. -2. Obtain the SHA256 value for the zip/tarball for your OS and check that it matches the value in the file manifest, e.g. for 64-bit Linux +1. Download the file manifest, the signature for the file manifest, and +the zip/tarball for your OS from here. +2. Obtain the SHA256 value for the zip/tarball for your OS and check that +it matches the value in the file manifest, e.g. for 64-bit Linux ``` $ sha256sum linux-amd64-20160127-02.tar.gz @@ -72,21 +76,40 @@ at: https://github.com/decred/ ## Building Binaries -To build the binaries, use the provided Docker image. First, ensure it is built on your system: +To build the binaries, use the provided Docker image. First, ensure it +is built on your system: -```docker build -t decred/decred-binaries .``` +``` +docker build -t decred/decred-binaries . +``` -With this image, you can build the production binaries by specifying the required tag. This will automatically fetch the specified tag from Github, build it inside the docker container, and place those packages in a directory of your choosing. Replace the TAG environment variable with the required tag, and specify the local folder you wish those packages to be placed in. The below example builds version 1.2.0, and places it into ./build on your local machine: +With this image, you can build the production binaries by specifying the +required tag. This will automatically fetch the specified tag from +Github, build it inside the docker container, and place those packages in +a directory of your choosing. Replace the TAG environment variable with +the required tag, and specify the local folder you wish those packages to +be placed in. The below example builds version 1.2.0, and places it into +./build on your local machine: -```docker run --rm -ti -e TAG="v1.2.0" -e PROD=1 -v $(pwd)/build:/build decred/decred-binaries``` +``` +docker run --rm -ti -e TAG="v1.2.0" -e PROD=1 -v $(pwd)/build:/build \ + decred/decred-binaries +``` -If you have local folders cloned that you want to build, instead of fetching, then mount those as well. E.g.: +If you have local folders cloned that you want to build, instead of +fetching, then mount those as well. E.g.: -```docker run --rm -ti -e TAG="v1.2.0" -e PROD=1 -v $GOPATH/src:/go/src -v $(pwd)/build:/build decred/decred-binaries``` +``` +docker run --rm -ti -e TAG="v1.2.0" -e PROD=1 -v $GOPATH/src:/go/src \ + -v $(pwd)/build:/build decred/decred-binaries +``` -Leave TAG unset if you wish to build the version you have already cloned without verifying it matches the specified tag. +Leave TAG unset if you wish to build the version you have already cloned +without verifying it matches the specified tag. ### Environment Variables -* TAG: Specify the git tag to have it fetch these packages automatically. Leave unset to use latest commit (if repo's do not exist locally) or local version (if already cloned) +* TAG: Specify the git tag to have it fetch these packages automatically. + Leave unset to use latest commit (if repo's do not exist locally) or + local version (if already cloned) * PROD: Set to 1 if you want to create a production build diff --git a/decredbuild.sh b/decredbuild.sh index ec67cfc..dfad88f 100755 --- a/decredbuild.sh +++ b/decredbuild.sh @@ -18,7 +18,8 @@ fi PARENT=$(pwd) -# Set the unix timestamp to match that of dcrd git commit, to have a stable anchor for setting file timestamps for reproducible builds +# Set the unix timestamp to match that of dcrd git commit, to have a +# stable anchor for setting file timestamps for reproducible builds cd $GOPATH/src/github.com/decred/dcrd # TZ is used by date command TZ='UTC' @@ -31,7 +32,8 @@ if [[ $PROD = 1 ]]; then echo "* Production build *" echo "********************" REL=(-ldflags "-X main.appBuild=release") - DCRWALLET_REL=(-ldflags "-X github.com/decred/dcrwallet/version.BuildMetadata=release") + DCRWALLET_REL=(-ldflags \ + "-X github.com/decred/dcrwallet/version.BuildMetadata=release") else echo "*********************" echo "* Development build *" @@ -44,7 +46,10 @@ MAINDIR=/build/$PACKAGE-$TAG mkdir -p $MAINDIR cd $MAINDIR -SYS="windows-386 windows-amd64 openbsd-386 openbsd-amd64 linux-386 linux-amd64 linux-arm linux-arm64 darwin-amd64 dragonfly-amd64 freebsd-386 freebsd-amd64 freebsd-arm netbsd-386 netbsd-amd64 solaris-amd64" +SYS="windows-386 windows-amd64 openbsd-386 openbsd-amd64 linux-386 \ +linux-amd64 linux-arm linux-arm64 darwin-amd64 dragonfly-amd64 \ +freebsd-386 freebsd-amd64 freebsd-arm netbsd-386 netbsd-amd64 \ +solaris-amd64" # Use the first element of $GOPATH in the case where GOPATH is a list # (something that is totally allowed). @@ -56,20 +61,28 @@ for i in $SYS; do mkdir $PACKAGE-$i-$TAG cd $PACKAGE-$i-$TAG echo "Building:" $OS $ARCH - env GOOS=$OS GOARCH=$ARCH go build "${REL[@]}" github.com/decred/dcrd - env GOOS=$OS GOARCH=$ARCH go build "${REL[@]}" github.com/decred/dcrd/cmd/dcrctl - env GOOS=$OS GOARCH=$ARCH go build "${REL[@]}" github.com/decred/dcrd/cmd/promptsecret - env GOOS=$OS GOARCH=$ARCH go build "${DCRWALLET_REL[@]}" github.com/decred/dcrwallet + env GOOS=$OS GOARCH=$ARCH go build "${REL[@]}" \ + github.com/decred/dcrd + env GOOS=$OS GOARCH=$ARCH go build "${REL[@]}" \ + github.com/decred/dcrd/cmd/dcrctl + env GOOS=$OS GOARCH=$ARCH go build "${REL[@]}" \ + github.com/decred/dcrd/cmd/promptsecret + env GOOS=$OS GOARCH=$ARCH go build "${DCRWALLET_REL[@]}"\ + github.com/decred/dcrwallet cp $GPATH/src/github.com/decred/dcrd/cmd/dcrctl/sample-dcrctl.conf . cp $GPATH/src/github.com/decred/dcrwallet/sample-dcrwallet.conf . cd .. if [[ $OS = "windows" ]]; then - # To enable reproducible builds, we need to change the timestamp of the files, pass those files in in a fixed order, and don't pass in extra file attributes + # To enable reproducible builds, we need to change the timestamp + # of the files, pass those files in in a fixed order, and don't + # pass in extra file attributes find $PACKAGE-$i-$TAG -exec touch -t $TOUCHTIME {} \; find $PACKAGE-$i-$TAG | sort | zip -X $PACKAGE-$i-$TAG.zip -@ fi # Strip out name and timestamp data so that builds can be reproducible - tar -c --mtime="$TARTIME" --sort=name --owner=0 --group=0 --numeric-owner $PACKAGE-$i-$TAG | gzip -9 -n > $PACKAGE-$i-$TAG.tar.gz + tar -c --mtime="$TARTIME" --sort=name --owner=0 --group=0 \ + --numeric-owner $PACKAGE-$i-$TAG | gzip -9 -n > \ + $PACKAGE-$i-$TAG.tar.gz rm -r $PACKAGE-$i-$TAG done diff --git a/fetch.sh b/fetch.sh index 7fa0c5b..020296c 100755 --- a/fetch.sh +++ b/fetch.sh @@ -4,7 +4,8 @@ # Use of this source code is governed by the ISC # license. -# Script to fetch either specified TAG for dcrd and dcrwallet, or else latest comment +# Script to fetch either specified TAG for dcrd and dcrwallet, or else +# latest comment PROJECTS="dcrd dcrwallet" @@ -30,13 +31,18 @@ for i in $PROJECTS; do cd $PROJECT - CURRENT_TAG=$(git describe --tags 2> /dev/null) if [ -n "$TAG" ]; then - # Tag provided, so check that the tag of this branch matches the provided tag: + # Check if specified tag is attached to current commit + CURRENT_TAG=$(git tag -l --points-at HEAD | grep "^$TAG$") + + # Tag provided, so check that the tag of this branch matches the + # provided tag: echo "Verifying $PROJECT repo tag matches $TAG..." + if [[ "$CURRENT_TAG" != "$TAG" ]]; then # Don't continue if tag of repo does not match - echo "Repo tag of '$CURRENT_TAG' does not match specified tag of '$TAG'" + echo "Repo tag of '$CURRENT_TAG' does not match specified " \ + "tag of '$TAG'" exit 1 else echo "...good." From 2740f72804901d333c7dfd14d57cd09017fc6345 Mon Sep 17 00:00:00 2001 From: orthomind Date: Sat, 26 May 2018 15:10:40 +1000 Subject: [PATCH 14/14] removed extraneous slash from travis line --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4be0d50..c8d6eee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,6 @@ services: script: - docker build -t decred/decred-binaries . - - docker run --rm -ti -e TAG="v1.2.0" -e PROD=1 -v $(pwd)/build:/build \ - decred/decred-binaries + - docker run --rm -ti -e TAG="v1.2.0" -e PROD=1 -v $(pwd)/build:/build + decred/decred-binaries - diff test-manifest-v1.2.0.txt ./build/decred-v1.2.0/manifest-v1.2.0.txt