Import upstream changes up to constabulary/gb@572f68e
diff --git a/fetch.go b/fetch.go
index dd953a8..ef16489 100644
--- a/fetch.go
+++ b/fetch.go
@@ -3,15 +3,15 @@
import (
"flag"
"fmt"
+ "go/build"
"log"
"net/url"
"path/filepath"
"runtime"
"sort"
- "go/build"
-
"github.com/FiloSottile/gvt/gbvendor"
+ "github.com/constabulary/gb/fileutils"
)
var (
@@ -122,7 +122,7 @@
dst := filepath.Join(vendorDir(), dep.Importpath)
src := filepath.Join(wc.Dir(), dep.Path)
- if err := vendor.Copypath(dst, src); err != nil {
+ if err := fileutils.Copypath(dst, src); err != nil {
return err
}
diff --git a/gbvendor/copy.go b/gbvendor/copy.go
deleted file mode 100644
index f2d5d2c..0000000
--- a/gbvendor/copy.go
+++ /dev/null
@@ -1,72 +0,0 @@
-package vendor
-
-import (
- "fmt"
- "io"
- "os"
- "path/filepath"
- "strings"
-
- "github.com/constabulary/gb/fileutils"
-)
-
-const debugCopypath = true
-const debugCopyfile = false
-
-// Copypath copies the contents of src to dst, excluding any file or
-// directory that starts with a period.
-func Copypath(dst string, src string) error {
- err := filepath.Walk(src, func(path string, info os.FileInfo, err error) error {
- if err != nil {
- return err
- }
-
- if strings.HasPrefix(filepath.Base(path), ".") {
- if info.IsDir() {
- return filepath.SkipDir
- }
- return nil
- }
-
- if info.IsDir() {
- return nil
- }
-
- if info.Mode()&os.ModeSymlink != 0 {
- if debugCopypath {
- fmt.Printf("skipping symlink: %v\n", path)
- }
- return nil
- }
-
- dst := filepath.Join(dst, path[len(src):])
- return copyfile(dst, path)
- })
- if err != nil {
- // if there was an error during copying, remove the partial copy.
- fileutils.RemoveAll(dst)
- }
- return err
-}
-
-func copyfile(dst, src string) error {
- err := mkdir(filepath.Dir(dst))
- if err != nil {
- return fmt.Errorf("copyfile: mkdirall: %v", err)
- }
- r, err := os.Open(src)
- if err != nil {
- return fmt.Errorf("copyfile: open(%q): %v", src, err)
- }
- defer r.Close()
- w, err := os.Create(dst)
- if err != nil {
- return fmt.Errorf("copyfile: create(%q): %v", dst, err)
- }
- defer w.Close()
- if debugCopyfile {
- fmt.Printf("copyfile(dst: %v, src: %v)\n", dst, src)
- }
- _, err = io.Copy(w, r)
- return err
-}
diff --git a/gbvendor/imports.go b/gbvendor/imports.go
index 80174af..0124483 100644
--- a/gbvendor/imports.go
+++ b/gbvendor/imports.go
@@ -35,9 +35,7 @@
for _, s := range f.Imports {
p := strings.Replace(s.Path.Value, "\"", "", -1)
- if !contains(stdlib, p) {
- pkgs[p] = true
- }
+ pkgs[p] = true
}
return nil
}
diff --git a/gbvendor/imports_test.go b/gbvendor/imports_test.go
index 283f9db..bdde910 100644
--- a/gbvendor/imports_test.go
+++ b/gbvendor/imports_test.go
@@ -18,7 +18,7 @@
t.Fatalf("ParseImports(%q): %v", root, err)
}
- want := set("github.com/quux/flobble", "github.com/lypo/moopo", "github.com/hoo/wuu")
+ want := set("fmt", "github.com/quux/flobble", "github.com/lypo/moopo", "github.com/hoo/wuu")
if !reflect.DeepEqual(got, want) {
t.Fatalf("ParseImports(%q): want: %v, got %v", root, want, got)
}
diff --git a/gbvendor/repo.go b/gbvendor/repo.go
index 97014f1..eb52e84 100644
--- a/gbvendor/repo.go
+++ b/gbvendor/repo.go
@@ -70,7 +70,7 @@
}
path = u.Host + u.Path
- if !regexp.MustCompile(`^([A-Za-z0-9-]+)(.[A-Za-z0-9-]+)+(/[A-Za-z0-9-_.~]+)+$`).MatchString(path) {
+ if !regexp.MustCompile(`^([A-Za-z0-9-]+)(\.[A-Za-z0-9-]+)+(/[A-Za-z0-9-_.~]+)*$`).MatchString(path) {
return nil, "", fmt.Errorf("%q is not a valid import path", path)
}
diff --git a/gbvendor/repo_test.go b/gbvendor/repo_test.go
index 03c5107..b42bbc8 100644
--- a/gbvendor/repo_test.go
+++ b/gbvendor/repo_test.go
@@ -84,6 +84,12 @@
},
extra: "",
}, {
+ path: "goji.io",
+ want: &gitrepo{
+ url: "https://github.com/goji/goji",
+ },
+ extra: "",
+ }, {
path: "golang.org/x/tools/go/vcs",
want: &gitrepo{
url: "https://go.googlesource.com/tools",
diff --git a/gbvendor/stdlib.go b/gbvendor/stdlib.go
deleted file mode 100644
index f297561..0000000
--- a/gbvendor/stdlib.go
+++ /dev/null
@@ -1,138 +0,0 @@
-package vendor
-
-// packages from the standard lib. They are excluded
-// from the package map.
-var stdlib = map[string]bool{
- "C": true,
- "archive/tar": true,
- "archive/zip": true,
- "bufio": true,
- "bytes": true,
- "compress/bzip2": true,
- "compress/flate": true,
- "compress/gzip": true,
- "compress/lzw": true,
- "compress/zlib": true,
- "container/heap": true,
- "container/list": true,
- "container/ring": true,
- "crypto": true,
- "crypto/aes": true,
- "crypto/cipher": true,
- "crypto/des": true,
- "crypto/dsa": true,
- "crypto/ecdsa": true,
- "crypto/elliptic": true,
- "crypto/hmac": true,
- "crypto/md5": true,
- "crypto/rand": true,
- "crypto/rc4": true,
- "crypto/rsa": true,
- "crypto/sha1": true,
- "crypto/sha256": true,
- "crypto/sha512": true,
- "crypto/subtle": true,
- "crypto/tls": true,
- "crypto/x509": true,
- "crypto/x509/pkix": true,
- "database/sql": true,
- "database/sql/driver": true,
- "debug/dwarf": true,
- "debug/elf": true,
- "debug/gosym": true,
- "debug/macho": true,
- "debug/pe": true,
- "encoding": true,
- "encoding/ascii85": true,
- "encoding/asn1": true,
- "encoding/base32": true,
- "encoding/base64": true,
- "encoding/binary": true,
- "encoding/csv": true,
- "encoding/gob": true,
- "encoding/hex": true,
- "encoding/json": true,
- "encoding/pem": true,
- "encoding/xml": true,
- "errors": true,
- "expvar": true,
- "flag": true,
- "fmt": true,
- "go/ast": true,
- "go/build": true,
- "go/doc": true,
- "go/format": true,
- "go/parser": true,
- "go/printer": true,
- "go/scanner": true,
- "go/token": true,
- "hash": true,
- "hash/adler32": true,
- "hash/crc32": true,
- "hash/crc64": true,
- "hash/fnv": true,
- "html": true,
- "html/template": true,
- "image": true,
- "image/color": true,
- "image/draw": true,
- "image/gif": true,
- "image/jpeg": true,
- "image/png": true,
- "index/suffixarray": true,
- "io": true,
- "io/ioutil": true,
- "log": true,
- "log/syslog": true,
- "math": true,
- "math/big": true,
- "math/cmplx": true,
- "math/rand": true,
- "mime": true,
- "mime/multipart": true,
- "net": true,
- "net/http": true,
- "net/http/cgi": true,
- "net/http/cookiejar": true,
- "net/http/fcgi": true,
- "net/http/httptest": true,
- "net/http/httputil": true,
- "net/http/pprof": true,
- "net/mail": true,
- "net/rpc": true,
- "net/rpc/jsonrpc": true,
- "net/smtp": true,
- "net/textproto": true,
- "net/url": true,
- "os": true,
- "os/exec": true,
- "os/signal": true,
- "os/user": true,
- "path": true,
- "path/filepath": true,
- "reflect": true,
- "regexp": true,
- "regexp/syntax": true,
- "runtime": true,
- "runtime/cgo": true,
- "runtime/debug": true,
- "runtime/pprof": true,
- "sort": true,
- "strconv": true,
- "strings": true,
- "sync": true,
- "sync/atomic": true,
- "syscall": true,
- "testing": true,
- "testing/iotest": true,
- "testing/quick": true,
- "text/scanner": true,
- "text/tabwriter": true,
- "text/template": true,
- "text/template/parse": true,
- "time": true,
- "unicode": true,
- "unicode/utf16": true,
- "unicode/utf8": true,
- "unsafe": true,
-}
diff --git a/rebuild.go b/rebuild.go
index 0f523c2..449747c 100644
--- a/rebuild.go
+++ b/rebuild.go
@@ -9,9 +9,8 @@
"sync"
"sync/atomic"
- "github.com/constabulary/gb/fileutils"
-
"github.com/FiloSottile/gvt/gbvendor"
+ "github.com/constabulary/gb/fileutils"
)
var (
@@ -113,7 +112,7 @@
}
src := filepath.Join(wc.Dir(), dep.Path)
- if err := vendor.Copypath(dst, src); err != nil {
+ if err := fileutils.Copypath(dst, src); err != nil {
return err
}
diff --git a/update.go b/update.go
index a719ced..a7d4d43 100644
--- a/update.go
+++ b/update.go
@@ -107,7 +107,7 @@
dst := filepath.Join(vendorDir(), filepath.FromSlash(dep.Importpath))
src := filepath.Join(wc.Dir(), dep.Path)
- if err := vendor.Copypath(dst, src); err != nil {
+ if err := fileutils.Copypath(dst, src); err != nil {
return err
}
diff --git a/vendor/github.com/constabulary/gb/fileutils/fileutils.go b/vendor/github.com/constabulary/gb/fileutils/fileutils.go
index c2c2dc7..a0bba9f 100644
--- a/vendor/github.com/constabulary/gb/fileutils/fileutils.go
+++ b/vendor/github.com/constabulary/gb/fileutils/fileutils.go
@@ -10,7 +10,7 @@
"strings"
)
-const debugCopypath = true
+const debugCopypath = false
const debugCopyfile = false
// Copypath copies the contents of src to dst, excluding any file or
@@ -40,7 +40,7 @@
}
dst := filepath.Join(dst, path[len(src):])
- return copyfile(dst, path)
+ return Copyfile(dst, path)
})
if err != nil {
// if there was an error during copying, remove the partial copy.
@@ -49,7 +49,7 @@
return err
}
-func copyfile(dst, src string) error {
+func Copyfile(dst, src string) error {
err := mkdir(filepath.Dir(dst))
if err != nil {
return fmt.Errorf("copyfile: mkdirall: %v", err)
diff --git a/vendor/manifest b/vendor/manifest
index 60981a3..61983d2 100644
--- a/vendor/manifest
+++ b/vendor/manifest
@@ -4,7 +4,7 @@
{
"importpath": "github.com/constabulary/gb/fileutils",
"repository": "https://github.com/constabulary/gb",
- "revision": "9e201fb977e3dff7e0c94b73640be2a97285c418",
+ "revision": "572f68e6f0e403df7e6b4426bb26e535b988398c",
"branch": "master",
"path": "/fileutils"
}