dump old doRelease() all code. terrible code

This commit is contained in:
Jeff Carr 2025-01-30 03:06:49 -06:00
parent d81a1f6cb9
commit 8d4687e2c1
Notes: Jeff Carr 2025-01-30 03:13:27 -06:00
// `autogen:go.mod`

module go.wit.com/apps/guireleaser

go 1.21

toolchain go1.23.4

require (
	go.wit.com/dev/alexflint/arg v1.5.5
	go.wit.com/gui v0.22.23
	go.wit.com/lib/debugger v0.22.6
	go.wit.com/lib/fhelp v0.0.4
	go.wit.com/lib/gadgets v0.22.6
	go.wit.com/lib/gui/logsettings v0.22.6
	go.wit.com/lib/gui/repolist v0.22.43
	go.wit.com/lib/gui/shell v0.22.23
	go.wit.com/lib/protobuf/forgepb v0.0.66
	go.wit.com/lib/protobuf/gitpb v0.0.68
	go.wit.com/log v0.22.10
)

require (
	github.com/destel/rill v0.6.0 // indirect
	github.com/go-cmd/cmd v1.4.3 // indirect
	github.com/google/uuid v1.6.0 // indirect
	go.wit.com/dev/alexflint/scalar v1.2.4 // indirect
	go.wit.com/lib/gui/repostatus v0.22.39 // indirect
	go.wit.com/lib/protobuf/zoopb v0.0.22 // indirect
	go.wit.com/widget v1.1.27 // indirect
	golang.org/x/text v0.21.0 // indirect
	google.golang.org/protobuf v1.36.4 // indirect
)

// `autogen:go.sum`

