From 69e56e26faea73eb388b76d4ec0bbc500790df96 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Fri, 2 Jun 2017 00:19:49 -0400 Subject: [PATCH 1/5] update glide, fix test --- glide.lock | 57 +++++++++++++++++++++++--------------------- tests/client_test.go | 19 ++++++++------- 2 files changed, 40 insertions(+), 36 deletions(-) diff --git a/glide.lock b/glide.lock index 97653f8..f300548 100644 --- a/glide.lock +++ b/glide.lock @@ -1,19 +1,27 @@ -hash: 176e67c0fdf08df0797772368bddec78a7ff5d2a789fd8ffdadc2b96476e294a -updated: 2017-04-28T13:02:06.00844195-04:00 +hash: a8af57ad9881011183dc9303839ceec09ec7b3745479224f1d4f1cbaf48f546c +updated: 2017-06-01T23:37:08.196716502-04:00 imports: - name: github.com/fsnotify/fsnotify version: 4da3e2cfbabc9f751898f250b49f2439785783a1 +- name: github.com/go-kit/kit + version: d67bb4c202e3b91377d1079b110a6c9ce23ab2f8 + subpackages: + - log + - log/level + - log/term +- name: github.com/go-logfmt/logfmt + version: 390ab7935ee28ec6b286364bba9b4dd6410cb3d5 - name: github.com/go-stack/stack - version: 100eb0c0a9c5b306ca2fb4f165df21d80ada4b82 + version: 7a2f19628aabfe68f0766b59e74d6315f8347d22 - name: github.com/golang/protobuf - version: 2bba0603135d7d7f5cb73b2125beeda19c09f4ef + version: b50ceb1fa9818fa4d78b016c2d4ae025593a7ce3 subpackages: - proto - ptypes/any - name: github.com/golang/snappy version: 553a641470496b2327abcac10b36396bd98e45c9 - name: github.com/hashicorp/hcl - version: 630949a3c5fa3c613328e1b8256052cbc2327c9b + version: 392dba7d905ed5d04a5794ba89f558b27e2ba1ca subpackages: - hcl/ast - hcl/parser @@ -27,14 +35,12 @@ imports: version: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75 - name: github.com/jmhodges/levigo version: c42d9e0ca023e2198120196f842701bb4c55d7b9 +- name: github.com/kr/logfmt + version: b84e30acd515aadc4b783ad4ff83aff3299bdfe0 - name: github.com/magiconair/properties version: 51463bfca2576e06c62a8504b5c0f06d61312647 -- name: github.com/mattn/go-colorable - version: ded68f7a9561c023e790de24279db7ebf473ea80 -- name: github.com/mattn/go-isatty - version: fc9e8d8ef48496124e79ae0df75490096eccf6fe - name: github.com/mitchellh/mapstructure - version: 53818660ed4955e899c0bcafa97299a388bd7c8e + version: cc8532a8e9a55ea36402aa21efdf403a60d34096 - name: github.com/pelletier/go-buffruneio version: c37440a7cf42ac63b919c752ca73a85067e05992 - name: github.com/pelletier/go-toml @@ -48,13 +54,13 @@ imports: - name: github.com/spf13/cast version: acbeb36b902d72a7a4c18e8f3241075e7ab763e4 - name: github.com/spf13/cobra - version: 10f6b9d7e1631a54ad07c5c0fb71c28a1abfd3c2 + version: 3454e0e28e69c1b8effa6b5123c8e4185e20d696 - name: github.com/spf13/jwalterweatherman - version: fa7ca7e836cf3a8bb4ebf799f472c12d7e903d66 + version: 8f07c835e5cc1450c082fe3a439cf87b0cbb2d99 - name: github.com/spf13/pflag - version: 2300d0f8576fe575f71aaa5b9bbe4e1b0dc2eb51 + version: e57e3eeb33f795204c1ca35f56c44f83227c6e66 - name: github.com/spf13/viper - version: 5d46e70da8c0b6f812e0b170b7a985753b5c63cb + version: 0967fc9aceab2ce9da34061253ac10fb99bba5b2 - name: github.com/syndtr/goleveldb version: 8c81ea47d4c41a385645e133e15510fc6a2a74b4 subpackages: @@ -71,33 +77,29 @@ imports: - leveldb/table - leveldb/util - name: github.com/tendermint/abci - version: 8d8e35ae537538c9cf6808be3ca9dd7dab81b7f6 + version: b86da575718079396af1f7fe3609ea34be6f855d subpackages: - client - server - types - name: github.com/tendermint/go-wire - version: b53add0b622662731985485f3a19be7f684660b8 + version: 5f88da3dbc1a72844e6dfaf274ce87f851d488eb subpackages: - data -- name: github.com/tendermint/log15 - version: ae0f3d6450da9eac7074b439c8e1c3cabf0d5ce6 - subpackages: - - term - name: github.com/tendermint/tmlibs - version: df250b69416a35a943a6e2a92118667e9ef031d4 + version: 306795ae1d8e4f4a10dcc8bdb32a00455843c9d5 subpackages: - common - db - - logger + - log - merkle - test - name: golang.org/x/crypto - version: 96846453c37f0876340a66a47f3f75b1f3a6cd2d + version: ab89591268e0c8b748cbe4047b00197516011af5 subpackages: - ripemd160 - name: golang.org/x/net - version: c8c74377599bd978aee1cf3b9b63a8634051cec2 + version: c9b681d35165f1995d6f3034e61f8761d4b90c99 subpackages: - context - http2 @@ -107,11 +109,11 @@ imports: - lex/httplex - trace - name: golang.org/x/sys - version: ea9bcade75cb975a0b9738936568ab388b845617 + version: 9c9d83fe39ed3fd2d9249fcf6b755891fff54b03 subpackages: - unix - name: golang.org/x/text - version: 19e3104b43db45fca0303f489a9536087b184802 + version: 470f45bf29f4147d6fbd7dfd0a02a848e49f5bf4 subpackages: - secure/bidirule - transform @@ -122,10 +124,11 @@ imports: subpackages: - googleapis/rpc/status - name: google.golang.org/grpc - version: 6914ab1e338c92da4218a23d27fcd03d0ad78d46 + version: a0c3e72252b6fbf4826bb143e450eb05588a9d6d subpackages: - codes - credentials + - grpclb/grpc_lb_v1 - grpclog - internal - keepalive diff --git a/tests/client_test.go b/tests/client_test.go index 8e77bae..4b78adf 100644 --- a/tests/client_test.go +++ b/tests/client_test.go @@ -7,9 +7,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/tendermint/abci/server" - . "github.com/tendermint/tmlibs/common" "github.com/tendermint/merkleeyes/app" eyes "github.com/tendermint/merkleeyes/client" + . "github.com/tendermint/tmlibs/common" ) var tmspAddr = "tcp://127.0.0.1:46659" @@ -35,20 +35,21 @@ func testProcedure(t *testing.T, addr, dbName string, cache int, testPersistence } } - // Start the listener + // Create the app and start the listener mApp := app.NewMerkleEyesApp(dbName, cache) - s, err := server.NewServer(addr, "socket", mApp) + defer mApp.CloseDB() - defer func() { //Close the database, and server - mApp.CloseDB() - s.Stop() - }() + s, err := server.NewServer(addr, "socket", mApp) checkErr(err) + s.Start() + defer s.Stop() + // Create client cli, err := eyes.NewClient(addr) - defer cli.Stop() checkErr(err) + cli.Start() + defer cli.Stop() if !testPersistence { // Empty @@ -116,5 +117,5 @@ func rem(t *testing.T, cli *eyes.Client, key string) { func commit(t *testing.T, cli *eyes.Client, hash string) { res := cli.CommitSync() require.False(t, res.IsErr(), res.Error()) - assert.Equal(t, hash, Fmt("%X", res.Data)) + assert.Equal(t, hash, Fmt("%X", res.Data.Bytes())) } From 0979887ed538ee1d21a001362191a534e8ee5d37 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Fri, 2 Jun 2017 00:48:44 -0400 Subject: [PATCH 2/5] version --- cmd/version.go | 21 +++++++++++++++++++++ version/version.go | 7 +++++++ 2 files changed, 28 insertions(+) create mode 100644 cmd/version.go create mode 100644 version/version.go diff --git a/cmd/version.go b/cmd/version.go new file mode 100644 index 0000000..70834f7 --- /dev/null +++ b/cmd/version.go @@ -0,0 +1,21 @@ +package cmd + +import ( + "fmt" + + "github.com/spf13/cobra" + + "github.com/tendermint/merkleeyes/version" +) + +var versionCmd = &cobra.Command{ + Use: "version", + Short: "Show version info", + Run: func(cmd *cobra.Command, args []string) { + fmt.Println(version.Version) + }, +} + +func init() { + RootCmd.AddCommand(versionCmd) +} diff --git a/version/version.go b/version/version.go new file mode 100644 index 0000000..cd1ad0f --- /dev/null +++ b/version/version.go @@ -0,0 +1,7 @@ +package version + +const Maj = "0" +const Min = "2" +const Fix = "0" + +const Version = "0.2.0" From ce41c34d0a0f38b8cfbd83e6984a4771f77062e9 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Fri, 2 Jun 2017 00:48:56 -0400 Subject: [PATCH 3/5] build scripts --- Makefile | 12 +++++- scripts/dist.sh | 53 +++++++++++++++++++++++++ scripts/dist_build.sh | 56 +++++++++++++++++++++++++++ scripts/merkleeyes-builder/Dockerfile | 12 ++++++ scripts/publish.sh | 7 ++++ 5 files changed, 139 insertions(+), 1 deletion(-) create mode 100755 scripts/dist.sh create mode 100755 scripts/dist_build.sh create mode 100644 scripts/merkleeyes-builder/Dockerfile create mode 100644 scripts/publish.sh diff --git a/Makefile b/Makefile index 950e840..0fd127f 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,6 @@ -.PHONY: all test get_deps install +GOTOOLS = \ + github.com/mitchellh/gox \ + github.com/Masterminds/glide PDFFLAGS=-pdf --nodefraction=0.1 @@ -7,12 +9,19 @@ all: test install install: go install github.com/tendermint/merkleeyes/cmd/... +dist: + @ sudo bash scripts/dist.sh + @ bash scripts/publish.sh + test: go test -v --race `glide novendor` get_deps: go get -d github.com/tendermint/merkleeyes/... +tools: + go get -u -v $(GOTOOLS) + get_vendor_deps: go get github.com/Masterminds/glide glide install @@ -55,3 +64,4 @@ exploremem: delve: dlv test ./benchmarks -- -test.bench=. +.PHONY: all test get_deps install tools dist diff --git a/scripts/dist.sh b/scripts/dist.sh new file mode 100755 index 0000000..e0d72ce --- /dev/null +++ b/scripts/dist.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash +set -e + +REPO_NAME="merkleeyes" + +# Get the version from the environment, or try to figure it out. +if [ -z $VERSION ]; then + VERSION=$(awk -F\" '/Version =/ { print $2; exit }' < version/version.go) +fi +if [ -z "$VERSION" ]; then + echo "Please specify a version." + exit 1 +fi +echo "==> Building version $VERSION..." + +# Get the parent directory of where this script is. +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done +DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )" + +# Change into that dir because we expect that. +cd "$DIR" + +# Generate the tag. +if [ -z "$NOTAG" ]; then + echo "==> Tagging..." + git commit --allow-empty -a -m "Release v$VERSION" + git tag -a -m "Version $VERSION" "v${VERSION}" master +fi + +# Do a hermetic build inside a Docker container. +docker build -t tendermint/${REPO_NAME}-builder scripts/${REPO_NAME}-builder/ +docker run --rm -e "BUILD_TAGS=$BUILD_TAGS" -v "$(pwd)":/go/src/github.com/tendermint/${REPO_NAME} tendermint/${REPO_NAME}-builder ./scripts/dist_build.sh + +# Add $REPO_NAME and $VERSION prefix to package name. +rm -rf ./build/dist +mkdir -p ./build/dist +for FILENAME in $(find ./build/pkg -mindepth 1 -maxdepth 1 -type f); do + FILENAME=$(basename "$FILENAME") + cp "./build/pkg/${FILENAME}" "./build/dist/${REPO_NAME}_${VERSION}_${FILENAME}" +done + +# Make the checksums. +pushd ./build/dist +shasum -a256 ./* > "./${REPO_NAME}_${VERSION}_SHA256SUMS" +popd + +# Done +echo +echo "==> Results:" +ls -hl ./build/dist + +exit 0 diff --git a/scripts/dist_build.sh b/scripts/dist_build.sh new file mode 100755 index 0000000..3773265 --- /dev/null +++ b/scripts/dist_build.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash +set -e + +# Get the parent directory of where this script is. +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done +DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )" + +# Change into that dir because we expect that. +cd "$DIR" + +# Get the git commit +GIT_COMMIT="$(git rev-parse --short HEAD)" +GIT_DESCRIBE="$(git describe --tags --always)" +GIT_IMPORT="github.com/tendermint/merkleeyes/version" + +# Determine the arch/os combos we're building for +XC_ARCH=${XC_ARCH:-"386 amd64 arm"} +XC_OS=${XC_OS:-"solaris darwin freebsd linux windows"} + +# Delete the old dir +echo "==> Removing old directory..." +rm -rf build/pkg +mkdir -p build/pkg + +# Make sure build tools are available. +make tools + +# Get VENDORED dependencies +make get_vendor_deps + +# Build! +echo "==> Building..." +"$(which gox)" \ + -os="${XC_OS}" \ + -arch="${XC_ARCH}" \ + -osarch="!darwin/arm !solaris/amd64 !freebsd/amd64" \ + -ldflags "-X ${GIT_IMPORT}.GitCommit='${GIT_COMMIT}' -X ${GIT_IMPORT}.GitDescribe='${GIT_DESCRIBE}'" \ + -output "build/pkg/{{.OS}}_{{.Arch}}/merkleeyes" \ + -tags="${BUILD_TAGS}" \ + github.com/tendermint/merkleeyes/cmd/merkleeyes + +# Zip all the files. +echo "==> Packaging..." +for PLATFORM in $(find ./build/pkg -mindepth 1 -maxdepth 1 -type d); do + OSARCH=$(basename "${PLATFORM}") + echo "--> ${OSARCH}" + + pushd "$PLATFORM" >/dev/null 2>&1 + zip "../${OSARCH}.zip" ./* + popd >/dev/null 2>&1 +done + + + +exit 0 diff --git a/scripts/merkleeyes-builder/Dockerfile b/scripts/merkleeyes-builder/Dockerfile new file mode 100644 index 0000000..465dc7f --- /dev/null +++ b/scripts/merkleeyes-builder/Dockerfile @@ -0,0 +1,12 @@ +FROM golang:1.7.4 + +RUN apt-get update && apt-get install -y --no-install-recommends \ + zip \ + && rm -rf /var/lib/apt/lists/* + +# We want to ensure that release builds never have any cgo dependencies so we +# switch that off at the highest level. +ENV CGO_ENABLED 0 + +RUN mkdir -p $GOPATH/src/github.com/tendermint/merkleeyes +WORKDIR $GOPATH/src/github.com/tendermint/merkleeyes diff --git a/scripts/publish.sh b/scripts/publish.sh new file mode 100644 index 0000000..7e1a1bd --- /dev/null +++ b/scripts/publish.sh @@ -0,0 +1,7 @@ +#! /bin/bash + +# Get the version from the environment, or try to figure it out. +if [ -z $VERSION ]; then + VERSION=$(awk -F\" '/Version =/ { print $2; exit }' < version/version.go) +fi +aws s3 cp --recursive build/dist s3://tendermint/binaries/merkleeyes/v${VERSION} --acl public-read From 3a0220ec8223b29c9931e24ff75a8ea47bbe4168 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Fri, 2 Jun 2017 00:49:31 -0400 Subject: [PATCH 4/5] bump version to v0.2.1 --- version/version.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version/version.go b/version/version.go index cd1ad0f..0a69fa9 100644 --- a/version/version.go +++ b/version/version.go @@ -2,6 +2,6 @@ package version const Maj = "0" const Min = "2" -const Fix = "0" +const Fix = "1" -const Version = "0.2.0" +const Version = "0.2.1" From bd07eb397a9c0440cba80730b4d8e35d61f61698 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Fri, 2 Jun 2017 00:50:39 -0400 Subject: [PATCH 5/5] update CHANGELOG --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94a2411..a55374e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.2.1 (June 2, 2017) + +IMPROVEMENTS: +- Add version number to the source code +- Update dependencies + ## 0.2.0 (May 18, 2017) Merge in the IAVL tree from `go-merkle` and update import paths for new `tmlibs`