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:34
Message-Id: 1630277456.04449756186ef0196fe9eecb3f516d498ac08ec3.ulm@gentoo
1 commit: 04449756186ef0196fe9eecb3f516d498ac08ec3
2 Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
3 AuthorDate: Sat Aug 28 05:25:20 2021 +0000
4 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
5 CommitDate: Sun Aug 29 22:50:56 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=04449756
7
8 kernel-2.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/kernel-2.eclass | 9 +++++----
16 1 file changed, 5 insertions(+), 4 deletions(-)
17
18 diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
19 index 8c174099827..05c07c4d153 100644
20 --- a/eclass/kernel-2.eclass
21 +++ b/eclass/kernel-2.eclass
22 @@ -560,7 +560,7 @@ kernel_is() {
23 [[ ${n} -eq 1 ]] && detect_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 @@ -572,9 +572,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 # Capture the sources type and set DEPENDs