add version number exception for widget

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-01 13:30:26 -06:00
parent 37e1e5a37a
commit 41a6166890
5 changed files with 82 additions and 54 deletions

View File

@ -35,8 +35,9 @@ func CheckReady() bool {
lastS := release.current.status.GetLastTagVersion() lastS := release.current.status.GetLastTagVersion()
currentS := release.current.status.GetCurrentBranchVersion() currentS := release.current.status.GetCurrentBranchVersion()
targetS := "v" + release.versionS var targetS string
log.Info("repo:", release.current.String(), goSumS, dirtyS, lastS, currentS) targetS = "v" + release.version.String()
log.Info("repo:", release.current.String(), goSumS, dirtyS, lastS, currentS, targetS)
if goSumS == "PRIMATIVE" { if goSumS == "PRIMATIVE" {
return true return true

View File

@ -100,8 +100,15 @@ func globalDisplayOptions(box *gui.Node) {
if whitelist(repo.String()) { if whitelist(repo.String()) {
continue continue
} }
repo.status.MakeRedomod() if repo.status.MakeRedomod() {
log.Info("redo go.sum failed on", repo.String())
me.Enable()
longB.Enable()
longB.SetLabel("FAILED")
return
} }
}
log.Info("redo go.sum finished ok!")
me.Enable() me.Enable()
longB.Enable() longB.Enable()
}) })

View File

@ -30,8 +30,8 @@ func (r *repo) lookToUnwind() bool {
return false return false
} }
if "v"+release.versionS != r.lastTag.String() { if release.version.String() != r.lastTag.String() {
log.Info("\trepo version mismatch last vs official", r.lastTag.String(), "!=", release.versionS) log.Info("\trepo version mismatch last vs official", r.lastTag.String(), "!=", release.version.String())
r.setGoSumStatus("CAN NOT UNWIND") r.setGoSumStatus("CAN NOT UNWIND")
return false return false
} }

View File

