This function may fail if the version cannot be parsed from a Makefile
found by following the /lib/modules/${KV_FULL}/{source,build} symlinks.
Instead of failing, we should just split KV_FULL as a fallback.
Also, simplify the existance checks for the kernel Makefile; if we can't
find the kernel source directory, there is really no point in checking
for the kernel build directory. The latter will probably contain a
Makefile with no version information.
Bug:
https://bugs.gentoo.org/811726
Signed-off-by: Mike Gilbert <
[email protected]>
---
eclass/linux-info.eclass | 47 +++++++++++++++++-----------------------
1 file changed, 20 insertions(+), 27 deletions(-)
diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
index 4e08949a385..97f7b5c06a9 100644
--- a/eclass/linux-info.eclass
+++ b/eclass/linux-info.eclass
@@ -629,34 +629,27 @@ get_running_version() {
die "${FUNCNAME}() called on non-Linux system, please fix the ebuild"
fi
- KV_FULL=$(uname -r)
-
- if [[ -f ${ROOT%/}/lib/modules/${KV_FULL}/source/Makefile && -f ${ROOT%/}/lib/modules/${KV_FULL}/build/Makefile ]]; then
- KERNEL_DIR=$(readlink -f ${ROOT%/}/lib/modules/${KV_FULL}/source)
- KBUILD_OUTPUT=$(readlink -f ${ROOT%/}/lib/modules/${KV_FULL}/build)
- unset KV_FULL
- get_version
- return $?
- elif [[ -f ${ROOT%/}/lib/modules/${KV_FULL}/source/Makefile ]]; then
- KERNEL_DIR=$(readlink -f ${ROOT%/}/lib/modules/${KV_FULL}/source)
- unset KV_FULL
- get_version
- return $?
- elif [[ -f ${ROOT%/}/lib/modules/${KV_FULL}/build/Makefile ]];