Gentoo Archives: gentoo-commits

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Sun, 29 Aug 2021 22:52:36
Message-Id: 1630277457.6edd821aefef800ad5bb3aeccbc8e4fefe27bd20.ulm@gentoo
1 commit: 6edd821aefef800ad5bb3aeccbc8e4fefe27bd20
2 Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
3 AuthorDate: Sat Aug 28 05:25:48 2021 +0000
4 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
5 CommitDate: Sun Aug 29 22:50:57 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6edd821a
7
8 linux-info.eclass: Replace bit-shift arithmetic by ver_test
9
10 There are kernel versions like 4.9.280, therefore shifting version
11 components by 8 bits in kernel_is() may fail.
12
13 Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
14
15 eclass/linux-info.eclass | 9 +++++----
16 1 file changed, 5 insertions(+), 4 deletions(-)
17
18 diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
19 index 124fb70e78a..8edd17c317d 100644
20 --- a/eclass/linux-info.eclass
21 +++ b/eclass/linux-info.eclass
22 @@ -395,7 +395,7 @@ kernel_is() {
23 linux-info_get_any_version
24
25 # Now we can continue
26 - local operator test value
27 + local operator
28
29 case ${1#-} in
30 lt) operator="-lt"; shift;;
31 @@ -407,9 +407,10 @@ kernel_is() {
32 esac
33 [[ $# -gt 3 ]] && die "Error in kernel-2_kernel_is(): too many parameters"
34
35 - : $(( test = (KV_MAJOR << 16) + (KV_MINOR << 8) + KV_PATCH ))
36 - : $(( value = (${1:-${KV_MAJOR}} << 16) + (${2:-${KV_MINOR}} << 8) + ${3:-${KV_PATCH}} ))
37 - [ ${test} ${operator} ${value} ]
38 + ver_test \
39 + "${KV_MAJOR:-0}.${KV_MINOR:-0}.${KV_PATCH:-0}" \
40 + "${operator}" \
41 + "${1:-${KV_MAJOR:-0}}.${2:-${KV_MINOR:-0}}.${3:-${KV_PATCH:-0}}"
42 }
43
44 get_localversion() {