man this doesn't work right

This commit is contained in:
Jeff Carr 2024-12-02 08:45:13 -06:00
parent 1c8815685b
commit e9ecf2ed7e
7 changed files with 103 additions and 28 deletions

View File

@ -6,17 +6,18 @@ package main
this enables command line options from other packages like 'gui' and 'log'
*/
type argv struct {
type args struct {
// Repo string `arg:"positional" help:"go import path"`
// Increment bool `arg:"--increment" help:"auto increment"`
// Release bool `arg:"--release" help:"do a release an exit"`
DryRun bool `arg:"--dry-run,env:DRYRUN" help:"don't actually do the release"`
Fix bool `arg:"--fix" help:"run fixGoMod() on startup"`
Reason string `arg:"--reason" help:"tag message"`
DumpVersions bool `arg:"--dump-versions" help:"dump the versions file for go.wit.com"`
Port int `arg:"--port" default:"9419" help:"do fun stuff with curl"`
}
func (a argv) Description() string {
func (a args) Description() string {
return `
Example usage:
guireleaser go.wit.com/apps/go-clone --increment --release --dry-run --reason "blerg"
@ -25,6 +26,6 @@ This will pull down the go sources and
the repositories in the go.sum file using git clone`
}
func (argv) Version() string {
func (args) Version() string {
return "guireleaser " + VERSION
}

View File

@ -52,7 +52,9 @@ func doRelease() bool {
log.Info("boo, you didn't git clone", me.current.GoPath())
return false
}
if !me.forge.FinalGoDepsCheck(check) {
if !me.forge.FinalGoDepsCheckOk(check) {
log.Info("the go.mod file is wrong. fix it here?", check.GetGoPath())
os.Exit(-1)
return false
}
@ -134,7 +136,8 @@ func doRelease() bool {
}
log.Info("EVERYTHING OK. RERELEASED", me.current.Name())
// recreate go.mod / go.sum
// it's necessary to recreate the the files here
// safe to do this here. everything has been published
fixGodeps(me.current)
// update the values in the GUI
@ -152,6 +155,7 @@ func doRelease() bool {
}
// 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() {
@ -165,7 +169,8 @@ func doReleaseFindNext() bool {
log.Info("boo, you didn't git clone", me.current.GoPath())
return false
}
if me.forge.FinalGoDepsCheck(check) {
if me.forge.FinalGoDepsCheckOk(check) {
// the go.sum file is ok to release
return true
}
return false

View File

@ -46,7 +46,7 @@ func findNext() bool {
log.Info("boo, you didn't git clone", repo.GoPath())
return false
}
if me.forge.FinalGoDepsCheck(check) {
if me.forge.FinalGoDepsCheckOk(check) {
setCurrentRepo(repo, "should be good to release", "pretty sure")
return true
}

View File

@ -162,7 +162,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
log.Info("boo, you didn't git clone", me.current.GoPath())
return
}
if me.forge.FinalGoDepsCheck(check) {
if me.forge.FinalGoDepsCheckOk(check) {
log.Info("finalGoDepsCheck(check) worked!")
} else {
log.Info("finalGoDepsCheck(check) failed. boo.")
@ -220,7 +220,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
log.Info("Whitelist == false")
}
log.Info("")
fixGodeps(me.current)
log.Info(repolist.ReportHeader())
log.Info(me.current.StandardHeader())
@ -272,7 +271,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
func startHTTP() {
http.HandleFunc("/", okHandler)
p := fmt.Sprintf(":%d", myargs.Port)
p := fmt.Sprintf(":%d", argv.Port)
log.Println("Running on port", p)
err := http.ListenAndServe(p, nil)

View File

@ -18,7 +18,7 @@ var VERSION string
//go:embed resources/*
var resources embed.FS
var myargs argv
var argv args
func main() {
me = new(autoType)
@ -29,7 +29,7 @@ func main() {
os.Setenv("REPO_WORK_PATH", me.forge.GetGoSrc())
// parse the command line
arg.MustParse(&myargs)
arg.MustParse(&argv)
// save the ENV var here
me.releaseReasonS = os.Getenv("GUIRELEASE_REASON")
@ -83,7 +83,7 @@ func main() {
// which should be all the git repositories in ~/go/src & the .config file
me.repos = makeRepoView()
if myargs.DumpVersions {
if argv.DumpVersions {
gowit.DumpVersions(me.repos.View)
os.Exit(0)
}

View File

@ -10,23 +10,80 @@ func makePrepareRelease() {
me.Disable()
me.release.box.Disable()
defer me.Enable()
// first reset all the target versions back to the current version
// incase there was a partial release process running that
// did not finish
loop := me.repos.View.ReposSortByName()
for loop.Scan() {
repo := loop.Repo()
// check if the package dependancies changed, if so, re-publish
// find the gitpb.Repo
check := me.forge.Repos.FindByGoPath(repo.GoPath())
if check == nil {
log.Info("boo, you didn't git clone", repo.GoPath())
os.Exit(-1)
}
if me.forge.FinalGoDepsCheck(check) {
log.Printf("dependancy checks indicate a new release is needed for %s\n", check.GetGoPath())
repo.Status.IncrementRevisionVersion("godeps changed")
target := repo.Status.GetTargetVersion()
check.SetTargetVersion(target)
continue
} else {
log.Printf("dependancies have not changed for %s\n", check.GetGoPath())
// set the target version to the current master version
curver := repo.Status.GetMasterVersion()
check.SetTargetVersion(curver)
}
// on startup, run fixGoDeps() on every go.sum that didn't match
if argv.Fix {
loop = me.repos.View.ReposSortByName()
for loop.Scan() {
repo := loop.Repo()
// find the gitpb.Repo
check := me.forge.Repos.FindByGoPath(repo.GoPath())
if check == nil {
log.Info("boo, you didn't git clone", repo.GoPath())
os.Exit(-1)
}
if !me.forge.FinalGoDepsCheckOk(check) {
fixGodeps(repo)
}
}
}
// now figure out what to release and increment the version
loop = me.repos.View.ReposSortByName()
for loop.Scan() {
repo := loop.Repo()
// find the gitpb.Repo
check := me.forge.Repos.FindByGoPath(repo.GoPath())
if check == nil {
log.Info("boo, you didn't git clone", repo.GoPath())
os.Exit(-1)
}
// if check.GetGoPath() == "go.wit.com/dev/alexflint/arg" {
if check.GetGoPath() == "go.wit.com/gui" {
log.Info("arg", check.GetGoPath(), check.GetMasterVersion(), check.GoPrimitive)
if me.forge.FinalGoDepsCheckOk(check) {
log.Info("arg final check true", check.GetGoPath())
} else {
log.Info("arg final check false", check.GetGoPath())
os.Exit(-1)
}
// see if there is a new version
master := repo.Status.GetMasterVersion()
lastTag := repo.Status.LastTag()
log.Info("arg ", master, lastTag)
// os.Exit(-1)
}
// check if the package dependancies changed, if so, re-publish
if !check.GoPrimitive {
if me.forge.FinalGoDepsCheckOk(check) {
log.Printf("go.sum is perfect! %s\n", check.GetGoPath())
} else {
log.Printf("dependancy checks indicate a new release is needed for %s\n", check.GetGoPath())
repo.Status.IncrementRevisionVersion("godeps changed")
target := repo.Status.GetTargetVersion()
check.SetTargetVersion(target)
continue
}
}
// see if there is a new version
@ -39,6 +96,25 @@ func makePrepareRelease() {
target := repo.Status.GetTargetVersion()
check.SetTargetVersion(target)
}
// if check.GetGoPath() == "go.wit.com/dev/alexflint/arg" {
// if check.GetGoPath() == "go.wit.com/gui" {
if check.GetGoPath() == "go.wit.com/dev/davecgh/spew" {
log.Info(repo.StandardReleaseHeader())
log.Info(me.forge.StandardReleaseHeader(check, repo.State()))
log.Info("arg", check.GetGoPath(), check.GetMasterVersion(), check.GoPrimitive)
if me.forge.FinalGoDepsCheckOk(check) {
log.Info("go.sum is perfect")
} else {
log.Info("go.sum check false")
}
// see if there is a new version
master := repo.Status.GetMasterVersion()
lastTag := repo.Status.LastTag()
log.Info("arg ", master, lastTag)
if master != lastTag {
os.Exit(-1)
}
}
}
findNext()
if setAllBranchesToMaster() {

View File

@ -133,12 +133,6 @@ func createReleaseBox(box *gui.Node) {
findNext()
})
me.release.checkGoSumB = grid.NewButton("fixGoDeps()", func() {
buttonDisable()
fixGodeps(me.current)
buttonEnable()
})
grid.NextRow()
group = me.release.box.NewGroup("Process against all repos")