Skip to content

Commit 9b88295

Browse files
committed
Update containers/storage and containers/image
Update the versions of containers/storage and containers/image, and add new dependencies that they pull in. Signed-off-by: Nalin Dahyabhai <[email protected]>
1 parent f893e38 commit 9b88295

File tree

458 files changed

+45347
-726
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

458 files changed

+45347
-726
lines changed

hack/.vendor-helpers.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ clean() {
6060
local packages=($(GOPATH=$original_GOPATH go list -e ./... | grep -v "^${PROJECT}/vendor"))
6161
local platforms=( linux/amd64 linux/386 )
6262

63-
local buildTags=( )
63+
local buildTags=( seccomp )
6464

6565
echo
6666

hack/vendor.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,17 @@ esac
4949
clone git github.com/coreos/go-systemd master
5050
clone git github.com/BurntSushi/toml v0.2.0
5151
clone git github.com/Sirupsen/logrus v0.10.0
52-
clone git github.com/containers/image f6f11ab5cf8b1e70ef4aa3f8b6fdb4b671d16abd
52+
53+
clone git github.com/containers/storage master
54+
clone git github.com/mistifyio/go-zfs master
55+
clone git github.com/pborman/uuid master
56+
57+
clone git github.com/containers/image master
58+
clone git github.com/mtrmac/gpgme master
59+
clone git gopkg.in/cheggaaa/pb.v1 master
60+
clone git github.com/mattn/go-runewidth master
61+
clone git github.com/docker/engine-api v0.4.0
62+
5363
clone git github.com/opencontainers/image-spec master
5464
clone git golang.org/x/net 991d3e32f76f19ee6d9caadb3a22eae8d23315f7 https://github.com/golang/net.git
5565
clone git github.com/docker/docker master
@@ -64,7 +74,7 @@ clone git github.com/opencontainers/runtime-spec bb6925ea99f0e366a3f7d1c975f6577
6474
clone git github.com/docker/distribution d22e09a6686c32be8c17b684b639da4b90efe320
6575
clone git github.com/vbatts/tar-split v0.10.1
6676
clone git github.com/docker/go-units f2145db703495b2e525c59662db69a7344b00bb8
67-
clone git github.com/docker/go-connections 988efe982fdecb46f01d53465878ff1f2ff411ce
77+
clone git github.com/docker/go-connections 4ccf312bf1d35e5dbda654e57a9be4c3f3cd0366
6878
clone git github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a
6979
clone git github.com/ghodss/yaml 73d445a93680fa1a78ae23a5839bad48f32ba1ee
7080
clone git gopkg.in/yaml.v2 d466437aa4adc35830964cffc5b5f262c63ddcb4

server/image_pull.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,15 @@ func (s *Server) PullImage(ctx context.Context, req *pb.PullImageRequest) (*pb.P
3535
if err != nil {
3636
return nil, err
3737
}
38-
i := image.FromSource(src)
39-
blobs, err := i.BlobDigests()
38+
i, err := image.FromSource(src)
4039
if err != nil {
4140
return nil, err
4241
}
42+
blobs := i.LayerInfos()
43+
config := i.ConfigInfo()
44+
if config.Digest != "" {
45+
blobs = append(blobs, config)
46+
}
4347

4448
if err = os.Mkdir(filepath.Join(s.config.ImageDir, tr.StringWithinTransport()), 0755); err != nil {
4549
return nil, err
@@ -61,7 +65,7 @@ func (s *Server) PullImage(ctx context.Context, req *pb.PullImageRequest) (*pb.P
6165
if err != nil {
6266
return nil, err
6367
}
64-
if _, _, err = dest.PutBlob(r, b, -1); err != nil {
68+
if _, err = dest.PutBlob(r, b); err != nil {
6569
r.Close()
6670
return nil, err
6771
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package copy
2+
3+
import (
4+
"bytes"
5+
"compress/bzip2"
6+
"compress/gzip"
7+
"errors"
8+
"io"
9+
10+
"github.com/Sirupsen/logrus"
11+
)
12+
13+
// decompressorFunc, given a compressed stream, returns the decompressed stream.
14+
type decompressorFunc func(io.Reader) (io.Reader, error)
15+
16+
func gzipDecompressor(r io.Reader) (io.Reader, error) {
17+
return gzip.NewReader(r)
18+
}
19+
func bzip2Decompressor(r io.Reader) (io.Reader, error) {
20+
return bzip2.NewReader(r), nil
21+
}
22+
func xzDecompressor(r io.Reader) (io.Reader, error) {
23+
return nil, errors.New("Decompressing xz streams is not supported")
24+
}
25+
26+
// compressionAlgos is an internal implementation detail of detectCompression
27+
var compressionAlgos = map[string]struct {
28+
prefix []byte
29+
decompressor decompressorFunc
30+
}{
31+
"gzip": {[]byte{0x1F, 0x8B, 0x08}, gzipDecompressor}, // gzip (RFC 1952)
32+
"bzip2": {[]byte{0x42, 0x5A, 0x68}, bzip2Decompressor}, // bzip2 (decompress.c:BZ2_decompress)
33+
"xz": {[]byte{0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00}, xzDecompressor}, // xz (/usr/share/doc/xz/xz-file-format.txt)
34+
}
35+
36+
// detectCompression returns a decompressorFunc if the input is recognized as a compressed format, nil otherwise.
37+
// Because it consumes the start of input, other consumers must use the returned io.Reader instead to also read from the beginning.
38+
func detectCompression(input io.Reader) (decompressorFunc, io.Reader, error) {
39+
buffer := [8]byte{}
40+
41+
n, err := io.ReadAtLeast(input, buffer[:], len(buffer))
42+
if err != nil && err != io.EOF && err != io.ErrUnexpectedEOF {
43+
// This is a “real” error. We could just ignore it this time, process the data we have, and hope that the source will report the same error again.
44+
// Instead, fail immediately with the original error cause instead of a possibly secondary/misleading error returned later.
45+
return nil, nil, err
46+
}
47+
48+
var decompressor decompressorFunc
49+
for name, algo := range compressionAlgos {
50+
if bytes.HasPrefix(buffer[:n], algo.prefix) {
51+
logrus.Debugf("Detected compression format %s", name)
52+
decompressor = algo.decompressor
53+
break
54+
}
55+
}
56+
if decompressor == nil {
57+
logrus.Debugf("No compression detected")
58+
}
59+
60+
return decompressor, io.MultiReader(bytes.NewReader(buffer[:n]), input), nil
61+
}

0 commit comments

Comments
 (0)