func (config *ServiceConfig) NewRepositoryInfo(reposName string, bySearch bool) (*RepositoryInfo, error) {
	indexName, remoteName, err := loadRepositoryName(reposName, !bySearch)
	if err != nil {
		return nil, err
	}

	repoInfo := &RepositoryInfo{
		RemoteName: remoteName,
	}

	repoInfo.Index, err = config.NewIndexInfo(indexName)
	if err != nil {
		return nil, err
	}

	if repoInfo.Index.Official {
		normalizedName := normalizeLibraryRepoName(repoInfo.RemoteName)

		repoInfo.LocalName = normalizedName
		repoInfo.RemoteName = normalizedName
		// If the normalized name does not contain a '/' (e.g. "foo")
		// then it is an official repo.
		if strings.IndexRune(normalizedName, '/') == -1 {
			repoInfo.Official = true
			// Fix up remote name for official repos.
			repoInfo.RemoteName = "library/" + normalizedName
		}

		repoInfo.CanonicalName = "docker.io/" + repoInfo.RemoteName
	} else {
		repoInfo.LocalName = localNameFromRemote(repoInfo.Index.Name, repoInfo.RemoteName)
		repoInfo.CanonicalName = repoInfo.LocalName

	}

	return repoInfo, nil
}
// NewRepositoryInfo validates and breaks down a repository name into a RepositoryInfo
NewRepositoryInfo validates and breaks down a repository name into a RepositoryInfo
// NewRepositoryInfo validates and breaks down a repository name into a RepositoryInfo
func (config *ServiceConfig) NewRepositoryInfo(reposName string, bySearch bool) (*RepositoryInfo, error) {
	indexName, remoteName, err := loadRepositoryName(reposName, !bySearch)
	if err != nil {
		return nil, err
	}
	repoInfo := &RepositoryInfo{
		RemoteName: remoteName,
	}
	repoInfo.Index, err = config.NewIndexInfo(indexName)
	if err != nil {
		return nil, err
	}
	if repoInfo.Index.Official {
		normalizedName := normalizeLibraryRepoName(repoInfo.RemoteName)
		repoInfo.LocalName = normalizedName
		repoInfo.RemoteName = normalizedName
		if strings.IndexRune(normalizedName, '/') == -1 {
			repoInfo.Official = true
			repoInfo.RemoteName = "library/" + normalizedName
		}
		repoInfo.CanonicalName = "docker.io/" + repoInfo.RemoteName
	} else {
		repoInfo.LocalName = localNameFromRemote(repoInfo.Index.Name, repoInfo.RemoteName)
		repoInfo.CanonicalName = repoInfo.LocalName
	}
	return repoInfo, nil
}
func ( config * ServiceConfig ) NewRepositoryInfo ( reposName string , bySearch bool ) ( * RepositoryInfo , error ) { indexName , remoteName , err := loadRepositoryName ( reposName , ! bySearch ) if err != nil { return nil , err } repoInfo := & RepositoryInfo { RemoteName : remoteName , } repoInfo . Index , err = config . NewIndexInfo ( indexName ) if err != nil { return nil , err } if repoInfo . Index . Official { normalizedName := normalizeLibraryRepoName ( repoInfo . RemoteName ) repoInfo . LocalName = normalizedName repoInfo . RemoteName = normalizedName if strings . IndexRune ( normalizedName , '/' ) == - 1 { repoInfo . Official = true repoInfo . RemoteName = " " + normalizedName } repoInfo . CanonicalName = " " + repoInfo . RemoteName } else { repoInfo . LocalName = localNameFromRemote ( repoInfo . Index . Name , repoInfo . RemoteName ) repoInfo . CanonicalName = repoInfo . LocalName } return repoInfo , nil }
NewRepositoryInfo validates and breaks down a repository name into a RepositoryInfo
NewRepositoryInfo validates and breaks down a repository name into a RepositoryInfo
// If the normalized name does not contain a '/' (e.g. "foo") // then it is an official repo. // Fix up remote name for official repos.