general cleanups
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
3dcb168348
commit
d18a8018cb
|
@ -60,6 +60,20 @@ func globalBuildOptions(box *gui.Node) {
|
||||||
group1 := vbox.NewGroup("Global Build Options")
|
group1 := vbox.NewGroup("Global Build Options")
|
||||||
grid := group1.NewGrid("buildOptions", 2, 1)
|
grid := group1.NewGrid("buildOptions", 2, 1)
|
||||||
|
|
||||||
|
// me.autoWorkingPwd = gadgets.NewOneLiner(grid, "working directory (pwd)")
|
||||||
|
me.userHomePwd = gadgets.NewOneLiner(grid, "user home")
|
||||||
|
me.goSrcPwd = gadgets.NewOneLiner(grid, "go src home")
|
||||||
|
|
||||||
|
usr, _ := user.Current()
|
||||||
|
homeDir, err := os.UserHomeDir()
|
||||||
|
if err != nil {
|
||||||
|
log.Warn("Error getting home directory:", err)
|
||||||
|
homeDir = "/home/autotypist"
|
||||||
|
}
|
||||||
|
me.userHomePwd.SetText(homeDir)
|
||||||
|
srcDir := filepath.Join(homeDir, "go/src")
|
||||||
|
me.goSrcPwd.SetText(srcDir)
|
||||||
|
|
||||||
me.mainBranch = gadgets.NewBasicCombobox(grid, "default main branch")
|
me.mainBranch = gadgets.NewBasicCombobox(grid, "default main branch")
|
||||||
me.mainBranch.AddText("gitea server default")
|
me.mainBranch.AddText("gitea server default")
|
||||||
me.mainBranch.Disable()
|
me.mainBranch.Disable()
|
||||||
|
@ -67,7 +81,6 @@ func globalBuildOptions(box *gui.Node) {
|
||||||
me.develBranch = gadgets.NewBasicCombobox(grid, "default devel branch")
|
me.develBranch = gadgets.NewBasicCombobox(grid, "default devel branch")
|
||||||
me.develBranch.AddText("devel")
|
me.develBranch.AddText("devel")
|
||||||
|
|
||||||
usr, _ := user.Current()
|
|
||||||
me.userBranch = gadgets.NewBasicCombobox(grid, "default user branch")
|
me.userBranch = gadgets.NewBasicCombobox(grid, "default user branch")
|
||||||
me.userBranch.AddText(usr.Username)
|
me.userBranch.AddText(usr.Username)
|
||||||
|
|
||||||
|
@ -95,72 +108,4 @@ func globalBuildOptions(box *gui.Node) {
|
||||||
newBranch.AddText("devel")
|
newBranch.AddText("devel")
|
||||||
newBranch.AddText(usr.Username)
|
newBranch.AddText(usr.Username)
|
||||||
newBranch.SetText(usr.Username)
|
newBranch.SetText(usr.Username)
|
||||||
|
|
||||||
me.autoWorkingPwd = gadgets.NewOneLiner(grid, "working directory (pwd)")
|
|
||||||
me.userHomePwd = gadgets.NewOneLiner(grid, "user home")
|
|
||||||
me.goSrcPwd = gadgets.NewOneLiner(grid, "go src home")
|
|
||||||
|
|
||||||
homeDir, err := os.UserHomeDir()
|
|
||||||
if err != nil {
|
|
||||||
log.Warn("Error getting home directory:", err)
|
|
||||||
homeDir = "/home/autotypist"
|
|
||||||
}
|
|
||||||
me.userHomePwd.SetText(homeDir)
|
|
||||||
srcDir := filepath.Join(homeDir, "go/src")
|
|
||||||
me.goSrcPwd.SetText(srcDir)
|
|
||||||
|
|
||||||
group2 := vbox.NewGroup("Run in every git repository")
|
|
||||||
me.stopOnErrors = group2.NewCheckbox("Stop on errors")
|
|
||||||
me.stopOnErrors.SetChecked(true)
|
|
||||||
|
|
||||||
me.autoDryRun = group2.NewCheckbox("autotypist --dry-run")
|
|
||||||
me.autoDryRun.SetChecked(true)
|
|
||||||
|
|
||||||
/*
|
|
||||||
group2.NewButton("parse .git/config ScanGitConfig()", func() {
|
|
||||||
repostatus.ScanGitConfig()
|
|
||||||
})
|
|
||||||
|
|
||||||
group2.NewButton("parse go.sum ScanGoSrc()", func() {
|
|
||||||
repostatus.ScanGoSrc()
|
|
||||||
})
|
|
||||||
|
|
||||||
group2.NewButton("run git status", func() {
|
|
||||||
me.autoWorkingPwd.SetValue("~/go/src")
|
|
||||||
log.Warn("scanning allrepos")
|
|
||||||
for path, _ := range me.allrepos {
|
|
||||||
fullpath := me.goSrcPwd.String() + path
|
|
||||||
quickCmd(fullpath, []string{"git", "status"})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
me.rerunGoMod = group2.NewButton("remove go.mod & go.sum", func() {
|
|
||||||
for path, _ := range me.allrepos {
|
|
||||||
fullpath := me.goSrcPwd.String() + path
|
|
||||||
if quickCmd(fullpath, []string{"rm", "-f", "go.mod", "go.sum"}) {
|
|
||||||
log.Info("rm go.mod FAILED in repo", fullpath, me.stopOnErrors.Bool())
|
|
||||||
if me.stopOnErrors.Bool() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
me.rerunGoMod = group2.NewButton("run go mod & go tidy", func() {
|
|
||||||
os.Unsetenv("GO111MODULE")
|
|
||||||
for path, _ := range me.allrepos {
|
|
||||||
fullpath := me.goSrcPwd.String() + path
|
|
||||||
quickCmd(fullpath, []string{"go", "mod", "init"})
|
|
||||||
quickCmd(fullpath, []string{"go", "mod", "tidy"})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
me.rerunGoMod = group2.NewButton("git checkout go.mod & go.sum", func() {
|
|
||||||
for path, _ := range me.allrepos {
|
|
||||||
fullpath := me.goSrcPwd.String() + path
|
|
||||||
quickCmd(fullpath, []string{"git", "checkout", "go.mod"})
|
|
||||||
quickCmd(fullpath, []string{"git", "checkout", "go.sum"})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,18 +71,6 @@ func globalDisplayOptions(box *gui.Node) {
|
||||||
}
|
}
|
||||||
me.scanEveryMinute = group1.NewCheckbox("Scan every minute").SetChecked(false)
|
me.scanEveryMinute = group1.NewCheckbox("Scan every minute").SetChecked(false)
|
||||||
|
|
||||||
group1.NewButton("status.Update() all", func() {
|
|
||||||
for _, repo := range me.allrepos {
|
|
||||||
repo.status.Update()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
group1.NewButton("rescan all", func() {
|
|
||||||
for _, repo := range me.allrepos {
|
|
||||||
repo.newScan()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
group2 := vbox.NewGroup("Debugger")
|
group2 := vbox.NewGroup("Debugger")
|
||||||
group2.NewButton("logging Window", func() {
|
group2.NewButton("logging Window", func() {
|
||||||
logsettings.LogWindow()
|
logsettings.LogWindow()
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"go.wit.com/gui"
|
"go.wit.com/gui"
|
||||||
|
@ -9,6 +10,7 @@ import (
|
||||||
|
|
||||||
func globalResetOptions(box *gui.Node) {
|
func globalResetOptions(box *gui.Node) {
|
||||||
group2 := box.NewGroup("Global Destructive Options")
|
group2 := box.NewGroup("Global Destructive Options")
|
||||||
|
globalTestingOptions(group2)
|
||||||
buildOptions := group2.NewGrid("buildOptions", 2, 1)
|
buildOptions := group2.NewGrid("buildOptions", 2, 1)
|
||||||
|
|
||||||
buildOptions.NewLabel("start over")
|
buildOptions.NewLabel("start over")
|
||||||
|
@ -36,3 +38,61 @@ func globalResetOptions(box *gui.Node) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// things being testing
|
||||||
|
func globalTestingOptions(box *gui.Node) {
|
||||||
|
|
||||||
|
var listallB *gui.Node
|
||||||
|
listallB = box.NewButton("go.wit.com/list", func() {
|
||||||
|
listallB.Disable()
|
||||||
|
listWindow()
|
||||||
|
listallB.Enable()
|
||||||
|
})
|
||||||
|
|
||||||
|
me.autoRebuildButton = box.NewButton("rebuild autotypist", func() {
|
||||||
|
me.autoRebuildButton.Disable()
|
||||||
|
me.autoRebuildButton.SetLabel("running....")
|
||||||
|
attemptAutoRebuild()
|
||||||
|
me.autoRebuildButton.Enable()
|
||||||
|
me.autoRebuildButton.SetLabel("rebuild autotypist")
|
||||||
|
})
|
||||||
|
|
||||||
|
me.stopOnErrors = box.NewCheckbox("Stop on errors")
|
||||||
|
me.stopOnErrors.SetChecked(true)
|
||||||
|
|
||||||
|
me.autoDryRun = box.NewCheckbox("autotypist --dry-run")
|
||||||
|
me.autoDryRun.SetChecked(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func attemptAutoRebuild() {
|
||||||
|
os.Setenv("GO111MODULE", "off")
|
||||||
|
|
||||||
|
homeDir := me.userHomePwd.String()
|
||||||
|
fullpath := filepath.Join(homeDir, "go")
|
||||||
|
quickCmd(fullpath, []string{"mkdir", "-p", "src/go.wit.com/apps/"})
|
||||||
|
|
||||||
|
fullpath = filepath.Join(homeDir, "go/src/go.wit.com/apps/")
|
||||||
|
|
||||||
|
quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/apps/autotypist"})
|
||||||
|
quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/toolkits/debian"})
|
||||||
|
quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/toolkits/tree"})
|
||||||
|
quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/toolkits/nocui"})
|
||||||
|
quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/toolkits/gocui"})
|
||||||
|
quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/toolkits/andlabs"})
|
||||||
|
|
||||||
|
fullpath = filepath.Join(homeDir, "go/src/go.wit.com/toolkits/nocui/")
|
||||||
|
quickCmd(fullpath, []string{"go", "get", "-v", "-u", "."})
|
||||||
|
quickCmd(fullpath, []string{"go", "build", "-v", "-x", "-buildmode=plugin", "-o", "../nocui.so"})
|
||||||
|
|
||||||
|
fullpath = filepath.Join(homeDir, "go/src/go.wit.com/toolkits/gocui/")
|
||||||
|
quickCmd(fullpath, []string{"go", "get", "-v", "-u", "."})
|
||||||
|
quickCmd(fullpath, []string{"go", "build", "-v", "-x", "-buildmode=plugin", "-o", "../gocui.so"})
|
||||||
|
|
||||||
|
fullpath = filepath.Join(homeDir, "go/src/go.wit.com/toolkits/andlabs/")
|
||||||
|
quickCmd(fullpath, []string{"go", "get", "-v", "-u", "."})
|
||||||
|
quickCmd(fullpath, []string{"go", "build", "-v", "-x", "-buildmode=plugin", "-o", "../andlabs.so"})
|
||||||
|
|
||||||
|
fullpath = filepath.Join(homeDir, "go/src/go.wit.com/apps/autotypist")
|
||||||
|
quickCmd(fullpath, []string{"go", "get", "-v", "-u", "."})
|
||||||
|
quickCmd(fullpath, []string{"go", "build", "-v", "-x"})
|
||||||
|
}
|
||||||
|
|
|
@ -1,68 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
"go.wit.com/lib/gui/repostatus"
|
|
||||||
|
|
||||||
"go.wit.com/gui"
|
|
||||||
)
|
|
||||||
|
|
||||||
// things being testing
|
|
||||||
func globalTestingOptions(box *gui.Node) {
|
|
||||||
test1 := box.NewGroup("testing build")
|
|
||||||
me.autoRebuildButton = test1.NewButton("rebuild autotypist", func() {
|
|
||||||
me.autoRebuildButton.Disable()
|
|
||||||
me.autoRebuildButton.SetLabel("running....")
|
|
||||||
attemptAutoRebuild()
|
|
||||||
me.autoRebuildButton.Enable()
|
|
||||||
me.autoRebuildButton.SetLabel("rebuild autotypist")
|
|
||||||
})
|
|
||||||
|
|
||||||
var listallB *gui.Node
|
|
||||||
listallB = test1.NewButton("go.wit.com/list", func() {
|
|
||||||
listallB.Disable()
|
|
||||||
listWindow()
|
|
||||||
listallB.Enable()
|
|
||||||
})
|
|
||||||
test1.NewButton("repostatus.ListAll()", func() {
|
|
||||||
repostatus.ListAll()
|
|
||||||
})
|
|
||||||
test1.NewButton("repostatus.ScanGoSrc()", func() {
|
|
||||||
repostatus.ScanGoSrc()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func attemptAutoRebuild() {
|
|
||||||
os.Setenv("GO111MODULE", "off")
|
|
||||||
|
|
||||||
homeDir := me.userHomePwd.String()
|
|
||||||
fullpath := filepath.Join(homeDir, "go")
|
|
||||||
quickCmd(fullpath, []string{"mkdir", "-p", "src/go.wit.com/apps/"})
|
|
||||||
|
|
||||||
fullpath = filepath.Join(homeDir, "go/src/go.wit.com/apps/")
|
|
||||||
|
|
||||||
quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/apps/autotypist"})
|
|
||||||
quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/toolkits/debian"})
|
|
||||||
quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/toolkits/tree"})
|
|
||||||
quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/toolkits/nocui"})
|
|
||||||
quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/toolkits/gocui"})
|
|
||||||
quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/toolkits/andlabs"})
|
|
||||||
|
|
||||||
fullpath = filepath.Join(homeDir, "go/src/go.wit.com/toolkits/nocui/")
|
|
||||||
quickCmd(fullpath, []string{"go", "get", "-v", "-u", "."})
|
|
||||||
quickCmd(fullpath, []string{"go", "build", "-v", "-x", "-buildmode=plugin", "-o", "../nocui.so"})
|
|
||||||
|
|
||||||
fullpath = filepath.Join(homeDir, "go/src/go.wit.com/toolkits/gocui/")
|
|
||||||
quickCmd(fullpath, []string{"go", "get", "-v", "-u", "."})
|
|
||||||
quickCmd(fullpath, []string{"go", "build", "-v", "-x", "-buildmode=plugin", "-o", "../gocui.so"})
|
|
||||||
|
|
||||||
fullpath = filepath.Join(homeDir, "go/src/go.wit.com/toolkits/andlabs/")
|
|
||||||
quickCmd(fullpath, []string{"go", "get", "-v", "-u", "."})
|
|
||||||
quickCmd(fullpath, []string{"go", "build", "-v", "-x", "-buildmode=plugin", "-o", "../andlabs.so"})
|
|
||||||
|
|
||||||
fullpath = filepath.Join(homeDir, "go/src/go.wit.com/apps/autotypist")
|
|
||||||
quickCmd(fullpath, []string{"go", "get", "-v", "-u", "."})
|
|
||||||
quickCmd(fullpath, []string{"go", "build", "-v", "-x"})
|
|
||||||
}
|
|
3
main.go
3
main.go
|
@ -56,8 +56,10 @@ func main() {
|
||||||
repo.newScan()
|
repo.newScan()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
/*
|
||||||
s := fmt.Sprint(duration)
|
s := fmt.Sprint(duration)
|
||||||
me.autoWorkingPwd.SetText(s)
|
me.autoWorkingPwd.SetText(s)
|
||||||
|
*/
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +69,6 @@ func autotypistWindow() {
|
||||||
|
|
||||||
globalDisplayOptions(box)
|
globalDisplayOptions(box)
|
||||||
globalBuildOptions(box)
|
globalBuildOptions(box)
|
||||||
globalTestingOptions(box)
|
|
||||||
globalResetOptions(box)
|
globalResetOptions(box)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
471
releaseWindow.go
471
releaseWindow.go
|
@ -1,471 +0,0 @@
|
||||||
// This is a simple example
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"os"
|
|
||||||
"sort"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"go.wit.com/gui"
|
|
||||||
"go.wit.com/log"
|
|
||||||
|
|
||||||
"go.wit.com/lib/gadgets"
|
|
||||||
"go.wit.com/lib/gui/repostatus"
|
|
||||||
)
|
|
||||||
|
|
||||||
var release releaseStruct
|
|
||||||
|
|
||||||
type releaseStruct struct {
|
|
||||||
current *repo
|
|
||||||
|
|
||||||
win *gadgets.BasicWindow
|
|
||||||
box *gui.Node
|
|
||||||
group *gui.Node
|
|
||||||
grid *gui.Node
|
|
||||||
repo *gadgets.OneLiner
|
|
||||||
status *gadgets.OneLiner
|
|
||||||
readOnly *gadgets.OneLiner
|
|
||||||
notes *gadgets.OneLiner
|
|
||||||
version *gadgets.OneLiner
|
|
||||||
reason *gadgets.BasicEntry
|
|
||||||
|
|
||||||
openrepo *gui.Node
|
|
||||||
|
|
||||||
goGetB *gui.Node
|
|
||||||
checkGoSumB *gui.Node
|
|
||||||
checkDirtyB *gui.Node
|
|
||||||
makeRedomodB *gui.Node
|
|
||||||
sendVersionB *gui.Node
|
|
||||||
checkSafeB *gui.Node
|
|
||||||
}
|
|
||||||
|
|
||||||
func createReleaseWindow() {
|
|
||||||
if release.win != nil {
|
|
||||||
release.win.Toggle()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
versionS := "0.14.0"
|
|
||||||
reasonS := "gocui"
|
|
||||||
partS := strings.Split(versionS, ".")
|
|
||||||
|
|
||||||
release.win = gadgets.NewBasicWindow(me.myGui, "Make a new release")
|
|
||||||
release.win.Custom = func() {
|
|
||||||
log.Info("Release Window close")
|
|
||||||
}
|
|
||||||
|
|
||||||
release.win.Make()
|
|
||||||
release.win.StandardClose()
|
|
||||||
release.win.Draw()
|
|
||||||
release.box = release.win.Box()
|
|
||||||
release.group = release.box.NewGroup("things")
|
|
||||||
release.grid = release.group.NewGrid("buildOptions", 2, 1)
|
|
||||||
|
|
||||||
// do an initial scan of all the repos
|
|
||||||
scanGoSum()
|
|
||||||
|
|
||||||
release.grid.NewButton("findNextDirty()", func() {
|
|
||||||
release.win.Disable()
|
|
||||||
if findNextDirty() {
|
|
||||||
log.Info("findNextDirty() found a repo")
|
|
||||||
release.win.Enable()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
release.win.Enable()
|
|
||||||
})
|
|
||||||
release.grid.NewButton("nil", func() {
|
|
||||||
log.Info("just filling the grid")
|
|
||||||
})
|
|
||||||
release.grid.NewButton("next repo", func() {
|
|
||||||
buttonDisable()
|
|
||||||
defer buttonEnable()
|
|
||||||
|
|
||||||
// allrepos map[string]*repo
|
|
||||||
|
|
||||||
keys := make([]string, 0, len(me.allrepos))
|
|
||||||
for key := range me.allrepos {
|
|
||||||
keys = append(keys, key)
|
|
||||||
}
|
|
||||||
sort.Strings(keys)
|
|
||||||
|
|
||||||
for _, path := range keys {
|
|
||||||
repo := me.allrepos[path]
|
|
||||||
// mt.Printf("%s: %s\n", key, myMap[key])
|
|
||||||
|
|
||||||
//// for _, repo := range me.allrepos {
|
|
||||||
// goSumS := repo.getGoSumStatus()
|
|
||||||
// dirtyS := repo.dirtyLabel.String()
|
|
||||||
|
|
||||||
if repo.status.ReadOnly() {
|
|
||||||
log.Info("skipping repo:", path, repo.String())
|
|
||||||
} else {
|
|
||||||
log.Info("searching on repo:", path, repo.String())
|
|
||||||
tmp := repo.status.GetGoDeps()
|
|
||||||
for path, version := range tmp {
|
|
||||||
r, ok := me.allrepos[path]
|
|
||||||
if ok {
|
|
||||||
log.Info("\tfound path", path, r, version)
|
|
||||||
} else {
|
|
||||||
log.Info("\tdid not find path", path, r, version)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
if findNextRepo() {
|
|
||||||
log.Info("findNextRepo() found a repo")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if findDirty2() {
|
|
||||||
log.Info("findDirty2() found a repo")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
release.openrepo = release.grid.NewButton("open repo", func() {
|
|
||||||
if release.current == nil {
|
|
||||||
log.Info("find the next repo first")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// make sure read only is set
|
|
||||||
if release.current.status.ReadOnly() {
|
|
||||||
release.readOnly.SetValue("true")
|
|
||||||
} else {
|
|
||||||
release.readOnly.SetValue("false")
|
|
||||||
}
|
|
||||||
|
|
||||||
// do a new scan
|
|
||||||
release.current.newScan()
|
|
||||||
|
|
||||||
// only continue if the go.sum & go.mod files are clean
|
|
||||||
if ok, missing := release.current.status.CheckGoSum(); ok {
|
|
||||||
log.Info("repo has go.sum requirements that are clean")
|
|
||||||
release.status.SetValue("CLEAN")
|
|
||||||
release.current.setGoSumStatus("CLEAN")
|
|
||||||
} else {
|
|
||||||
log.Info("BAD repo has go.sum requirements that are screwed up. missing:", missing)
|
|
||||||
release.status.SetValue("BAD")
|
|
||||||
release.current.setGoSumStatus("BAD")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if release.current.dirtyLabel.String() == "PERFECT" {
|
|
||||||
log.Info("REPO IS STILL DIRTY")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// open the status window to commit the release
|
|
||||||
release.current.status.Toggle()
|
|
||||||
release.current.status.SetVersion(partS[0], partS[1], partS[2], release.reason.String())
|
|
||||||
release.current.status.Update()
|
|
||||||
})
|
|
||||||
release.openrepo.Disable()
|
|
||||||
|
|
||||||
release.repo = gadgets.NewOneLiner(release.grid, "repo")
|
|
||||||
release.status = gadgets.NewOneLiner(release.grid, "status")
|
|
||||||
release.readOnly = gadgets.NewOneLiner(release.grid, "read-only")
|
|
||||||
release.notes = gadgets.NewOneLiner(release.grid, "notes")
|
|
||||||
|
|
||||||
release.version = gadgets.NewOneLiner(release.grid, "version")
|
|
||||||
release.version.SetText(versionS)
|
|
||||||
|
|
||||||
release.reason = gadgets.NewBasicEntry(release.grid, "release reason")
|
|
||||||
release.reason.SetText(reasonS)
|
|
||||||
|
|
||||||
release.sendVersionB = release.grid.NewButton("send version", func() {
|
|
||||||
log.Info("set version()")
|
|
||||||
release.current.status.SetVersion(partS[0], partS[1], partS[2], release.reason.String())
|
|
||||||
})
|
|
||||||
release.grid.NewButton("set ignore", func() {
|
|
||||||
tmp := release.current.getGoSumStatus()
|
|
||||||
log.Info("trying to set repo IGNORE is now =", tmp)
|
|
||||||
release.current.setGoSumStatus("IGNORE")
|
|
||||||
})
|
|
||||||
release.checkDirtyB = release.grid.NewButton("checkDirty()", func() {
|
|
||||||
buttonDisable()
|
|
||||||
if release.current.checkDirty() {
|
|
||||||
log.Info("repo is dirty")
|
|
||||||
} else {
|
|
||||||
log.Info("repo is not dirty")
|
|
||||||
}
|
|
||||||
buttonEnable()
|
|
||||||
})
|
|
||||||
release.checkSafeB = release.grid.NewButton("checkSafeGoSumRemake()", func() {
|
|
||||||
buttonDisable()
|
|
||||||
release.current.checkSafeGoSumRemake()
|
|
||||||
buttonEnable()
|
|
||||||
})
|
|
||||||
release.checkGoSumB = release.grid.NewButton("CheckGoSum()", func() {
|
|
||||||
buttonDisable()
|
|
||||||
tmp := release.current.String()
|
|
||||||
log.Info("Run CheckGoSum on repo:", tmp)
|
|
||||||
if ok, missing := release.current.status.CheckGoSum(); ok {
|
|
||||||
log.Info("repo has go.sum requirements that are clean")
|
|
||||||
release.current.setGoSumStatus("CLEAN")
|
|
||||||
} else {
|
|
||||||
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")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
buttonEnable()
|
|
||||||
})
|
|
||||||
release.grid.NewButton("CheckPrimativeGoMod()", func() {
|
|
||||||
tmp := release.current.String()
|
|
||||||
log.Info("Run CheckGoSum on repo:", tmp)
|
|
||||||
if release.current.status.CheckPrimativeGoMod() {
|
|
||||||
log.Info("repo has PRIMATIVE go.mod")
|
|
||||||
} else {
|
|
||||||
log.Info("repo go.mod requies checking for a go.sum")
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
release.grid.NewButton("reset with scanGoSum()", func() {
|
|
||||||
buttonDisable()
|
|
||||||
// do an initial scan of all the repos
|
|
||||||
scanGoSum()
|
|
||||||
buttonEnable()
|
|
||||||
})
|
|
||||||
release.makeRedomodB = release.grid.NewButton("make redomod", func() {
|
|
||||||
buttonDisable()
|
|
||||||
release.current.status.MakeRedomod()
|
|
||||||
buttonEnable()
|
|
||||||
})
|
|
||||||
release.goGetB = release.grid.NewButton("go get -v -u .", func() {
|
|
||||||
buttonDisable()
|
|
||||||
err, output := release.current.status.RunCmd([]string{"go", "get", "-v", "-u", "."})
|
|
||||||
log.Warn(output)
|
|
||||||
if err == nil {
|
|
||||||
log.Warn("go get worked. recheck go.sum")
|
|
||||||
} else {
|
|
||||||
log.Warn("go get failed")
|
|
||||||
}
|
|
||||||
buttonEnable()
|
|
||||||
})
|
|
||||||
release.goGetB = release.grid.NewButton("SetMainWorkingName(guimaster)", func() {
|
|
||||||
buttonDisable()
|
|
||||||
release.current.status.SetMainWorkingName("guimaster")
|
|
||||||
buttonEnable()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func buttonDisable() {
|
|
||||||
release.win.Disable()
|
|
||||||
/*
|
|
||||||
release.nextRepoB.Disable()
|
|
||||||
release.openRepoB.Disable()
|
|
||||||
release.goGetB.Disable()
|
|
||||||
release.makeRedomodB.Disable()
|
|
||||||
release.checkGoSumB.Disable()
|
|
||||||
release.openrepo.Disable()
|
|
||||||
release.checkDirtyB.Disable()
|
|
||||||
release.sendVersionB.Disable()
|
|
||||||
release.checkSafeB.Disable()
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
func buttonEnable() {
|
|
||||||
release.win.Enable()
|
|
||||||
/*
|
|
||||||
release.nextRepoB.Enable()
|
|
||||||
release.openRepoB.Enable()
|
|
||||||
release.goGetB.Enable()
|
|
||||||
release.makeRedomodB.Enable()
|
|
||||||
release.checkGoSumB.Enable()
|
|
||||||
release.openrepo.Enable()
|
|
||||||
release.checkDirtyB.Enable()
|
|
||||||
release.sendVersionB.Enable()
|
|
||||||
release.checkSafeB.Enable()
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
func findDirty2() bool {
|
|
||||||
log.Info("findDirty2() START")
|
|
||||||
for _, repo := range me.allrepos {
|
|
||||||
goSumS := repo.getGoSumStatus()
|
|
||||||
dirtyS := repo.dirtyLabel.String()
|
|
||||||
|
|
||||||
if goSumS == "IGNORE" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if goSumS == "DIRTY 2" {
|
|
||||||
log.Info("repo DIRTY 2", repo.String(), goSumS, dirtyS)
|
|
||||||
if setCurrentRepo(repo, "dirty 2", "check manually I guess") {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
} else {
|
|
||||||
log.Info("repo not DIRTY 2", repo.String(), goSumS, dirtyS)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log.Info("findDirty2() END")
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func setCurrentRepo(newcur *repo, s string, note string) bool {
|
|
||||||
if newcur.status.ReadOnly() {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
release.repo.SetValue(newcur.status.String())
|
|
||||||
release.status.SetValue(s)
|
|
||||||
release.notes.SetValue(note)
|
|
||||||
release.current = newcur
|
|
||||||
release.openrepo.Enable()
|
|
||||||
|
|
||||||
if newcur.status.ReadOnly() {
|
|
||||||
release.readOnly.SetValue("true ro")
|
|
||||||
} else {
|
|
||||||
release.readOnly.SetValue("false ro")
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
func findNextDirty() bool {
|
|
||||||
for _, repo := range me.allrepos {
|
|
||||||
goSumS := repo.getGoSumStatus()
|
|
||||||
dirtyS := repo.dirtyLabel.String()
|
|
||||||
|
|
||||||
log.Info("findNextDirty()", repo.String(), goSumS, dirtyS)
|
|
||||||
if goSumS == "PRIMATIVE" {
|
|
||||||
if dirtyS != "PERFECT" {
|
|
||||||
if setCurrentRepo(repo, "primative not committed", "release new version") {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if goSumS == "IGNORE" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if goSumS == "DIRTY 2" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if goSumS == "BAD DEP" {
|
|
||||||
// find out what kind of BAD DEP?
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
// latestversion := repo.status.GetLastTagVersion()
|
|
||||||
if goSumS == "CLEAN" {
|
|
||||||
// if it's clean here, then check and remake the go.sum file
|
|
||||||
// then stop to commit the release version
|
|
||||||
repo.checkSafeGoSumRemake()
|
|
||||||
if repo.checkDirty() {
|
|
||||||
dirtyS = repo.dirtyLabel.String()
|
|
||||||
}
|
|
||||||
if dirtyS == "PERFECT" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if setCurrentRepo(repo, "clean", "check manually") {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if goSumS == "DIRTY" {
|
|
||||||
if ok, missing := repo.status.CheckGoSum(); ok {
|
|
||||||
log.Info("repo has go.sum requirements that are clean")
|
|
||||||
// repo.setGoSumStatus("CLEAN")
|
|
||||||
} else {
|
|
||||||
log.Info("DIRTY 2 repo has go.sum requirements that are screwed up. missing:", missing)
|
|
||||||
repo.setGoSumStatus("DIRTY 2")
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if setCurrentRepo(repo, "dirty", "commit changes") {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log.Info("tried to findNextDirty() but not sure what to do next")
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func findNextRepo() bool {
|
|
||||||
for _, repo := range me.allrepos {
|
|
||||||
goSumS := repo.getGoSumStatus()
|
|
||||||
dirtyS := repo.dirtyLabel.String()
|
|
||||||
|
|
||||||
log.Info("findNextRepo()", repo.String(), goSumS, dirtyS)
|
|
||||||
if goSumS == "IGNORE" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if goSumS == "DIRTY 2" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if goSumS == "BAD VERSION" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if goSumS == "BAD DEP" {
|
|
||||||
// find out what kind of BAD DEP?
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
// latestversion := repo.status.GetLastTagVersion()
|
|
||||||
if goSumS == "CLEAN" {
|
|
||||||
// if it's clean here, then check and remake the go.sum file
|
|
||||||
// then stop to commit the release version
|
|
||||||
repo.checkSafeGoSumRemake()
|
|
||||||
if repo.checkDirty() {
|
|
||||||
dirtyS = repo.dirtyLabel.String()
|
|
||||||
}
|
|
||||||
if dirtyS == "PERFECT" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if setCurrentRepo(repo, "clean round 2", "check manually") {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if goSumS == "DIRTY" {
|
|
||||||
if ok, missing := repo.status.CheckGoSum(); ok {
|
|
||||||
log.Info("repo has go.sum requirements that are clean")
|
|
||||||
// repo.setGoSumStatus("CLEAN")
|
|
||||||
} else {
|
|
||||||
log.Info("DIRTY 3 repo has go.sum requirements that are screwed up. missing:", missing)
|
|
||||||
repo.setGoSumStatus("DIRTY 3")
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if setCurrentRepo(repo, "dirty", "commit changes") {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if goSumS == "BAD" {
|
|
||||||
// if it's clean here, then check and remake the go.sum file
|
|
||||||
// then stop to commit the release version
|
|
||||||
repo.checkSafeGoSumRemake()
|
|
||||||
if repo.checkDirty() {
|
|
||||||
dirtyS = repo.dirtyLabel.String()
|
|
||||||
}
|
|
||||||
if setCurrentRepo(repo, "bad", "redo go.sum") {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log.Info("tried to findNextRepo() but not sure what to do next")
|
|
||||||
return false
|
|
||||||
}
|
|
47
repolist.go
47
repolist.go
|
@ -152,6 +152,8 @@ func repolistWindow() {
|
||||||
log.Warn("Should I do something special here?")
|
log.Warn("Should I do something special here?")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
repoAllButtons(reposbox)
|
||||||
|
|
||||||
reposgroup = reposbox.NewGroup("go repositories (read from ~/.config/myrepolist)")
|
reposgroup = reposbox.NewGroup("go repositories (read from ~/.config/myrepolist)")
|
||||||
reposgrid = reposgroup.NewGrid("test", 9, 1)
|
reposgrid = reposgroup.NewGrid("test", 9, 1)
|
||||||
|
|
||||||
|
@ -190,15 +192,23 @@ func repolistWindow() {
|
||||||
|
|
||||||
// TODO: figure out why this borks everything
|
// TODO: figure out why this borks everything
|
||||||
/*
|
/*
|
||||||
for i, path := range repostatus.ListGitDirectories() {
|
for i, path := range repostatus.ListGitDirectories() {
|
||||||
// log.Info("addRepo()", i, path)
|
// log.Info("addRepo()", i, path)
|
||||||
tmp := strings.TrimPrefix(path, me.goSrcPwd.String())
|
tmp := strings.TrimPrefix(path, me.goSrcPwd.String())
|
||||||
log.Info("addRepo()", i, tmp)
|
log.Info("addRepo()", i, tmp)
|
||||||
addRepo(reposgrid, tmp, "guimaster", "guidevel", usr.Username)
|
addRepo(reposgrid, tmp, "guimaster", "guidevel", usr.Username)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
reposgroup.NewButton("merge all user to devel", func() {
|
reposwin.Toggle()
|
||||||
|
}
|
||||||
|
|
||||||
|
func repoAllButtons(box *gui.Node) {
|
||||||
|
// reposbox.SetExpand(false)
|
||||||
|
group1 := box.NewGroup("Run on all repos:")
|
||||||
|
grid1 := group1.NewGrid("test", 6, 1)
|
||||||
|
|
||||||
|
grid1.NewButton("merge all user to devel", func() {
|
||||||
reposwin.Disable()
|
reposwin.Disable()
|
||||||
log.Info("merge all here")
|
log.Info("merge all here")
|
||||||
for _, repo := range me.allrepos {
|
for _, repo := range me.allrepos {
|
||||||
|
@ -229,7 +239,7 @@ func repolistWindow() {
|
||||||
reposwin.Enable()
|
reposwin.Enable()
|
||||||
})
|
})
|
||||||
|
|
||||||
reposgroup.NewButton("merge all devel to main", func() {
|
grid1.NewButton("merge all devel to main", func() {
|
||||||
reposwin.Disable()
|
reposwin.Disable()
|
||||||
log.Info("merge all here")
|
log.Info("merge all here")
|
||||||
for _, repo := range me.allrepos {
|
for _, repo := range me.allrepos {
|
||||||
|
@ -260,5 +270,24 @@ func repolistWindow() {
|
||||||
reposwin.Enable()
|
reposwin.Enable()
|
||||||
})
|
})
|
||||||
|
|
||||||
reposwin.Toggle()
|
grid1.NewButton("status.Update() all", func() {
|
||||||
|
for _, repo := range me.allrepos {
|
||||||
|
repo.status.Update()
|
||||||
|
repo.newScan()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
grid1.NewButton("rescan all", func() {
|
||||||
|
for _, repo := range me.allrepos {
|
||||||
|
repo.newScan()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
grid1.NewButton("repostatus.ListAll()", func() {
|
||||||
|
repostatus.ListAll()
|
||||||
|
})
|
||||||
|
|
||||||
|
grid1.NewButton("repostatus.ScanGoSrc()", func() {
|
||||||
|
repostatus.ScanGoSrc()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ type autoType struct {
|
||||||
scanEveryMinute *gui.Node
|
scanEveryMinute *gui.Node
|
||||||
|
|
||||||
// The current working directory
|
// The current working directory
|
||||||
autoWorkingPwd *gadgets.OneLiner
|
// autoWorkingPwd *gadgets.OneLiner
|
||||||
|
|
||||||
// what is being used as your home dir
|
// what is being used as your home dir
|
||||||
userHomePwd *gadgets.OneLiner
|
userHomePwd *gadgets.OneLiner
|
||||||
|
|
Loading…
Reference in New Issue