summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2021-08-26 11:21:17 +0200
committerUlrich Müller <ulm@gentoo.org>2021-08-27 19:21:37 +0200
commit4b48b038fa23b5580fa2b916b34c646c155db93a (patch)
treee11a1de7a23f7f426e956790286848c21032beb3 /eclass/linux-info.eclass
parentkernel-2.eclass: Drop useless unset of local variables (diff)
downloadgentoo-4b48b038fa23b5580fa2b916b34c646c155db93a.tar.gz
gentoo-4b48b038fa23b5580fa2b916b34c646c155db93a.tar.bz2
gentoo-4b48b038fa23b5580fa2b916b34c646c155db93a.zip
linux-info.eclass: Replace bit-shift arithmetic by ver_test
There are kernel versions like 4.9.280, therefore shifting version components by 8 bits in kernel_is() may fail. Reviewed-by: Alice Ferrazzi <alicef@gentoo.org> Signed-off-by: Ulrich Müller <ulm@gentoo.org>
Diffstat (limited to 'eclass/linux-info.eclass')
-rw-r--r--eclass/linux-info.eclass9
1 files changed, 5 insertions, 4 deletions
diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
index 124fb70e78ad..5456d6be02eb 100644
--- a/eclass/linux-info.eclass
+++ b/eclass/linux-info.eclass
@@ -395,7 +395,7 @@ kernel_is() {
linux-info_get_any_version
# Now we can continue
- local operator test value
+ local operator
case ${1#-} in
lt) operator="-lt"; shift;;
@@ -407,9 +407,10 @@ kernel_is() {
esac
[[ $# -gt 3 ]] && die "Error in kernel-2_kernel_is(): too many parameters"
- : $(( test = (KV_MAJOR << 16) + (KV_MINOR << 8) + KV_PATCH ))
- : $(( value = (${1:-${KV_MAJOR}} << 16) + (${2:-${KV_MINOR}} << 8) + ${3:-${KV_PATCH}} ))
- [ ${test} ${operator} ${value} ]
+ ver_test \
+ "${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}" \
+ "${operator}" \
+ "${1:-${KV_MAJOR}}.${2:-${KV_MINOR}}.${3:-${KV_PATCH}}"
}
get_localversion() {