2015-11-18 17:18:44 -05:00
|
|
|
// +build !windows
|
|
|
|
|
|
|
|
package distribution
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|