Commit Graph

6 Commits

Author SHA1 Message Date
Miloslav Trmač df65181c70 API transition: Drop XNamed.XFullName
Instead call distreference.Named.Name() in all users.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2017-02-07 15:25:26 +01:00
Miloslav Trmač 5edbd7f016 Simplification: drop namedRef.our
Now that namedRef.our values are only used for computing other
namedRef.our values, drop the struct member and all code computing it,
including the entirety of our normalization code.

We still keep .upstream as a private member instead of using
distreference.Named directly, or making namedRef an implementation of
distreference.Named.

BEHAVIOR CHANGE: We used to minimize the input and then check whether it
is a 64-char hex string, now distreference.ParseNormalizedNamed first
checks for a 64-char hext string and then normalized (and by expanding,
not minimizing).  Hence, things like docker.io/$64hexchars are now
accepted, which is a behavior change (noticed by the tests).  Though,
there is really no risk of confusing such a value with a digest reference,
so this behavior change seems quite acceptable.

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 ded9fba96e
docker: reference: drop WithDigest to work with oci/go-digest
See https://github.com/docker/distribution/issues/2130

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2017-01-09 15:55:12 +01:00
Aleksa Sarai d0a45e907a
docker: reference: load sha256 explicitly
There has been a change in upstream (docker/distribution), where they
now require users of the digest library to load algorithms into the
binary (in other words they do .Available checks on crypto algorithms).

This fixes the unit test failures with "unsupported digest algorithm".

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2016-12-21 17:54:45 +11:00
Antonio Murdaca 6021224098
docker: fork docker/dockerreference pkg
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-10-11 16:53:40 +02:00