summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2009-09-06 23:24:49 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2009-09-06 23:24:49 +0000
commitb9793b96d1a7f91294677f2846791e4b30844f3e (patch)
tree7d4ff2471948f590bdc19983daee44b4751bd5d1 /eclass
parentBug #283320: The dependancy for linux-sources now moves into linux-mod, where... (diff)
downloadgentoo-2-b9793b96d1a7f91294677f2846791e4b30844f3e.tar.gz
gentoo-2-b9793b96d1a7f91294677f2846791e4b30844f3e.tar.bz2
gentoo-2-b9793b96d1a7f91294677f2846791e4b30844f3e.zip
Bug 28330: Provide a function to get the source or running version sanely.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/linux-info.eclass23
1 files changed, 17 insertions, 6 deletions
diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
index a21d9d713f91..a5823f093007 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.65 2009/09/06 23:16:37 robbat2 Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.66 2009/09/06 23:24:49 robbat2 Exp $
#
# Original author: John Mylchreest <johnm@gentoo.org>
# Maintainer: kernel-misc@gentoo.org
@@ -557,6 +557,21 @@ get_running_version() {
return 0
}
+# This next function is named with the eclass prefix to avoid conflicts with
+# some old versionator-like eclass functions.
+
+# @FUNCTION: linux-info_get_any_version
+# @DESCRIPTION:
+# This attempts to find the version of the sources, and otherwise falls back to
+# the version of the running kernel.
+linux-info_get_any_version() {
+ get_version
+ if [[ $rc -ne 0 ]]; then
+ ewarn "Unable to calculate Linux Kernel version for build, attempting to use running version"
+ get_running_version
+ fi
+}
+
# ebuild check functions
# ---------------------------------------
@@ -807,11 +822,7 @@ check_zlibinflate() {
# Force a get_version() call when inherited from linux-mod.eclass and then check if the kernel is configured
# to support the options specified in CONFIG_CHECK (if not null)
linux-info_pkg_setup() {
- get_version
- if [[ $rc -ne 0 ]]; then
- ewarn "Unable to calculate Linux Kernel version for build, attempting to use running version"
- get_running_version
- fi
+ linux-info_get_any_version
if kernel_is 2 4; then
if [ "$( gcc-major-version )" -eq "4" ] ; then