fix(stcrashreceiver): allow extra pre/post data in version line
Signed-off-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
+1
-1
@@ -16,7 +16,7 @@ import (
|
|||||||
// or, somewhere along the way the "+" in the version tag disappeared:
|
// or, somewhere along the way the "+" in the version tag disappeared:
|
||||||
// syncthing v1.23.7-dev.26.gdf7b56ae.dirty-stversionextra "Fermium Flea" (go1.20.5 darwin-arm64) jb@ok.kastelo.net 2023-07-12 06:55:26 UTC [Some Wrapper, purego, stnoupgrade]
|
// syncthing v1.23.7-dev.26.gdf7b56ae.dirty-stversionextra "Fermium Flea" (go1.20.5 darwin-arm64) jb@ok.kastelo.net 2023-07-12 06:55:26 UTC [Some Wrapper, purego, stnoupgrade]
|
||||||
var (
|
var (
|
||||||
longVersionRE = regexp.MustCompile(`syncthing\s+(v[^\s]+)\s+"([^"]+)"\s\(([^\s]+)\s+([^-]+)-([^)]+)\)\s+([^\s]+)[^\[]*(?:\[(.+)\])?$`)
|
longVersionRE = regexp.MustCompile(`syncthing\s+(v[^\s]+)\s+"([^"]+)"\s\(([^\s]+)\s+([^-]+)-([^)]+)\)\s+([^\s]+)[^\[]*(?:\[(.+)\])?`)
|
||||||
gitExtraRE = regexp.MustCompile(`\.\d+\.g[0-9a-f]+`) // ".1.g6aaae618"
|
gitExtraRE = regexp.MustCompile(`\.\d+\.g[0-9a-f]+`) // ".1.g6aaae618"
|
||||||
gitExtraSepRE = regexp.MustCompile(`[.-]`) // dot or dash
|
gitExtraSepRE = regexp.MustCompile(`[.-]`) // dot or dash
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -57,6 +57,20 @@ func TestParseVersion(t *testing.T) {
|
|||||||
Extra: []string{"Some Wrapper", "purego", "stnoupgrade"},
|
Extra: []string{"Some Wrapper", "purego", "stnoupgrade"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
longVersion: `2026-05-18 14:53:32 INF syncthing v2.0.3 "Hafnium Hornet" (go1.25.0 darwin-amd64) builder@github.syncthing.net 2025-08-22 07:00:05 UTC [stnoupgrade] (log.pkg=main)`,
|
||||||
|
parsed: VersionParts{
|
||||||
|
Version: "v2.0.3",
|
||||||
|
Tag: "v2.0.3",
|
||||||
|
Commit: "",
|
||||||
|
Codename: "Hafnium Hornet",
|
||||||
|
Runtime: "go1.25.0",
|
||||||
|
GOOS: "darwin",
|
||||||
|
GOARCH: "amd64",
|
||||||
|
Builder: "builder@github.syncthing.net",
|
||||||
|
Extra: []string{"stnoupgrade"},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
|
|||||||
Reference in New Issue
Block a user