summaryrefslogtreecommitdiff
path: root/doDebian.go
diff options
context:
space:
mode:
Diffstat (limited to 'doDebian.go')
-rw-r--r--doDebian.go79
1 files changed, 72 insertions, 7 deletions
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 {