Merge pull request #994 from infosiftr/fix-variant-detection

Fix variant detection for tags like "1.8-onbuild"
This commit is contained in:
yosifkit 2017-09-05 16:22:40 -07:00 committed by GitHub
commit 9b905584f5
7 changed files with 23 additions and 11 deletions

View File

@ -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

View File

@ -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:'

6
debian/content.md vendored
View File

@ -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
debian/variant-slim.md vendored Normal file
View File

@ -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
debian/variant.md vendored Normal file
View File

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

View File

View File