From 088718f389d35483e0cd87354adf7b0f1d0d789e Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 21 Dec 2023 17:03:24 -0800 Subject: [PATCH] Automate "latest" and "3" aliases --- generate-stackbrew-library.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 4e3679a08..da9269d38 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -1,10 +1,6 @@ #!/usr/bin/env bash set -Eeuo pipefail -declare -A aliases=( - [3.2]='3 latest' -) - self="$(basename "$BASH_SOURCE")" cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" @@ -73,6 +69,11 @@ join() { echo "${out#$sep}" } +declare -A latest=( + #[3]='3.2' + #[latest]='3.2' +) + for version; do export version @@ -86,9 +87,17 @@ for version; do versionAliases=( $fullVersion $version - ${aliases[$version]:-} ) + if [ "$version" = "${version%-rc}" ]; then + for a in "${version%%.*}" latest; do # "3", "latest" + if [ -z "${latest[$a]:-}" ]; then + latest[$a]="$version" + versionAliases+=( "$a" ) + fi + done + fi + defaultDebianVariant="$(jq -r ' .[env.version].variants | map(select(