dump old doRelease() all code. terrible code
This commit is contained in:
parent
d81a1f6cb9
commit
8d4687e2c1
49
doRelease.go
49
doRelease.go
|
@ -185,27 +185,13 @@ func doRelease() error {
|
|||
badExit(errors.New(msg))
|
||||
}
|
||||
|
||||
me.current.Reload()
|
||||
me.forge.SetConfigSave(true)
|
||||
me.forge.ConfigSave()
|
||||
log.Info("sleep 2")
|
||||
time.Sleep(2 * time.Second)
|
||||
printDone()
|
||||
|
||||
/*
|
||||
// run this each time something gets published successfully
|
||||
|
||||
// attempt to find another repo to release
|
||||
if !doReleaseFindNext() {
|
||||
log.Info("doReleaseFindNext() could not find a new", findCounter)
|
||||
log.Info("THIS PROBABLY MEANS THAT ACTUALLY WE ARE TOTALLY DONE?", findCounter)
|
||||
count := me.forge.PrintReleaseReport(me.found)
|
||||
log.Info("count =", count)
|
||||
os.Setenv("FindNextDone", "true")
|
||||
printDone()
|
||||
return false
|
||||
}
|
||||
printDone()
|
||||
*/
|
||||
rePrepareRelease()
|
||||
findNext()
|
||||
if me.current == nil {
|
||||
|
@ -218,39 +204,6 @@ func doRelease() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
// try to figure out if there is another package to update
|
||||
// returns true if it finds something
|
||||
func doReleaseFindNext() bool {
|
||||
// scan for new repo
|
||||
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
|
||||
}
|
||||
check := me.forge.FindByGoPath(me.current.GetGoPath())
|
||||
if check == nil {
|
||||
log.Info("boo, you didn't git clone", me.current.GetGoPath())
|
||||
return false
|
||||
}
|
||||
// took this out 2025-01-20. things were working perfectly before this
|
||||
// if findFix {
|
||||
// fixGodeps(check)
|
||||
// }
|
||||
if err := me.forge.FinalGoDepsCheckOk(check, false); err == nil {
|
||||
// the go.sum file is ok to release
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
*/
|
||||
|
||||
// this pulls the new tag from the golang package repository
|
||||
// to insert the new version
|
||||
func doPublishVersion() bool {
|
||||
|
|
|
@ -200,19 +200,20 @@ func fixGodeps(check *gitpb.Repo) bool {
|
|||
}
|
||||
|
||||
func setCurrentRepo(check *gitpb.Repo, s string, note string) bool {
|
||||
me.current = check
|
||||
if check == nil {
|
||||
me.release.repo.SetText("")
|
||||
me.release.version.SetText("")
|
||||
me.release.releaseVersionB.SetText("nope")
|
||||
me.release.version.SetText("badver")
|
||||
} else {
|
||||
me.release.repo.SetText(check.GetGoPath())
|
||||
me.release.version.SetText(check.GetTargetVersion())
|
||||
me.release.releaseVersionB.SetText("release version " + check.GetTargetVersion())
|
||||
me.release.version.SetText(check.GetTargetVersion())
|
||||
}
|
||||
me.release.status.SetText(s)
|
||||
me.release.notes.SetText(note)
|
||||
me.current = check
|
||||
me.release.version.SetText(check.GetTargetVersion())
|
||||
me.release.openrepo.Enable()
|
||||
|
||||
return true
|
||||
|
|
108
releaseBox.go
108
releaseBox.go
|
@ -2,9 +2,6 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/log"
|
||||
|
||||
|
@ -100,8 +97,6 @@ func createReleaseBox(box *gui.Node) {
|
|||
|
||||
me.autoWorkingPwd = gadgets.NewOneLiner(me.release.grid, "working directory (pwd)")
|
||||
me.release.grid.NextRow()
|
||||
// me.userHomePwd = gadgets.NewOneLiner(me.release.grid, "user home")
|
||||
// me.release.grid.NextRow()
|
||||
me.goSrcPwd = gadgets.NewOneLiner(me.release.grid, "go src home")
|
||||
me.release.grid.NextRow()
|
||||
|
||||
|
@ -111,110 +106,33 @@ func createReleaseBox(box *gui.Node) {
|
|||
group := me.release.box.NewGroup("Run on Current Repo")
|
||||
grid := group.NewGrid("buildOptions", 0, 0)
|
||||
|
||||
grid.NewButton("whitelist", func() {
|
||||
// tmp := me.current.GoState()
|
||||
if repov := me.repos.View.FindByPath(me.current.GetGoPath()); repov != nil {
|
||||
log.Info("trying to whitelist repo", me.current.GetGoPath())
|
||||
}
|
||||
findNext()
|
||||
})
|
||||
/*
|
||||
grid.NewButton("whitelist", func() {
|
||||
})
|
||||
*/
|
||||
|
||||
grid.NextRow()
|
||||
|
||||
group = me.release.box.NewGroup("Process against all repos")
|
||||
group = me.release.box.NewGroup("Publish until done")
|
||||
grid = group.NewGrid("buildOptions", 0, 0)
|
||||
grid.NewButton("doRelease() all", func() {
|
||||
buttonDisable()
|
||||
// rather than loop forever, at least limit this to the number of repos
|
||||
// incase something, somewhere, goes wrong
|
||||
ok, duration := doReleaseAll()
|
||||
s := fmt.Sprint(duration)
|
||||
log.Info("release returned", ok, "and ran for", s, "findCounter =", findCounter)
|
||||
if !findOk {
|
||||
log.Info("doRelease() immediately end something went wrong last time. findOk == false")
|
||||
return
|
||||
}
|
||||
first := findCounter
|
||||
if findCounter != 0 {
|
||||
log.Info("should try thsi doRelease() loop again since findCounter =", findCounter)
|
||||
ok, duration := doReleaseAll()
|
||||
s := fmt.Sprint(duration)
|
||||
log.Info("release returned", ok, "and ran for", s, "findCounter =", findCounter)
|
||||
}
|
||||
if !findOk {
|
||||
log.Info("doRelease() immediately end something went wrong last time. findOk == false")
|
||||
return
|
||||
}
|
||||
second := findCounter
|
||||
log.Info("doReleaseAll() first =", first, "second =", second)
|
||||
if first == 0 {
|
||||
log.Info("doReleaseAll() first is 0. everything is done. second is", second)
|
||||
log.Info("exit() here safely")
|
||||
me.forge.ConfigSave()
|
||||
printDone()
|
||||
okExit("")
|
||||
return
|
||||
}
|
||||
|
||||
if first != second {
|
||||
// try a third time
|
||||
log.Info("doReleaseAll() first second do not match. findNext()")
|
||||
findNext()
|
||||
ok, duration := doReleaseAll()
|
||||
s := fmt.Sprint(duration)
|
||||
log.Info("release returned", ok, "and ran for", s, "findCounter =", findCounter)
|
||||
third := findCounter
|
||||
log.Info("doReleaseAll() findCounter first =", first, "second =", second, "third =", third)
|
||||
if !findOk {
|
||||
log.Info("doRelease() immediately end something went wrong last time. findOk == false")
|
||||
return
|
||||
count := 0
|
||||
for {
|
||||
log.Info("START doRelease() LOOP count =", count, "len me.done =", len(me.done))
|
||||
if err := doRelease(); err != nil {
|
||||
break
|
||||
}
|
||||
if (second == 0) && (third == 0) {
|
||||
log.Info("doReleaseAll() SaveConfig() here and Exit(0)")
|
||||
me.forge.ConfigSave()
|
||||
okExit("")
|
||||
count += 1
|
||||
if count > 20 {
|
||||
break
|
||||
}
|
||||
} else {
|
||||
log.Info("doReleaseAll() first second match. something has gone terribly wrong")
|
||||
log.Info("killing guireleaser is a bad idea here. it will potentially loose state")
|
||||
log.Info("the only way now is to parse 'go list' or ~/go/pkg/mod/<gopath>/go.sum files")
|
||||
log.Info("to determine the last known version to make sure everything is redone correctly")
|
||||
log.Info("this is the worst case. the better idea is to make sure it never fails")
|
||||
log.Info("and restarts correctly where it left off. That might not be possible?")
|
||||
log.Info("because 'go get @foo.com/bar@latest' appears to be global and so")
|
||||
log.Info("some go.sum files might be correct when some are not actually published")
|
||||
log.Info("TODO: is this true or not?")
|
||||
}
|
||||
|
||||
buttonEnable()
|
||||
})
|
||||
grid.NextRow()
|
||||
}
|
||||
|
||||
func doReleaseAll() (bool, time.Duration) {
|
||||
var worked bool = true
|
||||
findCounter = 0
|
||||
duration := repolist.TimeFunction(func() {
|
||||
loop := me.repos.View.ReposSortByName()
|
||||
for loop.Scan() {
|
||||
loop.Repo()
|
||||
if !findOk {
|
||||
log.Info("doRelease() immediately end something went wrong last time. findOk == false")
|
||||
worked = false
|
||||
break
|
||||
}
|
||||
if err := doRelease(); err == nil {
|
||||
log.Info("doRelease() worked. findCounter =", findCounter)
|
||||
} else {
|
||||
log.Info("doRelease() failed. findCounter =", findCounter, err)
|
||||
worked = false
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
return worked, duration
|
||||
}
|
||||
|
||||
func buttonDisable() {
|
||||
me.Disable()
|
||||
me.release.box.Disable()
|
||||
|
|
Loading…
Reference in New Issue