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
}
check := me.forge.Repos.FindByGoPath(me.current.GoPath())
check := me.forge.FindByGoPath(me.current.GetGoPath())
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
}
if !me.forge.FinalGoDepsCheckOk(check) {
@ -57,15 +57,15 @@ func doRelease() bool {
badExit(errors.New(msg))
return false
}
if check.GoPath == me.startRepo.GoPath {
log.Info("CAN NOT SELF UPDATE.", check.GoPath, "is the same as os.Getwd()")
if check.GetGoPath() == me.startRepo.GetGoPath() {
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("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))
}
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("todo: error out earlier knowing this will upgrade")
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)
if err := check.ValidGoSum(); err != nil {
log.Info("ValidGoSum() error", check.GoPath, err)
msg := fmt.Sprint("ValidGoSum() error", check.GoPath, err)
log.Info("ValidGoSum() error", check.GetGoPath(), err)
msg := fmt.Sprint("ValidGoSum() error", check.GetGoPath(), err)
badExit(errors.New(msg))
}
@ -84,7 +84,7 @@ func doRelease() bool {
var autogen []string
all = append(all, []string{"git", "add", "-f", "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
} else {
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 {
pb.UpdatePublished()
// pb.UpdatePublished()
/* remove. earlier protected against nil
if !pb.IsPrimitive() {
loop := pb.Published.SortByGoPath()
@ -228,9 +228,9 @@ func doReleaseFindNext() bool {
log.Info("findNext() could not find anything")
return false
}
check := me.forge.Repos.FindByGoPath(me.current.GoPath())
check := me.forge.FindByGoPath(me.current.GetGoPath())
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
}
if findFix {
@ -246,7 +246,7 @@ func doReleaseFindNext() bool {
// this pulls the new tag from the golang package repository
// to insert the new version
func doPublishVersion() bool {
gopath := me.current.GoPath()
gopath := me.current.GetGoPath()
docmd := []string{"go", "get", "-v", gopath + "@" + me.release.version.String()}
log.Info("SHOULD RUN cmd HERE:", docmd)
@ -258,7 +258,7 @@ func doPublishVersion() bool {
// try to pull from google
var result cmd.Status
if gopath == me.startRepo.GoPath {
if gopath == me.startRepo.GetGoPath() {
log.Info("CAN NOT SELF UPDATE. cmd =", docmd)
log.Info("go get must be run from somewhere else other than startRepo")
log.Info("chdir to autotypist if it exists")

View File

@ -23,18 +23,18 @@ func findNext() bool {
for loop.Scan() {
repo := loop.Repo()
check := me.forge.Repos.FindByGoPath(repo.GoPath())
check := me.forge.FindByGoPath(repo.GetGoPath())
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
}
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
} 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")
continue
}
@ -86,7 +86,7 @@ func findNext() bool {
} else {
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 {
log.Info("NOTHING TO UPDATE. findCounter =", findCounter)
@ -104,10 +104,10 @@ func runGoClean(check *gitpb.Repo) bool {
check.GoDeps = nil
cmd := []string{"go-mod-clean", "--strict"}
log.Info("Running", cmd, "in", check.GoPath)
log.Info("Running", cmd, "in", check.GetGoPath())
result := check.Run(cmd)
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(strings.Join(result.Stdout, "\n"))
log.Info("STDERR")
@ -115,7 +115,7 @@ func runGoClean(check *gitpb.Repo) bool {
return false
}
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(strings.Join(result.Stdout, "\n"))
log.Info("STDERR")
@ -137,7 +137,7 @@ func fixGodeps(check *gitpb.Repo) bool {
}
// skip primative ones
if ok, _ := check.IsPrimitive(); ok {
log.Info("fixGoDeps() skipping primitive", check.GoPath)
log.Info("fixGoDeps() skipping primitive", check.GetGoPath())
return true
}
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() {
depRepo := deps.Next()
// 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())
continue
} else {
// log.Info("IsReadOnly = false", depRepo.GetGoPath())
}
found := me.forge.Repos.FindByGoPath(depRepo.GetGoPath())
found := me.forge.FindByGoPath(depRepo.GetGoPath())
if found == nil {
log.Info("not found:", depRepo.GetGoPath())
continue
@ -167,13 +167,13 @@ func fixGodeps(check *gitpb.Repo) 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 {
log.Info("boo, you didn't git clone", repo.GoPath())
log.Info("boo, you didn't git clone", repo.GetGoPath())
return false
}
me.release.repo.SetText(check.GoPath)
me.release.repo.SetText(check.GetGoPath())
me.release.status.SetText(s)
me.release.notes.SetText(note)
me.current = repo

14
http.go
View File

@ -161,9 +161,9 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
testNext()
return
case "/fixNext":
check := me.forge.Repos.FindByGoPath(me.current.GoPath())
check := me.forge.FindByGoPath(me.current.GetGoPath())
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
}
// destroy and recreate the go.sum
@ -229,9 +229,9 @@ func startHTTP() {
func testNext() {
// 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 {
log.Info("boo, you didn't git clone", me.current.GoPath())
log.Info("boo, you didn't git clone", me.current.GetGoPath())
return
}
@ -257,9 +257,9 @@ func showNext() {
return
}
check := me.forge.Repos.FindByGoPath(me.current.GoPath())
check := me.forge.FindByGoPath(me.current.GetGoPath())
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
}
@ -278,7 +278,7 @@ func showNext() {
} else {
log.Info("IsPrimitive() == false")
}
if me.forge.Config.IsPrivate(check.GoPath) {
if me.forge.Config.IsPrivate(check.GetGoPath()) {
log.Info("IsPrivate() == true")
} else {
log.Info("IsPrivate() == false")

View File

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

View File

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

View File

@ -21,7 +21,7 @@ func makePrepareRelease() {
// reset all the target versions back to the current version
// incase they were saved in the repos.pb file
all := me.forge.Repos.SortByGoPath()
all := me.forge.Repos.SortByFullPath()
for all.Scan() {
check := all.Next()
@ -30,11 +30,11 @@ func makePrepareRelease() {
check.SetTargetVersion(curver)
}
all = me.forge.Repos.SortByGoPath()
all = me.forge.Repos.SortByFullPath()
for all.Scan() {
check := all.Next()
if me.forge.Config.IsReadOnly(check.GoPath) {
if me.forge.Config.IsReadOnly(check.GetGoPath()) {
// can't release readonly repos
continue
}
@ -46,7 +46,7 @@ func makePrepareRelease() {
continue
}
if argv.Protobuf && check.RepoType() == "protobuf" {
if argv.Protobuf && check.GetRepoType() == "protobuf" {
// if --protobuf, this will force upgrade each one
forceReleaseVersion(check)
continue
@ -54,7 +54,7 @@ func makePrepareRelease() {
// if the repo is a go binary or plugin for a new release for
// 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
if me.forge.FinalGoDepsCheckOk(check) {
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"})
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() {
// 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
findNext()
})
@ -201,12 +201,12 @@ func createReleaseBox(box *gui.Node) {
continue
}
if repo.Status.Whitelist {
log.Warn("skipping whitelist", repo.GoPath())
log.Warn("skipping whitelist", repo.GetGoPath())
continue
}
good, files := repo.Status.GitLsFiles()
if !good {
log.Warn("Something went wrong", repo.GoPath())
log.Warn("Something went wrong", repo.GetGoPath())
continue
}
for _, filename := range strings.Split(files, "\n") {