summaryrefslogtreecommitdiff
path: root/doDebian.go
diff options
context:
space:
mode:
Diffstat (limited to 'doDebian.go')
-rw-r--r--doDebian.go123
1 files changed, 6 insertions, 117 deletions
diff --git a/doDebian.go b/doDebian.go
index 9fb76e2..00a1390 100644
--- a/doDebian.go
+++ b/doDebian.go
@@ -4,133 +4,22 @@
package main
import (
- "fmt"
- "os"
-
- "go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
-func buildDeb() {
- log.DaemonMode(true)
- defer log.DaemonMode(false)
-
- if argv.Test != nil {
+func doDebian() {
+ if !argv.Debian.SkipInstall {
if err := doInstall(); err != nil {
log.Info("doInstall() failed", err)
badExit(err)
}
}
- var counter int
- if int(argv.Max) == 0 {
- argv.Max = 50
- }
-
- all := me.forge.Repos.SortByFullPath()
- for all.Scan() {
- var cmd []string
- check := all.Next()
-
- outdir := getOutdir(check)
- os.MkdirAll(outdir, 0755)
-
- if me.forge.Config.IsReadOnly(check.GetGoPath()) {
- continue
- }
-
- if !check.IsBinary() {
- continue
- }
-
- if check.IsGoPlugin() {
- 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}
- continue
- }
-
- if argv.Verbose {
- log.Info("build cmd:", cmd)
- cmd = append(cmd, "--verbose")
- }
- 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
- }
- }
-
- counter += 1
-
- if counter > int(argv.Max) {
- log.Info("did --max builds", argv.Max)
- okExit("")
- }
-
- /*
- build-darwin:
- GOOS=darwin GOARCH=amd64 GO111MODULE=off go build -v -o go-clone-darwin.x86 \
- -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
-
- build-darwin-arm64:
- GOOS=darwin GOARCH=arm64 GO111MODULE=off go build -v -o go-clone-darwin.arm \
- -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
- */
- if argv.MacBuild != nil {
- log.Info("todo: add mac builds")
- 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 {
- log.Info(check.FullPath, cmd)
- failed[check] = fmt.Sprint("godeb failed", cmd, "with", err)
- badExit(err)
- } else {
- log.Info("build worked")
- }
- }
-}
-
-func getOutdir(repo *gitpb.Repo) string {
- if repo.GetLastTag() != repo.GetMasterVersion() {
- return "/home/jcarr/incoming-devel"
- }
-
- if repo.GetCurrentBranchVersion() != repo.GetMasterVersion() {
- return "/home/jcarr/incoming-devel"
- }
+ buildDeb()
- if repo.CheckDirty() {
- return "/home/jcarr/incoming-devel"
+ if argv.DryRun {
+ okExit("")
}
- if me.forge.Config.IsPrivate(repo.GetGoPath()) {
- return "/home/jcarr/incoming-private"
- }
- return "/home/jcarr/incoming"
+ exitOnError([]string{"do-aptly"})
}