Name the pinned mesh-sdk version when an SDK command is built from a reader's tree, not a bare (devel): the compose job builds mesh-compose there and its verdict must name the reader's SDK (ADR 0482 clause 5)
mesh/delivery superseded: a newer head of the same pull request
mesh/check failed: the composition: the manifest of pacman cannot be read: this manifest cannot be used: | 19c1d35939bc on 8c6e18e82286 | unit 4799 ru…
mesh/delivery superseded: a newer head of the same pull request
mesh/check failed: the composition: the manifest of pacman cannot be read: this manifest cannot be used: | 19c1d35939bc on 8c6e18e82286 | unit 4799 ru…
This commit is contained in:
@@ -24,7 +24,11 @@ func Version() string {
|
||||
|
||||
// FromBuildInfo reads the SDK's version out of a build info. A dependency replaced by another module version is that
|
||||
// version; replaced by a local path it is the path, never empty. When the SDK is the main module it is "(devel)",
|
||||
// followed by a space and the vcs.revision when the build stamped one. Without the SDK in the build it is "unknown".
|
||||
// followed by a space and the vcs.revision when the build stamped one. An SDK command built from another module that
|
||||
// requires the SDK (`go build git.novox.be/novox/mesh-sdk/go/cmd/mesh-compose` in a reader's tree, as mesh-build-go's
|
||||
// compose job builds it: novox/hq ADR 0482 clause 5) has the SDK as its main module at the version that module pins,
|
||||
// read from the module cache with no vcs stamp: it is that version, never a bare "(devel)" that names no SDK. Without
|
||||
// the SDK in the build it is "unknown".
|
||||
func FromBuildInfo(bi *debug.BuildInfo) string {
|
||||
if bi == nil {
|
||||
return "unknown"
|
||||
@@ -35,6 +39,9 @@ func FromBuildInfo(bi *debug.BuildInfo) string {
|
||||
return "(devel) " + s.Value
|
||||
}
|
||||
}
|
||||
if v := bi.Main.Version; v != "" && v != "(devel)" {
|
||||
return v
|
||||
}
|
||||
return "(devel)"
|
||||
}
|
||||
for _, d := range bi.Deps {
|
||||
|
||||
@@ -42,6 +42,18 @@ func TestTheMainModuleIsDevelWithItsRevision(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// The shape go gives `go build <the SDK's command>` run in a module that requires the SDK (captured with go1.27 from
|
||||
// mesh-compose built in a reader's tree at bc0c25e51052: "mod git.novox.be/novox/mesh-sdk/go v0.1.14-…-bc0c25e51052",
|
||||
// no vcs settings): the SDK is the main module at the pinned version, which names the SDK the binary carries.
|
||||
func TestAnSDKCommandBuiltFromAReaderIsThePinnedVersion(t *testing.T) {
|
||||
bi := &debug.BuildInfo{Path: sdkPath + "/cmd/mesh-compose",
|
||||
Main: debug.Module{Path: sdkPath, Version: "v0.1.14-0.20261024112544-bc0c25e51052"},
|
||||
Settings: []debug.BuildSetting{{Key: "-trimpath", Value: "true"}, {Key: "CGO_ENABLED", Value: "0"}}}
|
||||
if got := FromBuildInfo(bi); got != "v0.1.14-0.20261024112544-bc0c25e51052" {
|
||||
t.Fatalf("got %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNoBuildInfoIsUnknown(t *testing.T) {
|
||||
if got := FromBuildInfo(nil); got != "unknown" {
|
||||
t.Fatalf("got %q", got)
|
||||
|
||||
Reference in New Issue
Block a user