mirror of
https://github.com/clearlinux/official-images.git
synced 2026-10-03 23:38:32 +00:00
This should help avoid "empty cat" output we saw recently when something failed to fetch but was otherwise valid.
The current implementation is trying to do two things with one output:
1. normalized `bashbrew cat` diff
2. visualize `--build-order` changes
This change splits those into two separate things because combining them ends up making the diff harder to read than it should be ("changed tags + changed commit" leading to a full reordering of the diff because build-order also changed).
42 lines
867 B
Bash
Executable File
42 lines
867 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -Eeuo pipefail
|
|
|
|
# a mimic of "bashbrew cat" which should sort slightly more deterministically (so even full-order-changing PRs should have reasonable diffs)
|
|
|
|
images="$(
|
|
bashbrew list --repos --uniq "$@" \
|
|
| sort -uV
|
|
)"
|
|
set -- $images
|
|
|
|
declare -A seenGlobal=()
|
|
|
|
first=1
|
|
for img; do
|
|
if [ -n "$first" ]; then
|
|
first=
|
|
else
|
|
echo; echo
|
|
fi
|
|
|
|
if [ "$#" -gt 1 ]; then
|
|
echo "# $img"
|
|
fi
|
|
|
|
repo="${img%:*}"
|
|
if [ -z "${seenGlobal["$repo"]:-}" ]; then
|
|
bashbrew cat --format '{{ printf "%s\n" (.Manifest.Global.ClearDefaults defaults) }}' "$img"
|
|
seenGlobal["$repo"]="$img"
|
|
else
|
|
echo "# (see also ${seenGlobal["$repo"]} above)"
|
|
fi
|
|
|
|
bashbrew list --uniq "$img" \
|
|
| sort -V \
|
|
| xargs -r bashbrew cat --format '
|
|
{{- range $e := .TagEntries -}}
|
|
{{- printf "\n%s\n" ($e.ClearDefaults $.Manifest.Global) -}}
|
|
{{- end -}}
|
|
'
|
|
done
|