diff --git a/Makefile b/Makefile index dd9f9fd..1dba7ad 100644 --- a/Makefile +++ b/Makefile @@ -15,13 +15,13 @@ build: echo "build it!" -rm resources/*.so -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 \ -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" install: -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 \ -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" diff --git a/doRelease.go b/doRelease.go index 64926af..4a8c42f 100644 --- a/doRelease.go +++ b/doRelease.go @@ -138,7 +138,7 @@ func doRelease() bool { // it's necessary to recreate the the files here // safe to do this here. everything has been published - fixGodeps(me.current) + fixGodeps(check) // update the values in the GUI me.current.NewScan() @@ -175,7 +175,7 @@ func doReleaseFindNext() bool { return false } if findFix { - fixGodeps(me.current) + fixGodeps(check) } if me.forge.FinalGoDepsCheckOk(check) { // the go.sum file is ok to release diff --git a/findNext.go b/findNext.go index 072e60d..c347f3c 100644 --- a/findNext.go +++ b/findNext.go @@ -7,6 +7,7 @@ import ( "go.wit.com/log" "go.wit.com/lib/gui/repolist" + "go.wit.com/lib/protobuf/gitpb" ) var findCounter int @@ -50,22 +51,27 @@ func findNext() bool { log.Info("boo, you didn't git clone", repo.GoPath()) 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 { - fixGodeps(repo) + log.Info("findFix is true. running fixGoDeps()") + fixGodeps(check) } findCounter += 1 if me.forge.FinalGoDepsCheckOk(check) { setCurrentRepo(repo, "should be good to release", "pretty sure") 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 { - log.Info("NOTHING TO UPDATE. findCounter =", findCounter) - } else { - findFix = true - log.Info("me.current is nil findCounter =", findCounter, "so set findFix =", findFix) - } + if findCounter == 0 { + log.Info("NOTHING TO UPDATE. findCounter =", findCounter) + } else { + findFix = true + 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) me.release.status.SetText("ALL DONE?") @@ -123,20 +129,17 @@ func goodGodeps(repo *repolist.RepoRow) bool { } // 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 // 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 if check.GetGoPrimitive() { + log.Info("fixGoDeps() skipping primitive", check.GoPath) return true } ok, err := check.RedoGoMod() if err != nil { + log.Info("fixGoDeps() RedoGoMod() error", err) return false } if !ok { @@ -159,15 +162,14 @@ func fixGodeps(repo *repolist.RepoRow) bool { } else { // log.Info("IsReadOnly = false", depRepo.GetGoPath()) } - found := me.repos.View.FindByPath(depRepo.GetGoPath()) + found := me.forge.Repos.FindByGoPath(depRepo.GetGoPath()) if found == nil { log.Info("not found:", depRepo.GetGoPath()) continue } - if depRepo.GetVersion() != found.Status.GetMasterVersion() { - log.Printf("%-48s %10s (from gitpb)", depRepo.GetGoPath(), depRepo.GetVersion()) - header := found.StandardReleaseHeader() - log.Info(header, "(from repolist)") + if depRepo.GetVersion() != found.GetMasterVersion() { + log.Printf("%-48s %10s (gitpb depRepo)", depRepo.GetGoPath(), depRepo.GetVersion()) + log.Printf("%-48s %10s (gitpb found)", found.GetGoPath(), found.GetMasterVersion()) cmd := []string{"go", "get", depRepo.GetGoPath() + "@latest"} check.Run(cmd) } @@ -177,7 +179,10 @@ func fixGodeps(repo *repolist.RepoRow) bool { cmd = []string{"go", "mod", "edit", "-go=1.20"} check.Run(cmd) check.GoDeps = nil - check.ParseGoSum() + if ok, err := check.ParseGoSum(); !ok { + log.Info("ParseGoSum() failed", err) + return false + } deps = check.GoDeps.SortByGoPath() for deps.Scan() { diff --git a/http.go b/http.go index f04ebe5..99b2863 100644 --- a/http.go +++ b/http.go @@ -4,6 +4,7 @@ import ( "fmt" "net/http" "os" + "path/filepath" "strings" "go.wit.com/lib/gui/repolist" @@ -159,8 +160,13 @@ func okHandler(w http.ResponseWriter, r *http.Request) { testNext() return 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 - fixGodeps(me.current) + fixGodeps(check) return case "/showNext": showNext() @@ -230,11 +236,16 @@ func testNext() { log.Info("boo, you didn't git clone", me.current.GoPath()) return } + + data, _ := os.ReadFile(filepath.Join(check.FullPath, "go.mod")) + log.Info(string(data)) + if me.forge.FinalGoDepsCheckOk(check) { - log.Info("finalGoDepsCheck(check) worked!") + log.Info("forge.FinalGoDepsCheck(check) worked!") } else { - log.Info("finalGoDepsCheck(check) failed. boo.") + log.Info("forge.FinalGoDepsCheck(check) failed. boo.") } + } func showNext() { @@ -290,11 +301,11 @@ func showNext() { } log.Info("") + testNext() + log.Info(repolist.ReportHeader()) log.Info(me.current.StandardHeader()) log.Info("") log.Info(repolist.ReleaseReportHeader()) log.Info(me.current.StandardReleaseHeader()) - - testNext() } diff --git a/makePrepareRelease.go b/makePrepareRelease.go index b7a4cab..a599210 100644 --- a/makePrepareRelease.go +++ b/makePrepareRelease.go @@ -51,7 +51,7 @@ func makePrepareRelease() { os.Exit(-1) } if !me.forge.FinalGoDepsCheckOk(check) { - fixGodeps(repo) + fixGodeps(check) } } }