ソースを参照

Fix variant detection for tags like "1.8-onbuild"

Tianon Gravi 8 年 前
コミット
4ee7a17925

+ 16 - 4
.template-helpers/variant.sh

@@ -32,12 +32,24 @@ tags=( $(bashbrew cat -f '
 unset IFS
 
 text=
+declare -A includedFiles=()
 for tag in "${tags[@]}"; do
-	for f in "$repoDir/variant-$tag.md" "$dir/variant-$tag.md"; do
+	for f in \
+		"$repoDir/variant-$tag.md" "$repoDir/variant-${tag##*-}.md" \
+		"$dir/variant-$tag.md" "$dir/variant-${tag##*-}.md" \
+	; do
+		if [ -n "${includedFiles[$f]}" ]; then
+			# make sure we don't duplicate variant sections
+			break
+		fi
 		if [ -f "$f" ]; then
-			text+=$'\n' # give a little space
-			text+="$(< "$f")"
-			text+=$'\n' # parameter expansion eats the trailing newline
+			includedFiles[$f]=1
+			if [ -s "$f" ]; then
+				# an empty file can be used to disable a specific "variant" section for an image
+				text+=$'\n' # give a little space
+				text+="$(< "$f")"
+				text+=$'\n' # parameter expansion eats the trailing newline
+			fi
 			break
 		fi
 	done

+ 1 - 1
.travis/check-markdownfmt.sh

@@ -7,7 +7,7 @@ files="$(
 	find \( \
 			-name '*.md' \
 			-not -name 'README.md' \
-		\) -print0 \
+		\) -exec test -s '{}' ';' -print0 \
 		| xargs -0 markdownfmt -l)"
 if [ "$files" ]; then
 	echo >&2 'Need markdownfmt:'

+ 0 - 6
debian/content.md

@@ -28,12 +28,6 @@ RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/*
 ENV LANG en_US.utf8
 ```
 
-## `<suite>-slim` variants
-
-These tags are an experiment in providing a slimmer base (removing some extra files that are normally not necessary within containers, such as man pages and documentation), and are definitely subject to change.
-
-See the `debuerreotype-slimify` script (`debuerreotype` linked below) for more details about what gets removed during the "slimification" process.
-
 ## How It's Made
 
 The rootfs tarballs for this image are built using [the reproducible-Debian-rootfs tool, `debuerreotype`](https://github.com/debuerreotype/debuerreotype), with an explicit goal being that they are transparent and reproducible. Using the same toolchain, it should be possible to regenerate (clean-room!) the same tarballs used for building the official Debian images.

+ 5 - 0
debian/variant-slim.md

@@ -0,0 +1,5 @@
+## `%%IMAGE%%:<suite>-slim`
+
+These tags are an experiment in providing a slimmer base (removing some extra files that are normally not necessary within containers, such as man pages and documentation), and are definitely subject to change.
+
+See the `debuerreotype-slimify` script (`debuerreotype` linked above) for more details about what gets removed during the "slimification" process.

+ 1 - 0
debian/variant.md

@@ -0,0 +1 @@
+# Image Variants

+ 0 - 0
oraclelinux/variant-slim.md


+ 0 - 0
traefik/variant-alpine.md