fixes for new gitpb
This commit is contained in:
parent
e8de69e5a9
commit
d3f8613bd8
36
clone.go
36
clone.go
|
@ -20,7 +20,7 @@ func clone(gopath string) (*gitpb.Repo, error) {
|
|||
}
|
||||
os.Setenv("REPO_AUTO_CLONE", "true")
|
||||
// pb, _ := forge.NewGoPath(gopath)
|
||||
check := forge.Repos.FindByGoPath(gopath)
|
||||
check := forge.Repos.FindByFullPath(gopath)
|
||||
if check != nil {
|
||||
if check.IsValidDir() {
|
||||
// repo already exists and is valid
|
||||
|
@ -60,10 +60,10 @@ func recursiveClone(check *gitpb.Repo) error {
|
|||
if check == nil {
|
||||
return errors.New("repo was nil")
|
||||
}
|
||||
log.Info("STARTING RECURSIVE CLONE", check.GoPath)
|
||||
log.Info("STARTING RECURSIVE CLONE", check.GoPath)
|
||||
if check.GoPrimitive {
|
||||
log.Info("repo is a primitive", check.GoPath)
|
||||
log.Info("STARTING RECURSIVE CLONE", check.GetGoPath())
|
||||
log.Info("STARTING RECURSIVE CLONE", check.GetGoPath())
|
||||
if check.GoInfo.GoPrimitive {
|
||||
log.Info("repo is a primitive", check.GetGoPath())
|
||||
// go primitive repos are "pure"
|
||||
return nil
|
||||
}
|
||||
|
@ -72,29 +72,29 @@ func recursiveClone(check *gitpb.Repo) error {
|
|||
check.ParseGoSum()
|
||||
|
||||
if check.GoDeps == nil {
|
||||
log.Info("repo godeps == nil", check.GoPath)
|
||||
log.Info("repo godeps == nil", check.GetGoPath())
|
||||
return errors.New("go.sum is missing?")
|
||||
}
|
||||
|
||||
// probably this should never be 0 because GoPrimitive should have been true otherwise
|
||||
if check.GoDeps.Len() == 0 {
|
||||
log.Info("repo len(godeps) == 0", check.GoPath)
|
||||
log.Info("repo len(godeps) == 0", check.GetGoPath())
|
||||
return errors.New("go.sum never parsed?")
|
||||
}
|
||||
|
||||
log.Info("deps for", check.GoPath, "len()", check.GoDeps.Len())
|
||||
log.Info("deps for", check.GetGoPath(), "len()", check.GoDeps.Len())
|
||||
deps := check.GoDeps.SortByGoPath()
|
||||
for deps.Scan() {
|
||||
depRepo := deps.Next()
|
||||
log.Info("download:", depRepo.GoPath)
|
||||
_, err := clone(depRepo.GoPath)
|
||||
log.Info("download:", depRepo.GetGoPath())
|
||||
_, err := clone(depRepo.GetGoPath())
|
||||
if err != nil {
|
||||
log.Info("recursiveClone() could not download", depRepo.GoPath)
|
||||
log.Info("recursiveClone() could not download", depRepo.GetGoPath())
|
||||
log.Info("err:", err)
|
||||
bad += 1
|
||||
badmap[depRepo.GoPath] = err
|
||||
badmap[depRepo.GetGoPath()] = err
|
||||
} else {
|
||||
log.Info("downloaded", depRepo.GoPath)
|
||||
log.Info("downloaded", depRepo.GetGoPath())
|
||||
good += 1
|
||||
}
|
||||
}
|
||||
|
@ -119,8 +119,8 @@ func makeValidGoSum(check *gitpb.Repo) error {
|
|||
return err
|
||||
}
|
||||
}
|
||||
if check.GoPrimitive {
|
||||
log.Info(check.GoPath, "is a golang primitive! no need to parse go.sum because there is not one!")
|
||||
if check.GoInfo.GoPrimitive {
|
||||
log.Info(check.GetGoPath(), "is a golang primitive! no need to parse go.sum because there is not one!")
|
||||
return nil
|
||||
}
|
||||
// attempt to grab the notes
|
||||
|
@ -139,7 +139,7 @@ func makeValidGoSum(check *gitpb.Repo) error {
|
|||
}
|
||||
// if this fails, just use go mod
|
||||
if err := check.ValidGoSum(); err != nil {
|
||||
cmd := []string{"go", "mod", "init", check.GoPath}
|
||||
cmd := []string{"go", "mod", "init", check.GetGoPath()}
|
||||
log.Info("try running", cmd)
|
||||
if err := check.RunStrict(cmd); err != nil {
|
||||
log.Info("go mod init failed", err)
|
||||
|
@ -149,8 +149,8 @@ func makeValidGoSum(check *gitpb.Repo) error {
|
|||
return err
|
||||
}
|
||||
}
|
||||
if check.GoPrimitive {
|
||||
log.Info(check.GoPath, "is a golang primitive! no need to parse go.sum because there is not one!")
|
||||
if check.GoInfo.GoPrimitive {
|
||||
log.Info(check.GetGoPath(), "is a golang primitive! no need to parse go.sum because there is not one!")
|
||||
return nil
|
||||
}
|
||||
if err := check.RunStrict([]string{"go", "mod", "tidy"}); err != nil {
|
||||
|
|
|
@ -11,16 +11,16 @@ func gitPull() {
|
|||
pull := []string{"git", "pull"}
|
||||
|
||||
var trycount, errcount int
|
||||
repos := forge.Repos.SortByGoPath()
|
||||
repos := forge.Repos.SortByFullPath()
|
||||
for repos.Scan() {
|
||||
repo := repos.Next()
|
||||
if argv.DryRun {
|
||||
log.Info("git pull --dry-run", repo.GoPath)
|
||||
log.Info("git pull --dry-run", repo.GetGoPath())
|
||||
continue
|
||||
}
|
||||
log.Info("git pull:", repo.FullPath)
|
||||
trycount += 1
|
||||
log.Info("actually run: git pull:", repo.GoPath)
|
||||
log.Info("actually run: git pull:", repo.GetGoPath())
|
||||
if result := shell.PathRunRealtime(repo.FullPath, pull); result.Error != nil {
|
||||
log.Info("git pull error:", result.Error)
|
||||
errcount += 1
|
||||
|
|
18
main.go
18
main.go
|
@ -42,14 +42,14 @@ func main() {
|
|||
badExit(err)
|
||||
}
|
||||
if argv.Recursive {
|
||||
log.Info("STARTING RECURSIVE CLONE", workingRepo.GoPath)
|
||||
log.Info("STARTING RECURSIVE CLONE", workingRepo.GetGoPath())
|
||||
if err := recursiveClone(workingRepo); err != nil {
|
||||
badExit(err)
|
||||
}
|
||||
}
|
||||
autoWork()
|
||||
if argv.Build {
|
||||
log.Info("STARTING BUILD", workingRepo.GoPath)
|
||||
log.Info("STARTING BUILD", workingRepo.GetGoPath())
|
||||
/*
|
||||
if err := makeValidGoSum(workingRepo); err != nil {
|
||||
badExit(err)
|
||||
|
@ -58,22 +58,22 @@ func main() {
|
|||
badExit(err)
|
||||
}
|
||||
*/
|
||||
if workingRepo.RepoType() == "binary" || workingRepo.RepoType() == "plugin" {
|
||||
log.Info("build will probably fail", workingRepo.GoPath, "is", workingRepo.RepoType())
|
||||
if workingRepo.GetRepoType() == "binary" || workingRepo.GetRepoType() == "plugin" {
|
||||
log.Info("build will probably fail", workingRepo.GetGoPath(), "is", workingRepo.GetRepoType())
|
||||
}
|
||||
if err := forge.Build(workingRepo, nil); err != nil {
|
||||
log.Warn("BUILD FAILED", workingRepo.GoPath, err)
|
||||
log.Warn("BUILD FAILED", workingRepo.GetGoPath(), err)
|
||||
badExit(err)
|
||||
}
|
||||
}
|
||||
if argv.Install {
|
||||
log.Info("STARTING INSTALL", workingRepo.GoPath)
|
||||
log.Info("STARTING INSTALL", workingRepo.GetGoPath())
|
||||
// can only install binary or plugin go packages
|
||||
if workingRepo.RepoType() == "binary" || workingRepo.RepoType() == "plugin" {
|
||||
log.Info("install will probably fail", workingRepo.GoPath, "is", workingRepo.RepoType())
|
||||
if workingRepo.GetRepoType() == "binary" || workingRepo.GetRepoType() == "plugin" {
|
||||
log.Info("install will probably fail", workingRepo.GetGoPath(), "is", workingRepo.GetRepoType())
|
||||
}
|
||||
if err := forge.Install(workingRepo, nil); err != nil {
|
||||
log.Warn("INSTALL FAILED", workingRepo.GoPath, err)
|
||||
log.Warn("INSTALL FAILED", workingRepo.GetGoPath(), err)
|
||||
badExit(err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue