diff --git a/Makefile b/Makefile index 1ae718c5aeedf54a58bdf16974be15aac1a47122..77bcfd8d2fbc49f8aa49a77f49a5ea6fcf470d02 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ SHELL := /bin/bash REPO := $(shell pwd) GOFILES_NOVENDOR := $(shell go list -f "{{.Dir}}" ./...) PACKAGES_NOVENDOR := $(shell go list ./...) -COMMIT := $(shell git rev-parse --short HEAD) +COMMIT := $(shell ./scripts/commit_hash.sh) # Bosmarmot integration testing BOSMARMOT_PROJECT := github.com/monax/bosmarmot BOSMARMOT_GOPATH := ${REPO}/.gopath_bos @@ -102,6 +102,10 @@ build_race: check build_race_db build_race_client build_db: go build -ldflags "-X github.com/hyperledger/burrow/project.commit=${COMMIT}" -o ${REPO}/bin/burrow ./cmd/burrow +.PHONY: install_db +install_db: build_db + cp ${REPO}/bin/burrow ${GOPATH}/bin/burrow + # build burrow-client .PHONY: build_client build_client: diff --git a/scripts/commit_hash.sh b/scripts/commit_hash.sh new file mode 100755 index 0000000000000000000000000000000000000000..cd20bcb14f27d554893068cf2cf59540b95253c8 --- /dev/null +++ b/scripts/commit_hash.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# Gets the git commit hash of the working dir and adds an additional hash of any tracked modified files +commit=$(git describe --tags) +dirty=$(git ls-files -m) +if [[ -n ${dirty} ]]; then + commit="$commit+dirty.$(echo ${dirty} | git hash-object --stdin | head -c8)" +fi +echo "$commit" +