moving go.* processing here
This commit is contained in:
parent
5bf1c5ff35
commit
14b2fbb00b
|
@ -171,8 +171,7 @@ func (r *RepoList) addRepo(grid *gui.Node, path string, master string, devel str
|
||||||
newRepo.gitState = newRepo.Status.MirrorGitState()
|
newRepo.gitState = newRepo.Status.MirrorGitState()
|
||||||
grid.Append(newRepo.gitState)
|
grid.Append(newRepo.gitState)
|
||||||
|
|
||||||
newRepo.goState = newRepo.Status.MirrorGoState()
|
newRepo.goState = grid.NewLabel("goState")
|
||||||
grid.Append(newRepo.goState)
|
|
||||||
|
|
||||||
newRepo.endBox = grid.NewHorizontalBox("HBOX")
|
newRepo.endBox = grid.NewHorizontalBox("HBOX")
|
||||||
newRepo.endBox.NewButton("Configure", func() {
|
newRepo.endBox.NewButton("Configure", func() {
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package repolist
|
||||||
|
|
||||||
|
/*
|
||||||
|
this enables command line options from other packages like 'gui' and 'log'
|
||||||
|
*/
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go.wit.com/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
var REPO *log.LogFlag
|
||||||
|
var REPOWARN *log.LogFlag
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
full := "go.wit.com/lib/gui/repo"
|
||||||
|
short := "repo"
|
||||||
|
|
||||||
|
REPO = log.NewFlag("REPO", false, full, short, "general repo things")
|
||||||
|
REPOWARN = log.NewFlag("REPOWARN", true, full, short, "general repo things")
|
||||||
|
}
|
|
@ -0,0 +1,119 @@
|
||||||
|
package repolist
|
||||||
|
|
||||||
|
// does processing on the go.mod and go.sum files
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"go.wit.com/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
// scans through everything in the go.sum file to make
|
||||||
|
// sure the versions are correct when attempting to do a GUI release
|
||||||
|
func (rl *RepoList) CheckValidGoSum(r *Repo) (bool, error) {
|
||||||
|
log.Log(REPOWARN, "CheckValidGoSum() started")
|
||||||
|
ok, err := r.Status.MakeRedomod()
|
||||||
|
if !ok {
|
||||||
|
log.Log(REPOWARN, "CheckValidGoSum() failed", err)
|
||||||
|
return ok, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// go through each go.sum dependancy to see if the package is released
|
||||||
|
for depPath, version := range r.Status.GoConfig() {
|
||||||
|
log.Log(REPO, " ", depPath, version)
|
||||||
|
|
||||||
|
// lookup the repo
|
||||||
|
deprs := rl.FindRepo(depPath)
|
||||||
|
if deprs == nil {
|
||||||
|
// well, the go.sum dependancy hasn't been processed or doesn't exist
|
||||||
|
// so, download it? ignore it?
|
||||||
|
// for now, if it's not one of the GUI repos, assume it's readonly and ignore it
|
||||||
|
if strings.HasPrefix(depPath, "go.wit.com") {
|
||||||
|
log.Log(REPOWARN, "Run: go get -v", depPath)
|
||||||
|
// rs.RunCmd([]string{"go", "get", "-v", depname}) // download this here?
|
||||||
|
return false, errors.New("CheckValidGoSum() download repo: " + depPath)
|
||||||
|
}
|
||||||
|
// it's probably okay. running a compile check before this would be a good test
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if deprs.ReadOnly() {
|
||||||
|
// ignore versioning on other repos. todo: help fix this situation somehow?
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if deprs.CheckDirty() {
|
||||||
|
return false, errors.New("CheckValidGoSum() depends on dirty repo " + deprs.GoPath())
|
||||||
|
}
|
||||||
|
currentV := deprs.Status.GetCurrentVersion()
|
||||||
|
targetV := deprs.Status.GetTargetVersion()
|
||||||
|
if currentV != targetV {
|
||||||
|
return false, errors.New("CheckValidGoSum() depends on yet unreleased repo " + deprs.GoPath())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// no dependancies error'd out. It should be ok to release this package
|
||||||
|
log.Log(REPOWARN, "Releasing this should be ok", r.GoPath)
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// check if it is safe to remake the go.sum & go.mod files
|
||||||
|
func (rs *RepoStatus) CheckSafeGoSumRemakeOld() (bool, []string) {
|
||||||
|
// myGoSumS := rs.goSumStatus.String()
|
||||||
|
if rs.ReadGoMod() {
|
||||||
|
log.Log(REPO, "parsed go.mod", rs.realPath.String())
|
||||||
|
} else {
|
||||||
|
log.Log(REPOWARN, "Something went wrong parsing go.mod", rs.realPath.String())
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
log.Log(REPOWARN, "go.sum:", rs.realPath.String())
|
||||||
|
var clean []string
|
||||||
|
for depname, version := range rs.goConfig {
|
||||||
|
if strings.HasSuffix(depname, "/v2") {
|
||||||
|
log.Log(REPOWARN, " FOUND /v2 wierd golang stuff. instead, look for:", depname)
|
||||||
|
depname = strings.TrimSuffix(depname, "/v2")
|
||||||
|
}
|
||||||
|
log.Log(REPOWARN, " ", depname, version)
|
||||||
|
deprs, ok := windowMap[depname]
|
||||||
|
if ok {
|
||||||
|
if deprs.CheckDirty() {
|
||||||
|
log.Log(REPOWARN, " IS DIRTY", deprs.String())
|
||||||
|
clean = append(clean, deprs.String())
|
||||||
|
}
|
||||||
|
if deprs.readOnly.String() == "true" {
|
||||||
|
log.Log(REPOWARN, " SKIPPING Read Only", deprs.String())
|
||||||
|
} else {
|
||||||
|
// goSumS := deprs.goSumStatus.String()
|
||||||
|
log.Log(REPOWARN, " FOUND", deprs.String())
|
||||||
|
username := deprs.mainWorkingName.String()
|
||||||
|
userhash, _ := deprs.gitConfig.hashes[username]
|
||||||
|
userversion, _ := deprs.gitConfig.versions[userhash]
|
||||||
|
log.Log(REPOWARN, " username :"+username, userhash)
|
||||||
|
log.Log(REPOWARN, " username :"+username, userversion)
|
||||||
|
if version == userversion {
|
||||||
|
log.Log(REPOWARN, " USER VERSIONS MATCH", version, userversion)
|
||||||
|
clean = append(clean, deprs.String())
|
||||||
|
} else {
|
||||||
|
os.Unsetenv("GO111MODULE")
|
||||||
|
log.Log(REPOWARN, " USER VERSIONS MISMATCH", version, userversion)
|
||||||
|
log.Log(REPOWARN, " IGNORE UNCHANGED REPO. RUNNING 'go get'", depname, userversion)
|
||||||
|
err, output := rs.RunCmd([]string{"go", "get", depname + "@" + userversion})
|
||||||
|
log.Log(REPOWARN, " go get", depname, err, output)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// log.Log(REPOWARN, " NOT FOUND", depname)
|
||||||
|
// only fail on our stuff
|
||||||
|
if strings.HasPrefix(depname, "go.wit.com") {
|
||||||
|
log.Log(REPOWARN, " go get -v", depname)
|
||||||
|
// rs.RunCmd([]string{"go", "get", "-v", depname})
|
||||||
|
return false, clean
|
||||||
|
}
|
||||||
|
// log.Log(REPOWARN, " NOT FOUND BUT IGNORING FOR NOW")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(clean) == 0 {
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
return false, clean
|
||||||
|
}
|
||||||
|
*/
|
Loading…
Reference in New Issue