Browse Source

Apply a couple minor improvements/simplifications to `generate-dockerfile-links-partial.*`

This creates no visible change in behavior (the `--arch-filter` flag to `bashbrew list` didn't exist at the time this was originally written, and it looks like our newline outputting behavior has changed over time such that it can now be simplified).
Tianon Gravi 1 year ago
parent
commit
a20b1d523e

+ 1 - 1
.template-helpers/generate-dockerfile-links-partial.sh

@@ -13,7 +13,7 @@ if [ -z "${BASHBREW_LIBRARY:-}" ]; then
 	repo="https://github.com/docker-library/official-images/raw/master/library/$repo"
 fi
 
-if [ -n "$ARCH_SPECIFIC_DOCS" ] && archTags="$(bashbrew cat --format '{{ range .Entries }}{{ if .HasArchitecture arch }}{{ .Tags | first }}{{ "\n" }}{{ end }}{{ end }}' "$repo")" && [ -z "$archTags" ]; then
+if [ -n "$ARCH_SPECIFIC_DOCS" ] && archTags="$(bashbrew list --uniq --arch-filter "$repo")" && [ -z "$archTags" ]; then
 	echo "**WARNING:** THIS IMAGE *IS NOT SUPPORTED* ON THE \`$BASHBREW_ARCH\` ARCHITECTURE"
 	exit
 fi

+ 3 - 5
.template-helpers/generate-dockerfile-links-partial.tmpl

@@ -33,16 +33,14 @@ This template defines the "Supported tags and Dockerfile links" portion of an im
 	{{- $url = $url | ternary $url (hasPrefix "https://git.launchpad.net/" $repoUrlBase | ternary (print $repoUrlBase "/tree/" $dockerfilePath "?h=" ($e.ArchGitFetch $arch) "&id=" $gitCommit) "") -}}
 	{{- /* TODO decide what to do (if anything) about other non-GitHub repos with respect to URL */ -}}
 
-	{{- if $i -}}
-		{{- "\n" -}}
-	{{- end -}}
-
 	- {{- "\t" -}}
 	{{- if $url -}} [ {{- end -}}
 	` {{- $e.Tags | join "`, `" -}} `
 	{{- if $url -}} ]( {{- $url -}} ) {{- end -}}
+
+	{{- "\n" -}}
 {{- end -}}
-{{- "\n\n" -}}
+{{- "\n" -}}
 
 {{- if (len $sharedTagGroups) -}}
 	{{- "## Shared Tags\n\n" -}}