-
Notifications
You must be signed in to change notification settings - Fork 233
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
Trim kerl list releases
#465
Changes from 3 commits
f8d851e
b287b55
765f58e
5ae4131
10f1210
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -41,6 +41,8 @@ if [ -n "$KERL_DEBUG" ]; then | |||||
fi | ||||||
|
||||||
KERL_VERSION='3.1.0' | ||||||
OLDEST_OTP_LISTED='17' | ||||||
OLDEST_OTP_SUPPORTED='24' | ||||||
|
||||||
ERLANG_DOWNLOAD_URL='https://erlang.org/download' | ||||||
KERL_CONFIG_STORAGE_FILENAME='.kerl_config' | ||||||
|
@@ -1922,9 +1924,41 @@ maybe_remove() { | |||||
} | ||||||
|
||||||
list_print() { | ||||||
if [ -f "$KERL_BASE_DIR/otp_$1" ]; then | ||||||
if [ "$(\wc -l "$KERL_BASE_DIR/otp_$1")" != '0' ]; then | ||||||
cat "$KERL_BASE_DIR/otp_$1" | ||||||
list_type=$1 # releases | builds | installations | ||||||
maybe_all=$2 | ||||||
|
||||||
list=$KERL_BASE_DIR/otp_${list_type} | ||||||
if [ -f "$list" ]; then | ||||||
if [ "$(\wc -l "$list")" != '0' ]; then | ||||||
if [ "${list_type}" = releases ] && [ "$maybe_all" != all ]; then | ||||||
awk -v oldest_listed="$OLDEST_OTP_LISTED" \ | ||||||
-v oldest_supported="$OLDEST_OTP_SUPPORTED" \ | ||||||
-v last_major="$OLDEST_OTP_LISTED" ' | ||||||
{ | ||||||
full_version=$0 | ||||||
split(full_version, version_components, ".") | ||||||
major=version_components[1] | ||||||
if (major >= oldest_listed && !/-rc/ && !/^R/) { | ||||||
if (major > last_major) { | ||||||
if (last_major >= oldest_supported) { | ||||||
printf "* " | ||||||
} | ||||||
|
||||||
printf "%s\n",last_full_version | ||||||
} | ||||||
last_major=major | ||||||
last_full_version=full_version | ||||||
} | ||||||
} | ||||||
END { | ||||||
if (!/-rc/) { | ||||||
printf "* %s\n",$0 | ||||||
} | ||||||
}' "$list" | ||||||
else | ||||||
cat "$KERL_BASE_DIR/otp_$1" | ||||||
paulo-ferraz-oliveira marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
fi | ||||||
|
||||||
return 0 | ||||||
fi | ||||||
fi | ||||||
|
@@ -1962,7 +1996,7 @@ path_usage() { | |||||
} | ||||||
|
||||||
list_usage() { | ||||||
stderr "usage: $0 list <releases|builds|installations>" | ||||||
stderr "usage: $0 list <releases|builds|installations> [all]" | ||||||
} | ||||||
|
||||||
delete_usage() { | ||||||
|
@@ -2526,20 +2560,36 @@ upgrade) | |||||
fi | ||||||
;; | ||||||
list) | ||||||
if [ $# -ne 2 ]; then | ||||||
list_usage | ||||||
exit 1 | ||||||
fi | ||||||
case "$2" in | ||||||
releases) | ||||||
if [ $# -ne 2 ] && [ $# -ne 3 ]; then | ||||||
list_usage | ||||||
exit 1 | ||||||
fi | ||||||
if [ $# -eq 3 ] && [ "$3" != 'all' ]; then | ||||||
list_usage | ||||||
exit 1 | ||||||
fi | ||||||
check_releases | ||||||
list_print "$2" | ||||||
list_print "$2" "$3" | ||||||
l=t stderr "Run '$0 update releases' to update this list from erlang.org" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we're touching this area of code, I think this message should not mention the erlang.org website any more (since it really parses tags from github by default)
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
if [ $# -eq 2 ]; then | ||||||
l=t stderr "Run '$0 list releases all' to view all available releases" | ||||||
l=t stderr "Note: * means \"currently supported\"" | ||||||
fi | ||||||
;; | ||||||
builds) | ||||||
if [ $# -ne 2 ]; then | ||||||
list_usage | ||||||
exit 1 | ||||||
fi | ||||||
list_print "$2" | ||||||
;; | ||||||
installations) | ||||||
if [ $# -ne 2 ]; then | ||||||
list_usage | ||||||
exit 1 | ||||||
fi | ||||||
list_print "$2" | ||||||
;; | ||||||
*) | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put the asterisk behind the version tag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll accept the suggestion, but also change the README at the same time, so I can't commit from this one 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5ae4131