Permalink
Browse files

*: switch to opencontaniners/go-digest

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
  • Loading branch information...
1 parent e41b0d6 commit dcfcfdaa1e7e07e1e3d7cbe659ad654ffc11c5b5 @runcom runcom committed Jan 9, 2017
Showing with 1,252 additions and 60 deletions.
  1. +1 −1 cmd/skopeo/inspect.go
  2. +2 −2 cmd/skopeo/layers.go
  3. +1 −1 cmd/skopeo/signing_test.go
  4. +1 −0 hack/vendor.sh
  5. +1 −1 integration/copy_test.go
  6. +2 −2 vendor/github.com/containers/image/copy/copy.go
  7. +2 −2 vendor/github.com/containers/image/directory/directory_dest.go
  8. +1 −1 vendor/github.com/containers/image/directory/directory_src.go
  9. +1 −1 vendor/github.com/containers/image/directory/directory_transport.go
  10. +2 −2 vendor/github.com/containers/image/docker/daemon/daemon_dest.go
  11. +1 −1 vendor/github.com/containers/image/docker/daemon/daemon_src.go
  12. +2 −2 vendor/github.com/containers/image/docker/daemon/daemon_transport.go
  13. +1 −1 vendor/github.com/containers/image/docker/daemon/daemon_types.go
  14. +2 −2 vendor/github.com/containers/image/docker/docker_image_dest.go
  15. +1 −1 vendor/github.com/containers/image/docker/docker_image_src.go
  16. +1 −1 vendor/github.com/containers/image/docker/lookaside.go
  17. +11 −17 vendor/github.com/containers/image/docker/reference/reference.go
  18. +1 −1 vendor/github.com/containers/image/image/docker_list.go
  19. +1 −1 vendor/github.com/containers/image/image/docker_schema1.go
  20. +1 −1 vendor/github.com/containers/image/image/docker_schema2.go
  21. +1 −1 vendor/github.com/containers/image/image/manifest.go
  22. +1 −1 vendor/github.com/containers/image/image/oci.go
  23. +1 −1 vendor/github.com/containers/image/manifest/manifest.go
  24. +2 −2 vendor/github.com/containers/image/oci/layout/oci_dest.go
  25. +1 −1 vendor/github.com/containers/image/oci/layout/oci_src.go
  26. +1 −1 vendor/github.com/containers/image/oci/layout/oci_transport.go
  27. +1 −1 vendor/github.com/containers/image/openshift/openshift.go
  28. +1 −1 vendor/github.com/containers/image/signature/docker.go
  29. +1 −1 vendor/github.com/containers/image/signature/policy_eval_signedby.go
  30. +1 −1 vendor/github.com/containers/image/signature/signature.go
  31. +3 −3 vendor/github.com/containers/image/storage/storage_image.go
  32. +4 −4 vendor/github.com/containers/image/storage/storage_transport.go
  33. +1 −1 vendor/github.com/containers/image/types/types.go
  34. +12 −0 vendor/github.com/opencontainers/go-digest/.pullapprove.yml
  35. +4 −0 vendor/github.com/opencontainers/go-digest/.travis.yml
  36. +72 −0 vendor/github.com/opencontainers/go-digest/CONTRIBUTING.md
  37. +191 −0 vendor/github.com/opencontainers/go-digest/LICENSE.code
  38. +425 −0 vendor/github.com/opencontainers/go-digest/LICENSE.docs
  39. +7 −0 vendor/github.com/opencontainers/go-digest/MAINTAINERS
  40. +104 −0 vendor/github.com/opencontainers/go-digest/README.md
  41. +144 −0 vendor/github.com/opencontainers/go-digest/algorithm.go
  42. +140 −0 vendor/github.com/opencontainers/go-digest/digest.go
  43. +25 −0 vendor/github.com/opencontainers/go-digest/digester.go
  44. +42 −0 vendor/github.com/opencontainers/go-digest/doc.go
  45. +31 −0 vendor/github.com/opencontainers/go-digest/verifiers.go
