-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactors the newly introduced version reporting to use versions parsed from each shell release channel.
- Loading branch information
Showing
17 changed files
with
724 additions
and
833 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ set -euf | |
SHVR_DIR_SELF="$(cd "$(dirname "$0")"; pwd)" | ||
SHVR_DIR_SRC="${SHVR_DIR_SRC:-"/usr/src/shvr"}" | ||
SHVR_DIR_OUT="${SHVR_DIR_OUT:-"/opt"}" | ||
SHVR_DIR_CACHE="${SHVR_DIR_CACHE:-"${SHVR_DIR_SELF}/.cache"}" | ||
|
||
shvr () | ||
{ | ||
|
@@ -31,7 +32,7 @@ shvr_targets () | |
then set -- $(printf '%s ' $(shvr_interpreters)) | ||
fi | ||
|
||
shvr_each targets "${@:-}" | sort -V | ||
shvr_each targets "${@:-}" | ||
} | ||
|
||
shvr_semver_majors () | ||
|
@@ -41,15 +42,15 @@ shvr_semver_majors () | |
|
||
shvr_semver_minors () | ||
{ | ||
"shvr_targets_$1" | sed -n 's/^\('"$2"'\)\([.]*[^.]*\)\([.]*.*\)$/\1\2/p' | uniq | ||
"shvr_targets_$1" | sed -n 's/^\('"$2"'\)\([.][0-9]*\)\([.]*.*\)/\1\2/p' | uniq | ||
} | ||
|
||
shvr_semver_patches () | ||
{ | ||
shvr_semver_minors "$@" | ||
"shvr_targets_$1" | sed -n 's/^\('"$2"'\)\([.][0-9]*\)\([.]*[0-9]*\)/\1\2/p' | uniq | ||
} | ||
|
||
shvr_latest () | ||
shvr_versions () | ||
{ | ||
if test $# = 0 | ||
then set -- $(shvr_interpreters | tr '\n' ' ') | ||
|
@@ -58,20 +59,27 @@ shvr_latest () | |
while test $# -gt 0 | ||
do | ||
. "${SHVR_DIR_SELF}/variants/${1}.sh" | ||
majors="$(shvr_majors_$1 | tr '\n' ' ')" | ||
majors="$(shvr_majors_$1 | head -n ${SHVR_MAJORS:-16} | tr '\n' ' ')" | ||
if test -n "$majors" | ||
then printf '%s ' "$1-latest" | ||
fi | ||
for major in $majors | ||
do | ||
minors="$(shvr_minors_$1 $major | tr '\n' ' ')" | ||
minors="$(shvr_minors_$1 $major | head -n ${SHVR_MINORS:-16} | tr '\n' ' ')" | ||
printf '%s ' "$major-latest" | ||
if test -z "$minors" | ||
then echo "$major" | ||
fi | ||
for minor in $minors | ||
do | ||
patches="$(shvr_patches_$1 $minor | sort -V -r | tr '\n' ' ')" | ||
if test "$patches" != "$minor " | ||
patches="$(shvr_patches_$1 $minor | sort -V -r | head -n ${SHVR_PATCHES:-1} | tr '\n' ' ')" | ||
if test "$major " != "$minors" && test "$minor " != "$patches" | ||
then printf '%s ' "$minor-latest" | ||
fi | ||
if test -z "$patches" | ||
then | ||
echo "$minor" | ||
fi | ||
for patch in $patches | ||
do | ||
echo "$patch" | ||
|
@@ -113,7 +121,7 @@ shvr_yml_tags () | |
{ | ||
interpreter="${1%%_*}" | ||
version="${1#"$interpreter"_}" | ||
shvr_latest "$interpreter" | | ||
shvr_versions "$interpreter" | | ||
sed -n '/'"$(echo "$version" | | ||
sed 's/\./\\./g')"'$/p' | | ||
tr ' ' '\n' | | ||
|
@@ -135,6 +143,8 @@ shvr_yml_header () | |
# Copyright (c) Alexandre Gomes Gaigalas <[email protected]> | ||
# SPDX-License-Identifier: ISC | ||
# THIS FILE IS AUTO-GENERATED, DO NOT EDIT | ||
name: $2 | ||
on: | ||
|
@@ -174,6 +184,11 @@ shvr_yml_header () | |
@ | ||
} | ||
|
||
shvr_latest () | ||
{ | ||
shvr_versions "$1" | grep latest | sed '/beta\|alpha\|rc/ d' | ||
} | ||
|
||
shvr_yml_items () | ||
{ | ||
if test "$1" = "multi" | ||
|
@@ -184,17 +199,11 @@ shvr_yml_items () | |
########################################## | ||
#multi-latest | ||
- name: multi-latest | ||
targets: "$(shvr_latest | sed 's/ $//' | rev | cut -d' ' -f1 | rev | sort -V | tr '\n' ' ' )" | ||
targets: "$(SHVR_MAJORS=2 SHVR_MINORS=2 SHVR_PATCHES=1 shvr_versions | sed 's/ $//' | rev | cut -d' ' -f1 | rev | sort -V -r | tr '\n' ' ' )" | ||
can_fail_build: false | ||
tags: | | ||
latest | ||
multi-latest | ||
#multi-all | ||
- name: multi-all | ||
targets: "$(shvr_targets | sort -V | tr '\n' ' ' | sed 's/ $//')" | ||
can_fail_build: false | ||
tags: | | ||
multi-all | ||
@ | ||
echo | ||
fi | ||
|
@@ -207,21 +216,23 @@ shvr_yml_items () | |
@ | ||
if test "$1" = "multi" | ||
then | ||
targets="$(shvr_targets "$interpreter" | tr '\n' ' ' | sed 's/ $//')" | ||
targets="$(shvr_versions "$interpreter" | sed 's/ $//' | rev | cut -d' ' -f1 | rev | sort -V -r | tr '\n' ' ' )" | ||
if test -n "$targets" | ||
then | ||
cat <<-@ | ||
# $interpreter-all | ||
- name: $interpreter-all | ||
targets: "" | ||
targets: "$targets" | ||
can_fail_build: false | ||
tags: | | ||
$interpreter-all | ||
@ | ||
fi | ||
echo | ||
fi | ||
targets="$(shvr_latest "$interpreter")" | ||
|
||
targets="$(shvr_versions "$interpreter")" | ||
|
||
echo "$targets" | while read -r target | ||
do | ||
if test -z "$target" | ||
|
@@ -247,5 +258,18 @@ shvr_yml_items () | |
done | ||
} | ||
|
||
shvr_cache () | ||
{ | ||
cache_key="${SHVR_DIR_CACHE}/$1" | ||
shift | ||
|
||
if ! test -f "$cache_key" | ||
then | ||
mkdir -p "${SHVR_DIR_CACHE}" | ||
"$@" > "$cache_key" | ||
fi | ||
|
||
cat "$cache_key" | ||
} | ||
|
||
shvr "${@:-}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.