aboutsummaryrefslogtreecommitdiff
path: root/build.go
diff options
context:
space:
mode:
authorJakob Borg <jakob@kastelo.net>2020-03-29 16:51:50 +0200
committerGitHub <noreply@github.com>2020-03-29 16:51:50 +0200
commit38bd90e6f2485ff8fcb9cbe158e8a71400e4317a (patch)
tree6e2de93e60bb3831c26416f663b89bc3e5f9a1c0 /build.go
parent1c47fae2069f37b7dabc0e78c9cd0b44744cf5af (diff)
downloadsyncthing-38bd90e6f2485ff8fcb9cbe158e8a71400e4317a.tar.gz
syncthing-38bd90e6f2485ff8fcb9cbe158e8a71400e4317a.zip
build: Simplify/correct Windows version tagging (fixes #6471) (#6472)
Diffstat (limited to 'build.go')
-rw-r--r--build.go33
1 files changed, 18 insertions, 15 deletions
diff --git a/build.go b/build.go
index 45b8c704d..bf763601a 100644
--- a/build.go
+++ b/build.go
@@ -631,20 +631,27 @@ func buildSnap(target target) {
func shouldBuildSyso(dir string) (string, error) {
type M map[string]interface{}
- major, minor, patch, build := semanticVersion()
+ version := getVersion()
+ version = strings.TrimPrefix(version, "v")
+ major, minor, patch := semanticVersion()
bs, err := json.Marshal(M{
"FixedFileInfo": M{
"FileVersion": M{
"Major": major,
"Minor": minor,
"Patch": patch,
- "Build": build,
+ },
+ "ProductVersion": M{
+ "Major": major,
+ "Minor": minor,
+ "Patch": patch,
},
},
"StringFileInfo": M{
"FileDescription": "Open Source Continuous File Synchronization",
"LegalCopyright": "The Syncthing Authors",
- "ProductVersion": getVersion(),
+ "FileVersion": version,
+ "ProductVersion": version,
"ProductName": "Syncthing",
},
"IconPath": "assets/logo.ico",
@@ -864,22 +871,18 @@ func getVersion() string {
return "unknown-dev"
}
-func semanticVersion() (major, minor, patch, build int) {
- r := regexp.MustCompile(`v(?P<Major>\d+)\.(?P<Minor>\d+).(?P<Patch>\d+).*\+(?P<CommitsAhead>\d+)`)
+func semanticVersion() (major, minor, patch int) {
+ r := regexp.MustCompile(`v(\d+)\.(\d+).(\d+)`)
matches := r.FindStringSubmatch(getVersion())
- if len(matches) != 5 {
- return 0, 0, 0, 0
+ if len(matches) != 4 {
+ return 0, 0, 0
}
- var ints [4]int
- for i := 1; i < 5; i++ {
- value, err := strconv.Atoi(matches[i])
- if err != nil {
- return 0, 0, 0, 0
- }
- ints[i-1] = value
+ var ints [3]int
+ for i, s := range matches[1:] {
+ ints[i], _ = strconv.Atoi(s)
}
- return ints[0], ints[1], ints[2], ints[3]
+ return ints[0], ints[1], ints[2]
}
func getBranchSuffix() string {