summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-15 10:40:56 -0500
committerJeff Carr <[email protected]>2025-10-15 10:40:56 -0500
commitaba51175c7541a6ba2e80e13b20c43e5d88ad500 (patch)
tree4728218b5e80512370f9e1714a0bcf1bb53a7e21
parent2dd02cfdbbd1b29f57cd6a454941a9204965b9d3 (diff)
try to use config to track the build version
-rw-r--r--Makefile8
-rw-r--r--doBuild.debian.go27
2 files changed, 32 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 6301441..df83647 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
VERSION = $(shell git describe --tags)
BUILDTIME = $(shell date +%s)
-justinstall: install
+justinstall: install-verbose
# This will re-generate ALL of the needed autogenerated .pb.go files
generate: clean
@@ -26,6 +26,10 @@ install: goimports
GO111MODULE=off go install \
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME}"
+install-verbose: goimports
+ GO111MODULE=off go install -v \
+ -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME}"
+
vet:
GO111MODULE=off go vet
@@ -78,7 +82,7 @@ deb-with-commits-all:
rm -f ~/incoming/*.deb
forge commit --all
forge normal
- wit build deb --all --force --buildversion 8
+ wit build deb --all --force --buildversion 9
deb-with-commits-all-riscv64:
make commit
diff --git a/doBuild.debian.go b/doBuild.debian.go
index 8bf1c15..746fb4d 100644
--- a/doBuild.debian.go
+++ b/doBuild.debian.go
@@ -7,8 +7,10 @@ import (
"errors"
"os"
"path/filepath"
+ "strconv"
"strings"
+ "go.wit.com/lib/config"
"go.wit.com/lib/debian"
"go.wit.com/lib/fhelp"
"go.wit.com/lib/gui/shell"
@@ -142,6 +144,27 @@ func shouldBuild(repo *gitpb.Repo) string {
return ""
}
+func getBuildVersion(repo *gitpb.Repo) (int, error) {
+ if !config.InitValid() {
+ return 0, config.NotInitialized
+ }
+ _, reponame := filepath.Split(repo.Namespace)
+ if config.Get(reponame) == "" {
+ // first time for this repo
+ config.Get(log.Sprintf("%s %s %s", reponame, repo.DebianCurrentVersion(0), "0"))
+ config.Save()
+ return 0, nil
+ }
+ parts := strings.Fields(config.Get(reponame))
+ if len(parts) != 3 {
+ log.Info("Config.Get() wierd setting. fix manually:", reponame, parts)
+ return 0, errors.New("fix manually in ~/.config/mirrors/config.text")
+ }
+ i, err := strconv.Atoi(parts[2])
+ log.Info("Config.Get() worked", parts, err, i)
+ return i, err
+}
+
func buildDeb(repo *gitpb.Repo) error {
var cmd []string
@@ -164,6 +187,9 @@ func buildDeb(repo *gitpb.Repo) error {
if argv.Build.Debian.BuildVersion != 0 {
cmd = append(cmd, "--buildversion", log.Sprintf("%d", argv.Build.Debian.BuildVersion))
}
+ // try to use lib/config
+ bvers, err := getBuildVersion(repo)
+ log.Info("Config.Get() gave back", bvers, err)
if shouldBuild(repo) != "yes" {
return nil
@@ -183,7 +209,6 @@ func buildDeb(repo *gitpb.Repo) error {
}
log.Info("Building", debname, cmd)
- var err error
if _, err = repo.RunVerboseOnError(cmd); err != nil {
log.Info(repo.FullPath, cmd)
return err