diff options
| author | Jeff Carr <[email protected]> | 2025-10-04 02:34:49 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-04 02:34:49 -0500 |
| commit | c2c776c4f307c5c3c170c45ca06fc10f5ee58ee8 (patch) | |
| tree | 3a71322a8bd501d52c23caeb3ae54784aa8cf0e5 | |
| parent | f50d2bcb19f2165723dcd5e5e20368561a2febc9 (diff) | |
partail builds work againv0.1.5
| -rw-r--r-- | argv.go | 1 | ||||
| -rw-r--r-- | doDebian.go | 79 | ||||
| -rw-r--r-- | tableRepos.go | 73 |
3 files changed, 74 insertions, 79 deletions
@@ -49,6 +49,7 @@ type DebianCmd struct { DryRun bool `arg:"--dry-run" help:"only show what would be packaged"` Verbose bool `arg:"--verbose" help:"be loud about it"` Force bool `arg:"--force" help:"rebuild everything"` + Quick bool `arg:"--quick" help:"only build repos with new versions"` } type CloneCmd struct { diff --git a/doDebian.go b/doDebian.go index 63921cc..c447dba 100644 --- a/doDebian.go +++ b/doDebian.go @@ -4,8 +4,10 @@ package main import ( + "fmt" "os" "path/filepath" + "strings" "go.wit.com/lib/gui/shell" "go.wit.com/lib/protobuf/gitpb" @@ -77,6 +79,74 @@ func doDebian() { exitOnErrorRealtime([]string{"do-aptly"}) } +func getStatusEnd(repo *gitpb.Repo) string { + var end string + + manufactured := repo.GetCurrentVersion() + ver := trimNonNumericFromStart(manufactured) + name := me.forge.Config.DebName(repo.GetGoPath()) + var realver string + if installedPackage := me.machine.FindInstalledByName(name); installedPackage != nil { + realver = installedPackage.Version + } + if actualp := me.machine.FindByVersion(name, ver); actualp != nil { + // end += " (version match) " + actualp.Version + " " + ver + " " + // repo.State = "on mirrors" + } else { + if realver != "" { + end += fmt.Sprintf(" (version miss) %s vs %s ", realver, ver) + } + // end += "" + ver + " " + } + + debname := name + "_" + ver + "_amd64.deb" + // debnames[repo] = debname + outdir := getOutdir(repo) + _, err := os.Stat(filepath.Join(outdir, debname)) + if err == nil { + // log.Info("exists", filepath.Join(outdir, debname)) + repo.State = "in incoming" + } else { + // log.Info(debname, "does not exist") + } + if strings.HasPrefix(repo.GetState(), "unknown bran") { + end += " (will build) " + } + + if repo.State == "" { + end += " (will build) " + } + + if repo.State == "need to build" { + end += " (will build) " + } + + if name == "" { + // err := fmt.Sprintf("name is blank error %+v", repo) + log.Warn("name is blank error", repo.GetGoPath()) + } + return end +} + +func shouldBuild(repo *gitpb.Repo) bool { + if argv.Force { + return true + } + if strings.HasPrefix(repo.GetState(), "unknown bran") { + return true + } + + if repo.State == "" { + return true + } + + if repo.State == "need to build" { + return true + } + + return false +} + func buildDeb(check *gitpb.Repo) error { var cmd []string @@ -93,13 +163,8 @@ func buildDeb(check *gitpb.Repo) error { return nil } - if argv.Force { - // build everything no matter what - } else { - if check.GetState() != "need to build" { - // log.Info("skipping build for", check.GetGoPath(), state[check]) - return nil - } + if !shouldBuild(check) { + return nil } if argv.Verbose || argv.Force { diff --git a/tableRepos.go b/tableRepos.go index 7cdf76e..f478287 100644 --- a/tableRepos.go +++ b/tableRepos.go @@ -4,13 +4,7 @@ package main import ( - "fmt" - "os" - "path/filepath" - "strings" - "go.wit.com/lib/protobuf/gitpb" - "go.wit.com/log" ) func isPackageOnMirrors(repo *gitpb.Repo) bool { @@ -81,7 +75,7 @@ func printRepos(pb *gitpb.Repos) { col.Width = 4 col = tablePB.AddStringFunc("build", func(r *gitpb.Repo) string { - if willBuild(r) { + if shouldBuild(r) { return "yes" } return "" @@ -106,68 +100,3 @@ func printRepos(pb *gitpb.Repos) { tablePB.PrintTable() } - -func getStatusEnd(repo *gitpb.Repo) string { - var end string - - manufactured := repo.GetCurrentVersion() - ver := trimNonNumericFromStart(manufactured) - name := me.forge.Config.DebName(repo.GetGoPath()) - var realver string - if installedPackage := me.machine.FindInstalledByName(name); installedPackage != nil { - realver = installedPackage.Version - } - if actualp := me.machine.FindByVersion(name, ver); actualp != nil { - // end += " (version match) " + actualp.Version + " " + ver + " " - // repo.State = "on mirrors" - } else { - if realver != "" { - end += fmt.Sprintf(" (version miss) %s vs %s ", realver, ver) - } - // end += "" + ver + " " - } - - debname := name + "_" + ver + "_amd64.deb" - // debnames[repo] = debname - outdir := getOutdir(repo) - _, err := os.Stat(filepath.Join(outdir, debname)) - if err == nil { - // log.Info("exists", filepath.Join(outdir, debname)) - repo.State = "in incoming" - } else { - // log.Info(debname, "does not exist") - } - if strings.HasPrefix(repo.GetState(), "unknown bran") { - end += " (will build) " - } - - if repo.State == "" { - end += " (will build) " - } - - if repo.State == "need to build" { - end += " (will build) " - } - - if name == "" { - // err := fmt.Sprintf("name is blank error %+v", repo) - log.Warn("name is blank error", repo.GetGoPath()) - } - return end -} - -func willBuild(repo *gitpb.Repo) bool { - if strings.HasPrefix(repo.GetState(), "unknown bran") { - return true - } - - if repo.State == "" { - return true - } - - if repo.State == "need to build" { - return true - } - - return false -} |
