Commit 6aa16fff authored by Vitaly Lipatov's avatar Vitaly Lipatov

functions/common: use rpmvercmp for version comparison if available

Use rpmvercmp for more accurate version comparison instead of sort -n. Fallback to sort -n if rpmvercmp is not available.
parent 1de23d53
...@@ -614,7 +614,12 @@ usearg() ...@@ -614,7 +614,12 @@ usearg()
# return 0 if arg1 >= arg2 # return 0 if arg1 >= arg2
version_more_version() version_more_version()
{ {
[ "$2" = "$(echo -e "$1\n$2" | sort -n | head -n1)" ] if ! which rpmvercmp >/dev/null 2>/dev/null ; then
[ "$2" = "$(echo -e "$1\n$2" | sort -n | head -n1)" ]
return
fi
[ "$(rpmvercmp "$1" "$2")" = "-1" ] && return 1
return 0
} }
HELP_GIRAR=" GIRAR - git.alt (ga, galt) or git.eter (ge, geter)" HELP_GIRAR=" GIRAR - git.alt (ga, galt) or git.eter (ge, geter)"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment