소스 검색

Add a separate "EntryIdentifier" so that build output is more informative

This changes something like:

    Using bashbrew/cache:2775145643e397ca993e842f3263a1362a49df4115ce59d59bed1452323b7af2 (buildpack-deps)

into:

    Using bashbrew/cache:2775145643e397ca993e842f3263a1362a49df4115ce59d59bed1452323b7af2 (buildpack-deps:wheezy)
Tianon Gravi 9 년 전
부모
커밋
d5416b33ec
2개의 변경된 파일7개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 3
      bashbrew/go/src/bashbrew/cmd-build.go
  2. 4 0
      bashbrew/go/src/bashbrew/repo.go

+ 3 - 3
bashbrew/go/src/bashbrew/cmd-build.go

@@ -60,7 +60,7 @@ func cmdBuild(c *cli.Context) error {
 					return fmt.Errorf(`unexpected value for --pull: %s`, pull)
 				}
 				if doPull {
-					fmt.Printf("Pulling %s (%s)\n", from, r.Identifier())
+					fmt.Printf("Pulling %s (%s)\n", from, r.EntryIdentifier(entry))
 					dockerPull(from)
 				}
 			}
@@ -73,7 +73,7 @@ func cmdBuild(c *cli.Context) error {
 			// check whether we've already built this artifact
 			_, err = dockerInspect("{{.Id}}", cacheTag)
 			if err != nil {
-				fmt.Printf("Building %s (%s)\n", cacheTag, r.Identifier())
+				fmt.Printf("Building %s (%s)\n", cacheTag, r.EntryIdentifier(entry))
 
 				commit, err := r.fetchGitRepo(&entry)
 				if err != nil {
@@ -92,7 +92,7 @@ func cmdBuild(c *cli.Context) error {
 				}
 				archive.Close() // be sure this happens sooner rather than later (defer might take a while, and we want to reap zombies more aggressively)
 			} else {
-				fmt.Printf("Using %s (%s)\n", cacheTag, r.Identifier())
+				fmt.Printf("Using %s (%s)\n", cacheTag, r.EntryIdentifier(entry))
 			}
 
 			for _, tag := range r.Tags(namespace, uniq, entry) {

+ 4 - 0
bashbrew/go/src/bashbrew/repo.go

@@ -31,6 +31,10 @@ func (r Repo) Identifier() string {
 	return r.RepoName
 }
 
+func (r Repo) EntryIdentifier(entry manifest.Manifest2822Entry) string {
+	return r.RepoName + ":" + entry.Tags[0]
+}
+
 func (r Repo) SkipConstraints(entry manifest.Manifest2822Entry) bool {
 	repoTag := r.RepoName + ":" + entry.Tags[0]