revendor containers/image

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2016-11-30 18:07:35 +01:00
parent 7cca84ba57
commit 1e795e038b
No known key found for this signature in database
GPG Key ID: B2BEAD150DE936B9
5 changed files with 11 additions and 10 deletions

View File

@ -212,14 +212,14 @@ func copyLayers(manifestUpdates *types.ManifestUpdateOptions, dest types.ImageDe
canModifyManifest bool, reportWriter io.Writer) error { canModifyManifest bool, reportWriter io.Writer) error {
type copiedLayer struct { type copiedLayer struct {
blobInfo types.BlobInfo blobInfo types.BlobInfo
diffID string diffID digest.Digest
} }
diffIDsAreNeeded := src.UpdatedImageNeedsLayerDiffIDs(*manifestUpdates) diffIDsAreNeeded := src.UpdatedImageNeedsLayerDiffIDs(*manifestUpdates)
srcInfos := src.LayerInfos() srcInfos := src.LayerInfos()
destInfos := []types.BlobInfo{} destInfos := []types.BlobInfo{}
diffIDs := []string{} diffIDs := []digest.Digest{}
copiedLayers := map[digest.Digest]copiedLayer{} copiedLayers := map[digest.Digest]copiedLayer{}
for _, srcLayer := range srcInfos { for _, srcLayer := range srcInfos {
cl, ok := copiedLayers[srcLayer.Digest] cl, ok := copiedLayers[srcLayer.Digest]
@ -229,7 +229,7 @@ func copyLayers(manifestUpdates *types.ManifestUpdateOptions, dest types.ImageDe
if err != nil { if err != nil {
return err return err
} }
cl = copiedLayer{blobInfo: destInfo, diffID: diffID.String()} cl = copiedLayer{blobInfo: destInfo, diffID: diffID}
copiedLayers[srcLayer.Digest] = cl copiedLayers[srcLayer.Digest] = cl
} }
destInfos = append(destInfos, cl.blobInfo) destInfos = append(destInfos, cl.blobInfo)

View File

@ -22,7 +22,7 @@ type manifestItem struct {
} }
type imageID string type imageID string
type diffID string type diffID digest.Digest
// Based on github.com/docker/distribution/blobs.go // Based on github.com/docker/distribution/blobs.go
type distributionDescriptor struct { type distributionDescriptor struct {

View File

@ -236,7 +236,7 @@ func validateV1ID(id string) error {
} }
// Based on github.com/docker/docker/distribution/pull_v2.go // Based on github.com/docker/docker/distribution/pull_v2.go
func (m *manifestSchema1) convertToManifestSchema2(uploadedLayerInfos []types.BlobInfo, layerDiffIDs []string) (types.Image, error) { func (m *manifestSchema1) convertToManifestSchema2(uploadedLayerInfos []types.BlobInfo, layerDiffIDs []digest.Digest) (types.Image, error) {
if len(m.History) == 0 { if len(m.History) == 0 {
// What would this even mean?! Anyhow, the rest of the code depends on fsLayers[0] and history[0] existing. // What would this even mean?! Anyhow, the rest of the code depends on fsLayers[0] and history[0] existing.
return nil, fmt.Errorf("Cannot convert an image with 0 history entries to %s", manifest.DockerV2Schema2MediaType) return nil, fmt.Errorf("Cannot convert an image with 0 history entries to %s", manifest.DockerV2Schema2MediaType)
@ -253,7 +253,7 @@ func (m *manifestSchema1) convertToManifestSchema2(uploadedLayerInfos []types.Bl
rootFS := rootFS{ rootFS := rootFS{
Type: "layers", Type: "layers",
DiffIDs: []string{}, DiffIDs: []digest.Digest{},
BaseLayer: "", BaseLayer: "",
} }
var layers []descriptor var layers []descriptor

View File

@ -3,6 +3,7 @@ package image
import ( import (
"time" "time"
"github.com/docker/distribution/digest"
"github.com/docker/engine-api/types/strslice" "github.com/docker/engine-api/types/strslice"
"github.com/containers/image/manifest" "github.com/containers/image/manifest"
@ -47,7 +48,7 @@ type imageHistory struct {
type rootFS struct { type rootFS struct {
Type string `json:"type"` Type string `json:"type"`
DiffIDs []string `json:"diff_ids,omitempty"` DiffIDs []digest.Digest `json:"diff_ids,omitempty"`
BaseLayer string `json:"base_layer,omitempty"` BaseLayer string `json:"base_layer,omitempty"`
} }

View File

@ -221,7 +221,7 @@ type ManifestUpdateOptions struct {
type ManifestUpdateInformation struct { type ManifestUpdateInformation struct {
Destination ImageDestination // and yes, UpdatedManifest may write to Destination (see the schema2 → schema1 conversion logic in image/docker_schema2.go) Destination ImageDestination // and yes, UpdatedManifest may write to Destination (see the schema2 → schema1 conversion logic in image/docker_schema2.go)
LayerInfos []BlobInfo // Complete BlobInfos (size+digest) which have been uploaded, in order (the root layer first, and then successive layered layers) LayerInfos []BlobInfo // Complete BlobInfos (size+digest) which have been uploaded, in order (the root layer first, and then successive layered layers)
LayerDiffIDs []string // Digest values for the _uncompressed_ contents of the blobs which have been uploaded, in the same order. LayerDiffIDs []digest.Digest // Digest values for the _uncompressed_ contents of the blobs which have been uploaded, in the same order.
} }
// ImageInspectInfo is a set of metadata describing Docker images, primarily their manifest and configuration. // ImageInspectInfo is a set of metadata describing Docker images, primarily their manifest and configuration.