From 9589fc0762fa707cf3cef0003730a9aec69f5089 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Wed, 11 Dec 2019 23:00:39 +0100 Subject: [PATCH] Add version commit string License: MIT Signed-off-by: Jakub Sztandera --- Makefile | 3 ++- build/version.go | 4 ++++ cmd/lotus-bench/main.go | 2 +- cmd/lotus-chainwatch/main.go | 2 +- cmd/lotus-fountain/main.go | 2 +- cmd/lotus-seal-worker/main.go | 2 +- cmd/lotus-seed/main.go | 2 +- cmd/lotus-storage-miner/main.go | 2 +- cmd/lotus/main.go | 2 +- 9 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index e37dcf3e8..8cca65c28 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ MODULES:= CLEAN:= BINS:= +GOFLAGS+=-ldflags="-X "github.com/filecoin-project/lotus/build".CurrentCommit=-$(shell git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null || git rev-parse --short HEAD 2>/dev/null)" ## FFI @@ -47,7 +48,7 @@ CLEAN+=build/.update-modules deps: $(BUILD_DEPS) .PHONY: deps -debug: GOFLAGS=-tags=debug +debug: GOFLAGS+=-tags=debug debug: lotus lotus-storage-miner lotus-seal-worker lotus-seed lotus: $(BUILD_DEPS) diff --git a/build/version.go b/build/version.go index 10832a76a..bbdbffb12 100644 --- a/build/version.go +++ b/build/version.go @@ -1,8 +1,12 @@ package build +var CurrentCommit string + // Version is the local build version, set by build system const Version = "0.1.0" +var UserVersion = Version + CurrentCommit + // APIVersion is a hex semver version of the rpc api exposed // // M M P diff --git a/cmd/lotus-bench/main.go b/cmd/lotus-bench/main.go index 54aa6c6b4..4592fdbb5 100644 --- a/cmd/lotus-bench/main.go +++ b/cmd/lotus-bench/main.go @@ -59,7 +59,7 @@ func main() { app := &cli.App{ Name: "lotus-bench", Usage: "Benchmark performance of lotus on your hardware", - Version: build.Version, + Version: build.UserVersion, Flags: []cli.Flag{ &cli.StringFlag{ Name: "storage-dir", diff --git a/cmd/lotus-chainwatch/main.go b/cmd/lotus-chainwatch/main.go index 187f2a17d..f808b1e81 100644 --- a/cmd/lotus-chainwatch/main.go +++ b/cmd/lotus-chainwatch/main.go @@ -28,7 +28,7 @@ func main() { app := &cli.App{ Name: "lotus-chainwatch", Usage: "Devnet token distribution utility", - Version: build.Version, + Version: build.UserVersion, Flags: []cli.Flag{ &cli.StringFlag{ Name: "repo", diff --git a/cmd/lotus-fountain/main.go b/cmd/lotus-fountain/main.go index 8538a0af8..6e1ff8f2b 100644 --- a/cmd/lotus-fountain/main.go +++ b/cmd/lotus-fountain/main.go @@ -40,7 +40,7 @@ func main() { app := &cli.App{ Name: "lotus-fountain", Usage: "Devnet token distribution utility", - Version: build.Version, + Version: build.UserVersion, Flags: []cli.Flag{ &cli.StringFlag{ Name: "repo", diff --git a/cmd/lotus-seal-worker/main.go b/cmd/lotus-seal-worker/main.go index 586315dcd..57d2bf655 100644 --- a/cmd/lotus-seal-worker/main.go +++ b/cmd/lotus-seal-worker/main.go @@ -30,7 +30,7 @@ func main() { app := &cli.App{ Name: "lotus-seal-worker", Usage: "Remote storage miner worker", - Version: build.Version, + Version: build.UserVersion, Flags: []cli.Flag{ &cli.StringFlag{ Name: "repo", diff --git a/cmd/lotus-seed/main.go b/cmd/lotus-seed/main.go index 754030ade..e84f13951 100644 --- a/cmd/lotus-seed/main.go +++ b/cmd/lotus-seed/main.go @@ -36,7 +36,7 @@ func main() { app := &cli.App{ Name: "lotus-seed", Usage: "Seal sectors for genesis miner", - Version: build.Version, + Version: build.UserVersion, Flags: []cli.Flag{ &cli.StringFlag{ Name: "sectorbuilder-dir", diff --git a/cmd/lotus-storage-miner/main.go b/cmd/lotus-storage-miner/main.go index b8202fb7b..00c170703 100644 --- a/cmd/lotus-storage-miner/main.go +++ b/cmd/lotus-storage-miner/main.go @@ -52,7 +52,7 @@ func main() { app := &cli.App{ Name: "lotus-storage-miner", Usage: "Filecoin decentralized storage network storage miner", - Version: build.Version, + Version: build.UserVersion, Flags: []cli.Flag{ &cli.StringFlag{ Name: "repo", diff --git a/cmd/lotus/main.go b/cmd/lotus/main.go index a76b244dd..5ce4833b8 100644 --- a/cmd/lotus/main.go +++ b/cmd/lotus/main.go @@ -50,7 +50,7 @@ func main() { app := &cli.App{ Name: "lotus", Usage: "Filecoin decentralized storage network client", - Version: build.Version, + Version: build.UserVersion, Flags: []cli.Flag{ &cli.StringFlag{ Name: "repo",