From 8adb3f1eb87687ab1ce96ed1b5db3764c8f9024c Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Wed, 25 Jul 2018 09:26:51 -0700 Subject: [PATCH] Add suite aliases --- generate-stackbrew-library.sh | 53 ++++++++++++++++------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 4b6daba6..12367689 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -69,30 +69,10 @@ join() { } for version in "${versions[@]}"; do - commit="$(dirCommit "$version")" - - fullVersion="$(git show "$commit":"$version/Dockerfile" | awk '$1 == "ENV" && $2 == "REDIS_VERSION" { print $3; exit }')" - versionAliases=( - $fullVersion - $version - ${aliases[$version]:-} - ) - - parent="$(awk 'toupper($1) == "FROM" { print $2 }' "$version/Dockerfile")" - arches="${parentRepoToArches[$parent]}" - - echo - cat <<-EOE - Tags: $(join ', ' "${versionAliases[@]}") - Architectures: $(join ', ' $arches) - GitCommit: $commit - Directory: $version - EOE - for v in \ - 32bit alpine \ + '' 32bit alpine \ ; do - dir="$version/$v" + dir="$version${v:+/$v}" variant="$(basename "$v")" [ -f "$dir/Dockerfile" ] || continue @@ -106,15 +86,30 @@ for version in "${versions[@]}"; do ${aliases[$version]:-} ) - variantAliases=( "${versionAliases[@]/%/-$variant}" ) - variantAliases=( "${variantAliases[@]//latest-/}" ) + if [ -n "$variant" ]; then + variantAliases=( "${versionAliases[@]/%/-$variant}" ) + variantAliases=( "${variantAliases[@]//latest-/}" ) + else + variantAliases=( "${versionAliases[@]}" ) + fi + + variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$version/$variant/Dockerfile")" + + suite="${variantParent#*:}" # "jessie-slim", "stretch" + suite="${suite%-slim}" # "jessie", "stretch" + + if [ "$v" = 'alpine' ]; then + suite="alpine$suite" # "alpine3.8" + suiteAliases=( "${versionAliases[@]/%/-$suite}" ) + else + suiteAliases=( "${variantAliases[@]/%/-$suite}" ) + fi + suiteAliases=( "${suiteAliases[@]//latest-/}" ) + variantAliases+=( "${suiteAliases[@]}" ) case "$v" in - 32bit) variantArches='amd64' ;; - *) - variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$version/$variant/Dockerfile")" - variantArches="${parentRepoToArches[$variantParent]}" - ;; + 32bit) variantArches='amd64' ;; + *) variantArches="${parentRepoToArches[$variantParent]}" ;; esac echo