continue to migrate to protobuf package

This commit is contained in:
Jeff Carr 2024-12-02 07:00:28 -06:00
parent cfb4fb61bf
commit 1c8815685b
7 changed files with 176 additions and 77 deletions

View File

@ -98,6 +98,19 @@ func doRelease() bool {
return false
}
pb := me.forge.Repos.FindByGoPath(me.current.GoPath())
if pb != nil {
pb.UpdatePublished()
if !pb.GetGoPrimitive() {
loop := pb.Published.SortByGoPath()
for loop.Scan() {
t := loop.Next()
log.Info("new Published dep:", t.GetGoPath(), t.GetVersion())
}
}
me.forge.Repos.ConfigSave()
}
log.Info("PUBLISH OK")
// me.current.SetGoState("RELEASED")
@ -121,26 +134,11 @@ func doRelease() bool {
}
log.Info("EVERYTHING OK. RERELEASED", me.current.Name())
// recreate go.mod / go.sum
fixGodeps(me.current)
// update the values in the GUI
me.current.NewScan()
pb := me.forge.Repos.FindByGoPath(me.current.GoPath())
if pb != nil {
pb.ParseGoSum()
if pb.Published != nil {
loop := pb.Published.SortByGoPath()
for loop.Scan() {
t := loop.Next()
log.Info("orig Published dep:", t.GetGoPath(), t.GetVersion())
}
}
pb.UpdatePublished()
loop := pb.Published.SortByGoPath()
for loop.Scan() {
t := loop.Next()
log.Info("new Published dep:", t.GetGoPath(), t.GetVersion())
}
me.forge.Repos.ConfigSave()
}
// attempt to find another repo to release
if !doReleaseFindNext() {

View File

@ -115,7 +115,23 @@ func fixGodeps(repo *repolist.RepoRow) bool {
log.Info("boo, you didn't git clone", repo.GoPath())
os.Exit(-1)
}
check.RedoGoMod()
// skip primative ones
if check.GetGoPrimitive() {
return true
}
ok, err := check.RedoGoMod()
if err != nil {
return false
}
if !ok {
log.Info("gitpb.RedoGoMod() returned false", check.GetGoPath())
return false
}
if check.GoDeps == nil {
cmd := []string{"go", "mod", "edit", "-go=1.20"}
check.Run(cmd)
return true
}
log.Printf("current repo %s go dependancy count: %d", check.GetGoPath(), check.GoDepsLen())
deps := check.GoDeps.SortByGoPath()
for deps.Scan() {

View File

@ -1,8 +1,6 @@
package main
import (
"os"
"go.wit.com/gui"
"go.wit.com/lib/debugger"
"go.wit.com/lib/gui/logsettings"
@ -43,50 +41,3 @@ func globalDisplayOptions(box *gui.Node) {
debugger.DebugWindow()
})
}
func makePrepareRelease() {
me.Disable()
me.release.box.Disable()
defer me.Enable()
loop := me.repos.View.ReposSortByName()
for loop.Scan() {
repo := loop.Repo()
// check if the package dependancies changed, if so, re-publish
check := me.forge.Repos.FindByGoPath(repo.GoPath())
if check == nil {
log.Info("boo, you didn't git clone", repo.GoPath())
os.Exit(-1)
}
match, err := me.forge.Repos.GoDepsChanged(check)
if err != nil {
log.Info("dependancy checks failed", check.GetGoPath(), err)
repo.Status.IncrementRevisionVersion("missing prior published godeps")
continue
}
if match {
log.Printf("dependancy checks indicate a new release is needed for %s\n", check.GetGoPath())
repo.Status.IncrementRevisionVersion("godeps changed")
continue
} else {
log.Printf("dependancies have not changed for %s\n", check.GetGoPath())
}
// see if there is a new version
master := repo.Status.GetMasterVersion()
lastTag := repo.Status.LastTag()
if master == lastTag {
repo.Status.SetTargetVersion(master)
} else {
repo.Status.IncrementRevisionVersion("Nov 2024 test")
}
}
findNext()
if setAllBranchesToMaster() {
// if it succeeds, disable this button
me.setBranchesToMasterB.Disable()
me.release.box.Enable()
me.repos.View.PrintReleaseReport("", "")
} else {
log.Info("setAllBranchesToMaster() failed")
}
}

View File

@ -228,9 +228,9 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
log.Info(repolist.ReleaseReportHeader())
log.Info(me.current.StandardReleaseHeader())
case "/list":
me.repos.View.PrintReport(readonly, onlydirty, perfect)
PrintReport(readonly, onlydirty, perfect)
case "/releaseList":
me.repos.View.PrintReleaseReport(readonly, perfect)
PrintReleaseReport(readonly, perfect)
case "/quit":
log.Info("Got URL /quit")
os.Exit(0)

87
human.go Normal file
View File

@ -0,0 +1,87 @@
package main
import (
"fmt"
"go.wit.com/lib/gui/repolist"
"go.wit.com/log"
)
func PrintReport(readonly string, onlydirty string, perfect string) {
var count int
log.Info(repolist.ReportHeader())
loop := me.repos.View.ReposSortByName()
for loop.Scan() {
repo := loop.Repo()
count += 1
header := repo.StandardHeader()
if onlydirty == "true" {
if repo.CheckDirty() {
log.Info(header + "")
}
continue
}
if repo.ReadOnly() {
if readonly == "true" {
log.Info(header + "readonly")
}
continue
}
if repo.State() == "PERFECT" {
if perfect == "false" {
continue
}
}
if repo.State() != "merge to main" {
log.Info(header + "")
continue
}
if repo.CheckDirty() {
log.Info(header + "")
continue
}
log.Info(header + "")
check := me.forge.Repos.FindByGoPath(repo.GoPath())
if check == nil {
log.Info("boo, you didn't git clone", repo.GoPath())
continue
}
me.forge.StandardReleaseHeader(check, repo.State())
}
log.Info(fmt.Sprintf("EVERYTHING WORKED repo count = %d", count))
}
func PrintReleaseReport(readonly string, perfect string) {
var count int
log.Info(repolist.ReleaseReportHeader())
loop := me.repos.View.ReposSortByName()
for loop.Scan() {
repo := loop.Repo()
if repo.ReadOnly() && (readonly == "true") {
continue
}
if (repo.State() == "PERFECT") && (perfect == "true") {
continue
}
if repo.Status.IsReleased() {
continue
}
count += 1
header := repo.StandardReleaseHeader()
log.Info(header)
check := me.forge.Repos.FindByGoPath(repo.GoPath())
if check == nil {
log.Info("boo, you didn't git clone", repo.GoPath())
continue
}
log.Info(me.forge.StandardReleaseHeader(check, repo.State()))
}
log.Info(fmt.Sprintf("total repo count = %d", count))
}

52
makePrepareRelease.go Normal file
View File

@ -0,0 +1,52 @@
package main
import (
"os"
"go.wit.com/log"
)
func makePrepareRelease() {
me.Disable()
me.release.box.Disable()
defer me.Enable()
loop := me.repos.View.ReposSortByName()
for loop.Scan() {
repo := loop.Repo()
// check if the package dependancies changed, if so, re-publish
check := me.forge.Repos.FindByGoPath(repo.GoPath())
if check == nil {
log.Info("boo, you didn't git clone", repo.GoPath())
os.Exit(-1)
}
if me.forge.FinalGoDepsCheck(check) {
log.Printf("dependancy checks indicate a new release is needed for %s\n", check.GetGoPath())
repo.Status.IncrementRevisionVersion("godeps changed")
target := repo.Status.GetTargetVersion()
check.SetTargetVersion(target)
continue
} else {
log.Printf("dependancies have not changed for %s\n", check.GetGoPath())
}
// see if there is a new version
master := repo.Status.GetMasterVersion()
lastTag := repo.Status.LastTag()
if master == lastTag {
repo.Status.SetTargetVersion(master)
} else {
repo.Status.IncrementRevisionVersion("Nov 2024 test")
target := repo.Status.GetTargetVersion()
check.SetTargetVersion(target)
}
}
findNext()
if setAllBranchesToMaster() {
// if it succeeds, disable this button
me.setBranchesToMasterB.Disable()
me.release.box.Enable()
PrintReleaseReport("", "")
} else {
log.Info("setAllBranchesToMaster() failed")
}
}

View File

@ -1,12 +1,6 @@
package main
import (
"os"
"strings"
"go.wit.com/log"
)
/*
func setTargetVersion() {
// go through and set the target versions for each repo
// todo: add sanity checking in repolist to verify these and/or autocompute them
@ -76,3 +70,4 @@ func incrementTargetVersion() bool {
}
return false
}
*/