Fix "bashbrew list --uniq --build-order alpine:latest alpine:3.3" (to properly list two tags instead of just one)
This commit is contained in:
parent
3538a9d438
commit
2068a11e02
|
|
@ -45,7 +45,7 @@ func cmdBuild(c *cli.Context) error {
|
||||||
if pullMissing && from != "scratch" {
|
if pullMissing && from != "scratch" {
|
||||||
_, err := dockerInspect("{{.Id}}", from)
|
_, err := dockerInspect("{{.Id}}", from)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Pulling %s (%s)\n", from, r.RepoName)
|
fmt.Printf("Pulling %s (%s)\n", from, r.Identifier())
|
||||||
dockerPull(from)
|
dockerPull(from)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -60,7 +60,7 @@ func cmdBuild(c *cli.Context) error {
|
||||||
// check whether we've already built this artifact
|
// check whether we've already built this artifact
|
||||||
_, err = dockerInspect("{{.Id}}", cacheTag)
|
_, err = dockerInspect("{{.Id}}", cacheTag)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Building %s (%s)\n", cacheTag, r.RepoName)
|
fmt.Printf("Building %s (%s)\n", cacheTag, r.Identifier())
|
||||||
|
|
||||||
commit, err := r.fetchGitRepo(&entry)
|
commit, err := r.fetchGitRepo(&entry)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,7 @@ func sortRepos(repos []string) ([]string, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
rs = append(rs, r)
|
rs = append(rs, r)
|
||||||
|
network.AddNode(r.Identifier(), repo)
|
||||||
network.AddNode(r.RepoName, repo)
|
network.AddNode(r.RepoName, repo)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -101,6 +102,7 @@ func sortRepos(repos []string) ([]string, error) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// TODO somehow reconcile/avoid "a:a -> b:b, b:b -> a:c" (which will exhibit here as cyclic)
|
// TODO somehow reconcile/avoid "a:a -> b:b, b:b -> a:c" (which will exhibit here as cyclic)
|
||||||
|
network.AddEdgeIfExists(from, r.Identifier())
|
||||||
network.AddEdgeIfExists(from, r.RepoName)
|
network.AddEdgeIfExists(from, r.RepoName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -111,8 +113,14 @@ func sortRepos(repos []string) ([]string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ret := []string{}
|
ret := []string{}
|
||||||
|
seen := map[string]bool{}
|
||||||
for _, node := range nodes {
|
for _, node := range nodes {
|
||||||
ret = append(ret, node.Value.(string))
|
repo := node.Value.(string)
|
||||||
|
if seen[repo] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
seen[repo] = true
|
||||||
|
ret = append(ret, repo)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret, nil
|
return ret, nil
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,13 @@ type Repo struct {
|
||||||
TagEntry *manifest.Manifest2822Entry
|
TagEntry *manifest.Manifest2822Entry
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r Repo) Identifier() string {
|
||||||
|
if r.TagName != "" {
|
||||||
|
return r.RepoName + ":" + r.TagName
|
||||||
|
}
|
||||||
|
return r.RepoName
|
||||||
|
}
|
||||||
|
|
||||||
func (r Repo) SkipConstraints(entry manifest.Manifest2822Entry) bool {
|
func (r Repo) SkipConstraints(entry manifest.Manifest2822Entry) bool {
|
||||||
repoTag := r.RepoName + ":" + entry.Tags[0]
|
repoTag := r.RepoName + ":" + entry.Tags[0]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue