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

View File

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