private/version: minimal fix for tag-release.sh

Previous split to a storj.io/private repository broke tag-release.sh
script. This is the minimal temporary fix to make things work.

This links the build information to specified variables and sets them
inline. This approach, of course, is very fragile.

Change-Id: I73db2305e6c304146e5a14b13f1d917881a7455c
This commit is contained in:
Egon Elbre 2020-04-01 10:12:26 +03:00 committed by jens
parent 9a72b5fde9
commit 644df8dcdc
11 changed files with 51 additions and 7 deletions

View File

@ -14,6 +14,7 @@ import (
"storj.io/storj/certificate"
"storj.io/storj/certificate/authorization"
"storj.io/storj/pkg/revocation"
_ "storj.io/storj/private/version" // This attaches version information during release builds.
)
var (

View File

@ -25,6 +25,7 @@ import (
"storj.io/private/version"
"storj.io/storj/certificate/certificateclient"
"storj.io/storj/pkg/revocation"
_ "storj.io/storj/private/version" // This attaches version information during release builds.
"storj.io/storj/private/version/checker"
)

View File

@ -23,6 +23,7 @@ import (
"storj.io/common/storj"
"storj.io/private/process"
"storj.io/storj/private/prompt"
_ "storj.io/storj/private/version" // This attaches version information during release builds.
"storj.io/uplink/private/eestream"
)

View File

@ -26,6 +26,7 @@ import (
"storj.io/storj/cmd/satellite/reports"
"storj.io/storj/pkg/cache"
"storj.io/storj/pkg/revocation"
_ "storj.io/storj/private/version" // This attaches version information during release builds.
"storj.io/storj/satellite"
"storj.io/storj/satellite/accounting/live"
"storj.io/storj/satellite/compensation"

View File

@ -7,6 +7,7 @@ import (
"github.com/spf13/cobra"
"storj.io/private/process"
_ "storj.io/storj/private/version" // This attaches version information during release builds.
)
var (

View File

@ -34,6 +34,7 @@ import (
"storj.io/private/cfgstruct"
"storj.io/private/process"
"storj.io/private/version"
_ "storj.io/storj/private/version" // This attaches version information during release builds.
"storj.io/storj/private/version/checker"
)

View File

@ -22,6 +22,7 @@ import (
"storj.io/private/process"
"storj.io/private/version"
"storj.io/storj/pkg/revocation"
_ "storj.io/storj/private/version" // This attaches version information during release builds.
"storj.io/storj/storagenode"
"storj.io/storj/storagenode/storagenodedb"
)

View File

@ -9,6 +9,7 @@ import (
"storj.io/private/process"
"storj.io/storj/cmd/uplink/cmd"
_ "storj.io/storj/private/version" // This attaches version information during release builds.
)
func main() {

View File

@ -14,6 +14,7 @@ import (
"storj.io/common/fpath"
"storj.io/private/cfgstruct"
"storj.io/private/process"
_ "storj.io/storj/private/version" // This attaches version information during release builds.
"storj.io/storj/versioncontrol"
)

View File

@ -0,0 +1,23 @@
// Copyright (C) 2020 Storj Labs, Inc.
// See LICENSE for copying information.
package version
import _ "unsafe" // needed for go:linkname
//go:linkname buildTimestamp storj.io/private/version.buildTimestamp
var buildTimestamp string
//go:linkname buildCommitHash storj.io/private/version.buildCommitHash
var buildCommitHash string
//go:linkname buildVersion storj.io/private/version.buildVersion
var buildVersion string
//go:linkname buildRelease storj.io/private/version.buildRelease
var buildRelease string
// ensure that linter understands that the variables are being used.
func init() { use(buildTimestamp, buildCommitHash, buildVersion, buildRelease) }
func use(...interface{}) {}

View File

@ -35,17 +35,29 @@ TIMESTAMP=$(date +%s)
COMMIT=$(git rev-parse HEAD)
cat > ./private/version/release.go <<EOF
// Copyright (C) 2019 Storj Labs, Inc.
// Copyright (C) 2020 Storj Labs, Inc.
// See LICENSE for copying information.
package version
func init() {
buildTimestamp = "$TIMESTAMP"
buildCommitHash = "$COMMIT"
buildVersion = "$VERSION"
buildRelease = "true"
}
import _ "unsafe" // needed for go:linkname
//go:linkname buildTimestamp storj.io/private/version.buildTimestamp
var buildTimestamp string = "$TIMESTAMP"
//go:linkname buildCommitHash storj.io/private/version.buildCommitHash
var buildCommitHash string = "$COMMIT"
//go:linkname buildVersion storj.io/private/version.buildVersion
var buildVersion string = "$VERSION"
//go:linkname buildRelease storj.io/private/version.buildRelease
var buildRelease string = "true"
// ensure that linter understands that the variables are being used.
func init() { use(buildTimestamp, buildCommitHash, buildVersion, buildRelease) }
func use(...interface{}) {}
EOF
gofmt -w -s ./private/version/release.go