From 1d1be3d8bc87361c76100147ef3c00aa2d5ce667 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 26 Oct 2025 17:20:25 -0500 Subject: use the smae code --- currentVersions.go | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'currentVersions.go') diff --git a/currentVersions.go b/currentVersions.go index 8f727a9..0312737 100644 --- a/currentVersions.go +++ b/currentVersions.go @@ -123,35 +123,23 @@ func (repo *Repo) GetSmartVersion() string { // takes off the GO 'v' curver = trimNonNumericFromStart(curver) + patchCount := 0 parts := strings.Split(curver, "-") - if len(parts) == 1 { - curver += "-0" - } if len(parts) == 3 { - curver = strings.Join(parts[0:2], "-") + patchCount, _ = strconv.Atoi(parts[1]) + } + if repo.CheckDirty() { + patchCount += 1 } + curver = fmt.Sprintf("%s-%d", parts[0], patchCount) return "v" + curver } func (repo *Repo) DebianCurrentVersion(buildnum int) string { - curver := repo.GetCurrentBranchVersion() + smartver := repo.GetSmartVersion() // takes off the GO 'v' - curver = trimNonNumericFromStart(curver) - if curver == "" { - // need something for debian or it won't accept it - curver = "0.0" - } - - // .deb files don't like "v0.0.90-1-g778234j" - // so remove the end so it's "0.0.90-1" - parts := strings.Split(curver, "-") - if len(parts) == 1 { - curver = curver + "-0" // patches then show up as "-1", "-2", etc - } - if len(parts) > 1 { - curver = strings.Join(parts[0:2], "-") - } + curver := trimNonNumericFromStart(smartver) // removing the checks for '0' and doing this everytime // TODO: verify apt behavior without it (probably not worth it however. always add +bXXX -- cgit v1.2.3