almost clickable releases

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-02 01:42:13 -06:00
parent 504cd29dcb
commit c83524739c
2 changed files with 87 additions and 52 deletions

View File

@ -17,16 +17,16 @@ var release releaseStruct
type releaseStruct struct {
current *repo
box *gui.Node
group *gui.Node
grid *gui.Node
repo *gadgets.OneLiner
status *gadgets.OneLiner
readOnly *gadgets.OneLiner
notes *gadgets.OneLiner
version *gadgets.OneLiner
// versionS string
// widgetVersionS string
box *gui.Node
group *gui.Node
grid *gui.Node
repo *gadgets.OneLiner
status *gadgets.OneLiner
readOnly *gadgets.OneLiner
notes *gadgets.OneLiner
version *gadgets.OneLiner
// versionS string
// widgetVersionS string
releaseVersionB *gui.Node
unreleaseB *gui.Node
reason *gadgets.BasicEntry
@ -44,7 +44,7 @@ type releaseStruct struct {
// store myself here. use myself to
// do garbage go get tests and other potential junk
guireleaser *repo
guireleaser *repo
}
func (w *autoType) Disable() {
@ -104,6 +104,8 @@ func createReleaseBox(box *gui.Node) {
switch release.status.String() {
case "PRIMATIVE":
log.Warn("can do PRIMATIVE", release.version.String())
case "GOOD":
log.Warn("GOOD. lots of go.sum checks passed", release.version.String())
case "manually chosen":
log.Warn("attempting manual release", release.version.String())
case "NOT READY":
@ -119,6 +121,10 @@ func createReleaseBox(box *gui.Node) {
return
}
if release.current.status.ReadOnly() {
log.Info("sorry, it's read-only")
return
}
if release.current.status.CheckDirty() {
log.Info("sorry, it's still dirty")
return
@ -268,48 +274,19 @@ func createReleaseBox(box *gui.Node) {
}
buttonEnable()
})
release.checkGoSumB = release.grid.NewButton("CheckGoSum()", func() {
buttonDisable()
tmp := release.current.String()
log.Info("Run CheckGoSum on repo:", tmp)
if ok, _ := release.current.status.CheckGoSum(); ok {
log.Info("repo has go.sum requirements that are clean")
release.current.setGoSumStatus("CLEAN")
} else {
// release.current.setGoSumStatus("CLEAN")
release.status.SetValue("GOOD")
release.notes.SetValue("CheckGoSum() does not seem to lie")
}
// goodCheckGoSum()
buttonEnable()
})
/*
if missing == "" {
log.Info("BAD VERSION repo has go.sum requirements that are screwed up.", tmp)
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)
if repostatus.VerifyLocalGoRepo(missing) {
log.Info("BAD VERSION local directory exists", missing)
addRepo(reposgrid, missing, "master", "master", "master")
} else {
log.Info("BAD VERSION local directory does not exist", missing)
log.Info("START download of:", missing)
os.Setenv("GO111MODULE", "off")
err, output := release.current.status.RunCmd([]string{"go", "get", "-v", "-u", missing})
log.Warn(output)
log.Info("END download of:", missing)
if err == nil {
log.Warn("go get worked. recheck go.sum")
} else {
log.Warn("go get failed")
}
}
// addRepo(reposgrid, missing, "master", "master", "master")
}
*/
release.grid.NewButton("CheckPrimativeGoMod()", func() {
tmp := release.current.String()
log.Info("Run CheckGoSum on repo:", tmp)
@ -320,6 +297,7 @@ func createReleaseBox(box *gui.Node) {
}
})
release.grid.NewButton("reset with scanGoSum()", func() {
buttonDisable()
// do an initial scan of all the repos
@ -348,6 +326,41 @@ func createReleaseBox(box *gui.Node) {
buttonEnable()
})
}
func goodCheckGoSum() bool {
tmp := release.current.String()
log.Info("Run CheckGoSum on repo:", tmp)
/*
*/
var maybe bool = true
goConfig := release.current.status.GetGoDeps()
for depname, version := range goConfig {
log.Info("Checking repo deps:", depname, version)
repo, ok := me.allrepos[depname]
if ok {
goSumS := repo.getGoSumStatus()
if goSumS == "WHITELIST" {
continue
}
lastS := repo.status.GetLastTagVersion()
targetS := repo.targetVersion.String()
log.Info(" repo deps:", depname, version, "vs", goSumS, lastS, targetS)
if lastS != targetS {
maybe = false
}
} else {
log.Info(" repo deps: IGNORE", depname, version)
}
}
if maybe {
log.Info("SUCCEEDED.", release.current.String())
log.Info("SUCCEEDED. MAYBE. try it again get go.sum requirements")
return true
} else {
log.Info("FAILED. move on")
}
return false
}
func buttonDisable() {
me.Disable()
@ -391,8 +404,8 @@ func setCurrentRepo(newcur *repo, s string, note string) bool {
release.notes.SetValue(note)
release.current = newcur
release.version.SetText(release.current.targetVersion.String())
release.releaseVersionB.SetText("release version" + release.current.targetVersion.String())
release.unreleaseB.SetText("un-release version" + release.current.targetVersion.String())
release.releaseVersionB.SetText("release version " + release.current.targetVersion.String())
release.unreleaseB.SetText("un-release version " + release.current.targetVersion.String())
release.openrepo.Enable()
/*
@ -448,6 +461,28 @@ func findNextDirty(onlyKind string) bool {
if goSumS == "IGNORE" {
continue
}
if goSumS == "RELEASED" {
continue
}
if goSumS == "WHITELIST" {
continue
}
setCurrentRepo(repo, "REDO GOSUM", "try redoing the gosum")
if goodCheckGoSum() {
return true
} else {
// continue
}
if repo.String() == "go.wit.com/log" {
log.Info("findNextDirty() FOUND LOG", repo.String(), goSumS, dirtyS)
log.Info("findNextDirty() FOUND LOG", repo.String(), goSumS, dirtyS)
log.Info("findNextDirty() FOUND LOG", repo.String(), goSumS, dirtyS)
log.Info("findNextDirty() FOUND LOG", repo.String(), goSumS, dirtyS)
log.Info("findNextDirty() FOUND LOG", repo.String(), goSumS, dirtyS)
log.Sleep(10)
return true
}
continue
if goSumS == "UNRELEASED" {
if setCurrentRepo(repo, "UNRELEASED", "manually check go.sum") {
return true

View File

@ -91,10 +91,10 @@ type repo struct {
pLabel *gui.Node // path label
// bLabel *gui.Node // branch label
lastTag *gui.Node // last tagged version label
vLabel *gui.Node // version label
dirtyLabel *gui.Node // git state (dirty or not?)
goSumStatus *gui.Node // what is the state of the go.sum file
lastTag *gui.Node // last tagged version label
vLabel *gui.Node // version label
dirtyLabel *gui.Node // git state (dirty or not?)
goSumStatus *gui.Node // what is the state of the go.sum file
targetVersion *gui.Node // the final repo release version
statusButton *gui.Node // opens up the status window