From 697696d3dfed934d36b21caa2f87afdfa1da5679 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 18 Feb 2024 07:24:56 -0600 Subject: [PATCH] fixing the release process --- Makefile | 2 +- globalDisplayOptions.go | 4 ++- initRepoList.go | 70 +++++++++++++++++++++++++++++++++++++++++ main.go | 34 +++++++++----------- submitPatches.go | 67 +++++++++++++++++++++++++++++++++------ 5 files changed, 145 insertions(+), 32 deletions(-) create mode 100644 initRepoList.go diff --git a/Makefile b/Makefile index 14f2253..ca9ebfa 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ build: echo "build it!" -rm resources/*.so cp -a ~/go/src/go.wit.com/toolkits/*.so resources/ - go build -v -x + GO111MODULE=off go build -v -x install: rm -f ~/go/src/go.wit.com/toolkits/*.so diff --git a/globalDisplayOptions.go b/globalDisplayOptions.go index b403677..837b15d 100644 --- a/globalDisplayOptions.go +++ b/globalDisplayOptions.go @@ -83,7 +83,9 @@ func globalDisplayOptions(vbox *gui.Node) { } scanbox.NewButton("scan now", func() { log.Info("re-scanning repos now") - me.repos.View.ScanRepositories() + i, s := me.repos.View.ScanRepositories() + log.Info("re-scanning repos done", i, s) + me.duration.SetText(s) }) me.duration = scanbox.NewLabel("") diff --git a/initRepoList.go b/initRepoList.go new file mode 100644 index 0000000..befe28c --- /dev/null +++ b/initRepoList.go @@ -0,0 +1,70 @@ +package main + +// this initializes the repos + +import ( + "io/ioutil" + "os" + "os/user" + "path/filepath" + "strings" + + "go.wit.com/lib/gui/repolist" + "go.wit.com/lib/gui/repostatus" + "go.wit.com/log" +) + +func (r *repoWindow) initRepoList() { + usr, _ := user.Current() + + repos := parsecfg("~/.config/autotypist") + for _, line := range repos { + log.Verbose("repo =", line) + path, mbranch, dbranch, ubranch := splitLine(line) + if mbranch == "" { + mbranch = "master" + } + if dbranch == "" { + dbranch = "devel" + } + if ubranch == "" { + ubranch = usr.Username + } + r.View.AddRepo(path, mbranch, dbranch, ubranch) + } + + if args.OnlyMe { + log.Info("not scanning everything") + } else { + log.Info("scanning everything in ~/go/src") + for i, path := range repostatus.ListGitDirectories() { + // log.Info("addRepo()", i, path) + path = strings.TrimPrefix(path, me.goSrcPwd.String()) + path = strings.Trim(path, "/") + log.Info("addRepo()", i, path) + r.View.AddRepo(path, "master", "devel", usr.Username) + } + } +} + +func parsecfg(f string) []string { + homeDir, _ := os.UserHomeDir() + cfgfile := filepath.Join(homeDir, f) + content, _ := ioutil.ReadFile(cfgfile) + out := string(content) + out = strings.TrimSpace(out) + lines := strings.Split(out, "\n") + return lines +} + +// returns path, master branch name, devel branch name, user branch name +func splitLine(line string) (string, string, string, string) { + var path, master, devel, user string + parts := strings.Split(line, " ") + path, parts = repolist.RemoveFirstElement(parts) + master, parts = repolist.RemoveFirstElement(parts) + devel, parts = repolist.RemoveFirstElement(parts) + user, parts = repolist.RemoveFirstElement(parts) + // path, master, devel, user := strings.Split(line, " ") + return path, master, devel, user +} diff --git a/main.go b/main.go index f8450b7..2750ec7 100644 --- a/main.go +++ b/main.go @@ -2,11 +2,8 @@ package main import ( "embed" - "os/user" - "strings" "go.wit.com/lib/debugger" - "go.wit.com/lib/gui/repostatus" "go.wit.com/log" "go.wit.com/gui" @@ -42,29 +39,26 @@ func main() { me.repos = makeRepoView() - usr, _ := user.Current() - if args.OnlyMe { - log.Info("not scanning everything") - } else { - log.Info("scanning everything in ~/go/src") - for i, path := range repostatus.ListGitDirectories() { - // log.Info("addRepo()", i, path) - path = strings.TrimPrefix(path, me.goSrcPwd.String()) - path = strings.Trim(path, "/") - log.Info("addRepo()", i, path) - me.repos.View.AddRepo(path, "master", "devel", usr.Username) - } - } + // 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() // process everything on the command line + // may exit here handleCmdLine() - me.repos.View.ScanRepositories() - me.Enable() - // processing is done. update the repo summary box me.summary.Update() + me.Enable() + // intermittently scans the status indefinitly - me.repos.View.Watchdog() + me.repos.View.Watchdog(func() { + log.Info("In main()") + // processing is done. update the repo summary box + me.summary.Update() + }) } diff --git a/submitPatches.go b/submitPatches.go index dfdb402..17b63cb 100644 --- a/submitPatches.go +++ b/submitPatches.go @@ -27,19 +27,25 @@ type patchSummary struct { gitPullB *gui.Node checkB *gui.Node - totalOL *gadgets.OneLiner - totalGoOL *gadgets.OneLiner - dirtyOL *gadgets.OneLiner - readonlyOL *gadgets.OneLiner - totalPatchesOL *gadgets.OneLiner + // stats + totalOL *gadgets.OneLiner + totalGoOL *gadgets.OneLiner + dirtyOL *gadgets.OneLiner + readonlyOL *gadgets.OneLiner + totalPatchesOL *gadgets.OneLiner + totalUserRepos *gui.Node + totalDevelRepos *gui.Node + totalMasterRepos *gui.Node + totalUserPatches *gui.Node + totalDevelPatches *gui.Node + totalMasterPatches *gui.Node + // patch set generation unknownOL *gadgets.OneLiner unknownSubmitB *gui.Node - - reason *gadgets.BasicEntry - submitB *gui.Node - - allp []*patch + reason *gadgets.BasicEntry + submitB *gui.Node + allp []*patch } func submitPatchesBox(box *gui.Node) *patchSummary { @@ -156,10 +162,21 @@ func submitPatchesBox(box *gui.Node) *patchSummary { s.unknownSubmitB.Hide() s.grid.NextRow() + s.grid = group1.RawGrid() + s.grid.NewLabel("") + s.grid.NewLabel("") + s.grid.NewLabel("user to devel") + s.grid.NewLabel("devel to master") + s.grid.NewLabel("master to last tag") + s.grid.NextRow() + s.totalOL = gadgets.NewOneLiner(s.grid, "Total") s.grid.NextRow() s.totalGoOL = gadgets.NewOneLiner(s.grid, "Total GO") + s.totalUserRepos = s.grid.NewLabel("5 go repos") + s.totalDevelRepos = s.grid.NewLabel("3 go repos") + s.totalMasterRepos = s.grid.NewLabel("8 go repos") s.grid.NextRow() s.dirtyOL = gadgets.NewOneLiner(s.grid, "dirty") @@ -169,8 +186,19 @@ func submitPatchesBox(box *gui.Node) *patchSummary { s.grid.NextRow() s.totalPatchesOL = gadgets.NewOneLiner(s.grid, "total commits") + s.totalUserPatches = s.grid.NewLabel("5 patches") + s.totalDevelPatches = s.grid.NewLabel("3 patches") + s.totalMasterPatches = s.grid.NewLabel("8 patches") s.grid.NextRow() + s.grid.NewLabel("") + s.grid.NewLabel("") + s.grid.NewButton("merge from user", func() {}) + s.grid.NewButton("merge from devel", func() {}) + s.grid.NextRow() + + group1 = box.NewGroup("Create GUI Patch Set") + s.grid = group1.RawGrid() s.reason = gadgets.NewBasicEntry(s.grid, "patch name:") s.reason.Custom = func() { if s.reason.String() != "" { @@ -203,6 +231,8 @@ func submitPatchesBox(box *gui.Node) *patchSummary { func (s *patchSummary) Update() { var total, totalgo, dirty, readonly int + var userT, develT, masterT int + // var userP, develP, masterP int for _, repo := range repolist.AllRepos() { total += 1 if repo.Status.IsDirty() { @@ -219,12 +249,29 @@ func (s *patchSummary) Update() { if repo.Status.IsGoLang() { totalgo += 1 } + userV := repo.Status.GetUserVersion() + develV := repo.Status.GetDevelVersion() + masterV := repo.Status.GetMasterVersion() + lastV := repo.Status.GetLastTagVersion() + if userV != develV { + userT += 1 + } + if develV != masterV { + develT += 1 + } + if masterV != lastV { + masterT += 1 + } } s.totalOL.SetText(strconv.Itoa(total) + " repos") s.totalGoOL.SetText(strconv.Itoa(totalgo) + " repos") s.dirtyOL.SetText(strconv.Itoa(dirty) + " repos") s.readonlyOL.SetText(strconv.Itoa(readonly) + " repos") + s.totalUserRepos.SetText(strconv.Itoa(userT) + " repos") + s.totalDevelRepos.SetText(strconv.Itoa(develT) + " repos") + s.totalMasterRepos.SetText(strconv.Itoa(masterT) + " repos") + /* move all this to repolist and gowit repos p, allp := s.GetPatches() if s.allp == nil {