unbelievable. rill is great.
This commit is contained in:
parent
dfae92e3c3
commit
3600dbed8c
11
build.go
11
build.go
|
@ -91,12 +91,17 @@ func (f *Forge) doBuild(repo *gitpb.Repo, userFlags []string, goWhat string) err
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("running:", cmd)
|
log.Info("running:", cmd)
|
||||||
if r := repo.RunRealtime(cmd); r.Error == nil {
|
result := repo.RunRealtime(cmd)
|
||||||
// log.Warn("go build worked")
|
if result.Exit == 0 {
|
||||||
|
log.Info(strings.Join(result.Stdout, "\n"))
|
||||||
return nil
|
return nil
|
||||||
} else {
|
} else {
|
||||||
|
log.DaemonMode(true)
|
||||||
|
log.Info(strings.Join(result.Stdout, "\n"))
|
||||||
|
log.Info(strings.Join(result.Stderr, "\n"))
|
||||||
|
log.DaemonMode(false)
|
||||||
log.Warn("go build failed", cmd)
|
log.Warn("go build failed", cmd)
|
||||||
return errors.New("go build failed: " + fmt.Sprint(r.Error))
|
return errors.New("go build failed: " + fmt.Sprint(result.Error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package forgepb
|
package forgepb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
"go.wit.com/lib/protobuf/gitpb"
|
"go.wit.com/lib/protobuf/gitpb"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
@ -20,7 +22,7 @@ func (f *Forge) FinalGoDepsCheckOk(check *gitpb.Repo) bool {
|
||||||
}
|
}
|
||||||
// clear out the protobuf and rescan from the file
|
// clear out the protobuf and rescan from the file
|
||||||
check.GoDeps = nil
|
check.GoDeps = nil
|
||||||
if ok, err := check.ParseGoSum(); ! ok {
|
if ok, err := check.ParseGoSum(); !ok {
|
||||||
log.Info("FinalGoDepsCheckOk() error", err)
|
log.Info("FinalGoDepsCheckOk() error", err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -37,18 +39,42 @@ func (f *Forge) FinalGoDepsCheckOk(check *gitpb.Repo) bool {
|
||||||
depRepo := deps.Next()
|
depRepo := deps.Next()
|
||||||
found := f.Repos.FindByGoPath(depRepo.GetGoPath())
|
found := f.Repos.FindByGoPath(depRepo.GetGoPath())
|
||||||
if found == nil {
|
if found == nil {
|
||||||
|
if f.checkOverride(depRepo.GetGoPath()) {
|
||||||
|
// skip this gopath because it's probably broken forever
|
||||||
|
continue
|
||||||
|
}
|
||||||
log.Info("not found:", depRepo.GetGoPath())
|
log.Info("not found:", depRepo.GetGoPath())
|
||||||
return false
|
good = false
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
// log.Info("found dep", depRepo.GetGoPath())
|
// log.Info("found dep", depRepo.GetGoPath())
|
||||||
if depRepo.GetVersion() != found.GetTargetVersion() {
|
if depRepo.GetVersion() != found.GetTargetVersion() {
|
||||||
if f.IsReadOnly(depRepo.GetGoPath()) {
|
check := f.Repos.FindByGoPath(depRepo.GoPath)
|
||||||
|
if f.IsReadOnly(check) {
|
||||||
log.Printf("%-48s ok error %10s vs %10s (ignoring read-only repo)", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetMasterVersion())
|
log.Printf("%-48s ok error %10s vs %10s (ignoring read-only repo)", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetMasterVersion())
|
||||||
|
} else {
|
||||||
|
if f.checkOverride(depRepo.GetGoPath()) {
|
||||||
|
log.Printf("%-48s ok error %10s vs %10s (forge.checkOverride())", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetMasterVersion())
|
||||||
|
// skip this gopath because it's probably broken forever
|
||||||
|
continue
|
||||||
} else {
|
} else {
|
||||||
log.Printf("%-48s error %10s vs %10s", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetMasterVersion())
|
log.Printf("%-48s error %10s vs %10s", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetMasterVersion())
|
||||||
good = false
|
good = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return good
|
return good
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (f *Forge) checkOverride(gopath string) bool {
|
||||||
|
if gopath == "cloud.google.com/go" {
|
||||||
|
log.Info("checkOverride() is ignoring", gopath)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if strings.HasPrefix(gopath, "github.com/go-gl") {
|
||||||
|
log.Info("checkOverride() is ignoring", gopath)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
34
goSrcScan.go
34
goSrcScan.go
|
@ -155,3 +155,37 @@ func (f *Forge) rillScanDirs(gopaths []string) (int, error) {
|
||||||
|
|
||||||
return counter, err
|
return counter, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (f *Forge) RillRedoGoMod() int {
|
||||||
|
var all []*gitpb.Repo
|
||||||
|
repos := f.Repos.SortByGoPath()
|
||||||
|
for repos.Scan() {
|
||||||
|
repo := repos.Next()
|
||||||
|
if !repo.IsValid() {
|
||||||
|
log.Printf("%10s %-50s", "old?", repo.GetGoPath())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
all = append(all, repo)
|
||||||
|
}
|
||||||
|
// Convert a slice of user IDs into a channel
|
||||||
|
ids := rill.FromSlice(all, nil)
|
||||||
|
|
||||||
|
var counter int
|
||||||
|
// Read users from the API.
|
||||||
|
// Concurrency = 20
|
||||||
|
dirs := rill.Map(ids, 50, func(id *gitpb.Repo) (*gitpb.Repo, error) {
|
||||||
|
return id, nil
|
||||||
|
})
|
||||||
|
|
||||||
|
err := rill.ForEach(dirs, 20, func(repo *gitpb.Repo) error {
|
||||||
|
counter += 1
|
||||||
|
repo.RedoGoMod()
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Info("rill.ForEach() error:", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return counter
|
||||||
|
}
|
||||||
|
|
2
human.go
2
human.go
|
@ -29,7 +29,7 @@ func (f *Forge) standardHeader(r *ForgeConfig) string {
|
||||||
if f.IsFavorite(r.GoPath) {
|
if f.IsFavorite(r.GoPath) {
|
||||||
flags += "(favorite) "
|
flags += "(favorite) "
|
||||||
}
|
}
|
||||||
if f.IsReadOnly(r.GoPath) {
|
if f.Config.IsReadOnly(r.GoPath) {
|
||||||
readonly = ""
|
readonly = ""
|
||||||
} else {
|
} else {
|
||||||
readonly = "r/w"
|
readonly = "r/w"
|
||||||
|
|
|
@ -38,7 +38,7 @@ func (f *Forge) VerifyBranchNames(newr *gitpb.Repo) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if f.IsReadOnly(newr.GoPath) {
|
if f.Config.IsReadOnly(newr.GoPath) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@ package forgepb
|
||||||
import (
|
import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"go.wit.com/lib/protobuf/gitpb"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -36,10 +38,19 @@ func (all *ForgeConfigs) UpdateGoPath(name string, gopath string) bool {
|
||||||
|
|
||||||
// returns true if gopath is readonly()
|
// returns true if gopath is readonly()
|
||||||
// will attempt to match IsWritable("foo") against anything ending in "foo"
|
// will attempt to match IsWritable("foo") against anything ending in "foo"
|
||||||
func (f *Forge) IsReadOnly(gopath string) bool {
|
func (f *Forge) IsReadOnly(repo *gitpb.Repo) bool {
|
||||||
|
// var match *ForgeConfig
|
||||||
|
|
||||||
|
return f.Config.IsReadOnly(repo.GoPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
// returns true if gopath is readonly()
|
||||||
|
// will attempt to match IsWritable("foo") against anything ending in "foo"
|
||||||
|
func (f *ForgeConfigs) IsReadOnly(gopath string) bool {
|
||||||
var match *ForgeConfig
|
var match *ForgeConfig
|
||||||
|
|
||||||
loop := f.Config.SortByGoPath() // get the list of repos
|
|
||||||
|
loop := f.SortByGoPath() // get the list of repos
|
||||||
for loop.Scan() {
|
for loop.Scan() {
|
||||||
r := loop.Next()
|
r := loop.Next()
|
||||||
if r.GoPath == gopath {
|
if r.GoPath == gopath {
|
||||||
|
|
Loading…
Reference in New Issue