Skip to content

Commit

Permalink
split lines to have most under 80
Browse files Browse the repository at this point in the history
  • Loading branch information
orthomind committed May 26, 2018
1 parent c3050a2 commit cb15b00
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 26 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
47 changes: 35 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
31 changes: 22 additions & 9 deletions decredbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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 *"
Expand All @@ -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).
Expand All @@ -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

Expand Down
14 changes: 10 additions & 4 deletions fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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."
Expand Down

0 comments on commit cb15b00

Please sign in to comment.