diff options
| author | Jeff Carr <[email protected]> | 2025-10-03 03:33:17 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-03 03:33:17 -0500 |
| commit | 62abca26fd749a3fcb7838479e90bef7db747d0f (patch) | |
| tree | c7be891cefa186e0c9cbd62dc8f5f2de19045d2a | |
| parent | af388f137769fcee7aacac0b69ee20e47a996c71 (diff) | |
build debs using rill
| -rw-r--r-- | debian.go | 112 | ||||
| -rw-r--r-- | doDebian.go | 29 |
2 files changed, 76 insertions, 65 deletions
@@ -11,81 +11,65 @@ import ( "go.wit.com/log" ) -func buildDeb() { - var counter int - if int(argv.Max) == 0 { - argv.Max = 50 - } - - initForge() - - all := me.forge.Repos.SortByFullPath() - for all.Scan() { - var cmd []string - check := all.Next() - - outdir := getOutdir(check) - os.MkdirAll(outdir, 0755) +func buildDeb(check *gitpb.Repo) error { + var cmd []string - if me.forge.Config.IsReadOnly(check.GetGoPath()) { - continue - } - - if !check.IsBinary() { - continue - } + outdir := getOutdir(check) + os.MkdirAll(outdir, 0755) - if check.IsGoPlugin() { - continue - } + if me.forge.Config.IsReadOnly(check.GetGoPath()) { + return nil + } - if argv.Release { - cmd = []string{"go-deb", "--release", "--dir", outdir} - } else { - cmd = []string{"go-deb", "--dir", outdir} - } - if me.forge.Config.IsPrivate(check.GetGoPath()) { - cmd = []string{"go-deb", "--dir", outdir} - continue - } + if !check.IsBinary() { + return nil + } - if argv.Verbose { - log.Info("build cmd:", cmd) - cmd = append(cmd, "--verbose") - } - if argv.DryRun { - continue - } + if check.IsGoPlugin() { + return nil + } - if argv.Force { - // build everything no matter what - } else { - if state[check] != "need to build" { - // log.Info("skipping build for", check.GetGoPath(), state[check]) - continue - } - } + if argv.Release { + cmd = []string{"go-deb", "--release", "--dir", outdir} + } else { + cmd = []string{"go-deb", "--dir", outdir} + } + if me.forge.Config.IsPrivate(check.GetGoPath()) { + cmd = []string{"go-deb", "--dir", outdir} + return nil + } - counter += 1 + if argv.Verbose { + // log.Info("build cmd:", cmd) + cmd = append(cmd, "--verbose") + } + if argv.DryRun { + return nil + } - if counter > int(argv.Max) { - log.Info("did --max builds", argv.Max) - okExit("") + if argv.Force { + // build everything no matter what + } else { + if state[check] != "need to build" { + // log.Info("skipping build for", check.GetGoPath(), state[check]) + return nil } + } - if argv.MacBuild != nil { - log.Info("todo: add mac builds") - continue - } + if argv.MacBuild != nil { + log.Info("todo: add mac builds") + return nil + } - if err := check.RunVerbose(cmd); err != nil { - log.Info(check.FullPath, cmd) - failed[check] = fmt.Sprint("godeb failed", cmd, "with", err) - badExit(err) - } else { - log.Info("build worked") - } + var err error + if _, err = check.RunVerboseOnError(cmd); err != nil { + log.Info(check.FullPath, cmd) + failed[check] = fmt.Sprint("godeb failed", cmd, "with", err) + return err } + + log.Info("build worked", cmd, check.FullPath) + return nil } func getOutdir(repo *gitpb.Repo) string { diff --git a/doDebian.go b/doDebian.go index 160a01d..21571c2 100644 --- a/doDebian.go +++ b/doDebian.go @@ -4,6 +4,7 @@ package main import ( + "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" ) @@ -15,11 +16,37 @@ func doDebian() { } } - buildDeb() + initForge() + + found := gitpb.NewRepos() + for check := range me.forge.Repos.IterAll() { + if me.forge.Config.IsReadOnly(check.GetGoPath()) { + continue + } + + if !check.IsBinary() { + continue + } + + if check.IsGoPlugin() { + continue + } + found.Append(check) + } + me.forge.PrintForgedTable(found) if argv.DryRun { okExit("") } + me.forge.ConfigRill(5, 5) + stats := me.forge.RunOnRepos(found, buildDeb) + for s, stat := range stats { + log.Info(s, stat.Err) + if stat.Err != nil { + badExit(stat.Err) + } + } + exitOnErrorRealtime([]string{"do-aptly"}) } |
