From 663b04fc6061736052dcbb6d13256ea70dc36e00 Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Thu, 7 Apr 2016 14:19:57 -0700 Subject: [PATCH] vendor updated godep --- Godeps/Godeps.json | 6 +- .../github.com/hashicorp/go-getter/README.md | 68 +++++++++++++- .../hashicorp/go-getter/decompress_testing.go | 10 ++- .../hashicorp/go-getter/decompress_zip.go | 11 ++- .../hashicorp/go-getter/get_file.go | 90 ------------------- .../github.com/hashicorp/go-getter/get_hg.go | 7 +- 6 files changed, 95 insertions(+), 97 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 327b0c1fa..c5fb0da43 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -1,7 +1,7 @@ { "ImportPath": "github.com/hashicorp/nomad", "GoVersion": "go1.6", - "GodepVersion": "v60", + "GodepVersion": "v61", "Deps": [ { "ImportPath": "github.com/StackExchange/wmi", @@ -283,11 +283,11 @@ }, { "ImportPath": "github.com/hashicorp/go-getter", - "Rev": "cd92db7af9118d920be4f1b95680ba75ad91d1c6" + "Rev": "ef5edd3d8f6f482b775199be2f3734fd20e04d4a" }, { "ImportPath": "github.com/hashicorp/go-getter/helper/url", - "Rev": "cd92db7af9118d920be4f1b95680ba75ad91d1c6" + "Rev": "ef5edd3d8f6f482b775199be2f3734fd20e04d4a" }, { "ImportPath": "github.com/hashicorp/go-immutable-radix", diff --git a/vendor/github.com/hashicorp/go-getter/README.md b/vendor/github.com/hashicorp/go-getter/README.md index 8ce50622a..1e37892bb 100644 --- a/vendor/github.com/hashicorp/go-getter/README.md +++ b/vendor/github.com/hashicorp/go-getter/README.md @@ -1,10 +1,12 @@ # go-getter [![Build Status](http://img.shields.io/travis/hashicorp/go-getter.svg?style=flat-square)][travis] +[![Build status](https://ci.appveyor.com/api/projects/status/ulq3qr43n62croyq/branch/master?svg=true)][appveyor] [![Go Documentation](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)][godocs] [travis]: http://travis-ci.org/hashicorp/go-getter [godocs]: http://godoc.org/github.com/hashicorp/go-getter +[appveyor]: https://ci.appveyor.com/project/hashicorp/go-getter/branch/master go-getter is a library for Go (golang) for downloading files or directories from various sources using a URL as the primary form of input. @@ -48,7 +50,7 @@ The command is useful for verifying URL structures. ## URL Format -go-getter uses a single string URL as input to downlaod from a variety of +go-getter uses a single string URL as input to download from a variety of protocols. go-getter has various "tricks" with this URL to do certain things. This section documents the URL format. @@ -100,6 +102,23 @@ In the absense of a forced protocol, detectors may be run on the URL, transformi the protocol anyways. The above example would've used the Git protocol either way since the Git detector would've detected it was a GitHub URL. +### Protocol-Specific Options + +Each protocol can support protocol-specific options to configure that +protocol. For example, the `git` protocol supports specifying a `ref` +query parameter that tells it what ref to checkout for that Git +repository. + +The options are specified as query parameters on the URL (or URL-like string) +given to go-getter. Using the Git example above, the URL below is a valid +input to go-getter: + + github.com/hashicorp/go-getter?ref=abcd1234 + +The protocol-specific options are documented below the URL format +section. But because they are part of the URL, we point it out here so +you know they exist. + ### Checksumming For file downloads of any protocol, go-getter can automatically verify @@ -161,3 +180,50 @@ And finally, you can disable archiving completely: You can combine unarchiving with the other features of go-getter such as checksumming. The special `archive` query parameter will be removed from the URL before going to the final protocol downloader. + +## Protocol-Specific Options + +This section documents the protocol-specific options that can be specified +for go-getter. These options should be appended to the input as normal query +parameters. Depending on the usage of go-getter, applications may provide +alternate ways of inputting options. For example, [Nomad](https://www.nomadproject.io) +provides a nice options block for specifying options rather than in the URL. + +## General (All Protocols) + +The options below are available to all protocols: + + * `archive` - The archive format to use to unarchive this file, or "" (empty + string) to disable unarchiving. For more details, see the complete section + on archive support above. + + * `checksum` - Checksum to verify the downloaded file or archive. See + the entire section on checksumming above for format and more details. + +### Local Files (`file`) + +None + +### Git (`git`) + + * `ref` - The Git ref to checkout. This is a ref, so it can point to + a commit SHA, a branch name, etc. If it is a named ref such as a branch + name, go-getter will update it to the latest on each get. + +### Mercurial (`hg`) + + * `rev` - The Mercurial revision to checkout. + +### HTTP (`http`) + +None + +### S3 (`s3`) + +S3 takes various access configurations in the URL. Note that it will also +read these from standard AWS environment variables if they're set. If +the query parameters are present, these take priority. + + * `aws_access_key_id` - AWS access key. + * `aws_access_key_secret` - AWS access key secret. + * `aws_access_token` - AWS access token if this is being used. diff --git a/vendor/github.com/hashicorp/go-getter/decompress_testing.go b/vendor/github.com/hashicorp/go-getter/decompress_testing.go index 2834e399d..686d6c2b6 100644 --- a/vendor/github.com/hashicorp/go-getter/decompress_testing.go +++ b/vendor/github.com/hashicorp/go-getter/decompress_testing.go @@ -8,6 +8,7 @@ import ( "os" "path/filepath" "reflect" + "runtime" "sort" "strings" "testing" @@ -69,9 +70,16 @@ func TestDecompressor(t *testing.T, d Decompressor, cases []TestDecompressCase) return } + // Convert expected for windows + expected := tc.DirList + if runtime.GOOS == "windows" { + for i, v := range expected { + expected[i] = strings.Replace(v, "/", "\\", -1) + } + } + // Directory, check for the correct contents actual := testListDir(t, dst) - expected := tc.DirList if !reflect.DeepEqual(actual, expected) { t.Fatalf("bad %s\n\n%#v\n\n%#v", tc.Input, actual, expected) } diff --git a/vendor/github.com/hashicorp/go-getter/decompress_zip.go b/vendor/github.com/hashicorp/go-getter/decompress_zip.go index 0e4f6d739..a065c076f 100644 --- a/vendor/github.com/hashicorp/go-getter/decompress_zip.go +++ b/vendor/github.com/hashicorp/go-getter/decompress_zip.go @@ -46,7 +46,7 @@ func (d *ZipDecompressor) Decompress(dst, src string, dir bool) error { } if f.FileInfo().IsDir() { - if dir { + if !dir { return fmt.Errorf("expected a single file: %s", src) } @@ -58,6 +58,15 @@ func (d *ZipDecompressor) Decompress(dst, src string, dir bool) error { continue } + // Create the enclosing directories if we must. ZIP files aren't + // required to contain entries for just the directories so this + // can happen. + if dir { + if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil { + return err + } + } + // Open the file for reading srcF, err := f.Open() if err != nil { diff --git a/vendor/github.com/hashicorp/go-getter/get_file.go b/vendor/github.com/hashicorp/go-getter/get_file.go index 9564c9f48..341cd0ed8 100644 --- a/vendor/github.com/hashicorp/go-getter/get_file.go +++ b/vendor/github.com/hashicorp/go-getter/get_file.go @@ -1,98 +1,8 @@ package getter -import ( - "fmt" - "io" - "net/url" - "os" - "path/filepath" -) - // FileGetter is a Getter implementation that will download a module from // a file scheme. type FileGetter struct { // Copy, if set to true, will copy data instead of using a symlink Copy bool } - -func (g *FileGetter) Get(dst string, u *url.URL) error { - // The source path must exist and be a directory to be usable. - if fi, err := os.Stat(u.Path); err != nil { - return fmt.Errorf("source path error: %s", err) - } else if !fi.IsDir() { - return fmt.Errorf("source path must be a directory") - } - - fi, err := os.Lstat(dst) - if err != nil && !os.IsNotExist(err) { - return err - } - - // If the destination already exists, it must be a symlink - if err == nil { - mode := fi.Mode() - if mode&os.ModeSymlink == 0 { - return fmt.Errorf("destination exists and is not a symlink") - } - - // Remove the destination - if err := os.Remove(dst); err != nil { - return err - } - } - - // Create all the parent directories - if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil { - return err - } - - return os.Symlink(u.Path, dst) -} - -func (g *FileGetter) GetFile(dst string, u *url.URL) error { - // The source path must exist and be a directory to be usable. - if fi, err := os.Stat(u.Path); err != nil { - return fmt.Errorf("source path error: %s", err) - } else if fi.IsDir() { - return fmt.Errorf("source path must be a file") - } - - _, err := os.Lstat(dst) - if err != nil && !os.IsNotExist(err) { - return err - } - - // If the destination already exists, it must be a symlink - if err == nil { - // Remove the destination - if err := os.Remove(dst); err != nil { - return err - } - } - - // Create all the parent directories - if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil { - return err - } - - // If we're not copying, just symlink and we're done - if !g.Copy { - return os.Symlink(u.Path, dst) - } - - // Copy - srcF, err := os.Open(u.Path) - if err != nil { - return err - } - defer srcF.Close() - - dstF, err := os.Create(dst) - if err != nil { - return err - } - defer dstF.Close() - - _, err = io.Copy(dstF, srcF) - return err -} diff --git a/vendor/github.com/hashicorp/go-getter/get_hg.go b/vendor/github.com/hashicorp/go-getter/get_hg.go index eb170d100..542bef1f9 100644 --- a/vendor/github.com/hashicorp/go-getter/get_hg.go +++ b/vendor/github.com/hashicorp/go-getter/get_hg.go @@ -71,7 +71,12 @@ func (g *HgGetter) GetFile(dst string, u *url.URL) error { // Get the filename, and strip the filename from the URL so we can // just get the repository directly. filename := filepath.Base(u.Path) - u.Path = filepath.Dir(u.Path) + u.Path = filepath.ToSlash(filepath.Dir(u.Path)) + + // If we're on Windows, we need to set the host to "localhost" for hg + if runtime.GOOS == "windows" { + u.Host = "localhost" + } // Get the full repository if err := g.Get(td, u); err != nil {