logic is better
This commit is contained in:
parent
6f39827fb9
commit
d1708d6a4b
41
doRelease.go
41
doRelease.go
|
@ -3,7 +3,6 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -227,18 +226,12 @@ func doPublishVersion() bool {
|
||||||
docmd := []string{"go", "get", "-v", gopath + "@" + me.release.version.String()}
|
docmd := []string{"go", "get", "-v", gopath + "@" + me.release.version.String()}
|
||||||
log.Info("SHOULD RUN cmd HERE:", docmd)
|
log.Info("SHOULD RUN cmd HERE:", docmd)
|
||||||
|
|
||||||
testf := filepath.Join(me.forge.GetGoSrc(), "go.wit.com/apps/guireleaser", "go.sum")
|
if !me.startRepo.Exists("go.mod") {
|
||||||
if !shell.Exists(testf) {
|
log.Info("go.sum missing in", me.startRepo.GoPath)
|
||||||
pb := me.forge.Repos.FindByGoPath("go.wit.com/apps/guireleaser")
|
log.Info("pick a different repo here")
|
||||||
if pb != nil {
|
log.Info("todo: error out earlier knowing this will upgrade")
|
||||||
if err := pb.RunStrict([]string{"go-mod-clean"}); err != nil {
|
log.Info("versions", me.startRepo.GetTargetVersion(), me.startRepo.GetMasterVersion())
|
||||||
log.Info("go-mod-clean failed", err)
|
panic("redo go.sum")
|
||||||
}
|
|
||||||
}
|
|
||||||
if !shell.Exists(testf) {
|
|
||||||
log.Info("go.sum missing", testf)
|
|
||||||
panic("redo go.sum")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if me.current.Status.IsPrivate() {
|
if me.current.Status.IsPrivate() {
|
||||||
// do not self update private repos
|
// do not self update private repos
|
||||||
|
@ -248,23 +241,17 @@ func doPublishVersion() bool {
|
||||||
|
|
||||||
// try to pull from google
|
// try to pull from google
|
||||||
var result cmd.Status
|
var result cmd.Status
|
||||||
if gopath == "go.wit.com/apps/guireleaser" {
|
if gopath == me.startRepo.GoPath {
|
||||||
log.Info("CAN NOT SELF UPDATE. cmd =", docmd)
|
log.Info("CAN NOT SELF UPDATE. cmd =", docmd)
|
||||||
log.Info("go get must be run from somewhere else other than guireleaser")
|
log.Info("go get must be run from somewhere else other than guireleaser")
|
||||||
log.Info("chdir to autotypist if it exists")
|
log.Info("chdir to autotypist if it exists")
|
||||||
if shell.Exists("/home/jcarr/go/src/go.wit.com/apps/autotypist") {
|
os.Exit(-1)
|
||||||
os.Chdir("/home/jcarr/go/src/go.wit.com/apps/autotypist")
|
|
||||||
} else {
|
|
||||||
log.Info("need to chdir somewhere with go.sum & go.mod")
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
// result = shell.PathRun("/home/jcarr/go/src/go.wit.com/apps/autotypist", docmd)
|
|
||||||
} else {
|
|
||||||
// publish go.mod & go.sum for use with go
|
|
||||||
os.Unsetenv("GO111MODULE")
|
|
||||||
log.Info("TRYING TO SELF UPDATE HERE. cmd =", docmd)
|
|
||||||
result = me.release.guireleaser.Status.Run(docmd)
|
|
||||||
}
|
}
|
||||||
|
// publish go.mod & go.sum for use with go
|
||||||
|
os.Unsetenv("GO111MODULE")
|
||||||
|
log.Info("TRYING TO SELF UPDATE HERE. cmd =", docmd)
|
||||||
|
result = me.startRepo.Run(docmd)
|
||||||
|
|
||||||
if result.Error != nil {
|
if result.Error != nil {
|
||||||
log.Info("SELF UPDATE FAILED. error =", result.Error)
|
log.Info("SELF UPDATE FAILED. error =", result.Error)
|
||||||
log.Info("SELF UPDATE FAILED. exit =", result.Exit)
|
log.Info("SELF UPDATE FAILED. exit =", result.Exit)
|
||||||
|
@ -279,7 +266,7 @@ func doPublishVersion() bool {
|
||||||
log.Info("SELF UPDATE FAILED")
|
log.Info("SELF UPDATE FAILED")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
log.Info("SELF UPDATE OK. out =", result.Stdout)
|
log.Info("SELF UPDATE OK. out =", strings.Join(result.Stdout, "\n"))
|
||||||
log.Info("SELF UPDATE WORKED")
|
log.Info("SELF UPDATE WORKED")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
34
main.go
34
main.go
|
@ -65,17 +65,6 @@ func main() {
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// sanity check of things that might be around that mess
|
|
||||||
// up things later
|
|
||||||
// check to make sure we have a go.sum here
|
|
||||||
gosum := filepath.Join(homeDir, "go/src/go.wit.com/apps/guireleaser/go.sum")
|
|
||||||
if !shell.Exists(gosum) {
|
|
||||||
log.Info("go.sum must exist here")
|
|
||||||
os.Exit(0)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
log.Info("Creating the Release Window")
|
log.Info("Creating the Release Window")
|
||||||
|
|
||||||
// initialize the repo list window
|
// initialize the repo list window
|
||||||
|
@ -122,28 +111,9 @@ func main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// the repo from the command line
|
me.startRepo = me.forge.Repos.FindByGoPath("go.wit.com/apps/helloworld")
|
||||||
// var myrepo *repolist.RepoRow
|
|
||||||
|
|
||||||
// find myself. the guireleaser directory is used as a working scratchpad
|
if me.startRepo == nil {
|
||||||
// for running go commands that can mess up the go.* files
|
|
||||||
loop = me.repos.View.ReposSortByName()
|
|
||||||
for loop.Scan() {
|
|
||||||
repo := loop.Repo()
|
|
||||||
if repo.GoPath() == "go.wit.com/apps/guireleaser" {
|
|
||||||
if me.release.guireleaser == nil {
|
|
||||||
me.release.guireleaser = repo
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log.Info("repolist.ReposSortByName() found", repo.GoPath())
|
|
||||||
/*
|
|
||||||
if repo.GoPath() == myargs.Repo {
|
|
||||||
myrepo = repo
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
if me.release.guireleaser == nil {
|
|
||||||
log.Info("Can not release if guireleaser was not found")
|
log.Info("Can not release if guireleaser was not found")
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,10 +34,6 @@ type releaseStruct struct {
|
||||||
sendVersionB *gui.Node
|
sendVersionB *gui.Node
|
||||||
checkSafeB *gui.Node
|
checkSafeB *gui.Node
|
||||||
whitelist map[string]*repolist.RepoRow
|
whitelist map[string]*repolist.RepoRow
|
||||||
|
|
||||||
// store myself here. use myself to
|
|
||||||
// do garbage go get tests and other potential junk
|
|
||||||
guireleaser *repolist.RepoRow
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *autoType) Disable() {
|
func (w *autoType) Disable() {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"go.wit.com/lib/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
"go.wit.com/lib/gui/repolist"
|
"go.wit.com/lib/gui/repolist"
|
||||||
"go.wit.com/lib/protobuf/forgepb"
|
"go.wit.com/lib/protobuf/forgepb"
|
||||||
|
"go.wit.com/lib/protobuf/gitpb"
|
||||||
)
|
)
|
||||||
|
|
||||||
var me *autoType
|
var me *autoType
|
||||||
|
@ -20,6 +21,11 @@ type autoType struct {
|
||||||
reposgroup *gui.Node
|
reposgroup *gui.Node
|
||||||
current *repolist.RepoRow
|
current *repolist.RepoRow
|
||||||
|
|
||||||
|
// this is the repo we are starting in
|
||||||
|
// make sure it never changes so go.mod and go.sum are always there
|
||||||
|
// 'go get' is called from here
|
||||||
|
startRepo *gitpb.Repo
|
||||||
|
|
||||||
// guireleaser window
|
// guireleaser window
|
||||||
mainWindow *gui.Node
|
mainWindow *gui.Node
|
||||||
mainBox *gui.Node
|
mainBox *gui.Node
|
||||||
|
|
Loading…
Reference in New Issue