yet another attempt at doReleaseAll()

This commit is contained in:
Jeff Carr 2024-12-05 14:18:24 -06:00
parent c275e762c6
commit 6b3dd97713
1 changed files with 36 additions and 26 deletions

View File

@ -6,6 +6,7 @@ import (
"os"
"path/filepath"
"strings"
"time"
"go.wit.com/gui"
"go.wit.com/log"
@ -138,36 +139,15 @@ func createReleaseBox(box *gui.Node) {
group = me.release.box.NewGroup("Process against all repos")
grid = group.NewGrid("buildOptions", 0, 0)
grid.NewButton("doRelease() all", func() {
var worked bool = true
buttonDisable()
// rather than loop forever, at least limit this to the number of repos
// incase something, somewhere, goes wrong
duration := repolist.TimeFunction(func() {
loop := me.repos.View.ReposSortByName()
for loop.Scan() {
loop.Repo()
if doRelease() {
log.Info("doRelease() worked")
} else {
if os.Getenv("FindNextDone") == "true" {
log.Info("findNext says it was done")
log.Info("findNext says it was done")
log.Info("we can os.Exit here")
}
if me.release.status.String() == "ALL DONE?" {
log.Info("maybe ALL DONE?")
buttonEnable()
worked = true
// os.Exit(0)
}
log.Info("doRelease() failed")
worked = false
break
}
}
})
ok, duration := doReleaseAll()
s := fmt.Sprint(duration)
log.Info("release returned", worked, "and ran for", s)
log.Info("release returned", ok, "and ran for", s, "findCounter =", findCounter)
if findCounter != 0 {
log.Info("should try thsi doRelease() loop again since findCounter =", findCounter)
}
buttonEnable()
})
grid.NextRow()
@ -231,6 +211,36 @@ func createReleaseBox(box *gui.Node) {
grid.NextRow()
}
func doReleaseAll() (bool, time.Duration) {
var worked bool = true
findCounter = 0
duration := repolist.TimeFunction(func() {
loop := me.repos.View.ReposSortByName()
for loop.Scan() {
loop.Repo()
if doRelease() {
log.Info("doRelease() worked. findCounter =", findCounter)
} else {
if os.Getenv("FindNextDone") == "true" {
log.Info("findNext says it was done. findCounter =", findCounter)
log.Info("findNext says it was done. findCounter =", findCounter)
log.Info("we can os.Exit here")
}
if me.release.status.String() == "ALL DONE?" {
log.Info("maybe ALL DONE?. findCounter =", findCounter)
buttonEnable()
worked = true
// os.Exit(0)
}
log.Info("doRelease() failed. findCounter =", findCounter)
worked = false
break
}
}
})
return worked, duration
}
func buttonDisable() {
me.Disable()
me.release.box.Disable()