almost, maybe, fully automated. maybe. finally.

This commit is contained in:
Jeff Carr 2024-12-03 03:18:27 -06:00
parent 0abb2f7861
commit 96b72979a1
5 changed files with 46 additions and 30 deletions

View File

@ -15,13 +15,13 @@ build:
echo "build it!" echo "build it!"
-rm resources/*.so -rm resources/*.so
-mkdir resources/ -mkdir resources/
cp -a ~/go/src/go.wit.com/toolkits/*.so resources/ cp -a ~/go/src/go.wit.com/toolkits/*/*.so resources/
GO111MODULE=off go build \ GO111MODULE=off go build \
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
install: install:
-rm resources/*.so -rm resources/*.so
cp -a ~/go/src/go.wit.com/toolkits/*.so resources/ cp -a ~/go/src/go.wit.com/toolkits/*/*.so resources/
GO111MODULE=off go install \ GO111MODULE=off go install \
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"

View File

@ -138,7 +138,7 @@ func doRelease() bool {
// it's necessary to recreate the the files here // it's necessary to recreate the the files here
// safe to do this here. everything has been published // safe to do this here. everything has been published
fixGodeps(me.current) fixGodeps(check)
// update the values in the GUI // update the values in the GUI
me.current.NewScan() me.current.NewScan()
@ -175,7 +175,7 @@ func doReleaseFindNext() bool {
return false return false
} }
if findFix { if findFix {
fixGodeps(me.current) fixGodeps(check)
} }
if me.forge.FinalGoDepsCheckOk(check) { if me.forge.FinalGoDepsCheckOk(check) {
// the go.sum file is ok to release // the go.sum file is ok to release

View File

@ -7,6 +7,7 @@ import (
"go.wit.com/log" "go.wit.com/log"
"go.wit.com/lib/gui/repolist" "go.wit.com/lib/gui/repolist"
"go.wit.com/lib/protobuf/gitpb"
) )
var findCounter int var findCounter int
@ -50,23 +51,28 @@ func findNext() bool {
log.Info("boo, you didn't git clone", repo.GoPath()) log.Info("boo, you didn't git clone", repo.GoPath())
return false return false
} }
if ok, err := check.ParseGoSum(); !ok {
log.Info("ParseGoSum() failed (probably repo needs go mod tidy)", err)
log.Info("ParseGoSum() findFix =", findFix, "findCounter =", findCounter)
// return false
}
if findFix { if findFix {
fixGodeps(repo) log.Info("findFix is true. running fixGoDeps()")
fixGodeps(check)
} }
findCounter += 1 findCounter += 1
if me.forge.FinalGoDepsCheckOk(check) { if me.forge.FinalGoDepsCheckOk(check) {
setCurrentRepo(repo, "should be good to release", "pretty sure") setCurrentRepo(repo, "should be good to release", "pretty sure")
return true return true
} }
log.Info("findNext() got to the end. repo", repo.GoPath(), "did not work. trying to find a new one now")
} }
if me.current == nil {
if findCounter == 0 { if findCounter == 0 {
log.Info("NOTHING TO UPDATE. findCounter =", findCounter) log.Info("NOTHING TO UPDATE. findCounter =", findCounter)
} else { } else {
findFix = true findFix = true
log.Info("me.current is nil findCounter =", findCounter, "so set findFix =", findFix) log.Info("me.current is nil findCounter =", findCounter, "so set findFix =", findFix)
} }
}
log.Info("tried to findNext() but not sure what to do next counter =", findCounter, "findFix =", findFix) log.Info("tried to findNext() but not sure what to do next counter =", findCounter, "findFix =", findFix)
me.release.status.SetText("ALL DONE?") me.release.status.SetText("ALL DONE?")
return false return false
@ -123,20 +129,17 @@ func goodGodeps(repo *repolist.RepoRow) bool {
} }
// tries to fix the go.mod and go.sum files // tries to fix the go.mod and go.sum files
func fixGodeps(repo *repolist.RepoRow) bool { func fixGodeps(check *gitpb.Repo) bool {
var good bool = true var good bool = true
// check if the package dependancies changed, if so, re-publish // 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)
}
// skip primative ones // skip primative ones
if check.GetGoPrimitive() { if check.GetGoPrimitive() {
log.Info("fixGoDeps() skipping primitive", check.GoPath)
return true return true
} }
ok, err := check.RedoGoMod() ok, err := check.RedoGoMod()
if err != nil { if err != nil {
log.Info("fixGoDeps() RedoGoMod() error", err)
return false return false
} }
if !ok { if !ok {
@ -159,15 +162,14 @@ func fixGodeps(repo *repolist.RepoRow) bool {
} else { } else {
// log.Info("IsReadOnly = false", depRepo.GetGoPath()) // log.Info("IsReadOnly = false", depRepo.GetGoPath())
} }
found := me.repos.View.FindByPath(depRepo.GetGoPath()) found := me.forge.Repos.FindByGoPath(depRepo.GetGoPath())
if found == nil { if found == nil {
log.Info("not found:", depRepo.GetGoPath()) log.Info("not found:", depRepo.GetGoPath())
continue continue
} }
if depRepo.GetVersion() != found.Status.GetMasterVersion() { if depRepo.GetVersion() != found.GetMasterVersion() {
log.Printf("%-48s %10s (from gitpb)", depRepo.GetGoPath(), depRepo.GetVersion()) log.Printf("%-48s %10s (gitpb depRepo)", depRepo.GetGoPath(), depRepo.GetVersion())
header := found.StandardReleaseHeader() log.Printf("%-48s %10s (gitpb found)", found.GetGoPath(), found.GetMasterVersion())
log.Info(header, "(from repolist)")
cmd := []string{"go", "get", depRepo.GetGoPath() + "@latest"} cmd := []string{"go", "get", depRepo.GetGoPath() + "@latest"}
check.Run(cmd) check.Run(cmd)
} }
@ -177,7 +179,10 @@ func fixGodeps(repo *repolist.RepoRow) bool {
cmd = []string{"go", "mod", "edit", "-go=1.20"} cmd = []string{"go", "mod", "edit", "-go=1.20"}
check.Run(cmd) check.Run(cmd)
check.GoDeps = nil check.GoDeps = nil
check.ParseGoSum() if ok, err := check.ParseGoSum(); !ok {
log.Info("ParseGoSum() failed", err)
return false
}
deps = check.GoDeps.SortByGoPath() deps = check.GoDeps.SortByGoPath()
for deps.Scan() { for deps.Scan() {

21
http.go
View File

@ -4,6 +4,7 @@ import (
"fmt" "fmt"
"net/http" "net/http"
"os" "os"
"path/filepath"
"strings" "strings"
"go.wit.com/lib/gui/repolist" "go.wit.com/lib/gui/repolist"
@ -159,8 +160,13 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
testNext() testNext()
return return
case "/fixNext": case "/fixNext":
check := me.forge.Repos.FindByGoPath(me.current.GoPath())
if check == nil {
log.Info("boo, you didn't git clone", me.current.GoPath())
return
}
// destroy and recreate the go.sum // destroy and recreate the go.sum
fixGodeps(me.current) fixGodeps(check)
return return
case "/showNext": case "/showNext":
showNext() showNext()
@ -230,11 +236,16 @@ func testNext() {
log.Info("boo, you didn't git clone", me.current.GoPath()) log.Info("boo, you didn't git clone", me.current.GoPath())
return return
} }
data, _ := os.ReadFile(filepath.Join(check.FullPath, "go.mod"))
log.Info(string(data))
if me.forge.FinalGoDepsCheckOk(check) { if me.forge.FinalGoDepsCheckOk(check) {
log.Info("finalGoDepsCheck(check) worked!") log.Info("forge.FinalGoDepsCheck(check) worked!")
} else { } else {
log.Info("finalGoDepsCheck(check) failed. boo.") log.Info("forge.FinalGoDepsCheck(check) failed. boo.")
} }
} }
func showNext() { func showNext() {
@ -290,11 +301,11 @@ func showNext() {
} }
log.Info("") log.Info("")
testNext()
log.Info(repolist.ReportHeader()) log.Info(repolist.ReportHeader())
log.Info(me.current.StandardHeader()) log.Info(me.current.StandardHeader())
log.Info("") log.Info("")
log.Info(repolist.ReleaseReportHeader()) log.Info(repolist.ReleaseReportHeader())
log.Info(me.current.StandardReleaseHeader()) log.Info(me.current.StandardReleaseHeader())
testNext()
} }

View File

@ -51,7 +51,7 @@ func makePrepareRelease() {
os.Exit(-1) os.Exit(-1)
} }
if !me.forge.FinalGoDepsCheckOk(check) { if !me.forge.FinalGoDepsCheckOk(check) {
fixGodeps(repo) fixGodeps(check)
} }
} }
} }