Merge PR #3343: Enrich version command's output

This commit is contained in:
Alessio Treglia 2019-01-22 21:16:29 +01:00 committed by Christopher Goes
parent fae7852b61
commit bf59291a79
5 changed files with 30 additions and 18 deletions

View File

@ -44,7 +44,7 @@ deps: &dependencies
name: dependencies name: dependencies
command: | command: |
export PATH="$GOBIN:$PATH" export PATH="$GOBIN:$PATH"
make get_vendor_deps make vendor-deps
jobs: jobs:
setup_dependencies: setup_dependencies:
@ -260,7 +260,7 @@ jobs:
popd popd
set -x set -x
make tools make tools
make get_vendor_deps make vendor-deps
make build-linux make build-linux
make localnet-start make localnet-start
./scripts/localnet-blocks-test.sh 40 5 10 localhost ./scripts/localnet-blocks-test.sh 40 5 10 localhost
@ -292,7 +292,7 @@ jobs:
command: | command: |
source $BASH_ENV source $BASH_ENV
make tools make tools
make get_vendor_deps make vendor-deps
make install make install
- run: - run:
name: Integration tests name: Integration tests

View File

@ -1,15 +1,20 @@
PACKAGES_NOSIMULATION=$(shell go list ./... | grep -v '/simulation') PACKAGES_NOSIMULATION=$(shell go list ./... | grep -v '/simulation')
PACKAGES_SIMTEST=$(shell go list ./... | grep '/simulation') PACKAGES_SIMTEST=$(shell go list ./... | grep '/simulation')
VERSION := $(subst v,,$(shell git describe --tags --long)) VERSION := $(subst v,,$(shell git describe --tags --long))
COMMIT := $(shell git log -1 --format='%H')
BUILD_TAGS = netgo BUILD_TAGS = netgo
BUILD_FLAGS = -tags "${BUILD_TAGS}" -ldflags "-X github.com/cosmos/cosmos-sdk/version.Version=${VERSION}" CAT := $(if $(filter $(OS),Windows_NT),type,cat)
BUILD_FLAGS = -tags "${BUILD_TAGS}" -ldflags \
"-X github.com/cosmos/cosmos-sdk/version.Version=${VERSION} \
-X github.com/cosmos/cosmos-sdk/version.Commit=${COMMIT} \
-X github.com/cosmos/cosmos-sdk/version.VendorDirHash=$(shell $(CAT) vendor-deps)"
LEDGER_ENABLED ?= true LEDGER_ENABLED ?= true
GOTOOLS = \ GOTOOLS = \
github.com/golang/dep/cmd/dep \ github.com/golang/dep/cmd/dep \
github.com/alecthomas/gometalinter \ github.com/alecthomas/gometalinter \
github.com/rakyll/statik github.com/rakyll/statik
GOBIN ?= $(GOPATH)/bin GOBIN ?= $(GOPATH)/bin
all: devtools get_vendor_deps install install_examples install_cosmos-sdk-cli test_lint test all: devtools vendor-deps install install_examples install_cosmos-sdk-cli test_lint test
# The below include contains the tools target. # The below include contains the tools target.
include scripts/Makefile include scripts/Makefile
@ -17,7 +22,7 @@ include scripts/Makefile
######################################## ########################################
### CI ### CI
ci: devtools get_vendor_deps install test_cover test_lint test ci: devtools vendor-deps install test_cover test_lint test
######################################## ########################################
### Build/Install ### Build/Install
@ -131,10 +136,11 @@ devtools-stamp: tools
go get github.com/tendermint/lint/golint go get github.com/tendermint/lint/golint
touch $@ touch $@
get_vendor_deps: tools vendor-deps: tools
@echo "--> Generating vendor directory via dep ensure" @echo "--> Generating vendor directory via dep ensure"
@rm -rf .vendor-new @rm -rf .vendor-new
@dep ensure -v -vendor-only @dep ensure -v -vendor-only
tar -c vendor/ | sha1sum | cut -d' ' -f1 > $@
update_vendor_deps: tools update_vendor_deps: tools
@echo "--> Running dep ensure" @echo "--> Running dep ensure"
@ -147,7 +153,7 @@ draw_deps: tools
@goviz -i github.com/cosmos/cosmos-sdk/cmd/gaia/cmd/gaiad -d 2 | dot -Tpng -o dependency-graph.png @goviz -i github.com/cosmos/cosmos-sdk/cmd/gaia/cmd/gaiad -d 2 | dot -Tpng -o dependency-graph.png
clean: clean:
rm -f devtools-stamp rm -f devtools-stamp vendor-deps
######################################## ########################################
### Documentation ### Documentation
@ -268,7 +274,7 @@ localnet-stop:
# unless there is a reason not to. # unless there is a reason not to.
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html # https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
.PHONY: build build_cosmos-sdk-cli build_examples install install_examples install_cosmos-sdk-cli install_debug dist \ .PHONY: build build_cosmos-sdk-cli build_examples install install_examples install_cosmos-sdk-cli install_debug dist \
check_tools check_dev_tools get_vendor_deps draw_deps test test_cli test_unit \ check_tools check_dev_tools draw_deps test test_cli test_unit \
test_cover test_lint benchmark devdoc_init devdoc devdoc_save devdoc_update \ test_cover test_lint benchmark devdoc_init devdoc devdoc_save devdoc_update \
build-linux build-docker-gaiadnode localnet-start localnet-stop \ build-linux build-docker-gaiadnode localnet-start localnet-stop \
format check-ledger test_sim_gaia_nondeterminism test_sim_modules test_sim_gaia_fast \ format check-ledger test_sim_gaia_nondeterminism test_sim_modules test_sim_gaia_fast \

