Fix reproducible builds (#1099)

This commit is contained in:
Igor Mandrigin 2020-09-11 17:42:33 +01:00 committed by GitHub
parent 5339ca0968
commit eca39e12f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 8 deletions

View File

@ -21,12 +21,12 @@ docker-compose:
docker-compose up
geth:
$(GOBUILD) -o $(GOBIN)/tg -ldflags "-X main.GitCommit=${GIT_COMMIT} -X main.GitDate=$(shell date +%Y.%m.%d.%H%M%S)" ./cmd/tg
$(GOBUILD) -o $(GOBIN)/tg -ldflags "-X main.gitCommit=${GIT_COMMIT}" ./cmd/tg
@echo "Done building."
@echo "Run \"$(GOBIN)/tg\" to launch turbo-geth."
tg:
$(GOBUILD) -o $(GOBIN)/tg -ldflags "-X main.GitCommit=${GIT_COMMIT} -X main.GitDate=$(shell date +%Y.%m.%d.%H%M%S)" ./cmd/tg
$(GOBUILD) -o $(GOBIN)/tg -ldflags "-X main.gitCommit=${GIT_COMMIT}" ./cmd/tg
@echo "Done building."
@echo "Run \"$(GOBIN)/tg\" to launch turbo-geth."

View File

@ -14,8 +14,7 @@ import (
)
var (
GitCommit string
GitDate string
gitCommit string
)
func main() {
@ -31,7 +30,7 @@ func runTurboGeth(ctx *cli.Context) {
stagedsync.DefaultUnwindOrder(),
)
tg := node.New(ctx, sync, node.Params{GitCommit: GitCommit, GitDate: GitDate})
tg := node.New(ctx, sync, node.Params{GitCommit: gitCommit})
err := tg.Serve()
if err != nil {

View File

@ -43,7 +43,6 @@ func (tg *TurboGethNode) run() {
}
type Params struct {
GitDate string
GitCommit string
CustomBuckets dbutils.BucketsCfg
}
@ -75,8 +74,8 @@ func makeEthConfig(ctx *cli.Context, node *node.Node) *eth.Config {
func makeNodeConfig(ctx *cli.Context, p Params) *node.Config {
nodeConfig := node.DefaultConfig
// see simiar changes in `cmd/geth/config.go#defaultNodeConfig`
if commit, date := p.GitCommit, p.GitDate; commit != "" && date != "" {
nodeConfig.Version = params.VersionWithCommit(commit, date)
if commit := p.GitCommit; commit != "" {
nodeConfig.Version = params.VersionWithCommit(commit, "")
} else {
nodeConfig.Version = params.Version
}