attempt to detect new package dependancy versions
This commit is contained in:
parent
fd3b806b4a
commit
82935ae6b2
|
@ -35,7 +35,7 @@ func (repo *Repo) GetLastTag() string {
|
||||||
return result.Stdout[0]
|
return result.Stdout[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (repo *Repo) GitMasterVersion() string {
|
func (repo *Repo) GetMasterVersion() string {
|
||||||
bname := repo.GetMasterBranchName()
|
bname := repo.GetMasterBranchName()
|
||||||
v, err := repo.gitVersionByName(bname)
|
v, err := repo.gitVersionByName(bname)
|
||||||
/*
|
/*
|
||||||
|
@ -54,7 +54,7 @@ func (repo *Repo) GitMasterVersion() string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (repo *Repo) GitDevelVersion() string {
|
func (repo *Repo) GetDevelVersion() string {
|
||||||
bname := repo.GetDevelBranchName()
|
bname := repo.GetDevelBranchName()
|
||||||
v, err := repo.gitVersionByName(bname)
|
v, err := repo.gitVersionByName(bname)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -65,7 +65,7 @@ func (repo *Repo) GitDevelVersion() string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (repo *Repo) GitUserVersion() string {
|
func (repo *Repo) GetUserVersion() string {
|
||||||
bname := repo.GetUserBranchName()
|
bname := repo.GetUserBranchName()
|
||||||
if bname != "jcarr" {
|
if bname != "jcarr" {
|
||||||
panic("not jcarr bname =" + bname)
|
panic("not jcarr bname =" + bname)
|
||||||
|
|
|
@ -202,3 +202,45 @@ func (repo *Repo) UpdatePublished() (bool, error) {
|
||||||
}
|
}
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// returns true if the last published
|
||||||
|
func (repo *Repo) GoDepsLen() int {
|
||||||
|
if repo.GoDeps == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return repo.GoDeps.Len()
|
||||||
|
}
|
||||||
|
|
||||||
|
// returns true if the last published
|
||||||
|
func (repo *Repo) PublishedLen() int {
|
||||||
|
if repo.Published == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return repo.Published.Len()
|
||||||
|
}
|
||||||
|
|
||||||
|
// returns true if the last published
|
||||||
|
func (all *Repos) GoDepsChanged(repo *Repo) (bool, error) {
|
||||||
|
var match bool = true
|
||||||
|
|
||||||
|
if repo.GoDeps == nil {
|
||||||
|
repo.RedoGoMod()
|
||||||
|
}
|
||||||
|
if repo.GoDeps.Len() == 0 {
|
||||||
|
repo.RedoGoMod()
|
||||||
|
}
|
||||||
|
log.Printf("current repo %s go dependancy count: %d", repo.GetGoPath(), repo.GoDeps.Len())
|
||||||
|
deps := repo.GoDeps.SortByGoPath()
|
||||||
|
for deps.Scan() {
|
||||||
|
depRepo := deps.Next()
|
||||||
|
if repo.Published == nil {
|
||||||
|
return false, errors.New("repo published deps info is nil")
|
||||||
|
}
|
||||||
|
found := repo.Published.FindByGoPath(depRepo.GetGoPath())
|
||||||
|
if found == nil {
|
||||||
|
return true, errors.New("new repo added " + depRepo.GetGoPath())
|
||||||
|
}
|
||||||
|
log.Printf("deps %-50s %-10s vs %-10s", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetVersion())
|
||||||
|
}
|
||||||
|
return match, nil
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"go.wit.com/dev/alexflint/arg"
|
"go.wit.com/dev/alexflint/arg"
|
||||||
|
@ -34,12 +35,49 @@ func main() {
|
||||||
repos := forge.Repos.SortByGoPath()
|
repos := forge.Repos.SortByGoPath()
|
||||||
for repos.Scan() {
|
for repos.Scan() {
|
||||||
repo := repos.Next()
|
repo := repos.Next()
|
||||||
forge.VerifyBranchNames(repo)
|
// forge.VerifyBranchNames(repo)
|
||||||
fullpath := repo.GetFullPath()
|
fullpath := repo.GetFullPath()
|
||||||
mName := repo.GetMasterBranchName()
|
mName := repo.GetMasterBranchName()
|
||||||
dName := repo.GetDevelBranchName()
|
dName := repo.GetDevelBranchName()
|
||||||
uName := repo.GetUserBranchName()
|
uName := repo.GetUserBranchName()
|
||||||
log.Printf("repo: %-60s %-8s %-8s %-8s\n", fullpath, mName, dName, uName)
|
dlen := repo.GoDepsLen()
|
||||||
|
plen := repo.PublishedLen()
|
||||||
|
var ds, ps string
|
||||||
|
if dlen == 0 {
|
||||||
|
ds = ""
|
||||||
|
} else {
|
||||||
|
ds = fmt.Sprintf("%2d", dlen)
|
||||||
|
}
|
||||||
|
if plen == 0 {
|
||||||
|
ps = ""
|
||||||
|
} else {
|
||||||
|
ps = fmt.Sprintf("%2d", plen)
|
||||||
|
}
|
||||||
|
log.Printf("repo: %-60s %-10s %-8s %-8s %s %s\n", fullpath, mName, dName, uName, ds, ps)
|
||||||
|
/*
|
||||||
|
if repo.GoDepsChanged() {
|
||||||
|
log.Printf("\tdependancy checks indicate a new release is needed for %s\n", repo.GetGoPath())
|
||||||
|
} else {
|
||||||
|
log.Printf("\tdependancies have not changed for %s\n", repo.GetGoPath())
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
goclone := forge.Repos.FindByGoPath("go.wit.com/apps/go-clone")
|
||||||
|
if goclone == nil {
|
||||||
|
log.Info("boo, you didn't git go-clone?")
|
||||||
|
os.Exit(-1)
|
||||||
|
}
|
||||||
|
|
||||||
|
match, err := forge.Repos.GoDepsChanged(goclone)
|
||||||
|
if err != nil {
|
||||||
|
log.Info("dependancy checks failed", goclone.GetGoPath(), err)
|
||||||
|
os.Exit(-1)
|
||||||
|
}
|
||||||
|
if match {
|
||||||
|
log.Printf("dependancy checks indicate a new release is needed for %s\n", goclone.GetGoPath())
|
||||||
|
} else {
|
||||||
|
log.Printf("dependancies have not changed for %s\n", goclone.GetGoPath())
|
||||||
}
|
}
|
||||||
|
|
||||||
if argv.SaveConfig {
|
if argv.SaveConfig {
|
||||||
|
|
Loading…
Reference in New Issue