more improvements in automation

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-26 09:34:42 -06:00
parent 1f757d26ff
commit 615947a05a
3 changed files with 60 additions and 13 deletions

View File

@ -9,18 +9,21 @@ import (
// "go.wit.com/gui/gadgets"
)
func globalDisplayHide() {
func globalDisplaySetRepoState() {
for _, repo := range me.allrepos {
if me.autoHideReadOnly.Checked() {
if repo.status.ReadOnly() {
repo.Hide()
continue
}
}
if me.autoHidePerfect.Checked() {
if repo.dirtyLabel.String() == "PERFECT" {
repo.Hide()
continue
}
}
repo.Show()
}
}
@ -46,10 +49,25 @@ func globalDisplayOptions(box *gui.Node) {
group1 := vbox.NewGroup("Global Display Options")
group1.NewButton("Show Repository Window", func() {
globalDisplayHide()
globalDisplaySetRepoState()
reposwin.Toggle()
})
group1.NewButton("Create Release Window", func() {
if release.win == nil {
log.Info("Creating the Release Window")
createReleaseWindow()
log.Info("Toggling the Release Window")
release.win.Toggle()
}
log.Info("Toggling the Release Window")
release.openrepo.Disable()
for _, repo := range me.allrepos {
repo.newScan()
}
reposwin.Toggle()
release.win.Toggle()
})
group1.NewButton("Create Release Window (fullscan)", func() {
if release.win == nil {
log.Info("Creating the Release Window")
createReleaseWindow()
@ -57,6 +75,7 @@ func globalDisplayOptions(box *gui.Node) {
repo.status.Update()
repo.newScan()
}
globalDisplaySetRepoState()
// open the repo window
reposwin.Toggle()
log.Info("Toggling the Release Window")
@ -85,16 +104,16 @@ func globalDisplayOptions(box *gui.Node) {
me.autoHideReadOnly = group1.NewCheckbox("Hide read-only repos").SetChecked(true)
me.autoHideReadOnly.Custom = func() {
if me.autoHideReadOnly.Checked() {
globalDisplayHide()
globalDisplaySetRepoState()
} else {
globalDisplayShow()
}
}
me.autoHidePerfect = group1.NewCheckbox("Hide Perfectly clean repos").SetChecked(true)
me.autoHidePerfect = group1.NewCheckbox("Hide Perfectly clean repos").SetChecked(false)
me.autoHidePerfect.Custom = func() {
if me.autoHidePerfect.Checked() {
globalDisplayHide()
globalDisplaySetRepoState()
} else {
globalDisplayShow()
}

View File

@ -34,6 +34,7 @@ type releaseStruct struct {
checkDirtyB *gui.Node
makeRedomodB *gui.Node
sendVersionB *gui.Node
checkSafeB *gui.Node
}
func createReleaseWindow() {
@ -60,11 +61,17 @@ func createReleaseWindow() {
release.grid.NewButton("next repo", func() {
log.Info("find the next repo to release here")
if findNextDirty() {
log.Info("found a dirty repo")
} else {
findNextRepo()
log.Info("findNextDirty() found a repo")
return
}
if findNextRepo() {
log.Info("findNextRepo() found a repo")
return
}
if findDirty2() {
log.Info("findDirty2() found a repo")
return
}
findDirty2()
})
release.openrepo = release.grid.NewButton("open repo", func() {
@ -128,6 +135,11 @@ func createReleaseWindow() {
}
buttonEnable()
})
release.checkSafeB = release.grid.NewButton("checkSafeGoSumRemake()", func() {
buttonDisable()
release.current.checkSafeGoSumRemake()
buttonEnable()
})
release.checkGoSumB = release.grid.NewButton("CheckGoSum()", func() {
buttonDisable()
tmp := release.current.String()
@ -141,6 +153,9 @@ func createReleaseWindow() {
if release.current.getGoSumStatus() == "BAD" {
release.current.setGoSumStatus("BAD VERSION")
}
if release.current.getGoSumStatus() == "CLEAN" {
release.current.setGoSumStatus("BAD VERSION")
}
} else {
log.Info("BAD VERSION repo has go.sum requirements that are screwed up.", tmp)
log.Info("BAD VERSION need to addRepo() the missing repo", missing)
@ -211,6 +226,7 @@ func buttonDisable() {
release.openrepo.Disable()
release.checkDirtyB.Disable()
release.sendVersionB.Disable()
release.checkSafeB.Disable()
}
func buttonEnable() {
@ -220,6 +236,7 @@ func buttonEnable() {
release.openrepo.Enable()
release.checkDirtyB.Enable()
release.sendVersionB.Enable()
release.checkSafeB.Enable()
}
func findDirty2() bool {
@ -314,7 +331,7 @@ func findNextDirty() bool {
return false
}
func findNextRepo() {
func findNextRepo() bool {
for _, repo := range me.allrepos {
goSumS := repo.getGoSumStatus()
dirtyS := repo.dirtyLabel.String()
@ -335,7 +352,7 @@ func findNextRepo() {
continue
}
if setCurrentRepo(repo, "clean round 2", "check manually") {
return
return true
}
}
if goSumS == "DIRTY" {
@ -349,14 +366,15 @@ func findNextRepo() {
}
if setCurrentRepo(repo, "dirty", "commit changes") {
return
return true
}
}
if goSumS == "BAD" {
if setCurrentRepo(repo, "bad", "redo go.sum") {
return
return true
}
}
}
log.Info("tried to findNextRepo() but not sure what to do next")
return false
}

10
scan.go
View File

@ -86,6 +86,16 @@ func (r *repo) setGoSumStatus(s string) {
r.status.SetGoSumStatus(s)
}
func (r *repo) checkSafeGoSumRemake() {
if ok, bad := r.status.CheckSafeGoSumRemake(); ok {
log.Info("checkSafeGoSumRemake() is safe to redo")
r.setGoSumStatus("SAFE")
} else {
log.Info("checkSafeGoSumRemake() is not safe. problems:", bad)
r.setGoSumStatus("BAD DEP")
}
}
func scanGoSum() {
for _, repo := range me.allrepos {
latestversion := repo.status.GetLastTagVersion()