diff options
| author | Jeff Carr <[email protected]> | 2025-10-03 14:19:18 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-03 14:19:18 -0500 |
| commit | f19039b4ae20fbf01248da9fbdf97ef93c7080d0 (patch) | |
| tree | fcd1f9178451d0a4b0838ee5390d5f2ffb486428 | |
| parent | e4b679003ce0847dd65254a5e0a0b3239fd0d566 (diff) | |
try to fix .deb builds
| -rw-r--r-- | argv.go | 2 | ||||
| -rw-r--r-- | doBuild.go | 14 | ||||
| -rw-r--r-- | doDebian.go | 43 | ||||
| -rw-r--r-- | doListRepos.go | 14 | ||||
| -rw-r--r-- | structs.go | 9 |
5 files changed, 39 insertions, 43 deletions
@@ -29,7 +29,6 @@ type args struct { Zoo *EmptyCmd `arg:"subcommand:zoo" help:"WIT Private Cloud info"` Upgrade *UpgradeCmd `arg:"subcommand:upgrade" help:"apt upgrade packages installed from mirrors.wit.com"` RepoMap string `arg:"--repomap" help:"location of the repomap"` - Release bool `arg:"--release" help:"use go-deb --release"` DryRun bool `arg:"--dry-run" help:"only show what would be packaged"` Install bool `arg:"--install" help:"go install the binaries first"` Verbose bool `arg:"--verbose" help:"be loud about it"` @@ -46,6 +45,7 @@ type BuildCmd struct { } type DebianCmd struct { + Release bool `arg:"--release" help:"use go-deb --release"` 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"` @@ -102,7 +102,7 @@ func doInstallScan() { } if actualp := me.machine.FindByVersion(name, ver); actualp != nil { end += " (version match) " + actualp.Version + " " + ver + " " - state[check] = "on mirrors" + check.State = "on mirrors" } else { if realver != "" { end += fmt.Sprintf(" (version miss) %s vs %s ", realver, ver) @@ -122,22 +122,22 @@ func doInstallScan() { } debname := name + "_" + ver + "_amd64.deb" - debnames[check] = debname + // debnames[check] = debname outdir := getOutdir(check) _, err := os.Stat(filepath.Join(outdir, debname)) if err == nil { // log.Info("exists", filepath.Join(outdir, debname)) - state[check] = "in incoming" + check.State = "in incoming" } else { // log.Info(debname, "does not exist") } - if state[check] == "" { - state[check] = "need to build" + if check.GetState() == "" { + check.State = "need to build" } - start = fmt.Sprintf("%-15s %-20s %-50s", state[check], ver, debname) + start = fmt.Sprintf("%-15s %-20s %-50s", check.GetState(), ver, debname) - if state[check] == "need to build" { + if check.GetState() == "need to build" { end += " (will build) " } diff --git a/doDebian.go b/doDebian.go index acd2eae..333b99f 100644 --- a/doDebian.go +++ b/doDebian.go @@ -4,6 +4,8 @@ package main import ( + "fmt" + "os" "path/filepath" "go.wit.com/lib/gui/shell" @@ -29,7 +31,7 @@ func doDebian() { found := gitpb.NewRepos() for check := range me.forge.Repos.IterAll() { - if me.forge.Config.IsReadOnly(check.GetGoPath()) { + if me.forge.Config.IsReadOnly(check.GetNamespace()) { continue } @@ -61,6 +63,7 @@ func doDebian() { } me.forge.ConfigRill(16, 16) + log.Info("STARTING .deb BUILDS repo len =", found.Len()) stats = me.forge.RunOnRepos(found, buildDeb) for s, stat := range stats { log.Info(s, stat.Err) @@ -78,45 +81,37 @@ func buildDeb(check *gitpb.Repo) error { outdir := getOutdir(check) os.MkdirAll(outdir, 0755) - if me.forge.Config.IsReadOnly(check.GetGoPath()) { - return nil - } - - if !check.IsBinary() { - return nil - } - - if check.IsGoPlugin() { - return nil - } - - if argv.Release { + if argv.Build.Debian.Release { cmd = []string{"go-deb", "--release", "--dir", outdir} } else { cmd = []string{"go-deb", "--dir", outdir} } - if me.forge.Config.IsPrivate(check.GetGoPath()) { + if me.forge.Config.IsPrivate(check.GetNamespace()) { cmd = []string{"go-deb", "--dir", outdir} return nil } - if argv.Verbose || argv.Force { - // log.Info("build cmd:", cmd) - cmd = append(cmd, "--verbose") - } - if argv.DryRun { - return nil - } + // computes the state hash todo: move this logic into the protobuf + doInstallScan() if argv.Force { // build everything no matter what } else { - if state[check] != "need to build" { + if check.GetState() != "need to build" { // log.Info("skipping build for", check.GetGoPath(), state[check]) return nil } } + if argv.Verbose || argv.Force { + // log.Info("build cmd:", cmd) + cmd = append(cmd, "--verbose") + } + if argv.DryRun { + return nil + } + + log.Info("Building .deb", cmd) var err error if _, err = check.RunVerboseOnError(cmd); err != nil { log.Info(check.FullPath, cmd) @@ -129,7 +124,7 @@ func buildDeb(check *gitpb.Repo) error { } func getOutdir(repo *gitpb.Repo) string { - if me.forge.Config.IsPrivate(repo.GetGoPath()) { + if me.forge.Config.IsPrivate(repo.GetNamespace()) { return "/home/jcarr/incoming-private" } if argv.Force { diff --git a/doListRepos.go b/doListRepos.go index 7534f28..9d91375 100644 --- a/doListRepos.go +++ b/doListRepos.go @@ -43,7 +43,7 @@ func doListRepos() { } if actualp := me.machine.FindByVersion(name, ver); actualp != nil { end += " (version match) " + actualp.Version + " " + ver + " " - state[check] = "on mirrors" + check.State = "on mirrors" } else { if realver != "" { end += fmt.Sprintf(" (version miss) %s vs %s ", realver, ver) @@ -63,22 +63,22 @@ func doListRepos() { } debname := name + "_" + ver + "_amd64.deb" - debnames[check] = debname + // debnames[check] = debname outdir := getOutdir(check) _, err := os.Stat(filepath.Join(outdir, debname)) if err == nil { // log.Info("exists", filepath.Join(outdir, debname)) - state[check] = "in incoming" + check.State = "in incoming" } else { // log.Info(debname, "does not exist") } - if state[check] == "" { - state[check] = "need to build" + if check.State == "" { + check.State = "need to build" } - start = fmt.Sprintf("%-15s %-20s %-50s", state[check], ver, debname) + start = fmt.Sprintf("%-15s %-20s %-50s", check.State, ver, debname) - if state[check] == "need to build" { + if check.State == "need to build" { end += " (will build) " } @@ -26,8 +26,9 @@ type mainType struct { // move these to mainType var failed map[*gitpb.Repo]string -var state map[*gitpb.Repo]string -var debnames map[*gitpb.Repo]string + +// var state map[*gitpb.Repo]string +// var debnames map[*gitpb.Repo]string func initForge() { if me.forge == nil { @@ -48,8 +49,8 @@ func initMain() { me.auto = prep.Bash3(&argv) // add support for bash autocomplete with go-arg failed = make(map[*gitpb.Repo]string) - state = make(map[*gitpb.Repo]string) - debnames = make(map[*gitpb.Repo]string) + // state = make(map[*gitpb.Repo]string) + // debnames = make(map[*gitpb.Repo]string) me.homedir, _ = os.UserHomeDir() dumpDebug() |
