Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Sun, 27 Jan 2019 20:28:17
Message-Id: 1548620873.dd40cfb4721f691b5596e334960dea58b97f986a.slyfox@gentoo
1 commit: dd40cfb4721f691b5596e334960dea58b97f986a
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jan 27 20:13:56 2019 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Sun Jan 27 20:27:53 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dd40cfb4
7
8 toolchain-glibc.eclass: avoid using KV_to_int and get_KV
9
10 'KV_to_int' and 'get_KV' are portage internals.
11
12 This change pulls in implementation of 'KV_to_int' and
13 'get_KV' as-is with a rename:
14 KV_to_int -> tc_glibc_KV_to_int
15 get_KV -> tc_glibc_get_KV (small API change)
16
17 Reported-by: Brian Harring
18 Reported-by: Michał Górny
19 Bug: https://bugs.gentoo.org/384041
20 Closes: https://bugs.gentoo.org/587320
21 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
22
23 eclass/toolchain-glibc.eclass | 54 +++++++++++++++++++++++++++++++++++++++----
24 1 file changed, 50 insertions(+), 4 deletions(-)
25
26 diff --git a/eclass/toolchain-glibc.eclass b/eclass/toolchain-glibc.eclass
27 index 0d252cc0ff4..7c134682db5 100644
28 --- a/eclass/toolchain-glibc.eclass
29 +++ b/eclass/toolchain-glibc.eclass
30 @@ -586,7 +586,53 @@ toolchain-glibc_pkg_setup() {
31 [[ ${EAPI:-0} == [0123] ]] && toolchain-glibc_pkg_pretend
32 }
33
34 -int_to_KV() {
35 +# The following Kernel version handling functions are mostly copied from portage
36 +# source. It's better not to use linux-info.eclass here since a) it adds too
37 +# much magic, see bug 326693 for some of the arguments, and b) some of the
38 +# functions are just not provided.
39 +
40 +tc_glibc_get_KV() {
41 + uname -r
42 + return $?
43 +}
44 +
45 +tc_glibc_KV_major() {
46 + [[ -z $1 ]] && return 1
47 + local KV=$@
48 + echo "${KV%%.*}"
49 +}
50 +
51 +tc_glibc_KV_minor() {
52 + [[ -z $1 ]] && return 1
53 + local KV=$@
54 + KV=${KV#*.}
55 + echo "${KV%%.*}"
56 +}
57 +
58 +tc_glibc_KV_micro() {
59 + [[ -z $1 ]] && return 1
60 + local KV=$@
61 + KV=${KV#*.*.}
62 + echo "${KV%%[^[:digit:]]*}"
63 +}
64 +
65 +tc_glibc_KV_to_int() {
66 + [[ -z $1 ]] && return 1
67 + local KV_MAJOR=$(tc_glibc_KV_major "$1")
68 + local KV_MINOR=$(tc_glibc_KV_minor "$1")
69 + local KV_MICRO=$(tc_glibc_KV_micro "$1")
70 + local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))
71 +
72 + # We make version 2.2.0 the minimum version we will handle as
73 + # a sanity check ... if its less, we fail ...
74 + if [[ ${KV_int} -ge 131584 ]] ; then
75 + echo "${KV_int}"
76 + return 0
77 + fi
78 + return 1
79 +}
80 +
81 +tc_glibc_int_to_KV() {
82 local version=$1 major minor micro
83 major=$((version / 65536))
84 minor=$(((version % 65536) / 256))
85 @@ -595,7 +641,7 @@ int_to_KV() {
86 }
87
88 eend_KV() {
89 - [[ $(KV_to_int $1) -ge $(KV_to_int $2) ]]
90 + [[ $(tc_glibc_KV_to_int $1) -ge $(tc_glibc_KV_to_int $2) ]]
91 eend $?
92 }
93
94 @@ -610,8 +656,8 @@ check_nptl_support() {
95 just_headers && return
96
97 local run_kv build_kv want_kv
98 - run_kv=$(int_to_KV $(get_KV))
99 - build_kv=$(int_to_KV $(get_kheader_version))
100 + run_kv=$(tc_glibc_get_KV)
101 + build_kv=$(tc_glibc_int_to_KV $(get_kheader_version))
102 want_kv=${NPTL_KERN_VER}
103
104 ebegin "Checking gcc for __thread support"