@ -17,7 +17,6 @@ var release releaseStruct
type releaseStruct struct { type releaseStruct struct {
current *repo current *repo
// win *gadgets.BasicWindow
box *gui.Node box *gui.Node
group *gui.Node group *gui.Node
grid *gui.Node grid *gui.Node
@ -27,6 +26,9 @@ type releaseStruct struct {
notes *gadgets.OneLiner notes *gadgets.OneLiner
version *gadgets.OneLiner version *gadgets.OneLiner
versionS string versionS string
widgetVersionS string
releaseVersionB *gui.Node
unreleaseB *gui.Node
reason *gadgets.BasicEntry reason *gadgets.BasicEntry
reasonS string reasonS string
@ -54,9 +56,9 @@ func (w *autoType) Enable() {
} }
func createReleaseBox(box *gui.Node) { func createReleaseBox(box *gui.Node) {
release.versionS = "0.18.0" release.versionS = "0.19.0"
release.reasonS = "dns control panel" release.widgetVersionS = "1.1.13"
partS := strings.Split(release.versionS, ".") release.reasonS = "gocui checkboxes"
initWhitelist() initWhitelist()
@ -81,8 +83,22 @@ func createReleaseBox(box *gui.Node) {
} }
me.Enable() me.Enable()
}) })
release.grid.NewButton("release version "+release.versionS, func() { release.releaseVersionB = release.grid.NewButton("release version", func() {
buttonDisable() buttonDisable()
if release.releaseVersionB.String() != "release version "+release.version.String() {
log.Warn("something went wrong with the release.version:", release.version.String())
return
}
if strings.HasPrefix(release.version.String(), "v") {
log.Warn("everything is ok. version starts with v.", release.version.String())
} else {
log.Warn("version does not start with v.", release.version.String())
return
}
if release.status.String() != "PRIMATIVE" {
log.Warn("only can do PRIMATIVE right now", release.version.String())
return
}
if release.current.status.CheckDirty() { if release.current.status.CheckDirty() {
log.Info("sorry, it's still dirty") log.Info("sorry, it's still dirty")
@ -96,15 +112,19 @@ func createReleaseBox(box *gui.Node) {
return return
} }
log.Info("\ttag and push", curName, release.versionS, release.reasonS) log.Info("\ttag and push", curName, release.version.String(), release.reasonS)
var all [][]string var all [][]string
all = append(all, []string{"git", "add", "-f", "go.mod"}) all = append(all, []string{"git", "add", "-f", "go.mod"})
if release.status.String() == "PRIMATIVE" {
// don't add go.sum here. TODO: check for go.sum file and fail
} else {
all = append(all, []string{"git", "add", "-f", "go.sum"}) all = append(all, []string{"git", "add", "-f", "go.sum"})
}
all = append(all, []string{"git", "commit", "-m", release.reasonS}) all = append(all, []string{"git", "commit", "-m", release.reasonS})
all = append(all, []string{"git", "push"}) all = append(all, []string{"git", "push"})
all = append(all, []string{"git", "tag", "-m", release.reasonS, "v" + release.versionS}) all = append(all, []string{"git", "tag", "-m", release.reasonS, release.version.String()})
all = append(all, []string{"git", "push", "origin", "v" + release.versionS}) all = append(all, []string{"git", "push", "origin", release.version.String()})
if doAll(release.current, all) { if doAll(release.current, all) {
log.Info("EVERYTHING OK") log.Info("EVERYTHING OK")
@ -149,7 +169,6 @@ func createReleaseBox(box *gui.Node) {
// open the status window to commit the release // open the status window to commit the release
release.current.status.Toggle() release.current.status.Toggle()
release.current.status.SetVersion(partS[0], partS[1], partS[2], release.reason.String())
release.current.status.UpdateCurrent() release.current.status.UpdateCurrent()
}) })
release.openrepo.Disable() release.openrepo.Disable()
@ -160,7 +179,6 @@ func createReleaseBox(box *gui.Node) {
release.notes = gadgets.NewOneLiner(release.grid, "notes") release.notes = gadgets.NewOneLiner(release.grid, "notes")
release.version = gadgets.NewOneLiner(release.grid, "version") release.version = gadgets.NewOneLiner(release.grid, "version")
release.version.SetText(release.versionS)
release.reason = gadgets.NewBasicEntry(release.grid, "release reason") release.reason = gadgets.NewBasicEntry(release.grid, "release reason")
release.reason.SetText(release.reasonS) release.reason.SetText(release.reasonS)
@ -192,13 +210,6 @@ 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.grid.NewButton("set ignore", func() { release.grid.NewButton("set ignore", func() {
tmp := release.current.getGoSumStatus() tmp := release.current.getGoSumStatus()
log.Info("trying to set repo IGNORE is now =", tmp) log.Info("trying to set repo IGNORE is now =", tmp)
@ -206,18 +217,6 @@ func createReleaseBox(box *gui.Node) {
release.whitelist[release.current.String()] = release.current release.whitelist[release.current.String()] = release.current
}) })
/*
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() { release.checkSafeB = release.grid.NewButton("CheckSafeGoSumRemake()", func() {
buttonDisable() buttonDisable()
release.current.status.CheckSafeGoSumRemake() release.current.status.CheckSafeGoSumRemake()
@ -351,6 +350,15 @@ func setCurrentRepo(newcur *repo, s string, note string) bool {
release.status.SetValue(s) release.status.SetValue(s)
release.notes.SetValue(note) release.notes.SetValue(note)
release.current = newcur release.current = newcur
if newcur.String() == "go.wit.com/widget" {
release.version.SetText("v" + release.widgetVersionS)
release.releaseVersionB.SetText("release version v" + release.widgetVersionS)
release.unreleaseB.SetText("un-release version v" + release.widgetVersionS)
} else {
release.version.SetText("v" + release.versionS)
release.releaseVersionB.SetText("release version v" + release.versionS)
release.unreleaseB.SetText("un-release version v" + release.versionS)
}
release.openrepo.Enable() release.openrepo.Enable()
/* /*
@ -390,7 +398,7 @@ func findNextDirty() bool {
log.Info("findNextDirty()", repo.String(), goSumS, dirtyS) log.Info("findNextDirty()", repo.String(), goSumS, dirtyS)
if goSumS == "PRIMATIVE" { if goSumS == "PRIMATIVE" {
if dirtyS != "PERFECT" { if dirtyS != "PERFECT" {
if setCurrentRepo(repo, "primative not committed", "release new version") { if setCurrentRepo(repo, "PRIMATIVE", "release new version") {
return true return true
} }
continue continue

View File

@ -2,6 +2,8 @@
package main package main
import ( import (
"strings"
"go.wit.com/gui" "go.wit.com/gui"
"go.wit.com/log" "go.wit.com/log"
) )
@ -26,8 +28,19 @@ func createUnreleaseBox(box *gui.Node) {
} }
} }
}) })
group.NewButton("re-release"+release.versionS, func() { release.unreleaseB = group.NewButton("re-release", func() {
me.Disable() me.Disable()
if release.releaseVersionB.String() != "un-release version "+release.version.String() {
log.Warn("something went wrong with the release.version:", release.version.String())
return
}
if strings.HasPrefix(release.version.String(), "v") {
log.Warn("everything is ok. version starts with v.", release.version.String())
} else {
log.Warn("version does not start with v.", release.version.String())
return
}
if release.current.status.CheckDirty() { if release.current.status.CheckDirty() {
log.Info("sorry, it's still dirty") log.Info("sorry, it's still dirty")
@ -41,8 +54,7 @@ func createUnreleaseBox(box *gui.Node) {
return return
} }
log.Info("\treset to devel", curName, release.versionS, release.reasonS) log.Info("\treset to devel", curName, release.version.String(), release.reasonS)
var all [][]string var all [][]string
all = append(all, []string{"git", "checkout", "devel"}) all = append(all, []string{"git", "checkout", "devel"})
@ -51,10 +63,10 @@ func createUnreleaseBox(box *gui.Node) {
all = append(all, []string{"git", "checkout", mName}) all = append(all, []string{"git", "checkout", mName})
all = append(all, []string{"git", "push", "--set-upstream", "--force", "origin", mName}) all = append(all, []string{"git", "push", "--set-upstream", "--force", "origin", mName})
all = append(all, []string{"git", "tag", "--delete", "v" + release.versionS}) all = append(all, []string{"git", "tag", "--delete", release.version.String()})
all = append(all, []string{"git", "push", "--delete", "origin", "v" + release.versionS}) all = append(all, []string{"git", "push", "--delete", "origin", release.version.String()})
all = append(all, []string{"git", "tag", "-m", release.reasonS, "v" + release.versionS}) all = append(all, []string{"git", "tag", "-m", release.reasonS, release.version.String()})
all = append(all, []string{"git", "push", "origin", "v" + release.versionS}) all = append(all, []string{"git", "push", "origin", release.version.String()})
if doAll(release.current, all) { if doAll(release.current, all) {
log.Info("EVERYTHING OK") log.Info("EVERYTHING OK")