Adding support for kernel_is operators, and removing on behalf of line from modules...
authorJohn Mylchreest <johnm@gentoo.org>
Tue, 28 Dec 2004 20:05:45 +0000 (20:05 +0000)
committerJohn Mylchreest <johnm@gentoo.org>
Tue, 28 Dec 2004 20:05:45 +0000 (20:05 +0000)
eclass/linux-info.eclass
eclass/linux-mod.eclass

index cff75eff15a459fb87ea289a911f29a562b02347..38a47d93438910725c618523fee1625d99b43c1f 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.11 2004/12/17 15:12:07 johnm Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.12 2004/12/28 20:05:45 johnm Exp $
 #
 # Description: This eclass is used as a central eclass for accessing kernel
 #                         related information for sources already installed.
@@ -182,24 +182,39 @@ kernel_is() {
        # if we haven't determined the version yet, we need too.
        get_version;
        
-       local RESULT
-       RESULT=1
+       local RESULT operator value test
+       RESULT=0
        
+       operator="-eq"
+       if [ "${1}" == "lt" ]
+       then
+               operator="-lt"
+               shift
+       elif [ "${1}" == "gt" ]
+       then
+               operator="-gt"
+               shift
+       elif [ "${1}" == "le" ]
+       then
+               operator="-le"
+               shift
+       elif [ "${1}" == "ge" ]
+       then
+               operator="-ge"
+               shift
+       fi
+
        if [ -n "${1}" ]
        then
-               [ "${1}" = "${KV_MAJOR}" ] && RESULT=0
+               [ ${KV_MAJOR} ${operator} ${1} ] || RESULT=1
        fi
-       
        if [ -n "${2}" ]
        then
-               RESULT=1
-               [ "${2}" = "${KV_MINOR}" ] && RESULT=0
+               [ ${KV_MINOR} ${operator} ${2} -a ${RESULT} -eq 0 ] || RESULT=1
        fi
-       
        if [ -n "${3}" ]
        then
-               RESULT=1
-               [ "${3}" = "${KV_PATCH}" ] && RESULT=0
+               [ ${KV_PATCH} ${operator} ${3} -a ${RESULT} -eq 0 ] || RESULT=1
        fi
        return ${RESULT}
 }
@@ -301,7 +316,9 @@ get_version() {
        if [ ! -s "${KV_OUT_DIR}/.config" ]
        then
                qeerror "Could not find a usable .config in the kernel source directory."
-               qeerror "Please ensure that ${KERNEL_DIR} points to a configured set of Linux sources"
+               qeerror "Please ensure that ${KERNEL_DIR} points to a configured set of Linux sources."
+               qeerror "If you are using KBUILD_OUTPUT, please set the environment var so that"
+               qeerror "it points to the necessary object directory so that it might find .config."
                die ".config not found in ${KV_OUT_DIR}"
        fi
 }
index f410dfad2e3ce879d12181ddfaf54e0a42cbed30..b08acc30883b15f777f4259cb137322749ec30bc 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.12 2004/12/18 16:22:13 johnm Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.13 2004/12/28 20:05:45 johnm Exp $
 
 # Description: This eclass is used to interface with linux-info in such a way
 #              to provide the functionality required and initial functions
@@ -156,15 +156,14 @@ generate_modulesd() {
                ebegin "Preparing file for modules.d"
                echo  "# modules.d config file for ${selectedmodule}" >> ${module_config}
                echo  "# this file was automatically generated from linux-mod.eclass" >> ${module_config}
-               echo  "# on behalf of ${EBUILD/*\//}" >> ${module_config}
                for temp in ${module_docs}
                do
                        echo "#  Please read ${temp/*\//} for more info" >> ${module_config}
                done
 
-               # like inserting any aliases
                if [ ${module_aliases} > 0 ];
                then
+                       echo >> ${module_config}
                        echo  "# Internal Aliases - Do not edit" >> ${module_config}
                        echo  "# ------------------------------" >> ${module_config}