summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--findNext.go105
-rw-r--r--releaseBox.go24
2 files changed, 20 insertions, 109 deletions
diff --git a/findNext.go b/findNext.go
index c0d16c9..4c368e9 100644
--- a/findNext.go
+++ b/findNext.go
@@ -2,11 +2,8 @@
package main
import (
- "os"
-
"go.wit.com/log"
- "go.wit.com/lib/gui/repolist"
"go.wit.com/lib/protobuf/gitpb"
)
@@ -21,46 +18,40 @@ func findNext() bool {
loop := me.repos.View.ReposSortByName()
for loop.Scan() {
repo := loop.Repo()
- if repo.Status.IsReleased() {
- continue
+
+ check := me.forge.Repos.FindByGoPath(repo.GoPath())
+ if check == nil {
+ log.Info("boo, you didn't git clone", repo.GoPath())
+ return false
}
- if repo.Status.Whitelist {
+ log.Info("findNext() STARTING", check.GoPath)
+ log.Info("findNext() STARTING", check.GoPath)
+ log.Info("findNext() STARTING", check.GoPath)
+ if check.GetTargetVersion() == check.GetCurrentBranchVersion() {
+ log.Info("findNext() no update needed", check.GoPath, check.GetTargetVersion(), "vs", check.GetCurrentBranchVersion())
continue
+ } else {
+ log.Info("findNext() update needed", check.GoPath, check.GetTargetVersion(), "vs", check.GetCurrentBranchVersion())
}
- if repo.ReadOnly() {
- // log.Info("findNext() skipping readonly")
+ if me.forge.IsReadOnly(check) {
+ log.Info("findNext() skipping readonly")
continue
}
- if repo.CheckDirty() {
+ if check.CheckDirty() {
log.Info("findNext() skipping dirty")
continue
}
- // do makeredomod here
- // if ! repo.Status.Exists("go.sum") {
- // }
- if repo.Status.IsPrimitive() {
- log.Info("findNext()", repo.GoPath())
- if setCurrentRepo(repo, "PRIMATIVE", "release new version") {
- return true
- }
- continue
- }
log.Info("findNext()", repo.GoPath(), "is not a primative repo")
- check := me.forge.Repos.FindByGoPath(repo.GoPath())
- if check == nil {
- log.Info("boo, you didn't git clone", repo.GoPath())
- return false
- }
- if ok, err := check.ParseGoSum(); !ok {
- log.Info("ParseGoSum() failed (probably repo needs go mod tidy)", err)
- log.Info("ParseGoSum() findFix =", findFix, "findCounter =", findCounter)
- // return false
- }
if findFix {
log.Info("findFix is true. running fixGoDeps()")
fixGodeps(check)
}
findCounter += 1
+ if ok, err := check.ParseGoSum(); !ok {
+ log.Info("ParseGoSum() failed (probably repo needs go mod tidy)", err)
+ log.Info("ParseGoSum() findFix =", findFix, "findCounter =", findCounter)
+ continue
+ }
if me.forge.FinalGoDepsCheckOk(check) {
setCurrentRepo(repo, "should be good to release", "pretty sure")
return true
@@ -78,56 +69,6 @@ func findNext() bool {
return false
}
-/*
-func checkValidGoSum(repo *repolist.RepoRow) bool {
- if goodGodeps(repo) {
- log.Info("repo has go.sum requirements that are clean")
- // me.current.setGoSumStatus("CLEAN")
- me.release.status.SetValue("GOOD")
- me.release.notes.SetValue("CheckValidGoSum() does not seem to lie")
- return true
- }
- log.Info("go mod tidy not ok")
- me.release.notes.SetValue("CheckValidGoSum() failed")
- return false
-}
-*/
-
-func goodGodeps(repo *repolist.RepoRow) bool {
- var good bool = true
- // check if the package dependancies changed, if so, re-publish
- check := me.forge.Repos.FindByGoPath(repo.GoPath())
- if check == nil {
- log.Info("boo, you didn't git clone", repo.GoPath())
- os.Exit(-1)
- }
- // check.RedoGoMod()
- log.Printf("current repo %s go dependancy count: %d", check.GetGoPath(), check.GoDepsLen())
- deps := check.GoDeps.SortByGoPath()
- for deps.Scan() {
- depRepo := deps.Next()
- // log.Info("found dep", depRepo.GetGoPath())
- if me.forge.Config.IsReadOnly(depRepo.GoPath) {
- // log.Info("IsReadOnly = true", depRepo.GetGoPath())
- continue
- } else {
- // log.Info("IsReadOnly = false", depRepo.GetGoPath())
- }
- found := me.repos.View.FindByPath(depRepo.GetGoPath())
- if found == nil {
- // log.Info("repos.View.FindByPath() not found", depRepo.GetGoPath())
- continue
- }
- if found.Status.IsReleased() {
- continue
- }
- header := found.StandardReleaseHeader()
- log.Info("bad", header)
- good = false
- }
- return good
-}
-
// tries to fix the go.mod and go.sum files
func fixGodeps(check *gitpb.Repo) bool {
var good bool = true
@@ -183,11 +124,5 @@ func fixGodeps(check *gitpb.Repo) bool {
log.Info("ParseGoSum() failed", err)
return false
}
-
- deps = check.GoDeps.SortByGoPath()
- for deps.Scan() {
- depRepo := deps.Next()
- log.Info("found updated dep", depRepo.GetGoPath(), depRepo.GetVersion())
- }
return good
}
diff --git a/releaseBox.go b/releaseBox.go
index 2291dc3..99f50c7 100644
--- a/releaseBox.go
+++ b/releaseBox.go
@@ -229,30 +229,6 @@ func createReleaseBox(box *gui.Node) {
log.Info("All repos seem okay")
})
grid.NextRow()
-
- var longB *gui.Node
- longB = grid.NewButton("generate go.sum files", func() {
- me.Disable()
- var worked bool = true
- loop := me.repos.View.ReposSortByName()
- for loop.Scan() {
- repo := loop.Repo()
- if repo.Status.Whitelist {
- continue
- }
- if !goodGodeps(repo) {
- log.Info("redo go.sum failed on", repo.GoPath(), err)
- worked = false
- }
- }
- log.Info("redo go.sum finished with", worked)
- me.Enable()
- longB.SetLabel("go.sum files created")
- if worked {
- longB.Disable()
- }
- })
- grid.NextRow()
}
func buttonDisable() {