View File

@ -19,6 +19,7 @@ BREAKING CHANGES
* [\#3069](https://github.com/cosmos/cosmos-sdk/pull/3069) `--fee` flag renamed to `--fees` to support multiple coins * [\#3069](https://github.com/cosmos/cosmos-sdk/pull/3069) `--fee` flag renamed to `--fees` to support multiple coins
* [\#3156](https://github.com/cosmos/cosmos-sdk/pull/3156) Remove unimplemented `gaiacli init` command * [\#3156](https://github.com/cosmos/cosmos-sdk/pull/3156) Remove unimplemented `gaiacli init` command
* [\#2222] `gaiacli tx stake` -> `gaiacli tx staking`, `gaiacli query stake` -> `gaiacli query staking` * [\#2222] `gaiacli tx stake` -> `gaiacli tx staking`, `gaiacli query stake` -> `gaiacli query staking`
* [\#1894](https://github.com/cosmos/cosmos-sdk/issues/1894) `version` command now shows latest commit, vendor dir hash, and build machine info.
* [\#3320](https://github.com/cosmos/cosmos-sdk/pull/3320) Ensure all `gaiacli query` commands respect the `--output` and `--indent` flags * [\#3320](https://github.com/cosmos/cosmos-sdk/pull/3320) Ensure all `gaiacli query` commands respect the `--output` and `--indent` flags
* Gaia * Gaia
@ -26,6 +27,7 @@ BREAKING CHANGES
* [\#3162](https://github.com/cosmos/cosmos-sdk/issues/3162) The `--gas` flag now takes `auto` instead of `simulate` * [\#3162](https://github.com/cosmos/cosmos-sdk/issues/3162) The `--gas` flag now takes `auto` instead of `simulate`
in order to trigger a simulation of the tx before the actual execution. in order to trigger a simulation of the tx before the actual execution.
* [\#3285](https://github.com/cosmos/cosmos-sdk/pull/3285) New `gaiad tendermint version` to print libs versions * [\#3285](https://github.com/cosmos/cosmos-sdk/pull/3285) New `gaiad tendermint version` to print libs versions
* [\#1894](https://github.com/cosmos/cosmos-sdk/pull/1894) `version` command now shows latest commit, vendor dir hash, and build machine info.
* SDK * SDK
* [staking] \#2513 Validator power type from Dec -> Int * [staking] \#2513 Validator power type from Dec -> Int
@ -35,10 +37,9 @@ BREAKING CHANGES
* [\#3242](https://github.com/cosmos/cosmos-sdk/issues/3242) Fix infinite gas * [\#3242](https://github.com/cosmos/cosmos-sdk/issues/3242) Fix infinite gas
meter utilization during aborted ante handler executions. meter utilization during aborted ante handler executions.
* [x/distribution] \#3292 Enable or disable withdraw addresses with a parameter in the param store * [x/distribution] \#3292 Enable or disable withdraw addresses with a parameter in the param store
* [\#2222] [x/staking] `/stake` -> `/staking` module rename * [staking] \#2222 `/stake` -> `/staking` module rename
* [staking] \#1268 `LooseTokens` -> `NotBondedTokens` * [staking] \#1268 `LooseTokens` -> `NotBondedTokens`
* [staking] \#1402 Redelegation and unbonding-delegation structs changed to include multiple an array of entries * [staking] \#1402 Redelegation and unbonding-delegation structs changed to include multiple an array of entries
* [staking] \#3289 misc renames: * [staking] \#3289 misc renames:
* `Validator.UnbondingMinTime` -> `Validator.UnbondingCompletionTime` * `Validator.UnbondingMinTime` -> `Validator.UnbondingCompletionTime`
* `Delegation` -> `Value` in `MsgCreateValidator` and `MsgDelegate` * `Delegation` -> `Value` in `MsgCreateValidator` and `MsgDelegate`
@ -117,12 +118,8 @@ IMPROVEMENTS
slashing, and staking modules. slashing, and staking modules.
* [\#3093](https://github.com/cosmos/cosmos-sdk/issues/3093) Ante handler does no longer read all accounts in one go when processing signatures as signature * [\#3093](https://github.com/cosmos/cosmos-sdk/issues/3093) Ante handler does no longer read all accounts in one go when processing signatures as signature
verification may fail before last signature is checked. verification may fail before last signature is checked.
<<<<<<< HEAD
* [staking] \#1402 Add for multiple simultaneous redelegations or unbonding-delegations within an unbonding period * [staking] \#1402 Add for multiple simultaneous redelegations or unbonding-delegations within an unbonding period
* [staking] \#1268 staking spec rewrite * [staking] \#1268 staking spec rewrite
=======
* [x/stake] \#1402 Add for multiple simultaneous redelegations or unbonding-delegations within an unbonding period
>>>>>>> Pending.md
* Tendermint * Tendermint

View File

@ -2,6 +2,7 @@ package version
import ( import (
"fmt" "fmt"
"runtime"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -22,5 +23,9 @@ func GetVersion() string {
// CMD // CMD
func printVersion(cmd *cobra.Command, args []string) { func printVersion(cmd *cobra.Command, args []string) {
fmt.Println(GetVersion()) fmt.Println("cosmos-sdk:", GetVersion())
fmt.Println("git commit:", Commit)
fmt.Println("vendor hash:", VendorDirHash)
fmt.Printf("go version %s %s/%s\n",
runtime.Version(), runtime.GOOS, runtime.GOARCH)
} }

View File

@ -1,5 +1,9 @@
//nolint //nolint
package version package version
// GitCommit set by build flags // Variables set by build flags
var Version = "" var (
Commit = ""
Version = ""
VendorDirHash = ""
)