summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2010-01-10 08:47:01 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2010-01-10 08:47:01 +0000
commit406e9054a15653eea41f56b61d7e3d377cf34418 (patch)
tree0e0642490acbcba8b947394229782950465e1cd3 /eclass
parentBug #283219: libnl has never needed linux-info. (diff)
downloadgentoo-2-406e9054a15653eea41f56b61d7e3d377cf34418.tar.gz
gentoo-2-406e9054a15653eea41f56b61d7e3d377cf34418.tar.bz2
gentoo-2-406e9054a15653eea41f56b61d7e3d377cf34418.zip
Bug #300306, #167385: One side effect of the non-exec check version for the kernel makefile is that it did not pick up appends, breaking builds on some patched kernels. Try the exec version first now, with a fallback.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/linux-info.eclass29
1 files changed, 22 insertions, 7 deletions
diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
index b9ea97f98847..4918b28280ce 100644
--- a/eclass/linux-info.eclass
+++ b/eclass/linux-info.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.77 2010/01/10 08:25:55 robbat2 Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.78 2010/01/10 08:47:01 robbat2 Exp $
#
# Original author: John Mylchreest <johnm@gentoo.org>
# Maintainer: kernel-misc@gentoo.org
@@ -490,17 +490,32 @@ get_version() {
# do we pass KBUILD_OUTPUT on the CLI?
OUTPUT_DIR="${OUTPUT_DIR:-${KBUILD_OUTPUT}}"
+ # keep track of it
+ KERNEL_MAKEFILE="${KV_DIR}/Makefile"
+
+ # Check if the Makefile is valid for direct parsing.
+ # Check status results:
+ # - PASS, use 'getfilevar' to extract values
+ # - FAIL, use 'getfilevar_noexec' to extract values
+ # The check may fail if:
+ # - make is not present
+ # - corruption exists in the kernel makefile
+ local a='' b='' mkfunc='getfilevar'
+ a="$(getfilevar VERSION ${KERNEL_MAKEFILE})"
+ b="$(getfilevar_noexec VERSION ${KERNEL_MAKEFILE})"
+ [[ "${a}" != "${b}" ]] && mkfunc='getfilevar_noexec'
+
# And if we didn't pass it, we can take a nosey in the Makefile
- kbuild_output="$(getfilevar_noexec KBUILD_OUTPUT ${KV_DIR}/Makefile)"
+ kbuild_output="$(${mkfunc} KBUILD_OUTPUT ${KERNEL_MAKEFILE})"
OUTPUT_DIR="${OUTPUT_DIR:-${kbuild_output}}"
# And contrary to existing functions I feel we shouldn't trust the
# directory name to find version information as this seems insane.
- # so we parse ${KV_DIR}/Makefile
- KV_MAJOR="$(getfilevar_noexec VERSION ${KV_DIR}/Makefile)"
- KV_MINOR="$(getfilevar_noexec PATCHLEVEL ${KV_DIR}/Makefile)"
- KV_PATCH="$(getfilevar_noexec SUBLEVEL ${KV_DIR}/Makefile)"
- KV_EXTRA="$(getfilevar_noexec EXTRAVERSION ${KV_DIR}/Makefile)"
+ # so we parse ${KERNEL_MAKEFILE}
+ KV_MAJOR="$(${mkfunc} VERSION ${KERNEL_MAKEFILE})"
+ KV_MINOR="$(${mkfunc} PATCHLEVEL ${KERNEL_MAKEFILE})"
+ KV_PATCH="$(${mkfunc} SUBLEVEL ${KERNEL_MAKEFILE})"
+ KV_EXTRA="$(${mkfunc} EXTRAVERSION ${KERNEL_MAKEFILE})"
if [ -z "${KV_MAJOR}" -o -z "${KV_MINOR}" -o -z "${KV_PATCH}" ]
then