fix logic for godeps checking using forgepb
This commit is contained in:
parent
f5b8202fda
commit
007e0e81e3
18
doRelease.go
18
doRelease.go
|
@ -8,7 +8,6 @@ import (
|
||||||
|
|
||||||
"github.com/go-cmd/cmd"
|
"github.com/go-cmd/cmd"
|
||||||
|
|
||||||
"go.wit.com/lib/gui/repolist"
|
|
||||||
"go.wit.com/lib/gui/shell"
|
"go.wit.com/lib/gui/shell"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
@ -145,23 +144,6 @@ func doRelease() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkValidGoSum(repo *repolist.RepoRow) bool {
|
|
||||||
ok, err := me.repos.View.CheckValidGoSum(repo)
|
|
||||||
if err != nil {
|
|
||||||
log.Info("go mod tidy not ok", err)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if ok {
|
|
||||||
log.Info("repo has go.sum requirements that are clean")
|
|
||||||
// me.current.setGoSumStatus("CLEAN")
|
|
||||||
me.release.status.SetValue("GOOD")
|
|
||||||
me.release.notes.SetValue("CheckValidGoSum() does not seem to lie")
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
me.release.notes.SetValue("CheckValidGoSum() failed")
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// try to figure out if there is another package to update
|
// try to figure out if there is another package to update
|
||||||
func doReleaseFindNext() bool {
|
func doReleaseFindNext() bool {
|
||||||
// scan for new repo
|
// scan for new repo
|
||||||
|
|
|
@ -0,0 +1,124 @@
|
||||||
|
// This is a simple example
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"go.wit.com/log"
|
||||||
|
|
||||||
|
"go.wit.com/lib/gui/repolist"
|
||||||
|
)
|
||||||
|
|
||||||
|
// trys to figure out if there is still something to update
|
||||||
|
// todo: redo this logic as it is terrible
|
||||||
|
// rename this findNext()
|
||||||
|
func findNext() bool {
|
||||||
|
loop := me.repos.View.ReposSortByName()
|
||||||
|
for loop.Scan() {
|
||||||
|
repo := loop.Repo()
|
||||||
|
if repo.Status.IsReleased() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if repo.Status.Whitelist {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if repo.ReadOnly() {
|
||||||
|
// log.Info("findNext() skipping readonly")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if repo.CheckDirty() {
|
||||||
|
log.Info("findNext() skipping dirty")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
// do makeredomod here
|
||||||
|
// if ! repo.Status.Exists("go.sum") {
|
||||||
|
// }
|
||||||
|
if repo.Status.IsPrimitive() {
|
||||||
|
log.Info("findNext()", repo.GoPath())
|
||||||
|
if setCurrentRepo(repo, "PRIMATIVE", "release new version") {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
log.Info("findNext()", repo.GoPath(), "is not a primative repo")
|
||||||
|
if ! goodGodeps(repo) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if checkValidGoSum(repo) {
|
||||||
|
setCurrentRepo(repo, "should be good to release", "pretty sure")
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.Info("tried to findNext() but not sure what to do next")
|
||||||
|
me.release.status.SetText("ALL DONE?")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func checkValidGoSum(repo *repolist.RepoRow) bool {
|
||||||
|
ok, err := me.repos.View.CheckValidGoSum(repo)
|
||||||
|
if err != nil {
|
||||||
|
log.Info("go mod tidy not ok", err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if ok {
|
||||||
|
log.Info("repo has go.sum requirements that are clean")
|
||||||
|
// me.current.setGoSumStatus("CLEAN")
|
||||||
|
me.release.status.SetValue("GOOD")
|
||||||
|
me.release.notes.SetValue("CheckValidGoSum() does not seem to lie")
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
me.release.notes.SetValue("CheckValidGoSum() failed")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func goodGodeps(repo *repolist.RepoRow) bool {
|
||||||
|
var good bool = true
|
||||||
|
// check if the package dependancies changed, if so, re-publish
|
||||||
|
check := me.forge.Repos.FindByGoPath(repo.GoPath())
|
||||||
|
if check == nil {
|
||||||
|
log.Info("boo, you didn't git clone", repo.GoPath())
|
||||||
|
os.Exit(-1)
|
||||||
|
}
|
||||||
|
log.Printf("current repo %s go dependancy count: %d", check.GetGoPath(), check.GoDepsLen())
|
||||||
|
deps := check.GoDeps.SortByGoPath()
|
||||||
|
for deps.Scan() {
|
||||||
|
depRepo := deps.Next()
|
||||||
|
// log.Info("found dep", depRepo.GetGoPath())
|
||||||
|
if me.forge.IsReadOnly(depRepo.GetGoPath()) {
|
||||||
|
// log.Info("IsReadOnly = true", depRepo.GetGoPath())
|
||||||
|
continue
|
||||||
|
} else {
|
||||||
|
// log.Info("IsReadOnly = false", depRepo.GetGoPath())
|
||||||
|
}
|
||||||
|
found := me.repos.View.FindByPath(depRepo.GetGoPath())
|
||||||
|
if found == nil {
|
||||||
|
// log.Info("repos.View.FindByPath() not found", depRepo.GetGoPath())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if found.Status.IsReleased() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
header := found.StandardReleaseHeader()
|
||||||
|
log.Info("bad", header)
|
||||||
|
good = false
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
log.Info(repolist.ReleaseReportHeader())
|
||||||
|
loop := me.repos.View.ReposSortByName()
|
||||||
|
for loop.Scan() {
|
||||||
|
repo := loop.Repo()
|
||||||
|
|
||||||
|
// if repo.ReadOnly() {
|
||||||
|
// continue
|
||||||
|
// }
|
||||||
|
if repo.Status.IsReleased() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
header := repo.StandardReleaseHeader()
|
||||||
|
log.Info(header)
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
return good
|
||||||
|
}
|
|
@ -285,45 +285,3 @@ func setCurrentRepo(newcur *repolist.RepoRow, s string, note string) bool {
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// trys to figure out if there is still something to update
|
|
||||||
// todo: redo this logic as it is terrible
|
|
||||||
// rename this findNext()
|
|
||||||
func findNext() bool {
|
|
||||||
loop := me.repos.View.ReposSortByName()
|
|
||||||
for loop.Scan() {
|
|
||||||
repo := loop.Repo()
|
|
||||||
if repo.Status.IsReleased() {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if repo.Status.Whitelist {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if repo.ReadOnly() {
|
|
||||||
// log.Info("findNext() skipping readonly")
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if repo.CheckDirty() {
|
|
||||||
log.Info("findNext() skipping dirty")
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
// do makeredomod here
|
|
||||||
// if ! repo.Status.Exists("go.sum") {
|
|
||||||
// }
|
|
||||||
if repo.Status.IsPrimitive() {
|
|
||||||
log.Info("findNext()", repo.GoPath())
|
|
||||||
if setCurrentRepo(repo, "PRIMATIVE", "release new version") {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
log.Info("findNext()", repo.GoPath(), "is not a primative repo")
|
|
||||||
if checkValidGoSum(repo) {
|
|
||||||
setCurrentRepo(repo, "should be good to release", "pretty sure")
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log.Info("tried to findNext() but not sure what to do next")
|
|
||||||
me.release.status.SetText("ALL DONE?")
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue