summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doRelease.go27
-rw-r--r--findNext.go34
-rw-r--r--prepareRelease.go109
-rw-r--r--releaseBox.go29
-rw-r--r--structs.go3
5 files changed, 53 insertions, 149 deletions
diff --git a/doRelease.go b/doRelease.go
index 3f4c215..d9aa51d 100644
--- a/doRelease.go
+++ b/doRelease.go
@@ -36,13 +36,6 @@ func doRelease() bool {
} else {
log.Info("go.mod missing")
return false
- /*
- pwd, _ := os.Getwd()
- log.Info("go.mod disappeared. need to run go mod init and go mod tidy here:", pwd)
- shell.RunRealtime([]string{"go", "mod", "init"})
- shell.RunRealtime([]string{"go", "mod", "tidy"})
- shell.RunRealtime([]string{"go", "mod", "edit", "-go=1.20"})
- */
}
curName := me.current.Status.GetCurrentBranchName()
@@ -206,16 +199,16 @@ func doPublishVersion() bool {
docmd := []string{"go", "get", "-v", gopath + "@" + me.release.version.String()}
log.Info("SHOULD RUN cmd HERE:", docmd)
- // right now, you can't publish this because the go.* files in this project are screwed up
- if me.release.guireleaser == nil {
- log.Info("CAN NOT SELF UPDATE HERE. cmd =", docmd)
- return false
- }
- homeDir, _ := os.UserHomeDir()
- gosum := filepath.Join(homeDir, "go/src/go.wit.com/apps/guireleaser/go.sum")
- if !shell.Exists(gosum) {
- log.Info("go.sum must exist here")
- me.release.guireleaser.MakeRedoMod()
+ testf := filepath.Join(me.forge.GetGoSrc(), "go.wit.com/apps/guireleaser", "go.sum")
+ if !shell.Exists(testf) {
+ pb := me.forge.Repos.FindByGoPath("go.wit.com/apps/guireleaser")
+ if pb != nil {
+ pb.RedoGoMod() // hack for reset on guireleaser while publishing
+ }
+ if !shell.Exists(testf) {
+ log.Info("go.sum missing", testf)
+ panic("redo go.sum")
+ }
}
if me.current.Status.IsPrivate() {
// do not self update private repos
diff --git a/findNext.go b/findNext.go
index dbacc00..e78aeb3 100644
--- a/findNext.go
+++ b/findNext.go
@@ -101,25 +101,26 @@ func findNext() bool {
func fixGodeps(check *gitpb.Repo) bool {
var good bool = true
// check if the package dependancies changed, if so, re-publish
+ cmd := []string{"go-clean", "--auto"}
+ result := check.RunRealtime(cmd)
+ if result.Error != nil {
+ log.Info(cmd, "failed with", result.Error, check.GoPath)
+ return false
+ }
+ if result.Exit != 0 {
+ log.Info(cmd, "failed with", result.Exit, check.GoPath)
+ return false
+ }
+ check.GoDeps = nil
// skip primative ones
if ok, _ := check.IsPrimitive(); ok {
log.Info("fixGoDeps() skipping primitive", check.GoPath)
return true
}
- ok, err := check.RedoGoMod()
- if err != nil {
- log.Info("fixGoDeps() RedoGoMod() error", err)
- return false
- }
- if !ok {
- log.Info("gitpb.RedoGoMod() returned false", check.GetGoPath())
+ if ok, err := check.ParseGoSum(); !ok {
+ log.Info("ParseGoSum() failed", err)
return false
}
- if check.GoDeps == nil {
- cmd := []string{"go", "mod", "edit", "-go=1.20"}
- check.Run(cmd)
- return true
- }
log.Printf("current repo %s go dependancy count: %d", check.GetGoPath(), check.GoDepsLen())
deps := check.GoDeps.SortByGoPath()
for deps.Scan() {
@@ -143,15 +144,6 @@ func fixGodeps(check *gitpb.Repo) bool {
check.Run(cmd)
}
}
- cmd := []string{"go", "mod", "tidy"}
- check.Run(cmd)
- cmd = []string{"go", "mod", "edit", "-go=1.20"}
- check.Run(cmd)
- check.GoDeps = nil
- if ok, err := check.ParseGoSum(); !ok {
- log.Info("ParseGoSum() failed", err)
- return false
- }
return good
}
diff --git a/prepareRelease.go b/prepareRelease.go
index 952d41a..a50a8d7 100644
--- a/prepareRelease.go
+++ b/prepareRelease.go
@@ -1,8 +1,6 @@
package main
import (
- "os"
-
"go.wit.com/log"
)
@@ -20,109 +18,54 @@ func makePrepareRelease() {
log.Info("setAllBranchesToMaster() failed")
}
- // 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()
-
- // 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)
- }
+ // reset all the target versions back to the current version
+ // incase they were saved in the repos.pb file
+ all := me.forge.Repos.SortByGoPath()
+ for all.Scan() {
+ check := all.Next()
// set the target version to the current master version
- curver := repo.Status.GetMasterVersion()
+ curver := check.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)
- }
+ all := me.forge.Repos.SortByGoPath()
+ for all.Scan() {
+ check := all.Next()
+
if !me.forge.FinalGoDepsCheckOk(check) {
fixGodeps(check)
}
}
}
- // 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)
- }
+ all = me.forge.Repos.SortByGoPath()
+ for all.Scan() {
+ check := all.Next()
- // 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)
+ // if master != lastTag, always increment
+ master := check.GetMasterVersion()
+ lastTag := check.GetLastTag()
+ if master != lastTag {
+ // if v1.2.3 change to v.1.2.4
+ check.IncrementTargetRevision()
+ continue
}
- // check if the package dependancies changed, if so, re-publish
- if !check.GoPrimitive {
+
+ // if the repo is a go binary, try forcing new go.* files
+ if check.RepoType() == "binary" {
+ // 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())
} 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)
+ // if v1.2.3 change to v.1.2.4
+ check.IncrementTargetRevision()
}
}
- // see if there is a new version
- master := repo.Status.GetMasterVersion()
- lastTag := repo.Status.LastTag()
- if master == lastTag {
- repo.Status.SetTargetVersion(master)
- } else {
- repo.Status.IncrementRevisionVersion("Nov 2024 test")
- 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)
- }
- }
}
if findNext() {
log.Info("prepare release findNext() returned true")
diff --git a/releaseBox.go b/releaseBox.go
index f62e9e2..cfde8ec 100644
--- a/releaseBox.go
+++ b/releaseBox.go
@@ -4,7 +4,6 @@ package main
import (
"fmt"
"os"
- "path/filepath"
"strings"
"time"
@@ -13,7 +12,6 @@ import (
"go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/repolist"
- "go.wit.com/lib/gui/shell"
)
type releaseStruct struct {
@@ -33,7 +31,6 @@ type releaseStruct struct {
goGetB *gui.Node
checkGoSumB *gui.Node
checkDirtyB *gui.Node
- makeRedomodB *gui.Node
sendVersionB *gui.Node
checkSafeB *gui.Node
whitelist map[string]*repolist.RepoRow
@@ -98,31 +95,13 @@ 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.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()
- homeDir, err := os.UserHomeDir()
- if err != nil {
- log.Warn("Error getting home directory:", err)
- homeDir = "/home/autotypist"
- }
- me.userHomePwd.SetText(homeDir)
- srcDir := filepath.Join(homeDir, "go/src")
- me.goSrcPwd.SetText(srcDir)
-
- testf := filepath.Join(srcDir, "go.wit.com/apps/guireleaser", "go.sum")
- if !shell.Exists(testf) {
- pb := me.forge.Repos.FindByGoPath("go.wit.com/apps/guireleaser")
- if pb != nil {
- pb.RedoGoMod()
- }
- if !shell.Exists(testf) {
- log.Info("go.sum missing", testf)
- panic("redo go.sum")
- }
- }
+ // me.userHomePwd.SetText(homeDir)
+ me.goSrcPwd.SetText(me.forge.GetGoSrc())
group := me.release.box.NewGroup("Run on Current Repo")
grid := group.NewGrid("buildOptions", 0, 0)
diff --git a/structs.go b/structs.go
index 9dc7936..6cc8b4e 100644
--- a/structs.go
+++ b/structs.go
@@ -60,9 +60,6 @@ type autoType struct {
// The current working directory
autoWorkingPwd *gadgets.OneLiner
- // shows what is being used as your home dir
- userHomePwd *gadgets.OneLiner
-
// shows what directory being used as ~/go/src
goSrcPwd *gadgets.OneLiner