Commit Graph

8 Commits

Author SHA1 Message Date
Miloslav Trmač cc0f48aa03 API transition: Drop reference.XCanonical
Instead use distreference.Canonical directly.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2017-02-07 15:25:27 +01:00
Miloslav Trmač 777b215177 API transition: Drop reference.XNamedTagged
Instead use distreference.NamedTagged directly.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2017-02-07 15:25:26 +01:00
Miloslav Trmač 0268d9077d API transition: Drop XNamedTagged.XTag
Instead, call NamedTagged.Tag in all users.

XNamedTagged is now equivalent to distreference.NamedTagged.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2017-02-07 15:25:26 +01:00
Miloslav Trmač c2360fcb87 Duplication: Have both a namedRef and NamedTagged in taggedRef
Similar to the .our/.upstream dance in namedRef, add a second,
write-only implementation in taggedRef.  Except now we go a bit faster
and skip the .our/.upstream member names.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2017-02-07 15:25:26 +01:00
Miloslav Trmač 7abfa9812f API transition: Drop XNamed.XString
Instead call distreference.FamiliarString() for SOME uses, generally for
error messages and StringWithinTransport().

In signature/policy_reference_match.go and signature/docker.go, where we
care about equality but not exactly about the kind of normalization, call
XNamed.String() instead, with the same rationale as the earlier
Name/FamiliarName choice.

In copy.Image, when creating a singature, use .String() (i.e. the fully
explicit form), for that extra bit of safety.

In tests, generally use the simpler .String() and modify expected
results, instead of calling FamilarString().

XNamed is now equivalent to distreference.Named, all the extra methods
have went away.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2017-02-07 15:25:26 +01:00
Miloslav Trmač dda360d9ec API separation: Add an 'X' to all public names from c/i/docker/daemon/reference
This is an intermediate step which will eventually go away.

The goal of this PR is to get rid of c/i/docker/daemon/reference and to
replace uses of it by direct calls to docker/distribution/reference.

We can't do that safely and easily, because the two have different
semantics for reference.Named.Name() and reference.Named.String(): we
return a minimized version, e.g. "busybox", upstream returns an expanded
version, e.g. "docker.io/library/busybox".

BEFORE this commit the difference is hidden by using
docker/distribution/reference.WithName, which allows using the minimized
version, and works with it correctly; but because we want to use the
upstream canonicalization code, which will change semantics, we can't
just mix and match.

To make the distinction explicit, this commmit adds an X to ALL public
names from c/i/docker/daemon/reference.  E.g. a reference.XNamed type,
which has methods XName and XString.

This is pretty large, but does not change behavior at all.  By
inspection it is clear to see that reference.XNamed and subtypes does
not expose any of the non-X, conflicting, method names.

Using e.g.
> git diff --word-diff-regex=.|grep -F '{+'|grep -v '^\([^{]\|{+X+}\)*{\?$'
it is possible to see that most lines in this diff only add a single X
letter, and manually inspect the few lines which don't match the regexp.

The only REALLY new code is an explicit definition of namedRef.XName()
and namedRef.XString(), and two newly added casts to namedRef in cases
where we need to use the underlying distreference.Reference within
a reference.XNamed value.  Strictly speaking these changes change
behavior, in that third-party implementations of reference.XNamed are no
longer accepted; but we broke them by renaming at all.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2017-02-07 15:24:14 +01:00
Antonio Murdaca f4c6ac26a2
*: move to opencontainers/go-digest
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-01-09 15:55:13 +01:00
Miloslav Trmač d742d1caa4 Finish daemonReference
Allow either a !NameOnly named reference, or a sha256:hex digest.  Both
forms can be used for an ImageSource; ImageDestination accepts only a
name:tag value.

Because the sha256:hex reference values make it impossible to create
a reasonable policy hierarchy, only support a trivial namespace with
a single per-transport policy.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2016-11-22 19:12:22 +01:00