summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-12-12 22:01:37 +0000
committerMike Frysinger <vapier@gentoo.org>2011-12-12 22:01:37 +0000
commit80833d0bd9efe189cf56abc08ec22bfbd0a8da42 (patch)
tree4b332def63d9a4b1941c78d8b7618e8709fd3ad9 /eclass
parentStable for AMD64, wrt bug #393553 (diff)
downloadhistorical-80833d0bd9efe189cf56abc08ec22bfbd0a8da42.tar.gz
historical-80833d0bd9efe189cf56abc08ec22bfbd0a8da42.tar.bz2
historical-80833d0bd9efe189cf56abc08ec22bfbd0a8da42.zip
merge kernel_is updates between kernel-2 and linux-info eclasses
Diffstat (limited to 'eclass')
-rw-r--r--eclass/kernel-2.eclass5
-rw-r--r--eclass/linux-info.eclass43
2 files changed, 18 insertions, 30 deletions
diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
index 5288e4e50b5f..f53e9abd7612 100644
--- a/eclass/kernel-2.eclass
+++ b/eclass/kernel-2.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.272 2011/12/10 07:57:59 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.273 2011/12/12 22:01:37 vapier Exp $
# Description: kernel.eclass rewrite for a clean base regarding the 2.6
# series of kernel with back-compatibility for 2.4
@@ -379,6 +379,7 @@ detect_version() {
handle_genpatches
}
+# Note: duplicated in linux-info.eclass
kernel_is() {
# ALL of these should be set before we can safely continue this function.
# some of the sources have in the past had only one set.
@@ -390,7 +391,7 @@ kernel_is() {
# Now we can continue
local operator test value
- case $1 in
+ case ${1#-} in
lt) operator="-lt"; shift;;
gt) operator="-gt"; shift;;
le) operator="-le"; shift;;
diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
index 1ae9b34ebfbf..bbb854e24334 100644
--- a/eclass/linux-info.eclass
+++ b/eclass/linux-info.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.90 2011/08/22 04:46:32 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.91 2011/12/12 22:01:37 vapier Exp $
# @ECLASS: linux-info.eclass
# @MAINTAINER:
@@ -359,40 +359,27 @@ linux_chkconfig_string() {
# kernel_is 2 6 9 returns true
# @CODE
-# got the jist yet?
-
+# Note: duplicated in kernel-2.eclass
kernel_is() {
# if we haven't determined the version yet, we need to.
linux-info_get_any_version
- local operator testagainst value x=0 y=0 z=0
+ # Now we can continue
+ local operator test value
- case ${1} in
- -lt|lt) operator="-lt"; shift;;
- -gt|gt) operator="-gt"; shift;;
- -le|le) operator="-le"; shift;;
- -ge|ge) operator="-ge"; shift;;
- -eq|eq) operator="-eq"; shift;;
- *) operator="-eq";;
+ case ${1#-} in
+ lt) operator="-lt"; shift;;
+ gt) operator="-gt"; shift;;
+ le) operator="-le"; shift;;
+ ge) operator="-ge"; shift;;
+ eq) operator="-eq"; shift;;
+ *) operator="-eq";;
esac
+ [[ $# -gt 3 ]] && die "Error in kernel-2_kernel_is(): too many parameters"
- for x in ${@}; do
- for((y=0; y<$((3 - ${#x})); y++)); do value="${value}0"; done
- value="${value}${x}"
- z=$((${z} + 1))
-
- case ${z} in
- 1) for((y=0; y<$((3 - ${#KV_MAJOR})); y++)); do testagainst="${testagainst}0"; done;
- testagainst="${testagainst}${KV_MAJOR}";;
- 2) for((y=0; y<$((3 - ${#KV_MINOR})); y++)); do testagainst="${testagainst}0"; done;
- testagainst="${testagainst}${KV_MINOR}";;
- 3) for((y=0; y<$((3 - ${#KV_PATCH})); y++)); do testagainst="${testagainst}0"; done;
- testagainst="${testagainst}${KV_PATCH}";;
- *) die "Error in kernel-2_kernel_is(): Too many parameters.";;
- esac
- done
-
- [ "${testagainst}" ${operator} "${value}" ] && return 0 || return 1
+ : $(( test = (KV_MAJOR << 16) + (KV_MINOR << 8) + KV_PATCH ))
+ : $(( value = (${1:-${KV_MAJOR}} << 16) + (${2:-${KV_MINOR}} << 8) + ${3:-${KV_PATCH}} ))
+ [ ${test} ${operator} ${value} ]
}
get_localversion() {