mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-11-27 20:15:23 +00:00
Merge pull request #228 from neilalexander/semver
Strip v from version during imprint
This commit is contained in:
commit
467002bbf7
2
build
2
build
@ -10,7 +10,7 @@ done
|
|||||||
echo "Downloading..."
|
echo "Downloading..."
|
||||||
for CMD in `ls cmd/` ; do
|
for CMD in `ls cmd/` ; do
|
||||||
echo "Building: $CMD"
|
echo "Building: $CMD"
|
||||||
IMPRINT="-X github.com/yggdrasil-network/yggdrasil-go/src/yggdrasil.buildName=$(sh contrib/semver/name.sh) -X github.com/yggdrasil-network/yggdrasil-go/src/yggdrasil.buildVersion=$(sh contrib/semver/version.sh)"
|
IMPRINT="-X github.com/yggdrasil-network/yggdrasil-go/src/yggdrasil.buildName=$(sh contrib/semver/name.sh) -X github.com/yggdrasil-network/yggdrasil-go/src/yggdrasil.buildVersion=$(sh contrib/semver/version.sh --bare)"
|
||||||
if [ $DEBUG ]; then
|
if [ $DEBUG ]; then
|
||||||
go build -ldflags="$IMPRINT" -tags debug -v ./cmd/$CMD
|
go build -ldflags="$IMPRINT" -tags debug -v ./cmd/$CMD
|
||||||
else
|
else
|
||||||
|
@ -183,10 +183,10 @@ func main() {
|
|||||||
}
|
}
|
||||||
case "getself":
|
case "getself":
|
||||||
for k, v := range res["self"].(map[string]interface{}) {
|
for k, v := range res["self"].(map[string]interface{}) {
|
||||||
if buildname, ok := v.(map[string]interface{})["build_name"].(string); ok {
|
if buildname, ok := v.(map[string]interface{})["build_name"].(string); ok && buildname != "unknown" {
|
||||||
fmt.Println("Build name:", buildname)
|
fmt.Println("Build name:", buildname)
|
||||||
}
|
}
|
||||||
if buildversion, ok := v.(map[string]interface{})["build_version"].(string); ok {
|
if buildversion, ok := v.(map[string]interface{})["build_version"].(string); ok && buildversion != "unknown" {
|
||||||
fmt.Println("Build version:", buildversion)
|
fmt.Println("Build version:", buildversion)
|
||||||
}
|
}
|
||||||
fmt.Println("IPv6 address:", k)
|
fmt.Println("IPv6 address:", k)
|
||||||
|
@ -12,7 +12,7 @@ fi
|
|||||||
|
|
||||||
PKGBRANCH=$(basename `git name-rev --name-only HEAD`)
|
PKGBRANCH=$(basename `git name-rev --name-only HEAD`)
|
||||||
PKGNAME=$(sh contrib/semver/name.sh)
|
PKGNAME=$(sh contrib/semver/name.sh)
|
||||||
PKGVERSION=$(sh contrib/semver/version.sh | cut -c 2-)
|
PKGVERSION=$(sh contrib/semver/version.sh --bare)
|
||||||
PKGARCH=${PKGARCH-amd64}
|
PKGARCH=${PKGARCH-amd64}
|
||||||
PKGFILE=$PKGNAME-$PKGVERSION-$PKGARCH.deb
|
PKGFILE=$PKGNAME-$PKGVERSION-$PKGARCH.deb
|
||||||
PKGREPLACES=yggdrasil
|
PKGREPLACES=yggdrasil
|
||||||
|
@ -72,7 +72,7 @@ chmod +x pkgbuild/root/usr/local/bin/yggdrasilctl
|
|||||||
|
|
||||||
# Work out metadata for the package info
|
# Work out metadata for the package info
|
||||||
PKGNAME=$(sh contrib/semver/name.sh)
|
PKGNAME=$(sh contrib/semver/name.sh)
|
||||||
PKGVERSION=$(sh contrib/semver/version.sh | cut -c 2-)
|
PKGVERSION=$(sh contrib/semver/version.sh --bare)
|
||||||
PKGARCH=${PKGARCH-amd64}
|
PKGARCH=${PKGARCH-amd64}
|
||||||
PAYLOADSIZE=$(( $(wc -c pkgbuild/flat/base.pkg/Payload | awk '{ print $1 }') / 1024 ))
|
PAYLOADSIZE=$(( $(wc -c pkgbuild/flat/base.pkg/Payload | awk '{ print $1 }') / 1024 ))
|
||||||
|
|
||||||
|
@ -12,6 +12,13 @@ MERGE=$(git rev-list $TAG..master --grep "from $DEVELOPBRANCH" 2>/dev/null | hea
|
|||||||
# Get the number of merges since the last merge to master
|
# Get the number of merges since the last merge to master
|
||||||
PATCH=$(git rev-list $TAG..master --count --merges --grep="from $DEVELOPBRANCH" 2>/dev/null)
|
PATCH=$(git rev-list $TAG..master --count --merges --grep="from $DEVELOPBRANCH" 2>/dev/null)
|
||||||
|
|
||||||
|
# Decide whether we should prepend the version with "v" - the default is that
|
||||||
|
# we do because we use it in git tags, but we might not always need it
|
||||||
|
PREPEND="v"
|
||||||
|
if [ "$1" == "--bare" ]; then
|
||||||
|
PREPEND=""
|
||||||
|
fi
|
||||||
|
|
||||||
# If it fails then there's no last tag - go from the first commit
|
# If it fails then there's no last tag - go from the first commit
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
PATCH=$(git rev-list HEAD --count 2>/dev/null)
|
PATCH=$(git rev-list HEAD --count 2>/dev/null)
|
||||||
@ -22,7 +29,7 @@ if [ $? != 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf 'v0.0.%d' "$PATCH"
|
printf '%s0.0.%d' "$PREPEND" "$PATCH"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -39,12 +46,12 @@ BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|||||||
# Output in the desired format
|
# Output in the desired format
|
||||||
if [ $PATCH = 0 ]; then
|
if [ $PATCH = 0 ]; then
|
||||||
if [ ! -z $FULL ]; then
|
if [ ! -z $FULL ]; then
|
||||||
printf 'v%d.%d.0' "$MAJOR" "$MINOR"
|
printf '%s%d.%d.0' "$PREPEND" "$MAJOR" "$MINOR"
|
||||||
else
|
else
|
||||||
printf 'v%d.%d' "$MAJOR" "$MINOR"
|
printf '%s%d.%d' "$PREPEND" "$MAJOR" "$MINOR"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
printf 'v%d.%d.%d' "$MAJOR" "$MINOR" "$PATCH"
|
printf '%s%d.%d.%d' "$PREPEND" "$MAJOR" "$MINOR" "$PATCH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add the build tag on non-master branches
|
# Add the build tag on non-master branches
|
||||||
|
@ -556,13 +556,18 @@ func (a *admin) getData_getSelf() *admin_nodeInfo {
|
|||||||
table := a.core.switchTable.table.Load().(lookupTable)
|
table := a.core.switchTable.table.Load().(lookupTable)
|
||||||
coords := table.self.getCoords()
|
coords := table.self.getCoords()
|
||||||
self := admin_nodeInfo{
|
self := admin_nodeInfo{
|
||||||
{"build_name", GetBuildName()},
|
|
||||||
{"build_version", GetBuildVersion()},
|
|
||||||
{"box_pub_key", hex.EncodeToString(a.core.boxPub[:])},
|
{"box_pub_key", hex.EncodeToString(a.core.boxPub[:])},
|
||||||
{"ip", a.core.GetAddress().String()},
|
{"ip", a.core.GetAddress().String()},
|
||||||
{"subnet", a.core.GetSubnet().String()},
|
{"subnet", a.core.GetSubnet().String()},
|
||||||
{"coords", fmt.Sprint(coords)},
|
{"coords", fmt.Sprint(coords)},
|
||||||
}
|
}
|
||||||
|
if name := GetBuildName(); name != "unknown" {
|
||||||
|
self = append(self, admin_pair{"build_name", name})
|
||||||
|
}
|
||||||
|
if version := GetBuildVersion(); version != "unknown" {
|
||||||
|
self = append(self, admin_pair{"build_version", version})
|
||||||
|
}
|
||||||
|
|
||||||
return &self
|
return &self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,11 +87,11 @@ func GetBuildVersion() string {
|
|||||||
func (c *Core) Start(nc *config.NodeConfig, log *log.Logger) error {
|
func (c *Core) Start(nc *config.NodeConfig, log *log.Logger) error {
|
||||||
c.log = log
|
c.log = log
|
||||||
|
|
||||||
if buildName != "" {
|
if name := GetBuildName(); name != "unknown" {
|
||||||
c.log.Println("Build name:", buildName)
|
c.log.Println("Build name:", name)
|
||||||
}
|
}
|
||||||
if buildVersion != "" {
|
if version := GetBuildVersion(); version != "unknown" {
|
||||||
c.log.Println("Build version:", buildVersion)
|
c.log.Println("Build version:", version)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.log.Println("Starting up...")
|
c.log.Println("Starting up...")
|
||||||
|
Loading…
Reference in New Issue
Block a user