build: fix relup on amzn2

This commit is contained in:
Ivan Dyachkov 2022-12-14 10:08:29 +01:00
parent 81560381c8
commit f1a55bc052
3 changed files with 18 additions and 1 deletions

8
build
View File

@ -195,6 +195,14 @@ make_zip() {
;;
esac
;;
amzn2)
case "$PKG_VSN" in
4.4.12*)
# this is the first version for amzn2, no relup
has_relup='no'
;;
esac
;;
esac
# shellcheck disable=SC2207
bases=($(relup_db base-vsns "$PKG_VSN"))

View File

@ -14,7 +14,11 @@ case "$UNAME" in
SYSTEM="${DIST}${VERSION_ID}"
;;
Linux)
if grep -q -i 'rhel' /etc/*-release; then
# /etc/os-release on amazon linux 2 contains both rhel and centos strings
if grep -q -i 'amzn' /etc/*-release; then
DIST='amzn'
VERSION_ID="$(sed -n '/^VERSION_ID=/p' /etc/os-release | sed -r 's/VERSION_ID=(.*)/\1/g' | sed 's/"//g')"
elif grep -q -i 'rhel' /etc/*-release; then
DIST='el'
VERSION_ID="$(rpm --eval '%{rhel}')"
elif grep -q -i 'centos' /etc/*-release; then

View File

@ -171,6 +171,11 @@ filter_froms(Froms0, AvailableVersionsIndex) ->
fun(Vsn) ->
not lists:member(Vsn, [<<"4.4.0">>, <<"4.4.1">>])
end, Froms0);
%% amzn2 is introduced since v4.4.12 and e4.4.12
%% exclude tags before them
"amzn2" ->
Excluded = [list_to_binary(["4.4.", integer_to_list(X)]) || X <- lists:seq(0,11)],
lists:filter(fun(Vsn) -> not lists:member(Vsn, Excluded) end, Froms0);
_ ->
Froms0
end,