vendor containers/image b95a6b8688d7702cf5906debf87f01cfd849a67a

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2016-06-28 17:24:14 +02:00
parent 9900b79eb6
commit 6c4eab8a07
11 changed files with 25 additions and 78 deletions

View File

@ -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"
)

View File

@ -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"
)

View File

@ -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) {

View File

@ -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 {

View File

@ -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.

View File

@ -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.

View File

@ -3,7 +3,7 @@
package signature
import (
"github.com/containers/image/reference"
"github.com/containers/image/docker/reference"
"github.com/containers/image/types"
)

View File

@ -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.

View File

@ -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.

View File

@ -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)