github.com/destel/rill v0.6.0 h1:8MQRzS6k0akKmwNZFahKIhG1dkBeNxMoWKSfOxkaJNw=
github.com/destel/rill v0.6.0/go.mod h1:srKuXzvGqINUEGYR5b/iwvW+L9/S35RxVHWGYbXNoO4=
github.com/go-cmd/cmd v1.4.3 h1:6y3G+3UqPerXvPcXvj+5QNPHT02BUw7p6PsqRxLNA7Y=
github.com/go-cmd/cmd v1.4.3/go.mod h1:u3hxg/ry+D5kwh8WvUkHLAMe2zQCaXd00t35WfQaOFk=
github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg=
github.com/go-test/deep v1.1.0/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
go.wit.com/dev/alexflint/arg v1.5.5 h1:c4jgIb4OvHjnCMRNSjOa1sNLl6WDxV6tIkMVezR9hCk=
go.wit.com/dev/alexflint/arg v1.5.5/go.mod h1:nH3F6TJDaAUgnLkC0WgRN/H047YfN1TYKaWPYr6B8lo=
go.wit.com/dev/alexflint/scalar v1.2.4 h1:zmBeEkObwz1lcelwfGNYP2GS6SQ9e0tdv7JdHwMZEEk=
go.wit.com/dev/alexflint/scalar v1.2.4/go.mod h1:kCNO1Fo5LnnK6+qa+zYhP5fdgfC1C+vx1ti99Md+FAM=
go.wit.com/gui v0.22.23 h1:bvbnV+o2YWeZsLT859PYUZKfouJepnNFwqbE17CfOmU=
go.wit.com/gui v0.22.23/go.mod h1:BLB9puy4uNoJYA4WB5LBc7aB3mXavgh4mVLB36WuiTk=
go.wit.com/lib/debugger v0.22.6 h1:30FgxpFKwZZ3rmqwtQFHCZ8QwHGn7Xa48BVbkJeQ7Kc=
go.wit.com/lib/debugger v0.22.6/go.mod h1:r+D+NZ4pkp+nA/2nAA7UerWswwqBjVDkiFjWPWUhJJM=
go.wit.com/lib/fhelp v0.0.4 h1:VxWgMZuu/62Je13bcJHImgAk5MPaaYiXFLPmjhHmucs=
go.wit.com/lib/fhelp v0.0.4/go.mod h1:nw8oykiPsHsSXNGV0w+YmUYUsRNmQfxyqkaXSPRw8NI=
go.wit.com/lib/gadgets v0.22.6 h1:7ajBzCRftjZ170aa+QLhxuIL4eXK76kFLATD3tkxcKY=
go.wit.com/lib/gadgets v0.22.6/go.mod h1:3eMOLDlSyY6vohlUheTCB74PwYxhpHkX1KGZXTSOgdE=
go.wit.com/lib/gui/logsettings v0.22.6 h1:XZnERj6H+rTaD2nLFdb87qg14u9d2W4Ax4ObV8dmWO4=
go.wit.com/lib/gui/logsettings v0.22.6/go.mod h1:Njyvv5mgUU/d5BPi2Mcb660ZZiNB2DbF9X6DFChuBDo=
go.wit.com/lib/gui/repolist v0.22.43 h1:Wo+Q5pRs0ZMfIM1T54tsKt8nvurh8b+hQ7d9/YPxs6I=
go.wit.com/lib/gui/repolist v0.22.43/go.mod h1:yzrf1XfztSRRcz2AUdBD54aat0LKM+IvkaTPVurEX0U=
go.wit.com/lib/gui/repostatus v0.22.39 h1:RySdXCj8cHhBxgcftyw6hb8K7cL5CQrRrXpA7BYGvBk=
go.wit.com/lib/gui/repostatus v0.22.39/go.mod h1:Q8kM2Vyb6opJXqeuL+U4Dkf+hCcF5IYMATAQdUZ0Dco=
go.wit.com/lib/gui/shell v0.22.23 h1:U6Njsme2NU7ntcopcSXHD9bNYZzzeQueSTRB/L1YrgE=
go.wit.com/lib/gui/shell v0.22.23/go.mod h1:K6+ULaS8xQFcsi1QoWHY1+PM/vS+IRSyJvbnJF9GyIQ=
go.wit.com/lib/protobuf/forgepb v0.0.66 h1:yCbT6ZGBrP8J2KWacHw4f3LhlbyeaelX5LET/xS1hDs=
go.wit.com/lib/protobuf/forgepb v0.0.66/go.mod h1:8mfgxCfeFY5OvMDyNNS6J+X+3R1TrETRtEOKAilmdeA=
go.wit.com/lib/protobuf/gitpb v0.0.68 h1:ZVIIoWV56w9mesRwE0v1HmJMRcmWQWKv7os+kbahK5o=
go.wit.com/lib/protobuf/gitpb v0.0.68/go.mod h1:zlLM/+9vajrXNVbczpoyYIraLokZ6My47wDgqo9Gobg=
go.wit.com/lib/protobuf/zoopb v0.0.22 h1:tAFwRGMepMz+AsEehtwW5mO7ljXspQCcY3qTOT/EgXI=
go.wit.com/lib/protobuf/zoopb v0.0.22/go.mod h1:iEec6TXYJjaeShv+vOfCuw/3uWnfm35ongl19T2l0v0=
go.wit.com/log v0.22.10 h1:rlSgaYjvxbpcmi9UBQO3ESmbd/jiyFdRQFoGOvpCEUc=
go.wit.com/log v0.22.10/go.mod h1:4uNPFBqhsAh8zNF+zxVEmC3c/9AZ8JeTfUUvRpddvLQ=
go.wit.com/widget v1.1.27 h1:Yd+qp6GZVwLiTTepShXSeWSDqjaCxLyfhU0ch2FrPZ8=
go.wit.com/widget v1.1.27/go.mod h1:OXIdWk7GhVJRLnHTvf45LbPNXGYG/JjbkfnmXtkoiYE=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.36.4 h1:6A3ZDJHn/eNqc1i+IdefRzy/9PokBTPvcqMySR7NNIM=
google.golang.org/protobuf v1.36.4/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=

// `autogen:`
3 changed files with 17 additions and 145 deletions

View File

@ -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 {

View File

@ -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

View File

@ -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()