rill is fantastic

This commit is contained in:
Jeff Carr 2024-12-03 13:23:35 -06:00
parent 8e29098aa8
commit a3a54501f6
1 changed files with 24 additions and 18 deletions

44
main.go
View File

@ -47,6 +47,9 @@ func main() {
log.Info("yep, need to clone", argv.Repo)
} else {
log.Info("already have", argv.Repo)
if argv.Recursive {
recursiveClone()
}
build()
okExit(argv.Repo)
}
@ -173,32 +176,35 @@ func gitPull() {
log.Info("Total repositories:", forge.Repos.Len(), "Total attempted:", trycount, "Errors:", errcount)
}
// really only does go.sum things
// so not 'really' recursive
// but that is because go.sum is supposed
// to have everything required in it
func recursiveClone() {
var good int
var bad int
// this works sometimes
if argv.Recursive {
newr := rv.FindByName(argv.Repo)
if newr == nil {
log.Info("how did this repo still not exist?", argv.Repo)
badExit(errors.New("failed to clone repo: " + argv.Repo))
}
os.Setenv("REPO_AUTO_CLONE", "true")
godep := newr.Status.GetGoDeps()
for gopath, version := range godep {
pb, err := forge.Clone(gopath)
check := forge.Repos.FindByGoPath(argv.Repo)
log.Info("download deps for:", check.GoPath)
deps := check.GoDeps.SortByGoPath()
for deps.Scan() {
depRepo := deps.Next()
log.Info("download:", depRepo.GoPath)
_, err := forge.Clone(depRepo.GoPath)
if err != nil {
log.Info("could not download")
badExit(err)
}
repo, err := rv.AddRepo(pb)
if err != nil {
log.Info("git clone failed for", gopath, version)
continue
}
// always do this for now. probably always forever
repo.MakeRedoMod()
log.Info("could not download", depRepo.GoPath)
log.Info("err:", err)
bad += 1
} else {
log.Info("downloaded", depRepo.GoPath)
good += 1
}
}
}
log.Info("got", good, "repos", "failed on", bad, "repos")
}
func redoGoModAll() {
loop := rv.ReposSortByName()