@@ -7,7 +7,7 @@ import (
"github.com/containers/image/docker"
"github.com/containers/image/manifest"
- "github.com/docker/distribution/digest"
+ "github.com/opencontainers/go-digest"
"github.com/urfave/cli"
)
@@ -11,7 +11,7 @@ import (
"github.com/containers/image/image"
"github.com/containers/image/manifest"
"github.com/containers/image/types"
- "github.com/docker/distribution/digest"
+ "github.com/opencontainers/go-digest"
"github.com/urfave/cli"
)
@@ -46,7 +46,7 @@ var layersCmd = cli.Command{
if !strings.HasPrefix(dString, "sha256:") {
dString = "sha256:" + dString
}
- d, err := digest.ParseDigest(dString)
+ d, err := digest.Parse(dString)
if err != nil {
return err
}
@@ -6,7 +6,7 @@ import (
"testing"
"github.com/containers/image/signature"
- "github.com/docker/distribution/digest"
+ "github.com/opencontainers/go-digest"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
View
@@ -7,6 +7,7 @@ source 'hack/.vendor-helpers.sh'
clone git github.com/urfave/cli v1.17.0
clone git github.com/containers/image master
+clone git github.com/opencontainers/go-digest master
clone git gopkg.in/cheggaaa/pb.v1 ad4efe000aa550bb54918c06ebbadc0ff17687b9 https://github.com/cheggaaa/pb
clone git github.com/containers/storage master
clone git github.com/Sirupsen/logrus v0.10.0
@@ -11,8 +11,8 @@ import (
"strings"
"github.com/containers/image/manifest"
- "github.com/docker/distribution/digest"
"github.com/go-check/check"
+ "github.com/opencontainers/go-digest"
)
func init() {
@@ -16,7 +16,7 @@ import (
"github.com/containers/image/signature"
"github.com/containers/image/transports"
"github.com/containers/image/types"
- "github.com/docker/distribution/digest"
+ "github.com/opencontainers/go-digest"
"github.com/pkg/errors"
)
@@ -59,7 +59,7 @@ func newDigestingReader(source io.Reader, expectedDigest digest.Digest) (*digest
}
return &digestingReader{
source: source,
- digester: digestAlgorithm.New(),
+ digester: digestAlgorithm.Digester(),
expectedDigest: expectedDigest,
validationFailed: false,
}, nil
@@ -6,7 +6,7 @@ import (
"os"
"github.com/containers/image/types"
- "github.com/docker/distribution/digest"
+ "github.com/opencontainers/go-digest"
"github.com/pkg/errors"
)
@@ -69,7 +69,7 @@ func (d *dirImageDestination) PutBlob(stream io.Reader, inputInfo types.BlobInfo
}
}()
- digester := digest.Canonical.New()
+ digester := digest.Canonical.Digester()
tee := io.TeeReader(stream, digester.Hash())
size, err := io.Copy(blobFile, tee)
@@ -7,7 +7,7 @@ import (
"github.com/containers/image/manifest"
"github.com/containers/image/types"
- "github.com/docker/distribution/digest"
+ "github.com/opencontainers/go-digest"
"github.com/pkg/errors"
)
@@ -11,7 +11,7 @@ import (
"github.com/containers/image/docker/reference"
"github.com/containers/image/image"
"github.com/containers/image/types"
- "github.com/docker/distribution/digest"
+ "github.com/opencontainers/go-digest"
)
// Transport is an ImageTransport for directory paths.
@@ -14,8 +14,8 @@ import (
"github.com/containers/image/docker/reference"
"github.com/containers/image/manifest"
"github.com/containers/image/types"
- "github.com/docker/distribution/digest"
"github.com/docker/engine-api/client"
+ "github.com/opencontainers/go-digest"
"github.com/pkg/errors"
"golang.org/x/net/context"
)
@@ -170,7 +170,7 @@ func (d *daemonImageDestination) PutBlob(stream io.Reader, inputInfo types.BlobI
logrus.Debugf("… streaming done")
}
- digester := digest.Canonical.New()
+ digester := digest.Canonical.Digester()
tee := io.TeeReader(stream, digester.Hash())
if err := d.sendFile(inputInfo.Digest.String(), inputInfo.Size, tee); err != nil {
return types.BlobInfo{}, err
@@ -11,8 +11,8 @@ import (
"github.com/containers/image/manifest"
"github.com/containers/image/types"
- "github.com/docker/distribution/digest"
"github.com/docker/engine-api/client"
+ "github.com/opencontainers/go-digest"
"github.com/pkg/errors"
"golang.org/x/net/context"
)
@@ -6,7 +6,7 @@ import (
"github.com/containers/image/docker/reference"
"github.com/containers/image/image"
"github.com/containers/image/types"
- "github.com/docker/distribution/digest"
+ "github.com/opencontainers/go-digest"
)
// Transport is an ImageTransport for images managed by a local Docker daemon.
@@ -51,7 +51,7 @@ func ParseReference(refString string) (types.ImageReference, error) {
// digest:hexstring is structurally the same as a reponame:tag (meaning docker.io/library/reponame:tag).
// reference.ParseIDOrReference interprets such strings as digests.
- if dgst, err := digest.ParseDigest(refString); err == nil {
+ if dgst, err := digest.Parse(refString); err == nil {
// The daemon explicitly refuses to tag images with a reponame equal to digest.Canonical - but _only_ this digest name.
// Other digest references are ambiguous, so refuse them.
if dgst.Algorithm() != digest.Canonical {
@@ -1,6 +1,6 @@
package daemon
-import "github.com/docker/distribution/digest"
+import "github.com/opencontainers/go-digest"
// Various data structures.
@@ -13,7 +13,7 @@ import (
"github.com/Sirupsen/logrus"
"github.com/containers/image/manifest"
"github.com/containers/image/types"
- "github.com/docker/distribution/digest"
+ "github.com/opencontainers/go-digest"
"github.com/pkg/errors"
)
@@ -128,7 +128,7 @@ func (d *dockerImageDestination) PutBlob(stream io.Reader, inputInfo types.BlobI
return types.BlobInfo{}, errors.Wrap(err, "Error determining upload URL")
}
- digester := digest.Canonical.New()
+ digester := digest.Canonical.Digester()
sizeCounter := &sizeCounter{}
tee := io.TeeReader(stream, io.MultiWriter(digester.Hash(), sizeCounter))
res, err = d.c.makeRequestToResolvedURL("PATCH", uploadLocation.String(), map[string][]string{"Content-Type": {"application/octet-stream"}}, tee, inputInfo.Size, true)
@@ -13,8 +13,8 @@ import (
"github.com/Sirupsen/logrus"
"github.com/containers/image/manifest"
"github.com/containers/image/types"
- "github.com/docker/distribution/digest"
"github.com/docker/distribution/registry/client"
+ "github.com/opencontainers/go-digest"
"github.com/pkg/errors"
)
@@ -9,8 +9,8 @@ import (
"path/filepath"
"strings"
- "github.com/docker/distribution/digest"
"github.com/ghodss/yaml"
+ "github.com/opencontainers/go-digest"
"github.com/pkg/errors"
"github.com/Sirupsen/logrus"
@@ -4,13 +4,13 @@ import (
"regexp"
"strings"
- "github.com/pkg/errors"
-
- // "docker/distribution/digest" requires us to load the algorithms that we
+ // "opencontainers/go-digest" requires us to load the algorithms that we
// want to use into the binary (it calls .Available).
_ "crypto/sha256"
- "github.com/docker/distribution/digest"
+
distreference "github.com/docker/distribution/reference"
+ "github.com/opencontainers/go-digest"
+ "github.com/pkg/errors"
)
const (
@@ -65,7 +65,11 @@ func ParseNamed(s string) (Named, error) {
return nil, err
}
if canonical, isCanonical := named.(distreference.Canonical); isCanonical {
- return WithDigest(r, canonical.Digest())
+ r, err := distreference.WithDigest(r, canonical.Digest())
+ if err != nil {
+ return nil, err
+ }
+ return &canonicalRef{namedRef{r}}, nil
}
if tagged, isTagged := named.(distreference.NamedTagged); isTagged {
return WithTag(r, tagged.Tag())
@@ -100,16 +104,6 @@ func WithTag(name Named, tag string) (NamedTagged, error) {
return &taggedRef{namedRef{r}}, nil
}
-// WithDigest combines the name from "name" and the digest from "digest" to form
-// a reference incorporating both the name and the digest.
-func WithDigest(name Named, digest digest.Digest) (Canonical, error) {
- r, err := distreference.WithDigest(name, digest)
- if err != nil {
- return nil, err
- }
- return &canonicalRef{namedRef{r}}, nil
-}
-
type namedRef struct {
distreference.Named
}
@@ -136,7 +130,7 @@ func (r *taggedRef) Tag() string {
return r.namedRef.Named.(distreference.NamedTagged).Tag()
}
func (r *canonicalRef) Digest() digest.Digest {
- return r.namedRef.Named.(distreference.Canonical).Digest()
+ return digest.Digest(r.namedRef.Named.(distreference.Canonical).Digest())
}
// WithDefaultTag adds a default tag to a reference if it only has a repo name.
@@ -164,7 +158,7 @@ func ParseIDOrReference(idOrRef string) (digest.Digest, Named, error) {
if err := validateID(idOrRef); err == nil {
idOrRef = "sha256:" + idOrRef
}
- if dgst, err := digest.ParseDigest(idOrRef); err == nil {
+ if dgst, err := digest.Parse(idOrRef); err == nil {
return dgst, nil, nil
}
ref, err := ParseNamed(idOrRef)
@@ -6,7 +6,7 @@ import (
"github.com/containers/image/manifest"
"github.com/containers/image/types"
- "github.com/docker/distribution/digest"
+ "github.com/opencontainers/go-digest"
"github.com/pkg/errors"
)
@@ -9,7 +9,7 @@ import (
"github.com/containers/image/docker/reference"
"github.com/containers/image/manifest"
"github.com/containers/image/types"
- "github.com/docker/distribution/digest"
+ "github.com/opencontainers/go-digest"
"github.com/pkg/errors"
)
@@ -11,7 +11,7 @@ import (
"github.com/Sirupsen/logrus"
"github.com/containers/image/manifest"
"github.com/containers/image/types"
- "github.com/docker/distribution/digest"
+ "github.com/opencontainers/go-digest"
"github.com/pkg/errors"
)
@@ -3,8 +3,8 @@ package image
import (
"time"
- "github.com/docker/distribution/digest"
"github.com/docker/engine-api/types/strslice"
+ "github.com/opencontainers/go-digest"
"github.com/containers/image/manifest"
"github.com/containers/image/types"
@@ -6,7 +6,7 @@ import (
"github.com/containers/image/manifest"
"github.com/containers/image/types"
- "github.com/docker/distribution/digest"
+ "github.com/opencontainers/go-digest"
imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
)
@@ -3,8 +3,8 @@ package manifest
import (
"encoding/json"
- "github.com/docker/distribution/digest"
"github.com/docker/libtrust"
+ "github.com/opencontainers/go-digest"
imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1"
)
@@ -11,7 +11,7 @@ import (
"github.com/containers/image/manifest"
"github.com/containers/image/types"
- "github.com/docker/distribution/digest"
+ "github.com/opencontainers/go-digest"
imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1"
)
@@ -80,7 +80,7 @@ func (d *ociImageDestination) PutBlob(stream io.Reader, inputInfo types.BlobInfo
}
}()
- digester := digest.Canonical.New()
+ digester := digest.Canonical.Digester()
tee := io.TeeReader(stream, digester.Hash())
size, err := io.Copy(blobFile, tee)
@@ -8,7 +8,7 @@ import (
"github.com/containers/image/manifest"
"github.com/containers/image/types"
- "github.com/docker/distribution/digest"
+ "github.com/opencontainers/go-digest"
imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1"
)
@@ -10,7 +10,7 @@ import (
"github.com/containers/image/docker/reference"
"github.com/containers/image/image"
"github.com/containers/image/types"
- "github.com/docker/distribution/digest"
+ "github.com/opencontainers/go-digest"
"github.com/pkg/errors"
)
@@ -16,7 +16,7 @@ import (
"github.com/containers/image/manifest"
"github.com/containers/image/types"
"github.com/containers/image/version"
- "github.com/docker/distribution/digest"
+ "github.com/opencontainers/go-digest"
"github.com/pkg/errors"
)
@@ -6,7 +6,7 @@ import (
"fmt"
"github.com/containers/image/manifest"
- "github.com/docker/distribution/digest"
+ "github.com/opencontainers/go-digest"
)
// SignDockerManifest returns a signature for manifest as the specified dockerReference,
@@ -12,7 +12,7 @@ import (
"github.com/containers/image/manifest"
"github.com/containers/image/types"
- "github.com/docker/distribution/digest"
+ "github.com/opencontainers/go-digest"
)
func (pr *prSignedBy) isSignatureAuthorAccepted(image types.UnparsedImage, sig []byte) (signatureAcceptanceResult, *Signature, error) {
@@ -10,7 +10,7 @@ import (
"github.com/pkg/errors"
"github.com/containers/image/version"
- "github.com/docker/distribution/digest"
+ "github.com/opencontainers/go-digest"
)
const (
Oops, something went wrong.

0 comments on commit dcfcfda

Please sign in to comment.