diff --git a/Makefile b/Makefile index 89f836a..dd9f9fd 100644 --- a/Makefile +++ b/Makefile @@ -51,6 +51,9 @@ curl-setBranchesToMasterB: findNext: curl --silent http://localhost:9419/findNext +fixNext: + curl --silent http://localhost:9419/fixNext + showNext: curl --silent http://localhost:9419/showNext diff --git a/doRelease.go b/doRelease.go index c12adb0..64926af 100644 --- a/doRelease.go +++ b/doRelease.go @@ -161,6 +161,11 @@ func doReleaseFindNext() bool { if findNext() { log.Info("findNext() found something") } else { + // this means findNext() didn't find anything but there are + // still packages to release. start trying to fix the go.sum files + if findCounter != 0 { + findFix = true + } log.Info("findNext() could not find anything") return false } @@ -169,6 +174,9 @@ func doReleaseFindNext() bool { log.Info("boo, you didn't git clone", me.current.GoPath()) return false } + if findFix { + fixGodeps(me.current) + } if me.forge.FinalGoDepsCheckOk(check) { // the go.sum file is ok to release return true diff --git a/findNext.go b/findNext.go index c2dead1..072e60d 100644 --- a/findNext.go +++ b/findNext.go @@ -9,10 +9,14 @@ import ( "go.wit.com/lib/gui/repolist" ) +var findCounter int +var findFix bool = false + // trys to figure out if there is still something to update // todo: redo this logic as it is terrible // rename this findNext() func findNext() bool { + findCounter = 0 loop := me.repos.View.ReposSortByName() for loop.Scan() { repo := loop.Repo() @@ -46,12 +50,24 @@ func findNext() bool { log.Info("boo, you didn't git clone", repo.GoPath()) return false } + if findFix { + fixGodeps(repo) + } + findCounter += 1 if me.forge.FinalGoDepsCheckOk(check) { setCurrentRepo(repo, "should be good to release", "pretty sure") return true } } - log.Info("tried to findNext() but not sure what to do next") + 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) + } + } + log.Info("tried to findNext() but not sure what to do next counter =", findCounter, "findFix =", findFix) me.release.status.SetText("ALL DONE?") return false } diff --git a/http.go b/http.go index 9a8cda7..f04ebe5 100644 --- a/http.go +++ b/http.go @@ -156,83 +156,25 @@ func okHandler(w http.ResponseWriter, r *http.Request) { repo.Status.Whitelist = true } case "/testNext": - // re-scans the go.sum file. DOES NOT MODIFY ANYTHING - check := me.forge.Repos.FindByGoPath(me.current.GoPath()) - if check == nil { - log.Info("boo, you didn't git clone", me.current.GoPath()) - return - } - if me.forge.FinalGoDepsCheckOk(check) { - log.Info("finalGoDepsCheck(check) worked!") - } else { - log.Info("finalGoDepsCheck(check) failed. boo.") - } + testNext() + return + case "/fixNext": + // destroy and recreate the go.sum + fixGodeps(me.current) return case "/showNext": - log.Info("gui repo: " + me.release.repo.String()) - log.Info("gui name: " + me.release.version.String()) - log.Info("gui notes: " + me.release.notes.String()) - log.Info("gui status: " + me.release.status.String()) - log.Info("") - if me.current == nil { - log.Info("me.current == nil") - return - } - - if me.current.Status.IsReleased() { - log.Info("IsReleased() == true SHOULD NOT RELEASE THIS") - } else { - log.Info("IsReleased() == false") - } - if me.current.Status.CheckDirty() { - log.Info("CheckDirty() == true. SHOULD NOT RELEASE THIS") - } else { - log.Info("CheckDirty() == false") - } - if me.current.Status.IsPrimitive() { - log.Info("IsPrimitive() == true") - } else { - log.Info("IsPrimitive() == false") - } - if me.current.Status.IsPrivate() { - log.Info("IsPrivate() == true") - } else { - log.Info("IsPrivate() == false") - } - if ok, compiled, err := me.current.IsProtobuf(); ok { - log.Info(log.Sprint("IsProtobuf() == true compiled protobuf files = ", compiled)) - if err != nil { - log.Info(log.Sprint("IsProtobuf() == err", err)) - os.Exit(-1) - } - for _, s := range compiled { - log.Info("\tcompiled file found:", s) - } - } else { - log.Info("IsProtobuf() == false") - if err != nil { - log.Info(log.Sprint("IsProtobuf() == err", err)) - } - } - if me.current.Status.Whitelist { - log.Info("Whitelist == true SHOULD NOT RELEASE THIS") - } else { - log.Info("Whitelist == false") - } - log.Info("") - - log.Info(repolist.ReportHeader()) - log.Info(me.current.StandardHeader()) - log.Info("") - log.Info(repolist.ReleaseReportHeader()) - log.Info(me.current.StandardReleaseHeader()) + showNext() + return case "/list": PrintReport(readonly, onlydirty, perfect) + return case "/releaseList": PrintReleaseReport(readonly, perfect) + return case "/quit": log.Info("Got URL /quit") os.Exit(0) + return case "/goweblist": loop := me.repos.View.ReposAll() for loop.Scan() { @@ -262,6 +204,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) { */ } + return default: log.Info("BAD URL = " + route) } @@ -279,3 +222,79 @@ func startHTTP() { log.Println("Error starting server:", err) } } + +func testNext() { + // re-scans the go.sum file. DOES NOT MODIFY ANYTHING + check := me.forge.Repos.FindByGoPath(me.current.GoPath()) + if check == nil { + log.Info("boo, you didn't git clone", me.current.GoPath()) + return + } + if me.forge.FinalGoDepsCheckOk(check) { + log.Info("finalGoDepsCheck(check) worked!") + } else { + log.Info("finalGoDepsCheck(check) failed. boo.") + } +} + +func showNext() { + log.Info("gui repo: " + me.release.repo.String()) + log.Info("gui name: " + me.release.version.String()) + log.Info("gui notes: " + me.release.notes.String()) + log.Info("gui status: " + me.release.status.String()) + log.Info("") + if me.current == nil { + log.Info("me.current == nil") + return + } + + if me.current.Status.IsReleased() { + log.Info("IsReleased() == true SHOULD NOT RELEASE THIS") + } else { + log.Info("IsReleased() == false") + } + if me.current.Status.CheckDirty() { + log.Info("CheckDirty() == true. SHOULD NOT RELEASE THIS") + } else { + log.Info("CheckDirty() == false") + } + if me.current.Status.IsPrimitive() { + log.Info("IsPrimitive() == true") + } else { + log.Info("IsPrimitive() == false") + } + if me.current.Status.IsPrivate() { + log.Info("IsPrivate() == true") + } else { + log.Info("IsPrivate() == false") + } + if ok, compiled, err := me.current.IsProtobuf(); ok { + log.Info(log.Sprint("IsProtobuf() == true compiled protobuf files = ", compiled)) + if err != nil { + log.Info(log.Sprint("IsProtobuf() == err", err)) + os.Exit(-1) + } + for _, s := range compiled { + log.Info("\tcompiled file found:", s) + } + } else { + log.Info("IsProtobuf() == false") + if err != nil { + log.Info(log.Sprint("IsProtobuf() == err", err)) + } + } + if me.current.Status.Whitelist { + log.Info("Whitelist == true SHOULD NOT RELEASE THIS") + } else { + log.Info("Whitelist == false") + } + log.Info("") + + 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 9832116..b7a4cab 100644 --- a/makePrepareRelease.go +++ b/makePrepareRelease.go @@ -11,6 +11,15 @@ func makePrepareRelease() { me.release.box.Disable() defer me.Enable() + if setAllBranchesToMaster() { + // if it succeeds, disable this button + me.setBranchesToMasterB.Disable() + me.release.box.Enable() + PrintReleaseReport("", "") + } else { + log.Info("setAllBranchesToMaster() failed") + } + // first reset all the target versions back to the current version // incase there was a partial release process running that // did not finish @@ -65,7 +74,7 @@ func makePrepareRelease() { log.Info("arg final check true", check.GetGoPath()) } else { log.Info("arg final check false", check.GetGoPath()) - os.Exit(-1) + // os.Exit(-1) } // see if there is a new version master := repo.Status.GetMasterVersion() @@ -117,12 +126,4 @@ func makePrepareRelease() { } } findNext() - if setAllBranchesToMaster() { - // if it succeeds, disable this button - me.setBranchesToMasterB.Disable() - me.release.box.Enable() - PrintReleaseReport("", "") - } else { - log.Info("setAllBranchesToMaster() failed") - } }