attempting to fix guireleaser

This commit is contained in:
Jeff Carr 2024-02-18 17:55:59 -06:00
parent 08c7765cc7
commit a7619389df
8 changed files with 93 additions and 93 deletions

View File

@ -29,7 +29,7 @@ func CheckReady() bool {
log.Info("find the next repo first")
return false
}
goSumS := release.current.Status.GetGoSumStatus()
goSumS := release.current.GoState()
dirtyS := release.current.State()
lastS := release.current.Status.GetLastTagVersion()
currentS := release.current.Status.GetCurrentBranchVersion()
@ -44,7 +44,7 @@ func CheckReady() bool {
}
if goSumS == "PRIMATIVE" {
if targetS == lastS {
release.current.Status.SetGoSumStatus("RELEASED")
release.current.SetGoState("RELEASED")
}
return true
}
@ -53,15 +53,15 @@ func CheckReady() bool {
}
if goSumS == "READY" {
if targetS == lastS {
release.current.Status.SetGoSumStatus("RELEASED")
release.current.SetGoState("RELEASED")
return true
}
if lastS == currentS {
release.current.Status.SetGoSumStatus("UNRELEASED")
release.current.SetGoState("UNRELEASED")
}
return true
}
release.current.Status.SetGoSumStatus("NOT READY")
release.current.SetGoState("NOT READY")
if release.current.Status.ReadOnly() {
log.Info("\trepo is read only")
return false
@ -69,12 +69,12 @@ func CheckReady() bool {
if targetS == lastS {
log.Info("\trepo is already done", lastS, "=", targetS)
release.current.Status.SetGoSumStatus("READY")
release.current.SetGoState("READY")
return true
}
if lastS == currentS {
log.Info("\trepo is already done", lastS, "=", targetS)
release.current.Status.SetGoSumStatus("READY")
release.current.SetGoState("READY")
return true
}
@ -129,7 +129,7 @@ func CheckReady() bool {
return false
}
release.current.Status.SetGoSumStatus("READY")
release.current.SetGoState("READY")
return true
}

View File

@ -23,7 +23,7 @@ func doRelease() bool {
log.Warn("version does not start with v.", release.version.String())
return false
}
switch release.current.Status.GetGoSumStatus() {
switch release.current.GoState() {
case "PRIMATIVE":
log.Warn("can do PRIMATIVE", release.current.Name())
case "GOOD":
@ -88,7 +88,7 @@ func doRelease() bool {
}
log.Info("PUBLISH OK")
release.current.Status.SetGoSumStatus("RELEASED")
release.current.SetGoState("RELEASED")
// unwind and re-tag. Now that the go.mod and go.sum are published, revert
// to the development branch
@ -178,7 +178,7 @@ func doPublishVersion() bool {
if err == nil {
log.Info("SELF UPDATE OK. out =", out)
log.Info("SELF UPDATE WORKED")
release.current.Status.SetGoSumStatus("RELEASED")
release.current.SetGoState("RELEASED")
return true
}
return false

View File

@ -25,7 +25,7 @@ func showHideRepos() {
}
}
if me.autoReleased.Checked() {
if repo.Status.GetGoSumStatus() == "RELEASED" {
if repo.GoState() == "RELEASED" {
repo.Hide()
continue
}
@ -93,7 +93,7 @@ func globalDisplayOptions(box *gui.Node) {
me.autoReleased.Custom = func() {
if me.autoReleased.Checked() {
for _, repo := range me.repos.View.AllRepos() {
if repo.Status.GetGoSumStatus() == "RELEASED" {
if repo.GoState() == "RELEASED" {
repo.Hide()
}
}
@ -227,6 +227,14 @@ func globalDisplayOptions(box *gui.Node) {
log.Info("All repos seem okay")
})
group1.NewButton("initialize all the repos", func() {
setRepoState()
})
group1.NewButton("scanForReady()", func() {
scanForReady()
})
group2 := vbox.NewGroup("Debugger")
group2.NewButton("logging Window", func() {
logsettings.LogWindow()

View File

@ -9,7 +9,7 @@ import (
)
func lookToUnwind(r *repolist.Repo) bool {
goSumS := r.Status.GetGoSumStatus()
goSumS := r.GoState()
dirtyS := r.State()
currentS := r.Status.GetCurrentBranchVersion()
log.Info("repo:", r.Name(), goSumS, dirtyS, r.State(), currentS)
@ -21,19 +21,19 @@ func lookToUnwind(r *repolist.Repo) bool {
log.Info("\trepo is ready working from main branch", curName, "=", mName)
} else {
log.Info("\trepo is not ready main branch", curName, "!=", mName)
r.Status.SetGoSumStatus("CAN NOT UNWIND")
r.SetGoState("CAN NOT UNWIND")
return false
}
if r.LastTag() != currentS {
log.Info("\trepo version mismatch last vs current", r.LastTag(), "!=", currentS)
r.Status.SetGoSumStatus("CAN NOT UNWIND")
r.SetGoState("CAN NOT UNWIND")
return false
}
if release.version.String() != r.LastTag() {
log.Info("\trepo version mismatch last vs official", r.LastTag(), "!=", release.version.String())
r.Status.SetGoSumStatus("CAN NOT UNWIND")
r.SetGoState("CAN NOT UNWIND")
return false
}
@ -41,7 +41,7 @@ func lookToUnwind(r *repolist.Repo) bool {
testf := filepath.Join(fullpath, "go.mod")
if Exists(testf) {
log.Info("\trepo is ready. go.mod exists")
r.Status.SetGoSumStatus("UNWIND")
r.SetGoState("UNWIND")
return true
}
@ -49,10 +49,10 @@ func lookToUnwind(r *repolist.Repo) bool {
testf = filepath.Join(fullpath, "go.sum")
if Exists(testf) {
log.Info("\trepo is ready. go.sum exists")
r.Status.SetGoSumStatus("UNWIND")
r.SetGoState("UNWIND")
return true
}
r.Status.SetGoSumStatus("NO UNWIND?")
r.SetGoState("NO UNWIND?")
return false
}

104
main.go
View File

@ -66,8 +66,58 @@ func main() {
// save the ENV var here
me.releaseReasonS = releaseReasonS
me.repos = makeRepoView()
log.Info("Creating the Release Window")
// scan in the repo map first
// hopefully this is the list of all the golang packages and only the GUI golang packages
me.repos = makeRepoView()
log.Sleep(3)
// create the right side of the main window
createReleaseBox(me.mainBox)
// disable the open repo button. this isn't really important
// but does indicates the app (and toolkit) is working
// this can be removed later, but in these early days, I'm using this
// tool to release the code for this app, the gui and the gui toolkits
// and sometimes they lie, don't display stuff, don't even disable things
// so I can't trust even what I see. It's complicated right now still.
release.openrepo.Disable()
// parse config file and scan for .git repos
me.repos.initRepoList()
// reads in the State of all the repos
// TODO: should not really be necessary directly after init()
me.repos.View.ScanRepositories()
me.Enable()
// intermittently scans the status indefinitly
me.repos.View.Watchdog(func() {
log.Info("In main()")
// processing is done. update the repo summary box
// me.summary.Update()
})
}
func setRepoState() {
// start the initail scan and make sure each repo is set
// to the master branch
for _, repo := range me.repos.View.AllRepos() {
if repo.ReadOnly() {
continue
}
if whitelist(repo.GoPath()) {
continue
}
if repo.Status.CheckoutMaster() {
log.Warn("git checkout master branch worked", repo.Name())
} else {
log.Warn("git checkout master branch failed", repo.Name())
}
repo.NewScan()
}
// go through and set the target versions for each repo
// todo: add sanity checking in repolist to verify these and/or autocompute them
// for now, just don't be stupid when you set your ENV vars
@ -98,57 +148,7 @@ func main() {
repo.Status.SetTargetVersion(lasttag)
}
}
log.Info("Creating the Release Window")
// create the right side of the main window
createReleaseBox(me.mainBox)
// start the initail scan and make sure each repo is set
// to the master branch
for _, repo := range me.repos.View.AllRepos() {
if repo.ReadOnly() {
continue
repo.NewScan()
}
if whitelist(repo.GoPath()) {
continue
}
if repo.Status.CheckoutMaster() {
log.Warn("git checkout master branch worked", repo.Name())
repo.Status.UpdateNew()
} else {
repo.Status.UpdateNew()
log.Warn("git checkout master branch failed", repo.Name())
}
}
// disable the open repo button. this isn't really important
// but does indicates the app (and toolkit) is working
// this can be removed later, but in these early days, I'm using this
// tool to release the code for this app, the gui and the gui toolkits
// and sometimes they lie, don't display stuff, don't even disable things
// so I can't trust even what I see. It's complicated right now still.
release.openrepo.Disable()
// I don't know what this is autotypist thing?
// globalResetOptions(me.mainbox)
// hopefully this is the list of all the golang packages and only the GUI golang packages
me.repos = makeRepoView()
// parse config file and scan for .git repos
me.repos.initRepoList()
// reads in the State of all the repos
// TODO: should not really be necessary directly after init()
me.repos.View.ScanRepositories()
me.Enable()
// intermittently scans the status indefinitly
me.repos.View.Watchdog(func() {
log.Info("In main()")
// processing is done. update the repo summary box
// me.summary.Update()
})
}

View File

@ -325,7 +325,7 @@ func scanForReady() bool {
if whitelist(repo.GoPath()) {
log.Info("found WHITELIST", repo.GoPath())
repo.Status.SetGoSumStatus("WHITELIST")
repo.SetGoState("WHITELIST")
continue
}
@ -341,7 +341,7 @@ func scanForReady() bool {
// todo: redo this logic as it is terrible
func findNextDirty(onlyKind string) bool {
for _, repo := range me.repos.View.AllRepos() {
goSumS := repo.Status.GetGoSumStatus()
goSumS := repo.GoState()
// dirtyS := repo.State()
log.Info("findNextDirty()", repo.GoPath(), goSumS)

View File

@ -6,25 +6,14 @@ import (
"go.wit.com/log"
)
/*
func getGoSumStatus(r *repolist.Repo) string {
return r.Status.GoSumStatus.String()
}
func setGoSumStatus(r *repolist.Repo, s string) {
r.goSumStatus.SetLabel(s)
r.status.SetGoSumStatus(s)
}
*/
func checkSafeGoSumRemake(r *repolist.Repo) {
if ok, bad := r.Status.CheckSafeGoSumRemake(); ok {
log.Info("checkSafeGoSumRemake() is safe to redo")
r.Status.SetGoSumStatus("SAFE")
r.SetGoState("SAFE")
r.Status.MakeRedomod()
} else {
log.Info("checkSafeGoSumRemake() is not safe. problems:", bad)
r.Status.SetGoSumStatus("BAD DEP")
r.SetGoState("BAD DEP")
}
}

View File

@ -13,12 +13,15 @@ func initWhitelist() {
if strings.HasPrefix(repo.GoPath(), "go.wit.com/dev/davecgh") {
release.whitelist[repo.GoPath()] = repo
}
//
// if repo.String() == "go.wit.com/apps/guireleaser" {
// release.whitelist[repo.String()] = repo
// }
//
// if repo.String() == "go.wit.com/lib/gui/repostatus" {
// release.whitelist[repo.String()] = repo
// }
//
}
}