2015-11-18 17:18:44 -05:00
|
|
|
// +build !windows
|
|
|
|
|
2018-02-05 16:05:59 -05:00
|
|
|
package distribution // import "github.com/docker/docker/distribution"
|
2015-11-18 17:18:44 -05:00
|
|
|
|
|
|
|
import (
|
2017-10-03 19:58:07 -04:00
|
|
|
"runtime"
|
|
|
|
|
2016-05-25 22:11:51 -04:00
|
|
|
"github.com/docker/distribution"
|
|
|
|
"github.com/docker/distribution/context"
|
2017-10-03 19:58:07 -04:00
|
|
|
"github.com/docker/distribution/manifest/manifestlist"
|
|
|
|
"github.com/sirupsen/logrus"
|
2015-11-18 17:18:44 -05:00
|
|
|
)
|
|
|
|
|
2016-05-25 22:11:51 -04:00
|
|
|
func (ld *v2LayerDescriptor) open(ctx context.Context) (distribution.ReadSeekCloser, error) {
|
|
|
|
blobs := ld.repo.Blobs(ctx)
|
|
|
|
return blobs.Open(ctx, ld.digest)
|
|
|
|
}
|
2017-10-03 19:58:07 -04:00
|
|
|
|
2017-09-13 15:49:04 -04:00
|
|
|
func filterManifests(manifests []manifestlist.ManifestDescriptor, os string) []manifestlist.ManifestDescriptor {
|
2017-10-03 19:58:07 -04:00
|
|
|
var matches []manifestlist.ManifestDescriptor
|
|
|
|
for _, manifestDescriptor := range manifests {
|
2017-09-13 15:49:04 -04:00
|
|
|
if manifestDescriptor.Platform.Architecture == runtime.GOARCH && manifestDescriptor.Platform.OS == os {
|
2017-10-03 19:58:07 -04:00
|
|
|
matches = append(matches, manifestDescriptor)
|
|
|
|
|
2017-09-13 15:49:04 -04:00
|
|
|
logrus.Debugf("found match for %s/%s with media type %s, digest %s", os, runtime.GOARCH, manifestDescriptor.MediaType, manifestDescriptor.Digest.String())
|
2017-10-03 19:58:07 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return matches
|
|
|
|
}
|