From 6c4eab8a070c9dec71b1f1bb91b6e59cbdd4efa3 Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Tue, 28 Jun 2016 17:24:14 +0200 Subject: [PATCH] vendor containers/image b95a6b8688d7702cf5906debf87f01cfd849a67a Signed-off-by: Antonio Murdaca --- .../image/docker/docker_image_dest.go | 2 +- .../image/docker/docker_image_src.go | 2 +- .../containers/image/docker/docker_utils.go | 2 +- .../image/{ => docker}/reference/reference.go | 0 .../containers/image/image/image.go | 48 ------------------- .../image/signature/policy_config.go | 2 +- .../containers/image/signature/policy_eval.go | 4 +- .../image/signature/policy_reference_match.go | 2 +- .../containers/image/signature/signature.go | 5 +- .../containers/image/types/types.go | 18 ------- .../containers/image/version/version.go | 18 ++++++- 11 files changed, 25 insertions(+), 78 deletions(-) rename vendor/github.com/containers/image/{ => docker}/reference/reference.go (100%) diff --git a/vendor/github.com/containers/image/docker/docker_image_dest.go b/vendor/github.com/containers/image/docker/docker_image_dest.go index be49f684..3b99614d 100644 --- a/vendor/github.com/containers/image/docker/docker_image_dest.go +++ b/vendor/github.com/containers/image/docker/docker_image_dest.go @@ -9,7 +9,7 @@ import ( "github.com/Sirupsen/logrus" "github.com/containers/image/manifest" - "github.com/containers/image/reference" + "github.com/containers/image/docker/reference" "github.com/containers/image/types" ) diff --git a/vendor/github.com/containers/image/docker/docker_image_src.go b/vendor/github.com/containers/image/docker/docker_image_src.go index ceca2957..56cb0c13 100644 --- a/vendor/github.com/containers/image/docker/docker_image_src.go +++ b/vendor/github.com/containers/image/docker/docker_image_src.go @@ -9,7 +9,7 @@ import ( "github.com/Sirupsen/logrus" "github.com/containers/image/manifest" - "github.com/containers/image/reference" + "github.com/containers/image/docker/reference" "github.com/containers/image/types" ) diff --git a/vendor/github.com/containers/image/docker/docker_utils.go b/vendor/github.com/containers/image/docker/docker_utils.go index 2bfc117a..f9a1fcb0 100644 --- a/vendor/github.com/containers/image/docker/docker_utils.go +++ b/vendor/github.com/containers/image/docker/docker_utils.go @@ -1,6 +1,6 @@ package docker -import "github.com/containers/image/reference" +import "github.com/containers/image/docker/reference" // parseDockerImageName converts a string into a reference and tag value. func parseDockerImageName(img string) (reference.Named, string, error) { diff --git a/vendor/github.com/containers/image/reference/reference.go b/vendor/github.com/containers/image/docker/reference/reference.go similarity index 100% rename from vendor/github.com/containers/image/reference/reference.go rename to vendor/github.com/containers/image/docker/reference/reference.go diff --git a/vendor/github.com/containers/image/image/image.go b/vendor/github.com/containers/image/image/image.go index 3b110f6c..1179e507 100644 --- a/vendor/github.com/containers/image/image/image.go +++ b/vendor/github.com/containers/image/image/image.go @@ -7,12 +7,9 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" "regexp" - "strings" "time" - "github.com/containers/image/directory" "github.com/containers/image/manifest" "github.com/containers/image/types" ) @@ -111,14 +108,8 @@ type v1Image struct { OS string `json:"os,omitempty"` } -// TODO(runcom) -func (i *genericImage) DockerTar() ([]byte, error) { - return nil, nil -} - // will support v1 one day... type genericManifest interface { - String() string GetLayers() []string } @@ -145,14 +136,6 @@ func (m *manifestSchema1) GetLayers() []string { return layers } -func (m *manifestSchema1) String() string { - return fmt.Sprintf("%s-%s", sanitize(m.Name), sanitize(m.Tag)) -} - -func sanitize(s string) string { - return strings.Replace(s, "/", "-", -1) -} - // getSchema1Manifest parses the manifest into a data structure, cleans it up, and returns it. // NOTE: The manifest may have been modified in the process; DO NOT reserialize and store the return value // if you want to preserve the original manifest; use the blob returned by Manifest() directly. @@ -205,37 +188,6 @@ func (i *genericImage) LayerDigests() ([]string, error) { return uniqueLayerDigests(m), nil } -func (i *genericImage) LayersCommand(layers ...string) error { - m, err := i.getSchema1Manifest() - if err != nil { - return err - } - tmpDir, err := ioutil.TempDir(".", "layers-"+m.String()+"-") - if err != nil { - return err - } - dest := directory.NewDirImageDestination(tmpDir) - data, err := json.Marshal(m) - if err != nil { - return err - } - if err := dest.PutManifest(data); err != nil { - return err - } - if len(layers) == 0 { - layers = uniqueLayerDigests(m) - } - for _, l := range layers { - if !strings.HasPrefix(l, "sha256:") { - l = "sha256:" + l - } - if err := i.getLayer(dest, l); err != nil { - return err - } - } - return nil -} - func (i *genericImage) getLayer(dest types.ImageDestination, digest string) error { stream, _, err := i.src.GetBlob(digest) if err != nil { diff --git a/vendor/github.com/containers/image/signature/policy_config.go b/vendor/github.com/containers/image/signature/policy_config.go index 767e02a9..d9107f32 100644 --- a/vendor/github.com/containers/image/signature/policy_config.go +++ b/vendor/github.com/containers/image/signature/policy_config.go @@ -18,7 +18,7 @@ import ( "fmt" "io/ioutil" - "github.com/containers/image/reference" + "github.com/containers/image/docker/reference" ) // InvalidPolicyFormatError is returned when parsing an invalid policy configuration. diff --git a/vendor/github.com/containers/image/signature/policy_eval.go b/vendor/github.com/containers/image/signature/policy_eval.go index a7d89d78..f11f5266 100644 --- a/vendor/github.com/containers/image/signature/policy_eval.go +++ b/vendor/github.com/containers/image/signature/policy_eval.go @@ -10,9 +10,9 @@ import ( "strings" "github.com/Sirupsen/logrus" - distreference "github.com/docker/distribution/reference" - "github.com/containers/image/reference" + "github.com/containers/image/docker/reference" "github.com/containers/image/types" + distreference "github.com/docker/distribution/reference" ) // PolicyRequirementError is an explanatory text for rejecting a signature or an image. diff --git a/vendor/github.com/containers/image/signature/policy_reference_match.go b/vendor/github.com/containers/image/signature/policy_reference_match.go index 8c700e6c..9e3aee9b 100644 --- a/vendor/github.com/containers/image/signature/policy_reference_match.go +++ b/vendor/github.com/containers/image/signature/policy_reference_match.go @@ -3,7 +3,7 @@ package signature import ( - "github.com/containers/image/reference" + "github.com/containers/image/docker/reference" "github.com/containers/image/types" ) diff --git a/vendor/github.com/containers/image/signature/signature.go b/vendor/github.com/containers/image/signature/signature.go index adc15b29..2309e499 100644 --- a/vendor/github.com/containers/image/signature/signature.go +++ b/vendor/github.com/containers/image/signature/signature.go @@ -12,8 +12,7 @@ import ( ) const ( - signatureType = "atomic container signature" - signatureCreatorID = "atomic " + version.Version + signatureType = "atomic container signature" ) // InvalidSignatureError is returned when parsing an invalid signature. @@ -41,7 +40,7 @@ var _ json.Marshaler = (*privateSignature)(nil) // MarshalJSON implements the json.Marshaler interface. func (s privateSignature) MarshalJSON() ([]byte, error) { - return s.marshalJSONWithVariables(time.Now().UTC().Unix(), signatureCreatorID) + return s.marshalJSONWithVariables(time.Now().UTC().Unix(), "atomic "+version.Version) } // Implementation of MarshalJSON, with a caller-chosen values of the variable items to help testing. diff --git a/vendor/github.com/containers/image/types/types.go b/vendor/github.com/containers/image/types/types.go index b7fbe680..1c4609be 100644 --- a/vendor/github.com/containers/image/types/types.go +++ b/vendor/github.com/containers/image/types/types.go @@ -5,19 +5,6 @@ import ( "time" ) -// Registry is a service providing repositories. -type Registry interface { - Repositories() []Repository - Repository(ref string) Repository - Lookup(term string) []Image // docker registry v1 only AFAICT, v2 can be built hacking with Images() -} - -// Repository is a set of images. -type Repository interface { - Images() []Image - Image(ref string) Image // ref == image name w/o registry part -} - // ImageSource is a service, possibly remote (= slow), to download components of a single image. // This is primarily useful for copying images around; for examining their properties, Image (below) // is usually more useful. @@ -65,13 +52,8 @@ type Image interface { // The list will not contain duplicates; it is not intended to correspond to the "history" or "parent chain" of a Docker image. // NOTE: It is essential for signature verification that LayerDigests is computed from the same manifest which is returned by Manifest(). LayerDigests() ([]string, error) - // LayersCommand implements (skopeo layers). Do not use for any other purpose. - // Longer-term we would like to move the command-specific code up to the command handler, - // but the command has functionality specific to util.DockerV2Schema1MIMEType manifests. - LayersCommand(layers ...string) error // configure download directory? // Inspect returns various information for (skopeo inspect) parsed from the manifest and configuration. Inspect() (*ImageInspectInfo, error) - DockerTar() ([]byte, error) // ??? also, configure output directory } // ImageInspectInfo is a set of metadata describing Docker images, primarily their manifest and configuration. diff --git a/vendor/github.com/containers/image/version/version.go b/vendor/github.com/containers/image/version/version.go index ea7c9d9e..6644bcff 100644 --- a/vendor/github.com/containers/image/version/version.go +++ b/vendor/github.com/containers/image/version/version.go @@ -1,4 +1,18 @@ package version -// Version is the version of the build. -const Version = "0.1.14-dev" +import "fmt" + +const ( + // VersionMajor is for an API incompatible changes + VersionMajor = 0 + // VersionMinor is for functionality in a backwards-compatible manner + VersionMinor = 1 + // VersionPatch is for backwards-compatible bug fixes + VersionPatch = 0 + + // VersionDev indicates development branch. Releases will be empty string. + VersionDev = "-dev" +) + +// Version is the specification version that the package types support. +var Version = fmt.Sprintf("%d.%d.%d%s", VersionMajor, VersionMinor, VersionPatch, VersionDev)