working on release versioning

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-24 22:22:34 -06:00
parent 4735d37b3c
commit ceeab4c0d2
10 changed files with 106 additions and 117 deletions

View File

@ -109,14 +109,14 @@ func globalBuildOptions(box *gui.Node) {
group2.NewButton("run git status", func() { group2.NewButton("run git status", func() {
me.autoWorkingPwd.SetValue("~/go/src") me.autoWorkingPwd.SetValue("~/go/src")
log.Warn("scanning allrepos") log.Warn("scanning allrepos")
for _, path := range me.allrepos { for path, _ := range me.allrepos {
fullpath := "/home/jcarr/go/src/" + path fullpath := "/home/jcarr/go/src/" + path
quickCmd(fullpath, []string{"git", "status"}) quickCmd(fullpath, []string{"git", "status"})
} }
}) })
me.rerunGoMod = group2.NewButton("remove go.mod & go.sum", func() { me.rerunGoMod = group2.NewButton("remove go.mod & go.sum", func() {
for _, path := range me.allrepos { for path, _ := range me.allrepos {
fullpath := "/home/jcarr/go/src/" + path fullpath := "/home/jcarr/go/src/" + path
if quickCmd(fullpath, []string{"rm", "-f", "go.mod", "go.sum"}) { if quickCmd(fullpath, []string{"rm", "-f", "go.mod", "go.sum"}) {
log.Info("rm go.mod FAILED in repo", fullpath, me.stopOnErrors.Bool()) log.Info("rm go.mod FAILED in repo", fullpath, me.stopOnErrors.Bool())
@ -129,7 +129,7 @@ func globalBuildOptions(box *gui.Node) {
me.rerunGoMod = group2.NewButton("run go mod & go tidy", func() { me.rerunGoMod = group2.NewButton("run go mod & go tidy", func() {
os.Unsetenv("GO111MODULE") os.Unsetenv("GO111MODULE")
for _, path := range me.allrepos { for path, _ := range me.allrepos {
fullpath := "/home/jcarr/go/src/" + path fullpath := "/home/jcarr/go/src/" + path
quickCmd(fullpath, []string{"go", "mod", "init"}) quickCmd(fullpath, []string{"go", "mod", "init"})
quickCmd(fullpath, []string{"go", "mod", "tidy"}) quickCmd(fullpath, []string{"go", "mod", "tidy"})
@ -137,7 +137,7 @@ func globalBuildOptions(box *gui.Node) {
}) })
me.rerunGoMod = group2.NewButton("git checkout go.mod & go.sum", func() { me.rerunGoMod = group2.NewButton("git checkout go.mod & go.sum", func() {
for _, path := range me.allrepos { for path, _ := range me.allrepos {
fullpath := "/home/jcarr/go/src/" + path fullpath := "/home/jcarr/go/src/" + path
quickCmd(fullpath, []string{"git", "checkout", "go.mod"}) quickCmd(fullpath, []string{"git", "checkout", "go.mod"})
quickCmd(fullpath, []string{"git", "checkout", "go.sum"}) quickCmd(fullpath, []string{"git", "checkout", "go.sum"})

View File

@ -27,15 +27,18 @@ func globalDisplayOptions(box *gui.Node) {
log.Info("Toggling the Release Window") log.Info("Toggling the Release Window")
release.win.Toggle() release.win.Toggle()
release.openrepo.Disable() release.openrepo.Disable()
for _, repo := range me.allrepos {
repo.newScan()
}
}) })
/* /*
group1.NewButton("hide all", func() { group1.NewButton("hide all", func() {
for repo, _ := range me.allrepos { for _, repo := range me.allrepos {
repo.Hide() repo.Hide()
} }
}) })
group1.NewButton("show all", func() { group1.NewButton("show all", func() {
for repo, _ := range me.allrepos { for repo := range me.allrepos {
repo.Show() repo.Show()
} }
}) })
@ -44,26 +47,26 @@ func globalDisplayOptions(box *gui.Node) {
me.autoHidePerfect = group1.NewCheckbox("Hide Perfectly clean repos").SetChecked(false) 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() {
for repo, _ := range me.allrepos { for _, repo := range me.allrepos {
if repo.dirtyLabel.String() == "PERFECT" { if repo.dirtyLabel.String() == "PERFECT" {
repo.Hide() repo.Hide()
} }
} }
} else { } else {
for repo, _ := range me.allrepos { for _, repo := range me.allrepos {
repo.Show() repo.Show()
} }
} }
} }
group1.NewButton("status.Update() all", func() { group1.NewButton("status.Update() all", func() {
for repo, _ := range me.allrepos { for _, repo := range me.allrepos {
repo.status.Update() repo.status.Update()
} }
}) })
group1.NewButton("rescan all", func() { group1.NewButton("rescan all", func() {
for repo, _ := range me.allrepos { for _, repo := range me.allrepos {
repo.newScan() repo.newScan()
} }
}) })
@ -79,7 +82,7 @@ func globalDisplayOptions(box *gui.Node) {
} }
func hidePerfect() { func hidePerfect() {
for repo, _ := range me.allrepos { for _, repo := range me.allrepos {
if repo.dirtyLabel.String() == "PERFECT" { if repo.dirtyLabel.String() == "PERFECT" {
if repo.hidden { if repo.hidden {
continue continue

View File

@ -11,7 +11,7 @@ func globalResetOptions(box *gui.Node) {
buildOptions.NewLabel("start over") buildOptions.NewLabel("start over")
buildOptions.NewButton("rm ~/go/src & ~/go/pkg", func() { buildOptions.NewButton("rm ~/go/src & ~/go/pkg", func() {
for repo, _ := range me.allrepos { for _, repo := range me.allrepos {
// status := repo.getStatus() // status := repo.getStatus()
if repo.status.CheckDirty() { if repo.status.CheckDirty() {
log.Warn("repo is dirty. commit your changes first", repo.String()) log.Warn("repo is dirty. commit your changes first", repo.String())

10
go.mod
View File

@ -3,11 +3,11 @@ module go.wit.com/apps/autotypist
go 1.21.4 go 1.21.4
require ( require (
go.wit.com/gui v0.12.20 go.wit.com/gui v0.13.11
go.wit.com/lib/debugger v0.12.7 go.wit.com/lib/debugger v0.13.0
go.wit.com/lib/gadgets v0.12.16 go.wit.com/lib/gadgets v0.13.0
go.wit.com/lib/gui/logsettings v0.10.2 go.wit.com/lib/gui/logsettings v0.13.0
go.wit.com/lib/gui/repostatus v0.12.20 go.wit.com/lib/gui/repostatus v0.13.1
go.wit.com/log v0.5.6 go.wit.com/log v0.5.6
) )

20
go.sum
View File

@ -4,16 +4,16 @@ go.wit.com/dev/alexflint/scalar v1.2.1 h1:loXOcbVnd+8YeJRLey+XXidecBiedMDO00zQ26
go.wit.com/dev/alexflint/scalar v1.2.1/go.mod h1:+rYsfxqdI2cwA8kJ7GCMwWbNJvfvWUurOCXLiwdTtSs= go.wit.com/dev/alexflint/scalar v1.2.1/go.mod h1:+rYsfxqdI2cwA8kJ7GCMwWbNJvfvWUurOCXLiwdTtSs=
go.wit.com/dev/davecgh/spew v1.1.4 h1:C9hj/rjlUpdK+E6aroyLjCbS5MFcyNUOuP1ICLWdNek= go.wit.com/dev/davecgh/spew v1.1.4 h1:C9hj/rjlUpdK+E6aroyLjCbS5MFcyNUOuP1ICLWdNek=
go.wit.com/dev/davecgh/spew v1.1.4/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA= go.wit.com/dev/davecgh/spew v1.1.4/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA=
go.wit.com/gui v0.12.20 h1:mIc2DKGcpQjZdgtAj5qzkBrBDiteWfIaEpLyMnIBkh8= go.wit.com/gui v0.13.11 h1:d74Ko/XFZYR25P/AZfCQaVO2CuGh1BSjdUp1wjktdDg=
go.wit.com/gui v0.12.20/go.mod h1:v2VgnOL3dlZ13KclYeedZ1cd20nQdvwjyJTNKvFX3DA= go.wit.com/gui v0.13.11/go.mod h1:v2VgnOL3dlZ13KclYeedZ1cd20nQdvwjyJTNKvFX3DA=
go.wit.com/lib/debugger v0.12.7 h1:c8ehU7p2asb//K4YgC17XG4o2pPP+IZb9lR2a0nBio8= go.wit.com/lib/debugger v0.13.0 h1:k5XCa7BZFYA37rFf20iTAm5L4Ch+3eRuxCbHIhorYZI=
go.wit.com/lib/debugger v0.12.7/go.mod h1:zcZstsgOcALjCNOiIE+KcKkrIF78ogYjwxmaQlBbmtQ= go.wit.com/lib/debugger v0.13.0/go.mod h1:b3gykobdR+lcMjWAHJUa3GRsMYbnaHNwA/upfjpSA28=
go.wit.com/lib/gadgets v0.12.16 h1:xHz8zZiTe8xiGvfWs3s9drYUbePTT/Te58u7WXHjx0s= go.wit.com/lib/gadgets v0.13.0 h1:jtsEnf4DHqAxBxuYsaDlHti73rgaxYf/ffAXNB1PJAk=
go.wit.com/lib/gadgets v0.12.16/go.mod h1:9779QoRZlk+G3/MCcX4Io1eH3HTLImE0AXdAMMdw+0U= go.wit.com/lib/gadgets v0.13.0/go.mod h1:xidaHAL6Nk9+M9FkySVU1AG5i39v7T3PuFphUos6LxE=
go.wit.com/lib/gui/logsettings v0.10.2 h1:xRx0AX1V74kC6CIm+ib6C3ziTcbBjR/Ju3rTLEpQMsw= go.wit.com/lib/gui/logsettings v0.13.0 h1:iphACMcfdc5GoCcxZkShcWn9A/SwvnPmLXCSYSL+eJU=
go.wit.com/lib/gui/logsettings v0.10.2/go.mod h1:v5XUQ6WyNyfScR9oOFhdz8p1wtxCpNWXK3DJ/dbLPVo= go.wit.com/lib/gui/logsettings v0.13.0/go.mod h1:h+skqrtQ3muJ1TzMQ7M568xAwqT7nZCGS32c5jYCrqc=
go.wit.com/lib/gui/repostatus v0.12.20 h1:SPx45W8Yd6RZf0oZueXmMhlZsu3MVL8wdb5mVGovbfA= go.wit.com/lib/gui/repostatus v0.13.1 h1:BFIBw6p1RoqvC3ibTpYTt/Tefsq86lXf6VKY0DZqqlk=
go.wit.com/lib/gui/repostatus v0.12.20/go.mod h1:EO5bI+/cGwHGBQG1S8pDtV58Rmw5HWbW9vZtFLg5Vkw= go.wit.com/lib/gui/repostatus v0.13.1/go.mod h1:1q7IVR7sJ9r7wkrMi9VAG1JQFxy5PQutXCLPIUCvLd8=
go.wit.com/log v0.5.6 h1:rDC3ju95zfEads4f1Zm+QMkqjZ39CsYAT/UmQQs7VP4= go.wit.com/log v0.5.6 h1:rDC3ju95zfEads4f1Zm+QMkqjZ39CsYAT/UmQQs7VP4=
go.wit.com/log v0.5.6/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo= go.wit.com/log v0.5.6/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
go.wit.com/widget v1.1.6 h1:av2miF5vlohMfARA/QGPTPfgW/ADup1c+oeAOKgroPY= go.wit.com/widget v1.1.6 h1:av2miF5vlohMfARA/QGPTPfgW/ADup1c+oeAOKgroPY=

24
main.go
View File

@ -18,7 +18,7 @@ var resToolkit embed.FS
func main() { func main() {
me = new(autoType) me = new(autoType)
me.allrepos = make(map[*repo]string) me.allrepos = make(map[string]*repo)
me.myGui = gui.New() me.myGui = gui.New()
me.myGui.InitEmbed(resToolkit) me.myGui.InitEmbed(resToolkit)
@ -34,6 +34,12 @@ func main() {
} }
func addRepo(grid *gui.Node, path string, master string, devel string, user string) { func addRepo(grid *gui.Node, path string, master string, devel string, user string) {
_, ok := me.allrepos[path]
if ok {
log.Info("addRepo() already had path", path)
return
}
newRepo := new(repo) newRepo := new(repo)
path = strings.Trim(path, "/") // trim any extranous '/' chars put in the config file by the user path = strings.Trim(path, "/") // trim any extranous '/' chars put in the config file by the user
@ -76,16 +82,16 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
// newRepo.status = repostatus.New(me.myGui, newRepo.path) // newRepo.status = repostatus.New(me.myGui, newRepo.path)
newRepo.status = repostatus.NewRepoStatusWindow(newRepo.path) newRepo.status = repostatus.NewRepoStatusWindow(newRepo.path)
newRepo.hidden = false newRepo.hidden = false
newRepo.status.SetMainWorkingName(me.mainBranch.String()) newRepo.status.SetMainWorkingName(master)
newRepo.status.SetDevelWorkingName(me.develBranch.String()) newRepo.status.SetDevelWorkingName(devel)
newRepo.status.SetUserWorkingName(me.userBranch.String()) newRepo.status.SetUserWorkingName(user)
/* /*
newRepo.status.SetDevelBranchName(devel) newRepo.status.SetDevelBranchName(devel)
newRepo.status.SetUserBranchName(user) newRepo.status.SetUserBranchName(user)
newRepo.status.Update() newRepo.status.Update()
newRepo.newScan() newRepo.newScan()
*/ */
me.allrepos[newRepo] = path me.allrepos[path] = newRepo
} }
func autotypistWindow() { func autotypistWindow() {
@ -145,5 +151,13 @@ func repoworld() {
} }
addRepo(reposgrid, path, mbranch, dbranch, ubranch) addRepo(reposgrid, path, mbranch, dbranch, ubranch)
} }
for i, path := range repostatus.ListGitDirectories() {
// log.Info("addRepo()", i, path)
tmp := strings.TrimPrefix(path, "/home/jcarr/go/src/")
log.Info("addRepo()", i, tmp)
addRepo(reposgrid, tmp, "master", "master", "master")
}
reposwin.Toggle() reposwin.Toggle()
} }

View File

@ -60,6 +60,7 @@ func createReleaseWindow() {
} else { } else {
findNextRepo() findNextRepo()
} }
findDirty2()
}) })
release.openrepo = release.grid.NewButton("open repo", func() { release.openrepo = release.grid.NewButton("open repo", func() {
@ -67,12 +68,12 @@ func createReleaseWindow() {
log.Info("find the next repo first") log.Info("find the next repo first")
return return
} }
if release.current.status.CheckGoSum() { if ok, missing := release.current.status.CheckGoSum(); ok {
log.Info("repo has go.sum requirements that are clean") log.Info("repo has go.sum requirements that are clean")
release.status.SetValue("CLEAN") release.status.SetValue("CLEAN")
release.current.goSumStatus.SetValue("CLEAN") release.current.goSumStatus.SetValue("CLEAN")
} else { } else {
log.Info("repo has go.sum requirements that are screwed up") log.Info("BAD repo has go.sum requirements that are screwed up. missing:", missing)
release.status.SetValue("BAD") release.status.SetValue("BAD")
release.current.goSumStatus.SetValue("BAD") release.current.goSumStatus.SetValue("BAD")
} }
@ -122,17 +123,23 @@ func createReleaseWindow() {
buttonDisable() buttonDisable()
tmp := release.current.String() tmp := release.current.String()
log.Info("Run CheckGoSum on repo:", tmp) log.Info("Run CheckGoSum on repo:", tmp)
if release.current.status.CheckGoSum() { if ok, missing := release.current.status.CheckGoSum(); ok {
log.Info("repo has go.sum requirements that are clean") log.Info("repo has go.sum requirements that are clean")
release.current.goSumStatus.SetValue("CLEAN") release.current.goSumStatus.SetValue("CLEAN")
release.current.goSumStatus.SetLabel("CLEAN") release.current.goSumStatus.SetLabel("CLEAN")
release.current.goSumStatus.SetText("CLEAN") release.current.goSumStatus.SetText("CLEAN")
} else { } else {
log.Info("repo has go.sum requirements that are screwed up") if missing == "" {
log.Info("BAD VERSION repo has go.sum requirements that are screwed up.", tmp)
if release.current.goSumStatus.String() == "BAD" { if release.current.goSumStatus.String() == "BAD" {
release.current.goSumStatus.SetLabel("BAD VERSION") release.current.goSumStatus.SetLabel("BAD VERSION")
release.current.goSumStatus.SetText("BAD VERSION") release.current.goSumStatus.SetText("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)
// addRepo(reposgrid, missing, "master", "master", "master")
}
} }
buttonEnable() buttonEnable()
}) })
@ -188,8 +195,32 @@ func buttonEnable() {
release.sendVersionB.Enable() release.sendVersionB.Enable()
} }
func findDirty2() bool {
for _, repo := range me.allrepos {
goSumS := repo.goSumStatus.String()
dirtyS := repo.dirtyLabel.String()
if goSumS == "IGNORE" {
continue
}
if goSumS == "DIRTY 2" {
log.Info("repo DIRTY 2", repo.String(), goSumS, dirtyS)
release.repo.SetValue(repo.status.String())
release.status.SetValue("dirty 2")
release.notes.SetValue("check dirty 2 manually")
release.current = repo
release.openrepo.Enable()
return true
} else {
log.Info("repo not DIRTY 2", repo.String(), goSumS, dirtyS)
}
}
return false
}
func findNextDirty() bool { func findNextDirty() bool {
for repo, _ := range me.allrepos { for _, repo := range me.allrepos {
goSumS := repo.goSumStatus.String() goSumS := repo.goSumStatus.String()
dirtyS := repo.dirtyLabel.String() dirtyS := repo.dirtyLabel.String()
@ -216,11 +247,11 @@ func findNextDirty() bool {
return true return true
} }
if goSumS == "DIRTY" { if goSumS == "DIRTY" {
if repo.status.CheckGoSum() { if ok, missing := repo.status.CheckGoSum(); ok {
log.Info("repo has go.sum requirements that are clean") log.Info("repo has go.sum requirements that are clean")
// repo.goSumStatus.SetLabel("CLEAN") // repo.goSumStatus.SetLabel("CLEAN")
} else { } else {
log.Info("repo has go.sum requirements that are screwed up") log.Info("DIRTY 2 repo has go.sum requirements that are screwed up. missing:", missing)
repo.goSumStatus.SetLabel("DIRTY 2") repo.goSumStatus.SetLabel("DIRTY 2")
continue continue
} }
@ -235,12 +266,12 @@ func findNextDirty() bool {
return true return true
} }
} }
log.Info("tried to find() but not sure what to do next") log.Info("tried to findNextDirty() but not sure what to do next")
return false return false
} }
func findNextRepo() { func findNextRepo() {
for repo, _ := range me.allrepos { for _, repo := range me.allrepos {
goSumS := repo.goSumStatus.String() goSumS := repo.goSumStatus.String()
dirtyS := repo.dirtyLabel.String() dirtyS := repo.dirtyLabel.String()
@ -267,12 +298,12 @@ func findNextRepo() {
return return
} }
if goSumS == "DIRTY" { if goSumS == "DIRTY" {
if repo.status.CheckGoSum() { if ok, missing := repo.status.CheckGoSum(); ok {
log.Info("repo has go.sum requirements that are clean") log.Info("repo has go.sum requirements that are clean")
// repo.goSumStatus.SetLabel("CLEAN") // repo.goSumStatus.SetLabel("CLEAN")
} else { } else {
log.Info("repo has go.sum requirements that are screwed up") log.Info("DIRTY 3 repo has go.sum requirements that are screwed up. missing:", missing)
repo.goSumStatus.SetLabel("DIRTY 2") repo.goSumStatus.SetLabel("DIRTY 3")
continue continue
} }
@ -294,5 +325,5 @@ func findNextRepo() {
return return
} }
} }
log.Info("tried to find() but not sure what to do next") log.Info("tried to findNextRepo() but not sure what to do next")
} }

View File

@ -75,7 +75,7 @@ func (r *repo) getStatus() string {
} }
func scanGoSum() { func scanGoSum() {
for repo, _ := range me.allrepos { for _, repo := range me.allrepos {
latestversion := repo.status.GetLastTagVersion() latestversion := repo.status.GetLastTagVersion()
if repo.goSumStatus.String() == "BAD" { if repo.goSumStatus.String() == "BAD" {
continue continue
@ -100,11 +100,11 @@ func scanGoSum() {
// release.openrepo.Enable() // release.openrepo.Enable()
continue continue
} }
if repo.status.CheckGoSum() { if ok, missing := repo.status.CheckGoSum(); ok {
log.Info("repo has go.sum requirements that are clean") log.Info("repo has go.sum requirements that are clean")
repo.goSumStatus.SetLabel("CLEAN") repo.goSumStatus.SetLabel("CLEAN")
} else { } else {
log.Info("repo has go.sum requirements that are screwed up") log.Info("repo has go.sum requirements that are screwed up. missing:", missing)
repo.goSumStatus.SetLabel("BAD") repo.goSumStatus.SetLabel("BAD")
// release.repo.SetValue(repo.status.String()) // release.repo.SetValue(repo.status.String())

View File

@ -16,7 +16,7 @@ var reposgroup *gui.Node
var me *autoType var me *autoType
type autoType struct { type autoType struct {
allrepos map[*repo]string allrepos map[string]*repo
myGui *gui.Node myGui *gui.Node
autotypistWindow *gadgets.BasicWindow autotypistWindow *gadgets.BasicWindow

59
unix.go
View File

@ -1,59 +0,0 @@
package main
/*
import (
"strings"
"go.wit.com/lib/gui/repostatus"
"go.wit.com/log"
)
// var repopath string = "/home/jcarr/"
// if dryRun == true, then it just prints out the values
// but doesn't do anything
func goMake(dryRun string) bool {
var workingpath string = "~/go/src"
for _, line := range me.script {
if len(line) == 0 {
continue
}
if line[0] == "cd" {
switch len(line) {
case 1:
log.Verbose("do cmdPwd() TODO: change working path to ~ ?")
workingpath = "/home/jcarr/go/src/go.wit.com/"
case 2:
log.Verbose("do cmdPwd() here", line)
workingpath = line[1]
default:
log.Warn("bad cd", line)
return false
}
continue
}
cmd := line[0]
s := strings.Join(line[1:], " ")
log.Warn("NEED TO RUN path =", workingpath, "cmd =", cmd, s)
if dryRun == "--dry-run" {
continue
}
if dryRun == "--doit" {
log.Warn("Actually RUN path =", workingpath, "cmd =", cmd, s)
err, b, output := repostatus.RunCmd(workingpath, line)
if err != nil {
log.Info("output =", output)
log.Info("ABEND EXECUTION")
log.Info("error =", err)
log.Info("b =", b)
return false
}
// log.Warn("output was =", output)
continue
}
log.Warn("don't know what to do. dryRun ==", dryRun)
return false
}
return true
}
*/