mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 13:46:43 +00:00
fix version naming (#20)
* wip * cursor stuff * fixes * undo unneeded * tag nit * version cleaned
This commit is contained in:
parent
c0886119b3
commit
3058f19298
13 changed files with 51 additions and 34 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
|
@ -2,7 +2,7 @@ name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main, "release/*" ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
|
||||||
5
Makefile
5
Makefile
|
|
@ -8,6 +8,11 @@ GOBIN = ./build/bin
|
||||||
GO ?= latest
|
GO ?= latest
|
||||||
GORUN = go run
|
GORUN = go run
|
||||||
|
|
||||||
|
COMMIT = $(shell git log -1 --format='%H')
|
||||||
|
BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
|
||||||
|
TAG := $(shell git describe --tags --abbrev=0 --match "v*")
|
||||||
|
BUILD_FLAGS := -git-commit=$(COMMIT) -git-branch=$(BRANCH) -git-tag=$(TAG)
|
||||||
|
|
||||||
#? geth: Build geth.
|
#? geth: Build geth.
|
||||||
geth:
|
geth:
|
||||||
$(GORUN) build/ci.go install ./cmd/geth
|
$(GORUN) build/ci.go install ./cmd/geth
|
||||||
|
|
|
||||||
|
|
@ -362,8 +362,8 @@ type ExecutionPayloadBody struct {
|
||||||
|
|
||||||
// Client identifiers to support ClientVersionV1.
|
// Client identifiers to support ClientVersionV1.
|
||||||
const (
|
const (
|
||||||
ClientCode = "GE"
|
ClientCode = "BG"
|
||||||
ClientName = "go-ethereum"
|
ClientName = "bera-geth"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ClientVersionV1 contains information which identifies a client implementation.
|
// ClientVersionV1 contains information which identifies a client implementation.
|
||||||
|
|
|
||||||
|
|
@ -237,6 +237,7 @@ func buildFlags(env build.Environment, staticLinking bool, buildTags []string) (
|
||||||
if env.Commit != "" {
|
if env.Commit != "" {
|
||||||
ld = append(ld, "-X", "github.com/ethereum/go-ethereum/internal/version.gitCommit="+env.Commit)
|
ld = append(ld, "-X", "github.com/ethereum/go-ethereum/internal/version.gitCommit="+env.Commit)
|
||||||
ld = append(ld, "-X", "github.com/ethereum/go-ethereum/internal/version.gitDate="+env.Date)
|
ld = append(ld, "-X", "github.com/ethereum/go-ethereum/internal/version.gitDate="+env.Date)
|
||||||
|
ld = append(ld, "-X", "github.com/ethereum/go-ethereum/internal/version.gitTag="+env.Tag)
|
||||||
}
|
}
|
||||||
// Strip DWARF on darwin. This used to be required for certain things,
|
// Strip DWARF on darwin. This used to be required for certain things,
|
||||||
// and there is no downside to this, so we just keep doing it.
|
// and there is no downside to this, so we just keep doing it.
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ func TestConsoleWelcome(t *testing.T) {
|
||||||
geth.Expect(`
|
geth.Expect(`
|
||||||
Welcome to the Geth JavaScript console!
|
Welcome to the Geth JavaScript console!
|
||||||
|
|
||||||
instance: Geth/v{{gethver}}/{{goos}}-{{goarch}}/{{gover}}
|
instance: bera-geth/v{{gethver}}/{{goos}}-{{goarch}}/{{gover}}
|
||||||
at block: 0 ({{niltime}})
|
at block: 0 ({{niltime}})
|
||||||
datadir: {{.Datadir}}
|
datadir: {{.Datadir}}
|
||||||
modules: {{apis}}
|
modules: {{apis}}
|
||||||
|
|
@ -89,9 +89,9 @@ func TestAttachWelcome(t *testing.T) {
|
||||||
)
|
)
|
||||||
// Configure the instance for IPC attachment
|
// Configure the instance for IPC attachment
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
ipc = `\\.\pipe\geth` + strconv.Itoa(trulyRandInt(100000, 999999))
|
ipc = `\\.\pipe\bera-geth` + strconv.Itoa(trulyRandInt(100000, 999999))
|
||||||
} else {
|
} else {
|
||||||
ipc = filepath.Join(t.TempDir(), "geth.ipc")
|
ipc = filepath.Join(t.TempDir(), "bera-geth.ipc")
|
||||||
}
|
}
|
||||||
// And HTTP + WS attachment
|
// And HTTP + WS attachment
|
||||||
p := trulyRandInt(1024, 65533) // Yeah, sometimes this will fail, sorry :P
|
p := trulyRandInt(1024, 65533) // Yeah, sometimes this will fail, sorry :P
|
||||||
|
|
@ -140,7 +140,7 @@ func testAttachWelcome(t *testing.T, geth *testgeth, endpoint, apis string) {
|
||||||
attach.Expect(`
|
attach.Expect(`
|
||||||
Welcome to the Geth JavaScript console!
|
Welcome to the Geth JavaScript console!
|
||||||
|
|
||||||
instance: Geth/v{{gethver}}/{{goos}}-{{goarch}}/{{gover}}
|
instance: bera-geth/v{{gethver}}/{{goos}}-{{goarch}}/{{gover}}
|
||||||
at block: 0 ({{niltime}}){{if ipc}}
|
at block: 0 ({{niltime}}){{if ipc}}
|
||||||
datadir: {{datadir}}{{end}}
|
datadir: {{datadir}}{{end}}
|
||||||
modules: {{apis}}
|
modules: {{apis}}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
clientIdentifier = "geth" // Client identifier to advertise over the network
|
clientIdentifier = "bera-geth" // Client identifier to advertise over the network
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,12 @@ func printVersion(ctx *cli.Context) error {
|
||||||
git, _ := version.VCS()
|
git, _ := version.VCS()
|
||||||
|
|
||||||
fmt.Println(strings.Title(clientIdentifier))
|
fmt.Println(strings.Title(clientIdentifier))
|
||||||
|
// Use git tag if available, otherwise fall back to hardcoded version
|
||||||
|
if git.Tag != "" {
|
||||||
|
fmt.Println("Version:", git.Tag)
|
||||||
|
} else {
|
||||||
fmt.Println("Version:", version.WithMeta)
|
fmt.Println("Version:", version.WithMeta)
|
||||||
|
}
|
||||||
if git.Commit != "" {
|
if git.Commit != "" {
|
||||||
fmt.Println("Git Commit:", git.Commit)
|
fmt.Println("Git Commit:", git.Commit)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,9 +59,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/p2p/dnsdisc"
|
"github.com/ethereum/go-ethereum/p2p/dnsdisc"
|
||||||
"github.com/ethereum/go-ethereum/p2p/enode"
|
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||||
"github.com/ethereum/go-ethereum/params"
|
"github.com/ethereum/go-ethereum/params"
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
gethversion "github.com/ethereum/go-ethereum/version"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -359,13 +357,14 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
||||||
|
|
||||||
func makeExtraData(extra []byte) []byte {
|
func makeExtraData(extra []byte) []byte {
|
||||||
if len(extra) == 0 {
|
if len(extra) == 0 {
|
||||||
// create default extradata
|
// create default extradata in ASCII format similar to reth
|
||||||
extra, _ = rlp.EncodeToBytes([]interface{}{
|
// Format: "bera-geth/vX.Y.Z/platform"
|
||||||
uint(gethversion.Major<<16 | gethversion.Minor<<8 | gethversion.Patch),
|
tag := version.WithMeta
|
||||||
"geth",
|
if vcs, ok := version.VCS(); ok && vcs.Tag != "" {
|
||||||
runtime.Version(),
|
tag = vcs.Tag
|
||||||
runtime.GOOS,
|
}
|
||||||
})
|
versionStr := fmt.Sprintf("bera-geth/v%s/%s", tag, runtime.GOOS)
|
||||||
|
extra = []byte(versionStr)
|
||||||
}
|
}
|
||||||
if uint64(len(extra)) > params.MaximumExtraDataSize {
|
if uint64(len(extra)) > params.MaximumExtraDataSize {
|
||||||
log.Warn("Miner extra data exceed limit", "extra", hexutil.Bytes(extra), "limit", params.MaximumExtraDataSize)
|
log.Warn("Miner extra data exceed limit", "extra", hexutil.Bytes(extra), "limit", params.MaximumExtraDataSize)
|
||||||
|
|
|
||||||
|
|
@ -1034,14 +1034,18 @@ func (api *ConsensusAPI) ExchangeCapabilities([]string) []string {
|
||||||
func (api *ConsensusAPI) GetClientVersionV1(info engine.ClientVersionV1) []engine.ClientVersionV1 {
|
func (api *ConsensusAPI) GetClientVersionV1(info engine.ClientVersionV1) []engine.ClientVersionV1 {
|
||||||
log.Trace("Engine API request received", "method", "GetClientVersionV1", "info", info.String())
|
log.Trace("Engine API request received", "method", "GetClientVersionV1", "info", info.String())
|
||||||
commit := make([]byte, 4)
|
commit := make([]byte, 4)
|
||||||
|
vsn := version.WithMeta
|
||||||
if vcs, ok := version.VCS(); ok {
|
if vcs, ok := version.VCS(); ok {
|
||||||
commit = common.FromHex(vcs.Commit)[0:4]
|
commit = common.FromHex(vcs.Commit)[0:4]
|
||||||
|
if vcs.Tag != "" {
|
||||||
|
vsn = vcs.Tag
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return []engine.ClientVersionV1{
|
return []engine.ClientVersionV1{
|
||||||
{
|
{
|
||||||
Code: engine.ClientCode,
|
Code: engine.ClientCode,
|
||||||
Name: engine.ClientName,
|
Name: engine.ClientName,
|
||||||
Version: version.WithMeta,
|
Version: vsn,
|
||||||
Commit: hexutil.Encode(commit),
|
Commit: hexutil.Encode(commit),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,12 @@ func LocalEnv() Environment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if info, err := os.Stat(".git/objects"); err == nil && info.IsDir() && env.Tag == "" {
|
if info, err := os.Stat(".git/objects"); err == nil && info.IsDir() && env.Tag == "" {
|
||||||
|
// Try to get tag at HEAD first
|
||||||
env.Tag = firstLine(RunGit("tag", "-l", "--points-at", "HEAD"))
|
env.Tag = firstLine(RunGit("tag", "-l", "--points-at", "HEAD"))
|
||||||
|
// If no tag points at HEAD, get the most recent tag
|
||||||
|
if env.Tag == "" {
|
||||||
|
env.Tag = firstLine(RunGit("describe", "--tags", "--abbrev=0"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return env
|
return env
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,11 @@ const (
|
||||||
|
|
||||||
// These variables are set at build-time by the linker when the build is
|
// These variables are set at build-time by the linker when the build is
|
||||||
// done by build/ci.go.
|
// done by build/ci.go.
|
||||||
var gitCommit, gitDate string
|
var gitCommit, gitDate, gitTag string
|
||||||
|
|
||||||
// VCSInfo represents the git repository state.
|
// VCSInfo represents the git repository state.
|
||||||
type VCSInfo struct {
|
type VCSInfo struct {
|
||||||
|
Tag string // git tag
|
||||||
Commit string // head commit hash
|
Commit string // head commit hash
|
||||||
Date string // commit time in YYYYMMDD format
|
Date string // commit time in YYYYMMDD format
|
||||||
Dirty bool
|
Dirty bool
|
||||||
|
|
@ -43,7 +44,7 @@ type VCSInfo struct {
|
||||||
func VCS() (VCSInfo, bool) {
|
func VCS() (VCSInfo, bool) {
|
||||||
if gitCommit != "" {
|
if gitCommit != "" {
|
||||||
// Use information set by the build script if present.
|
// Use information set by the build script if present.
|
||||||
return VCSInfo{Commit: gitCommit, Date: gitDate}, true
|
return VCSInfo{Tag: gitTag, Commit: gitCommit, Date: gitDate}, true
|
||||||
}
|
}
|
||||||
if buildInfo, ok := debug.ReadBuildInfo(); ok {
|
if buildInfo, ok := debug.ReadBuildInfo(); ok {
|
||||||
if buildInfo.Main.Path == ourPath {
|
if buildInfo.Main.Path == ourPath {
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,6 @@ import (
|
||||||
|
|
||||||
const ourPath = "github.com/ethereum/go-ethereum" // Path to our module
|
const ourPath = "github.com/ethereum/go-ethereum" // Path to our module
|
||||||
|
|
||||||
// Family holds the textual version string for major.minor
|
|
||||||
var Family = fmt.Sprintf("%d.%d", version.Major, version.Minor)
|
|
||||||
|
|
||||||
// Semantic holds the textual version string for major.minor.patch.
|
// Semantic holds the textual version string for major.minor.patch.
|
||||||
var Semantic = fmt.Sprintf("%d.%d.%d", version.Major, version.Minor, version.Patch)
|
var Semantic = fmt.Sprintf("%d.%d.%d", version.Major, version.Minor, version.Patch)
|
||||||
|
|
||||||
|
|
@ -114,9 +111,9 @@ func Info() (version, vcs string) {
|
||||||
// information. If it is unable to determine which module is related to our
|
// information. If it is unable to determine which module is related to our
|
||||||
// package it falls back to the hardcoded values in the params package.
|
// package it falls back to the hardcoded values in the params package.
|
||||||
func versionInfo(info *debug.BuildInfo) string {
|
func versionInfo(info *debug.BuildInfo) string {
|
||||||
// If the main package is from our repo, prefix version with "geth".
|
// If the main package is from our repo, prefix version with "bera-geth".
|
||||||
if strings.HasPrefix(info.Path, ourPath) {
|
if strings.HasPrefix(info.Path, ourPath) {
|
||||||
return fmt.Sprintf("geth %s", info.Main.Version)
|
return fmt.Sprintf("bera-geth %s", info.Main.Version)
|
||||||
}
|
}
|
||||||
// Not our main package, so explicitly print out the module path and
|
// Not our main package, so explicitly print out the module path and
|
||||||
// version.
|
// version.
|
||||||
|
|
@ -130,7 +127,7 @@ func versionInfo(info *debug.BuildInfo) string {
|
||||||
// If our module path wasn't imported, it's unclear which
|
// If our module path wasn't imported, it's unclear which
|
||||||
// version of our code they are running. Fallback to hardcoded
|
// version of our code they are running. Fallback to hardcoded
|
||||||
// version.
|
// version.
|
||||||
return version + fmt.Sprintf("geth %s", WithMeta)
|
return version + fmt.Sprintf("bera-geth %s", WithMeta)
|
||||||
}
|
}
|
||||||
// Our package is a dependency for the main module. Return path and
|
// Our package is a dependency for the main module. Return path and
|
||||||
// version data for both.
|
// version data for both.
|
||||||
|
|
|
||||||
|
|
@ -79,15 +79,15 @@ func TestIPCPathResolution(t *testing.T) {
|
||||||
}{
|
}{
|
||||||
{"", "", false, ""},
|
{"", "", false, ""},
|
||||||
{"data", "", false, ""},
|
{"data", "", false, ""},
|
||||||
{"", "geth.ipc", false, filepath.Join(os.TempDir(), "geth.ipc")},
|
{"", "bera-geth.ipc", false, filepath.Join(os.TempDir(), "bera-geth.ipc")},
|
||||||
{"data", "geth.ipc", false, "data/geth.ipc"},
|
{"data", "bera-geth.ipc", false, "data/bera-geth.ipc"},
|
||||||
{"data", "./geth.ipc", false, "./geth.ipc"},
|
{"data", "./bera-geth.ipc", false, "./bera-geth.ipc"},
|
||||||
{"data", "/geth.ipc", false, "/geth.ipc"},
|
{"data", "/bera-geth.ipc", false, "/bera-geth.ipc"},
|
||||||
{"", "", true, ``},
|
{"", "", true, ``},
|
||||||
{"data", "", true, ``},
|
{"data", "", true, ``},
|
||||||
{"", "geth.ipc", true, `\\.\pipe\geth.ipc`},
|
{"", "bera-geth.ipc", true, `\\.\pipe\bera-geth.ipc`},
|
||||||
{"data", "geth.ipc", true, `\\.\pipe\geth.ipc`},
|
{"data", "bera-geth.ipc", true, `\\.\pipe\bera-geth.ipc`},
|
||||||
{"data", `\\.\pipe\geth.ipc`, true, `\\.\pipe\geth.ipc`},
|
{"data", `\\.\pipe\bera-geth.ipc`, true, `\\.\pipe\bera-geth.ipc`},
|
||||||
}
|
}
|
||||||
for i, test := range tests {
|
for i, test := range tests {
|
||||||
// Only run when platform/test match
|
// Only run when platform/test match
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue