Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch "generate-stackbrew-library.sh" from "switch" (gawk-ism) to if-else chain so it works in mawk #393

Merged
merged 1 commit into from
Feb 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions generate-stackbrew-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,18 +171,17 @@ for javaVersion in "${versions[@]}"; do
variantAliases=()
fromTag="$(git show "$commit":"$dir/Dockerfile" | awk -v variant="$variant" '
$1 == "FROM" {
switch ($2) {
case /^mcr.microsoft.com\//:
# "switch" is a gawk-ism
if ($2 ~ /^mcr.microsoft.com\//) {
$2 = ""
break
case /^(alpine|oraclelinux):/:
}
else if ($2 ~ /^(alpine|oraclelinux):/) {
gsub(/:/, "", $2) # "alpine3.7", "alpine3.6", etc
gsub(/-slim$/, "", $2) # "oraclelinux:7-slim"
break
default:
}
else {
gsub(/^[^:]+:/, "", $2) # peel off "debian:", "buildpack-deps:", etc
gsub(/-[^-]+$/, "", $2) # peel off "-scm", "-curl", etc
break
}
fromTag = $2
}
Expand Down