start moving things to gitpb
This commit is contained in:
parent
c25e4dd406
commit
b52c3c426a
29
clone.go
29
clone.go
|
@ -85,33 +85,33 @@ func clonePathHack(dirname string, basedir string, gopath string) error {
|
|||
|
||||
switch gopath {
|
||||
case "golang.org/x/crypto":
|
||||
return cloneActual(dirname, basedir, "https://" + "go.googlesource.com/crypto")
|
||||
return cloneActual(dirname, basedir, "https://"+"go.googlesource.com/crypto")
|
||||
case "golang.org/x/mod":
|
||||
return cloneActual(dirname, basedir, "https://" + "go.googlesource.com/mod")
|
||||
return cloneActual(dirname, basedir, "https://"+"go.googlesource.com/mod")
|
||||
case "golang.org/x/net":
|
||||
return cloneActual(dirname, basedir, "https://" + "go.googlesource.com/net")
|
||||
return cloneActual(dirname, basedir, "https://"+"go.googlesource.com/net")
|
||||
case "golang.org/x/sys":
|
||||
return cloneActual(dirname, basedir, "https://" + "go.googlesource.com/sys")
|
||||
return cloneActual(dirname, basedir, "https://"+"go.googlesource.com/sys")
|
||||
case "golang.org/x/sync":
|
||||
return cloneActual(dirname, basedir, "https://" + "go.googlesource.com/sync")
|
||||
return cloneActual(dirname, basedir, "https://"+"go.googlesource.com/sync")
|
||||
case "golang.org/x/term":
|
||||
return cloneActual(dirname, basedir, "https://" + "go.googlesource.com/term")
|
||||
return cloneActual(dirname, basedir, "https://"+"go.googlesource.com/term")
|
||||
case "golang.org/x/text":
|
||||
return cloneActual(dirname, basedir, "https://" + "go.googlesource.com/text")
|
||||
return cloneActual(dirname, basedir, "https://"+"go.googlesource.com/text")
|
||||
case "golang.org/x/tools":
|
||||
return cloneActual(dirname, basedir, "https://" + "go.googlesource.com/tools")
|
||||
return cloneActual(dirname, basedir, "https://"+"go.googlesource.com/tools")
|
||||
case "golang.org/x/xerrors":
|
||||
return cloneActual(dirname, basedir, "https://" + "go.googlesource.com/xerrors")
|
||||
return cloneActual(dirname, basedir, "https://"+"go.googlesource.com/xerrors")
|
||||
case "google.golang.org/protobuf":
|
||||
return cloneActual(dirname, basedir, "https://" + "go.googlesource.com/protobuf")
|
||||
return cloneActual(dirname, basedir, "https://"+"go.googlesource.com/protobuf")
|
||||
case "google.golang.org/genproto":
|
||||
return cloneActual(dirname, basedir, "https://" + "go.googlesource.com/genproto")
|
||||
return cloneActual(dirname, basedir, "https://"+"go.googlesource.com/genproto")
|
||||
case "google.golang.org/api":
|
||||
return cloneActual(dirname, basedir, "https://" + "go.googlesource.com/api")
|
||||
return cloneActual(dirname, basedir, "https://"+"go.googlesource.com/api")
|
||||
case "google.golang.org/grpc":
|
||||
return cloneActual(dirname, basedir, "https://" + "go.googlesource.com/grpc")
|
||||
return cloneActual(dirname, basedir, "https://"+"go.googlesource.com/grpc")
|
||||
case "google.golang.org/appengine":
|
||||
return cloneActual(dirname, basedir, "https://" + "go.googlesource.com/appengine")
|
||||
return cloneActual(dirname, basedir, "https://"+"go.googlesource.com/appengine")
|
||||
}
|
||||
|
||||
return errors.New("no gopath override here")
|
||||
|
@ -132,7 +132,6 @@ func Clone(workdir, gopath string) error {
|
|||
log.Info("trying git clone")
|
||||
log.Info("gopath =", gopath)
|
||||
|
||||
|
||||
// try a direct git clone against the gopath
|
||||
// cloneActual("helloworld", "/home/jcarr/go/src/go.wit.com/apps", "https://go.wit.com/apps/helloworld")
|
||||
if err = cloneActual(dirname, basedir, url); err == nil {
|
||||
|
|
35
common.go
35
common.go
|
@ -1,9 +1,7 @@
|
|||
package repostatus
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
|
@ -61,39 +59,6 @@ func (rs *RepoStatus) IsPrimitive() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) IsProtobuf() (bool, []string, error) {
|
||||
fullp, fullc, err := ScanForProtobuf(rs.Path())
|
||||
protos := make(map[string]string)
|
||||
protoc := make(map[string]string)
|
||||
var anyfound bool = false
|
||||
var allc []string
|
||||
for _, s := range fullp {
|
||||
filebase := filepath.Base(s)
|
||||
name := strings.TrimSuffix(filebase, ".proto")
|
||||
anyfound = true
|
||||
protos[name] = s
|
||||
}
|
||||
for pname, _ := range protos {
|
||||
var found bool = false
|
||||
for _, s := range fullc {
|
||||
cfilebase := filepath.Base(s)
|
||||
cname := strings.TrimSuffix(cfilebase, ".pb.go")
|
||||
protoc[cname] = s
|
||||
if cname == pname {
|
||||
found = true
|
||||
allc = append(allc, cfilebase)
|
||||
}
|
||||
}
|
||||
if found {
|
||||
// log.Info("found ok")
|
||||
} else {
|
||||
log.Info("missing compiled proto file:", pname+"pb.go")
|
||||
err = errors.New("compiled file " + pname + ".pb.go missing")
|
||||
}
|
||||
}
|
||||
return anyfound, allc, err
|
||||
}
|
||||
|
||||
// returns the filesystem path to the repo
|
||||
func (rs *RepoStatus) Path() string {
|
||||
if rs == nil {
|
||||
|
|
2
new.go
2
new.go
|
@ -4,8 +4,8 @@ import (
|
|||
"os"
|
||||
"strings"
|
||||
|
||||
"go.wit.com/lib/protobuf/gitpb"
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/lib/protobuf/gitpb"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
|
|
24
unix.go
24
unix.go
|
@ -398,27 +398,3 @@ func ScanGitDirectories(srcDir string) []string {
|
|||
|
||||
return all
|
||||
}
|
||||
|
||||
func ScanForProtobuf(srcDir string) ([]string, []string, error) {
|
||||
var protofiles []string
|
||||
var compiled []string
|
||||
err := filepath.Walk(srcDir, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
log.Log(REPOWARN, "Error accessing path:", path, err)
|
||||
return err
|
||||
}
|
||||
|
||||
if strings.HasSuffix(path, ".proto") {
|
||||
//
|
||||
protofiles = append(protofiles, path)
|
||||
}
|
||||
|
||||
if strings.HasSuffix(path, ".pb.go") {
|
||||
compiled = append(compiled, path)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
return protofiles, compiled, err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue