fixes for new gitpb

This commit is contained in:
Jeff Carr 2024-12-17 07:03:17 -06:00
parent 8dd47d59e3
commit 3d22172fa9
7 changed files with 54 additions and 54 deletions

View File

@ -47,9 +47,9 @@ func doRelease() bool {
return false return false
} }
check := me.forge.Repos.FindByGoPath(me.current.GoPath()) check := me.forge.FindByGoPath(me.current.GetGoPath())
if check == nil { if check == nil {
log.Info("boo, you didn't git clone", me.current.GoPath()) log.Info("boo, you didn't git clone", me.current.GetGoPath())
return false return false
} }
if !me.forge.FinalGoDepsCheckOk(check) { if !me.forge.FinalGoDepsCheckOk(check) {
@ -57,15 +57,15 @@ func doRelease() bool {
badExit(errors.New(msg)) badExit(errors.New(msg))
return false return false
} }
if check.GoPath == me.startRepo.GoPath { if check.GetGoPath() == me.startRepo.GetGoPath() {
log.Info("CAN NOT SELF UPDATE.", check.GoPath, "is the same as os.Getwd()") log.Info("CAN NOT SELF UPDATE.", check.GetGoPath(), "is the same as os.Getwd()")
log.Info("go get must be run from somewhere else other than startRepo") log.Info("go get must be run from somewhere else other than startRepo")
log.Info("chdir to autotypist if it exists") log.Info("chdir to autotypist if it exists")
msg := fmt.Sprint("CAN NOT SELF UPDATE.", check.GoPath, "is the same as os.Getwd()") msg := fmt.Sprint("CAN NOT SELF UPDATE.", check.GetGoPath(), "is the same as os.Getwd()")
badExit(errors.New(msg)) badExit(errors.New(msg))
} }
if !me.startRepo.Exists("go.mod") { if !me.startRepo.Exists("go.mod") {
log.Info("go.sum missing in", me.startRepo.GoPath) log.Info("go.sum missing in", me.startRepo.GetGoPath())
log.Info("pick a different repo here") log.Info("pick a different repo here")
log.Info("todo: error out earlier knowing this will upgrade") log.Info("todo: error out earlier knowing this will upgrade")
log.Info("versions", me.startRepo.GetTargetVersion(), me.startRepo.GetMasterVersion()) log.Info("versions", me.startRepo.GetTargetVersion(), me.startRepo.GetMasterVersion())
@ -75,8 +75,8 @@ func doRelease() bool {
log.Info("\ttag and push", curName, me.release.version.String(), me.releaseReasonS) log.Info("\ttag and push", curName, me.release.version.String(), me.releaseReasonS)
if err := check.ValidGoSum(); err != nil { if err := check.ValidGoSum(); err != nil {
log.Info("ValidGoSum() error", check.GoPath, err) log.Info("ValidGoSum() error", check.GetGoPath(), err)
msg := fmt.Sprint("ValidGoSum() error", check.GoPath, err) msg := fmt.Sprint("ValidGoSum() error", check.GetGoPath(), err)
badExit(errors.New(msg)) badExit(errors.New(msg))
} }
@ -84,7 +84,7 @@ func doRelease() bool {
var autogen []string var autogen []string
all = append(all, []string{"git", "add", "-f", "go.mod"}) all = append(all, []string{"git", "add", "-f", "go.mod"})
autogen = append(autogen, "go.mod") autogen = append(autogen, "go.mod")
if check.GoPrimitive { if check.GoInfo.GoPrimitive {
// don't add go.sum here. TODO: check for go.sum file and fail // don't add go.sum here. TODO: check for go.sum file and fail
} else { } else {
all = append(all, []string{"git", "add", "-f", "go.sum"}) all = append(all, []string{"git", "add", "-f", "go.sum"})
@ -139,9 +139,9 @@ func doRelease() bool {
} }
} }
pb := me.forge.Repos.FindByGoPath(me.current.GoPath()) pb := me.forge.FindByGoPath(me.current.GetGoPath())
if pb != nil { if pb != nil {
pb.UpdatePublished() // pb.UpdatePublished()
/* remove. earlier protected against nil /* remove. earlier protected against nil
if !pb.IsPrimitive() { if !pb.IsPrimitive() {
loop := pb.Published.SortByGoPath() loop := pb.Published.SortByGoPath()
@ -228,9 +228,9 @@ func doReleaseFindNext() bool {
log.Info("findNext() could not find anything") log.Info("findNext() could not find anything")
return false return false
} }
check := me.forge.Repos.FindByGoPath(me.current.GoPath()) check := me.forge.FindByGoPath(me.current.GetGoPath())
if check == nil { if check == nil {
log.Info("boo, you didn't git clone", me.current.GoPath()) log.Info("boo, you didn't git clone", me.current.GetGoPath())
return false return false
} }
if findFix { if findFix {
@ -246,7 +246,7 @@ func doReleaseFindNext() bool {
// this pulls the new tag from the golang package repository // this pulls the new tag from the golang package repository
// to insert the new version // to insert the new version
func doPublishVersion() bool { func doPublishVersion() bool {
gopath := me.current.GoPath() gopath := me.current.GetGoPath()
docmd := []string{"go", "get", "-v", gopath + "@" + me.release.version.String()} docmd := []string{"go", "get", "-v", gopath + "@" + me.release.version.String()}
log.Info("SHOULD RUN cmd HERE:", docmd) log.Info("SHOULD RUN cmd HERE:", docmd)
@ -258,7 +258,7 @@ func doPublishVersion() bool {
// try to pull from google // try to pull from google
var result cmd.Status var result cmd.Status
if gopath == me.startRepo.GoPath { if gopath == me.startRepo.GetGoPath() {
log.Info("CAN NOT SELF UPDATE. cmd =", docmd) log.Info("CAN NOT SELF UPDATE. cmd =", docmd)
log.Info("go get must be run from somewhere else other than startRepo") log.Info("go get must be run from somewhere else other than startRepo")
log.Info("chdir to autotypist if it exists") log.Info("chdir to autotypist if it exists")

View File

@ -23,18 +23,18 @@ func findNext() bool {
for loop.Scan() { for loop.Scan() {
repo := loop.Repo() repo := loop.Repo()
check := me.forge.Repos.FindByGoPath(repo.GoPath()) check := me.forge.FindByGoPath(repo.GetGoPath())
if check == nil { if check == nil {
log.Info("boo, you didn't git clone", repo.GoPath()) log.Info("boo, you didn't git clone", repo.GetGoPath())
return false return false
} }
if check.GetTargetVersion() == check.GetCurrentBranchVersion() { if check.GetTargetVersion() == check.GetCurrentBranchVersion() {
// log.Info("findNext() no update needed", check.GoPath, check.GetTargetVersion(), "vs", check.GetCurrentBranchVersion()) // log.Info("findNext() no update needed", check.GetGoPath, check.GetTargetVersion(), "vs", check.GetCurrentBranchVersion())
continue continue
} else { } else {
log.Info("findNext() update needed", check.GoPath, check.GetTargetVersion(), "vs", check.GetCurrentBranchVersion()) log.Info("findNext() update needed", check.GetGoPath(), check.GetTargetVersion(), "vs", check.GetCurrentBranchVersion())
} }
if me.forge.Config.IsReadOnly(check.GoPath) { if me.forge.Config.IsReadOnly(check.GetGoPath()) {
log.Info("findNext() skipping readonly") log.Info("findNext() skipping readonly")
continue continue
} }
@ -86,7 +86,7 @@ func findNext() bool {
} else { } else {
log.Info("go.mod is gone here") log.Info("go.mod is gone here")
} }
log.Info("findNext() got to the end. repo", repo.GoPath(), "did not work. trying to find a new one now") log.Info("findNext() got to the end. repo", repo.GetGoPath(), "did not work. trying to find a new one now")
} }
if findCounter == 0 { if findCounter == 0 {
log.Info("NOTHING TO UPDATE. findCounter =", findCounter) log.Info("NOTHING TO UPDATE. findCounter =", findCounter)
@ -104,10 +104,10 @@ func runGoClean(check *gitpb.Repo) bool {
check.GoDeps = nil check.GoDeps = nil
cmd := []string{"go-mod-clean", "--strict"} cmd := []string{"go-mod-clean", "--strict"}
log.Info("Running", cmd, "in", check.GoPath) log.Info("Running", cmd, "in", check.GetGoPath())
result := check.Run(cmd) result := check.Run(cmd)
if result.Error != nil { if result.Error != nil {
log.Info(cmd, "failed with", result.Error, check.GoPath) log.Info(cmd, "failed with", result.Error, check.GetGoPath())
log.Info("STDOUT") log.Info("STDOUT")
log.Info(strings.Join(result.Stdout, "\n")) log.Info(strings.Join(result.Stdout, "\n"))
log.Info("STDERR") log.Info("STDERR")
@ -115,7 +115,7 @@ func runGoClean(check *gitpb.Repo) bool {
return false return false
} }
if result.Exit != 0 { if result.Exit != 0 {
log.Info(cmd, "failed with", result.Exit, check.GoPath) log.Info(cmd, "failed with", result.Exit, check.GetGoPath())
log.Info("STDOUT") log.Info("STDOUT")
log.Info(strings.Join(result.Stdout, "\n")) log.Info(strings.Join(result.Stdout, "\n"))
log.Info("STDERR") log.Info("STDERR")
@ -137,7 +137,7 @@ func fixGodeps(check *gitpb.Repo) bool {
} }
// skip primative ones // skip primative ones
if ok, _ := check.IsPrimitive(); ok { if ok, _ := check.IsPrimitive(); ok {
log.Info("fixGoDeps() skipping primitive", check.GoPath) log.Info("fixGoDeps() skipping primitive", check.GetGoPath())
return true return true
} }
log.Printf("current repo %s go dependancy count: %d", check.GetGoPath(), check.GoDepsLen()) log.Printf("current repo %s go dependancy count: %d", check.GetGoPath(), check.GoDepsLen())
@ -145,13 +145,13 @@ func fixGodeps(check *gitpb.Repo) bool {
for deps.Scan() { for deps.Scan() {
depRepo := deps.Next() depRepo := deps.Next()
// log.Info("found dep", depRepo.GetGoPath()) // log.Info("found dep", depRepo.GetGoPath())
if me.forge.Config.IsReadOnly(depRepo.GoPath) { if me.forge.Config.IsReadOnly(depRepo.GetGoPath()) {
log.Info("IsReadOnly = true", depRepo.GetGoPath()) log.Info("IsReadOnly = true", depRepo.GetGoPath())
continue continue
} else { } else {
// log.Info("IsReadOnly = false", depRepo.GetGoPath()) // log.Info("IsReadOnly = false", depRepo.GetGoPath())
} }
found := me.forge.Repos.FindByGoPath(depRepo.GetGoPath()) found := me.forge.FindByGoPath(depRepo.GetGoPath())
if found == nil { if found == nil {
log.Info("not found:", depRepo.GetGoPath()) log.Info("not found:", depRepo.GetGoPath())
continue continue
@ -167,13 +167,13 @@ func fixGodeps(check *gitpb.Repo) bool {
} }
func setCurrentRepo(repo *repolist.RepoRow, s string, note string) bool { func setCurrentRepo(repo *repolist.RepoRow, s string, note string) bool {
check := me.forge.Repos.FindByGoPath(repo.GoPath()) check := me.forge.FindByGoPath(repo.GetGoPath())
if check == nil { if check == nil {
log.Info("boo, you didn't git clone", repo.GoPath()) log.Info("boo, you didn't git clone", repo.GetGoPath())
return false return false
} }
me.release.repo.SetText(check.GoPath) me.release.repo.SetText(check.GetGoPath())
me.release.status.SetText(s) me.release.status.SetText(s)
me.release.notes.SetText(note) me.release.notes.SetText(note)
me.current = repo me.current = repo

14
http.go
View File

@ -161,9 +161,9 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
testNext() testNext()
return return
case "/fixNext": case "/fixNext":
check := me.forge.Repos.FindByGoPath(me.current.GoPath()) check := me.forge.FindByGoPath(me.current.GetGoPath())
if check == nil { if check == nil {
log.Info("boo, you didn't git clone", me.current.GoPath()) log.Info("boo, you didn't git clone", me.current.GetGoPath())
return return
} }
// destroy and recreate the go.sum // destroy and recreate the go.sum
@ -229,9 +229,9 @@ func startHTTP() {
func testNext() { func testNext() {
// re-scans the go.sum file. DOES NOT MODIFY ANYTHING // re-scans the go.sum file. DOES NOT MODIFY ANYTHING
check := me.forge.Repos.FindByGoPath(me.current.GoPath()) check := me.forge.FindByGoPath(me.current.GetGoPath())
if check == nil { if check == nil {
log.Info("boo, you didn't git clone", me.current.GoPath()) log.Info("boo, you didn't git clone", me.current.GetGoPath())
return return
} }
@ -257,9 +257,9 @@ func showNext() {
return return
} }
check := me.forge.Repos.FindByGoPath(me.current.GoPath()) check := me.forge.FindByGoPath(me.current.GetGoPath())
if check == nil { if check == nil {
log.Info("forge: how was this not found?", me.current.GoPath()) log.Info("forge: how was this not found?", me.current.GetGoPath())
return return
} }
@ -278,7 +278,7 @@ func showNext() {
} else { } else {
log.Info("IsPrimitive() == false") log.Info("IsPrimitive() == false")
} }
if me.forge.Config.IsPrivate(check.GoPath) { if me.forge.Config.IsPrivate(check.GetGoPath()) {
log.Info("IsPrivate() == true") log.Info("IsPrivate() == true")
} else { } else {
log.Info("IsPrivate() == false") log.Info("IsPrivate() == false")

View File

@ -25,7 +25,7 @@ func PrintReport(readonly string, onlydirty string, perfect string) {
continue continue
} }
if me.forge.Config.IsReadOnly(repo.GoPath()) { if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
if readonly == "true" { if readonly == "true" {
log.Info(header + "readonly") log.Info(header + "readonly")
} }
@ -45,9 +45,9 @@ func PrintReport(readonly string, onlydirty string, perfect string) {
continue continue
} }
log.Info(header + "") log.Info(header + "")
check := me.forge.Repos.FindByGoPath(repo.GoPath()) check := me.forge.FindByGoPath(repo.GetGoPath())
if check == nil { if check == nil {
log.Info("boo, you didn't git clone", repo.GoPath()) log.Info("boo, you didn't git clone", repo.GetGoPath())
continue continue
} }
me.forge.StandardReleaseHeader(check, repo.State()) me.forge.StandardReleaseHeader(check, repo.State())
@ -60,10 +60,10 @@ func PrintReleaseReport(readonly string, perfect string) int {
log.Info(repolist.ReleaseReportHeader()) log.Info(repolist.ReleaseReportHeader())
loop := me.forge.Repos.SortByGoPath() loop := me.forge.Repos.SortByFullPath()
for loop.Scan() { for loop.Scan() {
check := loop.Next() check := loop.Next()
if me.forge.Config.IsReadOnly(check.GoPath) { if me.forge.Config.IsReadOnly(check.GetGoPath()) {
continue continue
} }
if check.GetCurrentBranchVersion() == check.GetTargetVersion() { if check.GetCurrentBranchVersion() == check.GetTargetVersion() {
@ -71,7 +71,7 @@ func PrintReleaseReport(readonly string, perfect string) int {
} }
count += 1 count += 1
if check == nil { if check == nil {
log.Info("boo, you didn't git clone", check.GoPath) log.Info("boo, you didn't git clone", check.GetGoPath())
continue continue
} }
var state string var state string

View File

@ -99,12 +99,12 @@ func main() {
loop := me.repos.View.ReposSortByName() loop := me.repos.View.ReposSortByName()
for loop.Scan() { for loop.Scan() {
repo := loop.Repo() repo := loop.Repo()
if me.forge.Config.IsReadOnly(repo.GoPath()) { if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
repo.Status.SetReadOnly(true) repo.Status.SetReadOnly(true)
} else { } else {
repo.Status.SetReadOnly(false) repo.Status.SetReadOnly(false)
} }
if me.forge.Config.IsPrivate(repo.GoPath()) { if me.forge.Config.IsPrivate(repo.GetGoPath()) {
repo.Status.SetPrivate(true) repo.Status.SetPrivate(true)
} else { } else {
repo.Status.SetPrivate(false) repo.Status.SetPrivate(false)

View File

@ -21,7 +21,7 @@ func makePrepareRelease() {
// reset all the target versions back to the current version // reset all the target versions back to the current version
// incase they were saved in the repos.pb file // incase they were saved in the repos.pb file
all := me.forge.Repos.SortByGoPath() all := me.forge.Repos.SortByFullPath()
for all.Scan() { for all.Scan() {
check := all.Next() check := all.Next()
@ -30,11 +30,11 @@ func makePrepareRelease() {
check.SetTargetVersion(curver) check.SetTargetVersion(curver)
} }
all = me.forge.Repos.SortByGoPath() all = me.forge.Repos.SortByFullPath()
for all.Scan() { for all.Scan() {
check := all.Next() check := all.Next()
if me.forge.Config.IsReadOnly(check.GoPath) { if me.forge.Config.IsReadOnly(check.GetGoPath()) {
// can't release readonly repos // can't release readonly repos
continue continue
} }
@ -46,7 +46,7 @@ func makePrepareRelease() {
continue continue
} }
if argv.Protobuf && check.RepoType() == "protobuf" { if argv.Protobuf && check.GetRepoType() == "protobuf" {
// if --protobuf, this will force upgrade each one // if --protobuf, this will force upgrade each one
forceReleaseVersion(check) forceReleaseVersion(check)
continue continue
@ -54,7 +54,7 @@ func makePrepareRelease() {
// if the repo is a go binary or plugin for a new release for // if the repo is a go binary or plugin for a new release for
// any library version change // any library version change
if check.RepoType() == "binary" || check.RepoType() == "plugin" { if check.GetRepoType() == "binary" || check.GetRepoType() == "plugin" {
// check if the package dependancies changed, if so, re-publish // check if the package dependancies changed, if so, re-publish
if me.forge.FinalGoDepsCheckOk(check) { if me.forge.FinalGoDepsCheckOk(check) {
log.Printf("go.sum is perfect! %s\n", check.GetGoPath()) log.Printf("go.sum is perfect! %s\n", check.GetGoPath())
@ -91,6 +91,6 @@ func forceReleaseVersion(repo *gitpb.Repo) {
repo.Run([]string{"git", "notes", "remove"}) repo.Run([]string{"git", "notes", "remove"})
if !runGoClean(repo) { if !runGoClean(repo) {
log.Info("go-mod-clean probably failed here. that's ok", repo.GoPath) log.Info("go-mod-clean probably failed here. that's ok", repo.GetGoPath())
} }
} }

View File

@ -104,7 +104,7 @@ func createReleaseBox(box *gui.Node) {
grid.NewButton("whitelist", func() { grid.NewButton("whitelist", func() {
// tmp := me.current.GoState() // tmp := me.current.GoState()
log.Info("trying to whitelist repo", me.current.GoPath()) log.Info("trying to whitelist repo", me.current.GetGoPath())
me.current.Status.Whitelist = true me.current.Status.Whitelist = true
findNext() findNext()
}) })
@ -201,12 +201,12 @@ func createReleaseBox(box *gui.Node) {
continue continue
} }
if repo.Status.Whitelist { if repo.Status.Whitelist {
log.Warn("skipping whitelist", repo.GoPath()) log.Warn("skipping whitelist", repo.GetGoPath())
continue continue
} }
good, files := repo.Status.GitLsFiles() good, files := repo.Status.GitLsFiles()
if !good { if !good {
log.Warn("Something went wrong", repo.GoPath()) log.Warn("Something went wrong", repo.GetGoPath())
continue continue
} }
for _, filename := range strings.Split(files, "\n") { for _, filename := range strings.Split(files, "\n") {