From e4fae760afa0615c73ce6bd3091d73537a2fa00e Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Mon, 13 Jul 2015 11:49:09 -0700 Subject: [PATCH] move revisions file to ~/.tendermint/ --- Makefile | 12 ++++-------- common/os.go | 4 +--- config/tendermint/config.go | 1 + node/node.go | 3 +-- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 88b3350b3..e670b8440 100644 --- a/Makefile +++ b/Makefile @@ -2,13 +2,15 @@ all: install +TMROOT = $${TMROOT:-$$HOME/.tendermint} + install: go install github.com/tendermint/tendermint/cmd/tendermint go install github.com/tendermint/tendermint/cmd/barak go install github.com/tendermint/tendermint/cmd/debora go install github.com/tendermint/tendermint/cmd/stdinwriter go install github.com/tendermint/tendermint/cmd/logjack - echo -n `git rev-parse --verify HEAD` > .revision + @echo -n `git rev-parse --verify HEAD` > $(TMROOT)/revisions build: go build -o build/tendermint github.com/tendermint/tendermint/cmd/tendermint @@ -44,10 +46,4 @@ gen_client: go generate rpc/core_client/*.go revision: - echo -n `git rev-parse --verify HEAD` > .revision - -tendermint_root/priv_validator.json: tendermint_root/priv_validator.json.orig - cp $< $@ - -clean: - rm -f tendermint tendermint_root/priv_validator.json + @echo -n `git rev-parse --verify HEAD` > $(TMROOT)/revisions diff --git a/common/os.go b/common/os.go index 51c6d2b6a..5cdfd10ae 100644 --- a/common/os.go +++ b/common/os.go @@ -5,14 +5,12 @@ import ( "io/ioutil" "os" "os/signal" - "path" "sync" "time" ) var ( - GoPath = os.Getenv("GOPATH") - TendermintRepo = path.Join(GoPath, "src", "github.com", "tendermint", "tendermint") + GoPath = os.Getenv("GOPATH") ) func TrapSignal(cb func()) { diff --git a/config/tendermint/config.go b/config/tendermint/config.go index 14868d56b..52a0092e6 100644 --- a/config/tendermint/config.go +++ b/config/tendermint/config.go @@ -70,6 +70,7 @@ func GetConfig(rootDir string) cfg.Config { mapConfig.SetDefault("db_dir", rootDir+"/data") mapConfig.SetDefault("log_level", "info") mapConfig.SetDefault("rpc_laddr", "0.0.0.0:46657") + mapConfig.SetDefault("revisions_file", rootDir+"/revisions") return mapConfig } diff --git a/node/node.go b/node/node.go index 3b5812767..858b7d0c8 100644 --- a/node/node.go +++ b/node/node.go @@ -7,7 +7,6 @@ import ( "net" "net/http" "os" - "path" "strconv" "strings" "time" @@ -247,7 +246,7 @@ func makeNodeInfo(sw *p2p.Switch) *types.NodeInfo { } // include git hash in the nodeInfo if available - if rev, err := ReadFile(path.Join(TendermintRepo, ".revision")); err == nil { + if rev, err := ReadFile(config.GetString("revisions_file")); err == nil { nodeInfo.Revision = string(rev) }