parent
417f5be49b
commit
df8d238f2f
|
@ -8,6 +8,23 @@ import (
|
|||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
func ReCheckReady() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
/*
|
||||
- // 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]
|
||||
*/
|
||||
|
||||
func CheckReady() bool {
|
||||
if release.current == nil {
|
||||
log.Info("find the next repo first")
|
||||
|
@ -16,11 +33,22 @@ func CheckReady() bool {
|
|||
goSumS := release.current.getGoSumStatus()
|
||||
dirtyS := release.current.dirtyLabel.String()
|
||||
lastS := release.current.status.GetLastTagVersion()
|
||||
log.Info("repo:", release.current.String(), goSumS, dirtyS, lastS)
|
||||
currentS := release.current.status.GetCurrentBranchVersion()
|
||||
log.Info("repo:", release.current.String(), goSumS, dirtyS, lastS, currentS)
|
||||
|
||||
if goSumS == "READY" {
|
||||
if goSumS == "PRIMATIVE" {
|
||||
return true
|
||||
}
|
||||
if goSumS == "READY" {
|
||||
if release.versionS == lastS {
|
||||
release.current.setGoSumStatus("RELEASED")
|
||||
}
|
||||
if lastS == currentS {
|
||||
release.current.setGoSumStatus("DONE")
|
||||
}
|
||||
return true
|
||||
}
|
||||
release.current.setGoSumStatus("NOT READY")
|
||||
if release.current.status.ReadOnly() {
|
||||
log.Info("\trepo is read only")
|
||||
return false
|
||||
|
@ -28,7 +56,13 @@ func CheckReady() bool {
|
|||
|
||||
if release.versionS == lastS {
|
||||
log.Info("\trepo is already done", lastS, "=", release.versionS)
|
||||
return false
|
||||
release.current.setGoSumStatus("READY")
|
||||
return true
|
||||
}
|
||||
if lastS == currentS {
|
||||
log.Info("\trepo is already done", lastS, "=", release.versionS)
|
||||
release.current.setGoSumStatus("READY")
|
||||
return true
|
||||
}
|
||||
|
||||
if goSumS == "BAD" {
|
||||
|
@ -82,6 +116,7 @@ func CheckReady() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
release.current.setGoSumStatus("READY")
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
160
releaseWindow.go
160
releaseWindow.go
|
@ -4,14 +4,12 @@ package main
|
|||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/log"
|
||||
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/lib/gui/repostatus"
|
||||
)
|
||||
|
||||
var release releaseStruct
|
||||
|
@ -44,11 +42,15 @@ type releaseStruct struct {
|
|||
}
|
||||
|
||||
func (w *autoType) Disable() {
|
||||
w.mainWindow.Disable()
|
||||
// w.mainWindow.Disable()
|
||||
release.box.Disable()
|
||||
// buttonDisable()
|
||||
}
|
||||
|
||||
func (w *autoType) Enable() {
|
||||
w.mainWindow.Enable()
|
||||
// w.mainWindow.Enable()
|
||||
release.box.Enable()
|
||||
// buttonEnable()
|
||||
}
|
||||
|
||||
func createReleaseBox(box *gui.Node) {
|
||||
|
@ -79,50 +81,30 @@ func createReleaseBox(box *gui.Node) {
|
|||
}
|
||||
me.Enable()
|
||||
})
|
||||
release.grid.NewButton("next repo", func() {
|
||||
release.grid.NewButton("release version "+release.versionS, 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")
|
||||
if release.current.status.CheckDirty() {
|
||||
log.Info("sorry, it's still dirty")
|
||||
return
|
||||
}
|
||||
if findDirty2() {
|
||||
log.Info("findDirty2() found a repo")
|
||||
|
||||
curName := release.current.status.GetCurrentBranchName()
|
||||
mName := release.current.status.GetMasterBranchName()
|
||||
if curName != mName {
|
||||
log.Info("\trepo is not working from main branch", curName, "!=", mName)
|
||||
return
|
||||
}
|
||||
|
||||
log.Info("\ttag and push", curName, release.versionS, release.reasonS)
|
||||
|
||||
release.current.status.RunCmd([]string{"git", "add", "-f", "go.mod"})
|
||||
release.current.status.RunCmd([]string{"git", "add", "-f", "go.sum"})
|
||||
release.current.status.RunCmd([]string{"git", "commit", "-m", release.reasonS})
|
||||
release.current.status.RunCmd([]string{"git", "push"})
|
||||
release.current.status.RunCmd([]string{"git", "tag", "-m", release.reasonS, "v" + release.versionS})
|
||||
release.current.status.RunCmd([]string{"git", "push", "origin", "v" + release.versionS})
|
||||
})
|
||||
|
||||
release.openrepo = release.grid.NewButton("open repo", func() {
|
||||
|
@ -189,6 +171,8 @@ func createReleaseBox(box *gui.Node) {
|
|||
me.goSrcPwd.SetText(srcDir)
|
||||
|
||||
release.grid.NewButton("Check Ready", func() {
|
||||
buttonDisable()
|
||||
defer buttonEnable()
|
||||
goSumS := release.current.getGoSumStatus()
|
||||
dirtyS := release.current.dirtyLabel.String()
|
||||
lastS := release.current.status.GetLastTagVersion()
|
||||
|
@ -201,10 +185,10 @@ func createReleaseBox(box *gui.Node) {
|
|||
})
|
||||
|
||||
/*
|
||||
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.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() {
|
||||
|
@ -215,15 +199,15 @@ func createReleaseBox(box *gui.Node) {
|
|||
})
|
||||
|
||||
/*
|
||||
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.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() {
|
||||
|
@ -235,44 +219,44 @@ func createReleaseBox(box *gui.Node) {
|
|||
buttonDisable()
|
||||
tmp := release.current.String()
|
||||
log.Info("Run CheckGoSum on repo:", tmp)
|
||||
if ok, missing := release.current.status.CheckGoSum(); ok {
|
||||
if ok, _ := release.current.status.CheckGoSum(); ok {
|
||||
log.Info("repo has go.sum requirements that are clean")
|
||||
release.current.setGoSumStatus("CLEAN")
|
||||
} else {
|
||||
}
|
||||
buttonEnable()
|
||||
})
|
||||
/*
|
||||
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")
|
||||
/*
|
||||
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")
|
||||
}
|
||||
*/
|
||||
release.grid.NewButton("CheckPrimativeGoMod()", func() {
|
||||
tmp := release.current.String()
|
||||
log.Info("Run CheckGoSum on repo:", tmp)
|
||||
|
@ -378,11 +362,7 @@ func scanForReady() bool {
|
|||
|
||||
log.Info("scan for Ready: found a repo")
|
||||
if setCurrentRepo(repo, "checking ready", "notsure") {
|
||||
if CheckReady() {
|
||||
release.current.setGoSumStatus("READY")
|
||||
} else {
|
||||
release.current.setGoSumStatus("NOT READY")
|
||||
}
|
||||
CheckReady()
|
||||
}
|
||||
}
|
||||
return true
|
||||
|
|
|
@ -152,7 +152,6 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
|
|||
newRepo.dirtyLabel = grid.NewLabel("")
|
||||
newRepo.goSumStatus = grid.NewLabel("?")
|
||||
|
||||
|
||||
newRepo.statusButton = grid.NewButton("Configure", func() {
|
||||
if newRepo.status == nil {
|
||||
log.Warn("status window doesn't exist")
|
||||
|
|
Loading…
Reference in New Issue