Update to use newer manifest file format (#233)

The new format is base on based on RFC 2822.

See:

https://github.com/docker-library/official-images#instruction-format

Also:

* No longer hardcodes the variant names (onbuild slim wheezy)
* Sorts version numbers which puts the higher version numbers first
* Adds link to generate-stackbrew-library.sh in manifest header
* Don't script against `ls` when determining variants
* And some other code improvements
This commit is contained in:
Christopher Horrell 2016-09-23 16:08:17 -04:00 committed by GitHub
parent 0e76bf977c
commit 06eb255cfa
1 changed files with 45 additions and 20 deletions

View File

@ -9,37 +9,62 @@ array_6_6='6 latest';
cd $(cd ${0%/*} && pwd -P);
self="$(basename "$BASH_SOURCE")"
versions=( */ )
versions=( "${versions[@]%/}" )
url='git://github.com/nodejs/docker-node'
url='https://github.com/nodejs/docker-node'
echo '# maintainer: Node.js Docker Team <https://github.com/nodejs/docker-node> (@nodejs)'
# sort version numbers with highest first
IFS=$'\n'; versions=( $(echo "${versions[*]}" | sort -r) ); unset IFS
# get the most recent commit which modified any of "$@"
fileCommit() {
git log -1 --format='format:%H' HEAD -- "$@"
}
echo "# this file is generated via ${url}/blob/$(fileCommit "$self")/$self"
echo
echo "Maintainers: The Node.js Docker Team <${url}> (@nodejs)"
echo "GitRepo: ${url}.git"
echo
# prints "$2$1$3$1...$N"
join() {
local sep="$1"; shift
local out; printf -v out "${sep//%/%%}%s" "$@"
echo "${out#$sep}"
}
for version in "${versions[@]}"; do
if [[ "$version" == "docs" ]]; then
continue
fi
# Skip "docs" and other non-docker directories
[ -f "$version/Dockerfile" ] || continue
eval stub=$(echo "$version" | awk -F. '{ print "$array_" $1 "_" $2 }');
commit="$(git log -1 --format='format:%H' -- "$version")"
commit="$(fileCommit "$version")"
fullVersion="$(grep -m1 'ENV NODE_VERSION ' "$version/Dockerfile" | cut -d' ' -f3)"
versionAliases=( $fullVersion $version ${stub} )
echo "Tags: $(join ', ' "${versionAliases[@]}")"
echo "GitCommit: ${commit}"
echo "Directory: ${version}"
echo
for va in "${versionAliases[@]}"; do
echo "$va: ${url}@${commit} $version"
done
for variant in onbuild slim wheezy; do
commit="$(git log -1 --format='format:%H' -- "$version/$variant")"
variants=$(echo $version/*/ | xargs -n1 basename)
for variant in $variants; do
# Skip non-docker directories
[ -f "$version/$variant/Dockerfile" ] || continue
commit="$(fileCommit "$version/$variant")"
slash='/'
variantAliases=( "${versionAliases[@]/%/-${variant//$slash/-}}" )
variantAliases=( "${variantAliases[@]//latest-/}" )
echo "Tags: $(join ', ' "${variantAliases[@]}")"
echo "GitCommit: ${commit}"
echo "Directory: ${version}/${variant}"
echo
for va in "${versionAliases[@]}"; do
if [ "$va" = 'latest' ]; then
va="$variant"
else
va="$va-$variant"
fi
echo "$va: ${url}@${commit} $version/$variant"
done
done
done