diff options
author | 2018-01-19 21:09:11 +0100 | |
---|---|---|
committer | 2018-01-20 01:50:27 +0100 | |
commit | 79a05395f7f72e5f30fb9b8b4f765753ead17137 (patch) | |
tree | 1fac445c50fef3874c27941ca68b779f128ace3b /sys-libs | |
parent | sys-apps/busybox: update shell options in live git ebuild too (diff) | |
download | gentoo-79a05395f7f72e5f30fb9b8b4f765753ead17137.tar.gz gentoo-79a05395f7f72e5f30fb9b8b4f765753ead17137.tar.bz2 gentoo-79a05395f7f72e5f30fb9b8b4f765753ead17137.zip |
sys-libs/glibc: Use linux-info.eclass to get running kernel, bug 587320
Bug: https://bugs.gentoo.org/587320
Package-Manager: Portage-2.3.19, Repoman-2.3.6
Diffstat (limited to 'sys-libs')
-rw-r--r-- | sys-libs/glibc/glibc-9999.ebuild | 54 |
1 files changed, 47 insertions, 7 deletions
diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild index f7f93ffbd6ea..f2132994237e 100644 --- a/sys-libs/glibc/glibc-9999.ebuild +++ b/sys-libs/glibc/glibc-9999.ebuild @@ -4,7 +4,7 @@ EAPI=6 inherit prefix eutils versionator toolchain-funcs flag-o-matic gnuconfig \ - multilib systemd multiprocessing + multilib systemd multiprocessing linux-info DESCRIPTION="GNU libc C library" HOMEPAGE="https://www.gnu.org/software/libc/" @@ -509,7 +509,46 @@ check_devpts() { fi } -int_to_KV() { +# The following functions are copied from portage source and split a Kernel +# version into its components. + +g_KV_major() { + [[ -z $1 ]] && return 1 + local KV=$@ + echo "${KV%%.*}" +} + +g_KV_minor() { + [[ -z $1 ]] && return 1 + local KV=$@ + KV=${KV#*.} + echo "${KV%%.*}" +} + +g_KV_micro() { + [[ -z $1 ]] && return 1 + local KV=$@ + KV=${KV#*.*.} + echo "${KV%%[^[:digit:]]*}" +} + +g_KV_to_int() { + [[ -z $1 ]] && return 1 + local KV_MAJOR=$(g_KV_major "$1") + local KV_MINOR=$(g_KV_minor "$1") + local KV_MICRO=$(g_KV_micro "$1") + local KV_int=$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO )) + + # We make version 2.2.0 the minimum version we will handle as + # a sanity check ... if its less, we fail ... + if [[ ${KV_int} -ge 131584 ]] ; then + echo "${KV_int}" + return 0 + fi + return 1 +} + +g_int_to_KV() { local version=$1 major minor micro major=$((version / 65536)) minor=$(((version % 65536) / 256)) @@ -518,7 +557,7 @@ int_to_KV() { } eend_KV() { - [[ $(KV_to_int $1) -ge $(KV_to_int $2) ]] + [[ $(g_KV_to_int $1) -ge $(g_KV_to_int $2) ]] eend $? } @@ -534,10 +573,11 @@ check_nptl_support() { local run_kv build_kv want_kv - # TODO: this needs to be replaced somehow - run_kv=$(int_to_KV $(get_KV)) + # We get the running kernel version using linux-info.eclass + get_running_version + run_kv=${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} - build_kv=$(int_to_KV $(get_kheader_version)) + build_kv=$(g_int_to_KV $(get_kheader_version)) want_kv=${MIN_KERN_VER} ebegin "Checking gcc for __thread support" @@ -550,7 +590,7 @@ check_nptl_support() { if ! is_crosscompile && ! tc-is-cross-compiler ; then # Building fails on an non-supporting kernel - ebegin "Checking kernel version (${run_kv} >= ${want_kv})" + ebegin "Checking running kernel version (${run_kv} >= ${want_kv})" if ! eend_KV ${run_kv} ${want_kv} ; then echo eerror "You need a kernel of at least ${want_kv}!" |