diff options
Diffstat (limited to 'doDebian.go')
| -rw-r--r-- | doDebian.go | 68 |
1 files changed, 44 insertions, 24 deletions
diff --git a/doDebian.go b/doDebian.go index 7681bec..d844090 100644 --- a/doDebian.go +++ b/doDebian.go @@ -6,56 +6,76 @@ package main import ( "fmt" "os" - "path/filepath" "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" ) func buildDeb() { - if argv.DryRun { - return - } log.DaemonMode(true) defer log.DaemonMode(false) + if err := doInstall(); err != nil { + log.Info("doInstall() failed", err) + badExit(err) + } + all := me.forge.Repos.SortByFullPath() for all.Scan() { var cmd []string check := all.Next() - if state[check] != "need to build" { - // log.Info("skipping build for", check.GetGoPath(), state[check]) - continue - } - outdir := getOutdir(check) os.MkdirAll(outdir, 0755) - _, err := os.Stat(filepath.Join(outdir, debnames[check])) - if err == nil { - if debnames[check] == "" { - log.Info("something went wrong. .deb blank", check.GetGoPath()) - } - // already built + if me.forge.Config.IsReadOnly(check.GetGoPath()) { + continue + } + + if !check.IsBinary() { continue } if argv.Release { - cmd = []string{"go-deb", "--release", "--auto", "--forge", check.GetGoPath(), "--dir", outdir} + cmd = []string{"go-deb", "--release", "--no-gui", "--auto", "--forge", check.GetGoPath(), "--dir", outdir} } else { cmd = []string{"go-deb", "--auto", "--no-gui", "--forge", check.GetGoPath(), "--dir", outdir} } if me.forge.Config.IsPrivate(check.GetGoPath()) { - cmd = []string{"go-deb", "--auto", "--forge", check.GetGoPath(), "--dir", outdir} + cmd = []string{"go-deb", "--auto", "--no-gui", "--forge", check.GetGoPath(), "--dir", outdir} + continue } - log.Info("build cmd:", cmd) - if r := check.RunRealtime(cmd); r.Error != nil { - log.Info("go-deb failed error:", r.Error, check.GetGoPath()) - failed[check] = fmt.Sprint("godeb failed", cmd, "with", r.Exit, r.Error) - } else if r.Exit != 0 { - log.Info("go-deb failed exit =", r.Exit, check.GetGoPath()) - failed[check] = fmt.Sprint("godeb failed", cmd, "with", r.Exit, r.Error) + + if argv.Verbose { + log.Info("build cmd:", cmd) + } + if argv.DryRun { + continue + } + + 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 + } + } + + /* + _, err := os.Stat(filepath.Join(outdir, debnames[check])) + if err == nil { + if debnames[check] == "" { + log.Info("something went wrong. .deb blank", check.GetGoPath()) + } + // already built + continue + } + */ + + if err := check.RunVerbose(cmd); err != nil { + failed[check] = fmt.Sprint("godeb failed", cmd, "with", err) + badExit(err) } else { log.Info("build worked") } |
