From 8eed4f7a8efa5c1ac3e096e93794556629021840 Mon Sep 17 00:00:00 2001 From: Mike Dillon Date: Fri, 13 Mar 2015 22:06:53 -0700 Subject: [PATCH 1/2] Output stackbrew library file in a canonical order * Current LTS & weekly * Previous LTS (descending order) * Previous weekly (descending order) --- generate-stackbrew-library.sh | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 3a3c36a717..108f29ed76 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -1,4 +1,4 @@ -#!/usr/local/Cellar/bash/4.3.30/bin/bash +#!/bin/bash set -e declare -A aliases @@ -9,17 +9,39 @@ aliases=( versions=( */ ) versions=( "${versions[@]%/}" ) +versions=( $(IFS=$'\n'; sort -Vr <<< "${versions[*]}") ) url='git://github.com/cloudbees/jenkins-ci.org-docker' echo '# maintainer: Nicolas De Loof (@ndeloof)' echo '# maintainer: Michael Neale (@michaelneale)' echo -for version in "${versions[@]}"; do - commit="$(git log -1 --format='format:%H' -- "$version")" - versionAliases=( $version ${aliases[$version]} ) - - for va in "${versionAliases[@]}"; do +echo "# group: Current Releases" +for current in $(IFS=$'\n'; sort -V <<< "${!aliases[*]}"); do + commit="$(git log -1 --format='format:%H' -- "$current")" + for va in "$current" ${aliases[$current]}; do echo "$va: ${url}@${commit} $version" done + echo +done + +echo "# group: Previous LTS Releases" +for version in "${versions[@]}"; do + if [[ "${aliases[$version]}" || "$version" != *.*.* ]]; then + continue + fi + + commit="$(git log -1 --format='format:%H' -- "$version")" + echo "$version: ${url}@${commit} $version" +done +echo + +echo "# group: Previous Weekly Releases" +for version in "${versions[@]}"; do + if [[ "${aliases[$version]}" || "$version" == *.*.* ]]; then + continue + fi + + commit="$(git log -1 --format='format:%H' -- "$version")" + echo "$version: ${url}@${commit} $version" done From 8dc6c8052c0aa7634860b2b9579f975a63a2e989 Mon Sep 17 00:00:00 2001 From: Mike Dillon Date: Sun, 15 Mar 2015 13:53:48 -0700 Subject: [PATCH 2/2] Make handling of LTS/weekly clearer in generate-stackbrew-library.sh --- generate-stackbrew-library.sh | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 108f29ed76..64c69c6d32 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -1,5 +1,7 @@ #!/bin/bash + set -e +shopt -s extglob declare -A aliases aliases=( @@ -7,9 +9,14 @@ aliases=( [1.580.3]='latest' ) -versions=( */ ) -versions=( "${versions[@]%/}" ) -versions=( $(IFS=$'\n'; sort -Vr <<< "${versions[*]}") ) +versions() { + local IFS=$'\n' + local versions=( "${@%/}" ) + sort -Vr <<< "${versions[*]}" +} + +lts_versions=( $(versions *.*.*/) ) +weekly_versions=( $(versions !(*.*.*)/) ) url='git://github.com/cloudbees/jenkins-ci.org-docker' echo '# maintainer: Nicolas De Loof (@ndeloof)' @@ -26,8 +33,8 @@ for current in $(IFS=$'\n'; sort -V <<< "${!aliases[*]}"); do done echo "# group: Previous LTS Releases" -for version in "${versions[@]}"; do - if [[ "${aliases[$version]}" || "$version" != *.*.* ]]; then +for version in "${lts_versions[@]}"; do + if [ "${aliases[$version]}" ]; then continue fi @@ -37,8 +44,8 @@ done echo echo "# group: Previous Weekly Releases" -for version in "${versions[@]}"; do - if [[ "${aliases[$version]}" || "$version" == *.*.* ]]; then +for version in "${weekly_versions[@]}"; do + if [ "${aliases[$version]}" ]; then continue fi