ready for another attempt at an auto-rebuild

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-18 16:21:43 -06:00
parent a1aa87c78a
commit 1928ac7e7c
6 changed files with 54 additions and 16 deletions

View File

@ -21,13 +21,26 @@ func doesExist(path string) bool {
return true
}
var quickCmds [][]string
var quickCmdLastPath string
var quickCmdDoNotRun bool = false
// only errors on bad errors
func quickCmd(fullpath string, cmd []string) bool {
var err error
var b bool
var output string
if quickCmdLastPath != fullpath {
quickCmds = append(quickCmds, []string{"cd", fullpath})
quickCmdLastPath = fullpath
}
quickCmds = append(quickCmds, cmd)
log.Warn("RUN:", fullpath, cmd)
if quickCmdDoNotRun {
return false
}
err, b, output = repostatus.RunCmd(fullpath, cmd)
if err != nil {
log.Error(err)
@ -74,7 +87,22 @@ func globalBuildOptions(box *gui.Node) {
me.mainBranch.Disable()
}
groupvbox.NewButton("git status", func() {
quickCmdDoNotRun = false
quickCmdLastPath = "~/go/src"
quickCmds = [][]string{}
log.Warn("scanning allrepos")
for _, path := range me.allrepos {
fullpath := "/home/jcarr/go/src/" + path
quickCmd(fullpath, []string{"git", "status"})
}
})
groupvbox.NewButton("rebuild autotypist", func() {
quickCmdDoNotRun = true
quickCmdLastPath = "~/go/src"
quickCmds = [][]string{}
log.Warn("scanning allrepos")
fullpath := "/home/jcarr/go/src"
quickCmd(fullpath, []string{"mkdir", "-p", "go.wit.com/apps/"})
@ -87,10 +115,15 @@ func globalBuildOptions(box *gui.Node) {
fullpath = "/home/jcarr/go/src/go.wit.com/apps/autotypist"
quickCmd(fullpath, []string{"go", "-v", "-x", "build"})
me.script = quickCmds
setGitCommands()
})
me.rerunGoMod = groupvbox.NewButton("re-run go mod & go tidy", func() {
me.rerunGoMod.Disable()
quickCmdDoNotRun = true
quickCmdLastPath = "~/go/src"
quickCmds = [][]string{}
log.Warn("scanning allrepos")
os.Unsetenv("GO111MODULE")
for _, path := range me.allrepos {
@ -104,13 +137,25 @@ func globalBuildOptions(box *gui.Node) {
quickCmd(fullpath, []string{"rm", "go.mod", "go.sum"})
quickCmd(fullpath, []string{"go", "mod", "init"})
log.Sleep(.1) // don't hammer google's golang versioning system
// don't hammer google's golang versioning system
if quickCmdDoNotRun {
quickCmd(fullpath, []string{"sleep", ".2"})
} else {
log.Sleep(.2)
}
quickCmd(fullpath, []string{"go", "mod", "tidy"})
log.Sleep(.2) // don't hammer google's golang versioning system
// don't hammer google's golang versioning system
if quickCmdDoNotRun {
quickCmd(fullpath, []string{"sleep", ".1"})
} else {
log.Sleep(.1)
}
quickCmd(fullpath, []string{"git", "status"}) // TODO: process this?
}
// re-enable the button
me.rerunGoMod.SetText("re-run go mod & go tidy")
me.script = quickCmds
setGitCommands()
me.rerunGoMod.Enable()
})
setCurrentBranch = groupvbox.NewButton("set all branches to", func() {
@ -118,9 +163,6 @@ func globalBuildOptions(box *gui.Node) {
for repo, path := range me.allrepos {
log.Warn("found repo", repo.String())
var changeBranch [][]string
// realname, realversion := repo.status.CheckoutBranch(me.toMoveToBranch)
// log.Warn("GOT", realname, realversion)
// path := repo.status.GetPath()
changeBranch = append(changeBranch, []string{"cd", "go/src/" + path})
changeBranch = append(changeBranch, []string{"git", "checkout", me.toMoveToBranch})
me.script = changeBranch

View File

@ -14,7 +14,8 @@ func globalDisplayOptions(box *gui.Node) {
// grouphbox := groupvbox.NewBox("bw hbox", true)
groupvbox.NewButton("Show Repository Window", func() {
reposwin.Draw()
repoworld()
// reposwin.Draw()
})
me.autoHidePerfect = groupvbox.NewCheckbox("Hide repos")
me.autoHidePerfect.Custom = func() {
@ -60,9 +61,6 @@ func globalDisplayOptions(box *gui.Node) {
repo.newScan()
}
})
groupvbox.NewButton("repoworld()", func() {
repoworld()
})
}
func hidePerfect() {

View File

@ -73,8 +73,8 @@ func globalResetOptions(box *gui.Node) {
buildOptions.NewSeparator("endStatusScans")
buildOptions.NewSeparator("endStatusScans")
buildOptions.NewLabel("cmd")
cmds = buildOptions.NewLabel("ls")
// buildOptions.NewLabel("cmd")
cmds = group2.NewTextbox("ls")
buildOptions.NewLabel("--dry-run")
dryrun = buildOptions.NewButton("show commands", func() {

2
go.mod
View File

@ -5,7 +5,7 @@ go 1.21.4
require (
go.wit.com/gui v0.12.16
go.wit.com/lib/gadgets v0.12.9
go.wit.com/lib/gui/repostatus v0.12.12
go.wit.com/lib/gui/repostatus v0.12.13
go.wit.com/log v0.5.5
)

4
go.sum
View File

@ -8,8 +8,8 @@ go.wit.com/gui v0.12.16 h1:GBiPiDyzkGCxwNegehHiONmNppaqyFZv7iteLUHJ/Po=
go.wit.com/gui v0.12.16/go.mod h1:27+THr2a84GZ61KKUuN30WYnYoSsBewllUKc+fnWLto=
go.wit.com/lib/gadgets v0.12.9 h1:yayXQDiAENfMElRMeh7Yab1f6HNkiy5Aw6KNP5Wd1DI=
go.wit.com/lib/gadgets v0.12.9/go.mod h1:Hb/vSiW22hPJjTVA1mShQ6HuqQ7dHGB95WLEfZlPO3M=
go.wit.com/lib/gui/repostatus v0.12.12 h1:l4mCK/M/QAOuFu+q6F/qVxKtt/+gxLPqTSMdJby+jAY=
go.wit.com/lib/gui/repostatus v0.12.12/go.mod h1:GqLGG3lxcnKQhmVwqE+G5uQoRwN+KdErPCWOHGABrEw=
go.wit.com/lib/gui/repostatus v0.12.13 h1:kumPC2wEYjAk+mCQzjrNfcr40CY0qaXva4EjfW0kExk=
go.wit.com/lib/gui/repostatus v0.12.13/go.mod h1:QxWg6Ml68eiz7mhrX+pF0oXHtixpzllaEi1XDP/VaH4=
go.wit.com/log v0.5.5 h1:bK3b94uVKgev4jB5wg06FnvCFBEapQICTSH2YW+CWr4=
go.wit.com/log v0.5.5/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
go.wit.com/widget v1.1.5 h1:jx5hJ2WLZJnCcvMuaLHegzpNlzwo+0kOkzsRkzRiB30=

View File

@ -1,8 +1,6 @@
package main
import (
"errors"
"os/exec"
"strings"
"go.wit.com/lib/gui/repostatus"