Skip to content

Commit

Permalink
feat: show network name in binary versions (#1642)
Browse files Browse the repository at this point in the history
* fix boostd-data maddr, enhance build

* add CQL migrator

* refactor migrator

* modify migrate query

* remove idx from migrate query

* remove CQL migrator

* undo go mod changes, fix mainnet build

* undo yugabyte changes

* remove extra line
  • Loading branch information
LexLuthr authored Aug 28, 2023
1 parent 592afba commit 162fdc8
Show file tree
Hide file tree
Showing 9 changed files with 150 additions and 4 deletions.
13 changes: 13 additions & 0 deletions build/params_calibnet.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//go:build calibnet
// +build calibnet

package build

import (
"github.com/filecoin-project/go-address"
)

func init() {
SetAddressNetwork(address.Testnet)
BuildType = BuildCalibnet
}
13 changes: 13 additions & 0 deletions build/params_mainnet.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//go:build !calibnet && !debug && !2k
// +build !calibnet,!debug,!2k

package build

import (
"github.com/filecoin-project/go-address"
)

func init() {
SetAddressNetwork(address.Mainnet)
BuildType = BuildMainnet
}
13 changes: 13 additions & 0 deletions build/params_testnets.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//go:build debug || 2k
// +build debug 2k

package build

import (
"github.com/filecoin-project/go-address"
)

func init() {
SetAddressNetwork(address.Testnet)
BuildType = BuildDebug
}
31 changes: 30 additions & 1 deletion build/version.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,38 @@
package build

var CurrentCommit string
var BuildType int

const (
BuildMainnet = 0x1
Build2k = 0x2
BuildDebug = 0x3
BuildCalibnet = 0x4
BuildInteropnet = 0x5
BuildButterflynet = 0x7
)

func BuildTypeString() string {
switch BuildType {
case BuildMainnet:
return "+mainnet"
case Build2k:
return "+2k"
case BuildDebug:
return "+debug"
case BuildCalibnet:
return "+calibnet"
case BuildInteropnet:
return "+interopnet"
case BuildButterflynet:
return "+butterflynet"
default:
return "+huh?"
}
}

const BuildVersion = "2.0.0-rc1"

func UserVersion() string {
return BuildVersion + CurrentCommit
return BuildVersion + BuildTypeString() + CurrentCommit
}
40 changes: 39 additions & 1 deletion extern/boostd-data/build/build.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,47 @@
package build

import (
"github.com/filecoin-project/go-address"
)

var CurrentCommit string

func SetAddressNetwork(n address.Network) {
address.CurrentNetwork = n
}

var BuildType int

const (
BuildMainnet = 0x1
Build2k = 0x2
BuildDebug = 0x3
BuildCalibnet = 0x4
BuildInteropnet = 0x5
BuildButterflynet = 0x7
)

func BuildTypeString() string {
switch BuildType {
case BuildMainnet:
return "+mainnet"
case Build2k:
return "+2k"
case BuildDebug:
return "+debug"
case BuildCalibnet:
return "+calibnet"
case BuildInteropnet:
return "+interopnet"
case BuildButterflynet:
return "+butterflynet"
default:
return "+huh?"
}
}

const BuildVersion = "1.4.0"

func UserVersion() string {
return BuildVersion + CurrentCommit
return BuildVersion + BuildTypeString() + CurrentCommit
}
13 changes: 13 additions & 0 deletions extern/boostd-data/build/params_calibnet.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//go:build calibnet
// +build calibnet

package build

import (
"github.com/filecoin-project/go-address"
)

func init() {
SetAddressNetwork(address.Testnet)
BuildType = BuildCalibnet
}
13 changes: 13 additions & 0 deletions extern/boostd-data/build/params_mainnet.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//go:build !calibnet && !debug && !2k
// +build !calibnet,!debug,!2k

package build

import (
"github.com/filecoin-project/go-address"
)

func init() {
SetAddressNetwork(address.Mainnet)
BuildType = BuildMainnet
}
13 changes: 13 additions & 0 deletions extern/boostd-data/build/params_testnets.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//go:build debug || 2k
// +build debug 2k

package build

import (
"github.com/filecoin-project/go-address"
)

func init() {
SetAddressNetwork(address.Testnet)
BuildType = BuildDebug
}
5 changes: 3 additions & 2 deletions extern/boostd-data/svc/setup_yugabyte_test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package svc

import (
"database/sql"
"testing"
"time"

"github.com/filecoin-project/boostd-data/yugabyte"
"github.com/filecoin-project/go-address"
logging "github.com/ipfs/go-log/v2"
Expand All @@ -10,8 +13,6 @@ import (
"github.com/yugabyte/gocql"
"github.com/yugabyte/pgx/v4/pgxpool"
"golang.org/x/net/context"
"testing"
"time"
)

var tlog = logging.Logger("ybtest")
Expand Down

0 comments on commit 162fdc8

Please sign in to comment.