Browse Source

Add an "arches list" to "diff-pr" output

This should make it easier to see architecture changes (additions, removals, etc).
Tianon Gravi 8 years ago
parent
commit
728e22d0d1
1 changed files with 14 additions and 0 deletions
  1. 14 0
      diff-pr.sh

+ 14 - 0
diff-pr.sh

@@ -76,6 +76,18 @@ export BASHBREW_CACHE="${BASHBREW_CACHE:-${XDG_CACHE_HOME:-$HOME/.cache}/bashbre
 export BASHBREW_LIBRARY="$PWD/oi/library"
 export BASHBREW_ARCH='amd64' # TODO something smarter with arches
 
+# "bashbrew cat" template for duplicating something like "bashbrew list --uniq" but with architectures too
+archesListTemplate='
+	{{- range $e := $.Entries -}}
+		{{- range .Architectures -}}
+			{{- $.RepoName -}}:{{- $e.Tags | last -}}
+			{{- " @ " -}}
+			{{- . -}}
+			{{- "\n" -}}
+		{{- end -}}
+	{{- end -}}
+'
+
 # TODO something less hacky than "git archive" hackery, like a "bashbrew archive" or "bashbrew context" or something
 template='
 {{- range $.Entries -}}
@@ -171,6 +183,7 @@ mkdir temp
 git -C temp init --quiet
 
 bashbrew list "${images[@]}" | sort -V > temp/_bashbrew-list || :
+bashbrew cat --format "$archesListTemplate" "${images[@]}" | sort -V > temp/_bashbrew-arches || :
 for image in "${images[@]}"; do
 	if script="$(bashbrew cat -f "$template" "$image")"; then
 		mkdir tar
@@ -186,6 +199,7 @@ git -C oi checkout --quiet pull
 
 git -C temp rm --quiet -rf . || :
 bashbrew list "${images[@]}" | sort -V > temp/_bashbrew-list || :
+bashbrew cat --format "$archesListTemplate" "${images[@]}" | sort -V > temp/_bashbrew-arches || :
 script="$(bashbrew cat -f "$template" "${images[@]}")"
 mkdir tar
 ( eval "$script" | tar -xiC tar )