checks for more things
This commit is contained in:
parent
021c7774b2
commit
8cc487393f
2
main.go
2
main.go
|
@ -113,6 +113,8 @@ func main() {
|
||||||
badExit(errors.New(msg))
|
badExit(errors.New(msg))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
me.forge.RillFuncError(rillPurge)
|
||||||
|
|
||||||
// run this each time something gets published successfully
|
// run this each time something gets published successfully
|
||||||
rePrepareRelease()
|
rePrepareRelease()
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
@ -43,6 +44,23 @@ func checkpkgcache(repo *gitpb.Repo) error {
|
||||||
|
|
||||||
var rillcount int
|
var rillcount int
|
||||||
|
|
||||||
|
func rillPurge(repo *gitpb.Repo) error {
|
||||||
|
if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if me.forge.Config.IsPrivate(repo.GetGoPath()) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := repo.RunQuiet([]string{"go-mod-clean", "--purge"})
|
||||||
|
rillcount += 1
|
||||||
|
if err != nil {
|
||||||
|
log.Info("go-mod-clean --smart failed", repo.GetGoPath(), err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func rillRestore(repo *gitpb.Repo) error {
|
func rillRestore(repo *gitpb.Repo) error {
|
||||||
if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
|
if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
|
||||||
return nil
|
return nil
|
||||||
|
@ -102,6 +120,20 @@ func rePrepareRelease() {
|
||||||
// can't release readonly repos
|
// can't release readonly repos
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !me.forge.Config.IsPrivate(check.GetGoPath()) {
|
||||||
|
if err := checkPublishedGodeps(check); err != nil {
|
||||||
|
// this means the published godeps are no longer up to date
|
||||||
|
forceReleaseVersion(check)
|
||||||
|
me.found.AppendByGoPath(check)
|
||||||
|
log.Info("checkPublishedGodeps failed with err", check.GetGoPath(), err)
|
||||||
|
okExit("")
|
||||||
|
continue
|
||||||
|
} else {
|
||||||
|
// log.Info("checkPublishedGodeps is ok", check.GetGoPath())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if master != lastTag, always increment
|
// if master != lastTag, always increment
|
||||||
master := check.GetMasterVersion()
|
master := check.GetMasterVersion()
|
||||||
lastTag := check.GetLastTag()
|
lastTag := check.GetLastTag()
|
||||||
|
@ -187,3 +219,71 @@ func alreadyDone(repo *gitpb.Repo) bool {
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func checkPublishedGodeps(repo *gitpb.Repo) error {
|
||||||
|
godepsOld, err := repo.GoSumFromPkgDir()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if godepsOld != nil {
|
||||||
|
if err := me.forge.TestGoDepsCheckOk(godepsOld, argv.Verbose); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
all := godepsOld.All()
|
||||||
|
for all.Scan() {
|
||||||
|
dep := all.Next()
|
||||||
|
// log.Info(repo.GetGoPath(), dep.GoPath, dep.Version)
|
||||||
|
|
||||||
|
// check if the package in question is waiting for another package to publish
|
||||||
|
found := me.forge.FindByGoPath(dep.GoPath)
|
||||||
|
if found == nil {
|
||||||
|
return fmt.Errorf("%s has godep %s which can not be found", repo.GetGoPath(), dep.GoPath)
|
||||||
|
}
|
||||||
|
if found.GetLastTag() != dep.Version {
|
||||||
|
return fmt.Errorf("%s with godep %s version mismatch %s vs %s", repo.GetGoPath(), dep.GoPath, found.GetLastTag(), dep.Version)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
godepsNew, err := repo.GoSumFromRepo()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if godepsOld == nil {
|
||||||
|
if godepsNew == nil {
|
||||||
|
log.Printf("%s published godeps == nil && real == nil\n", repo.GetGoPath())
|
||||||
|
return nil
|
||||||
|
} else {
|
||||||
|
return fmt.Errorf("published godeps == nil vs real != nil")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err := me.forge.TestGoDepsCheckOk(godepsNew, argv.Verbose); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
func checkGodeps(repo *gitpb.Repo, godeps *gitpb.GoDeps) error {
|
||||||
|
if godeps == nil {
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
all := godeps.All()
|
||||||
|
for all.Scan() {
|
||||||
|
dep := all.Next()
|
||||||
|
// log.Info(repo.GetGoPath(), dep.GoPath, dep.Version)
|
||||||
|
|
||||||
|
// check if the package in question is waiting for another package to publish
|
||||||
|
found := me.forge.FindByGoPath(dep.GoPath)
|
||||||
|
if found == nil {
|
||||||
|
return fmt.Errorf("%s has godep %s which can not be found", repo.GetGoPath(), dep.GoPath)
|
||||||
|
}
|
||||||
|
if found.GetLastTag() != dep.Version {
|
||||||
|
return fmt.Errorf("%s with godep %s version mismatch %s vs %s", repo.GetGoPath(), dep.GoPath, found.GetLastTag(), dep.Version)
|
||||||
|
}
|
||||||
|
log.Printf("%s with godep %s version match %s vs %s\n", repo.GetGoPath(), dep.GoPath, found.GetLastTag(), dep.Version)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
Loading…
Reference in New Issue