Add own reference package wrapper

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi 2015-12-04 13:55:15 -08:00
parent 35d767115c
commit 9b8f1a0895
8 changed files with 12 additions and 11 deletions

View File

@ -7,11 +7,12 @@ import (
"net/url"
"strings"
"github.com/docker/distribution/reference"
distreference "github.com/docker/distribution/reference"
registrytypes "github.com/docker/docker/api/types/registry"
"github.com/docker/docker/image/v1"
"github.com/docker/docker/opts"
flag "github.com/docker/docker/pkg/mflag"
"github.com/docker/docker/reference"
)
// Options holds command line options.
@ -269,7 +270,7 @@ func GetAuthConfigKey(index *registrytypes.IndexInfo) string {
// splitReposName breaks a reposName into an index name and remote name
func splitReposName(reposName reference.Named) (indexName string, remoteName reference.Named, err error) {
var remoteNameStr string
indexName, remoteNameStr = reference.SplitHostname(reposName)
indexName, remoteNameStr = distreference.SplitHostname(reposName)
if indexName == "" || (!strings.Contains(indexName, ".") &&
!strings.Contains(indexName, ":") && indexName != "localhost") {
// This is a Docker Index repos (ex: samalba/hipache or ubuntu)
@ -405,13 +406,13 @@ func localNameFromRemote(indexName string, remoteName reference.Named) (referenc
// error.
func NormalizeLocalReference(ref reference.Named) reference.Named {
localName := NormalizeLocalName(ref)
if tagged, isTagged := ref.(reference.Tagged); isTagged {
if tagged, isTagged := ref.(reference.NamedTagged); isTagged {
newRef, err := reference.WithTag(localName, tagged.Tag())
if err != nil {
return ref
}
return newRef
} else if digested, isDigested := ref.(reference.Digested); isDigested {
} else if digested, isCanonical := ref.(reference.Canonical); isCanonical {
newRef, err := reference.WithDigest(localName, digested.Digest())
if err != nil {
return ref

View File

@ -15,9 +15,9 @@ import (
"testing"
"time"
"github.com/docker/distribution/reference"
registrytypes "github.com/docker/docker/api/types/registry"
"github.com/docker/docker/opts"
"github.com/docker/docker/reference"
"github.com/gorilla/mux"
"github.com/Sirupsen/logrus"

View File

@ -8,10 +8,10 @@ import (
"strings"
"testing"
"github.com/docker/distribution/reference"
"github.com/docker/distribution/registry/client/transport"
"github.com/docker/docker/api/types"
registrytypes "github.com/docker/docker/api/types/registry"
"github.com/docker/docker/reference"
)
var (

View File

@ -6,10 +6,10 @@ import (
"net/url"
"strings"
"github.com/docker/distribution/reference"
"github.com/docker/distribution/registry/client/auth"
"github.com/docker/docker/api/types"
registrytypes "github.com/docker/docker/api/types/registry"
"github.com/docker/docker/reference"
)
// Service is a registry service. It tracks configuration data such as a list

View File

@ -4,8 +4,8 @@ import (
"fmt"
"strings"
"github.com/docker/distribution/reference"
"github.com/docker/docker/pkg/tlsconfig"
"github.com/docker/docker/reference"
)
func (s *Service) lookupV1Endpoints(repoName reference.Named) (endpoints []APIEndpoint, err error) {

View File

@ -4,9 +4,9 @@ import (
"fmt"
"strings"
"github.com/docker/distribution/reference"
"github.com/docker/distribution/registry/client/auth"
"github.com/docker/docker/pkg/tlsconfig"
"github.com/docker/docker/reference"
)
func (s *Service) lookupV2Endpoints(repoName reference.Named) (endpoints []APIEndpoint, err error) {

View File

@ -19,13 +19,13 @@ import (
"strings"
"github.com/Sirupsen/logrus"
"github.com/docker/distribution/reference"
"github.com/docker/docker/api/types"
registrytypes "github.com/docker/docker/api/types/registry"
"github.com/docker/docker/pkg/httputils"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/stringid"
"github.com/docker/docker/pkg/tarsum"
"github.com/docker/docker/reference"
)
var (

View File

@ -1,8 +1,8 @@
package registry
import (
"github.com/docker/distribution/reference"
registrytypes "github.com/docker/docker/api/types/registry"
"github.com/docker/docker/reference"
)
// RepositoryData tracks the image list, list of endpoints, and list of tokens