From e0efadcfd3dec644549ed24f27c2f2a014f96810 Mon Sep 17 00:00:00 2001 From: Alin Năstac Date: Fri, 31 Dec 2004 09:23:43 +0000 Subject: correct kernel_is; format kernel versions as %d%03d%03d and test them as integers --- eclass/linux-info.eclass | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'eclass/linux-info.eclass') diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass index 4576f08b34cf..d22bdd24d9f7 100644 --- a/eclass/linux-info.eclass +++ b/eclass/linux-info.eclass @@ -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.14 2004/12/29 11:22:41 johnm Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.15 2004/12/31 09:23:43 mrness Exp $ # # Description: This eclass is used as a central eclass for accessing kernel # related information for sources already installed. @@ -182,7 +182,7 @@ kernel_is() { # if we haven't determined the version yet, we need too. get_version; - local RESULT operator test value + local RESULT operator test value i len RESULT=0 operator="=" @@ -211,12 +211,30 @@ kernel_is() { fi if [ -n "${2}" ] then + len=$[ 3 - ${#2} ] + for((i=0; i<$len; i++)); do + value="${value}0" + done value="${value}${2}" + + len=$[ 3 - ${#KV_MINOR} ] + for((i=0; i<$len; i++)); do + test="${test}0" + done test="${test}${KV_MINOR}" fi if [ -n "${3}" ] then + len=$[ 3 - ${#3} ] + for((i=0; i<$len; i++)); do + value="${value}0" + done value="${value}${3}" + + len=$[ 3 - ${#KV_PATCH} ] + for((i=0; i<$len; i++)); do + test="${test}0" + done test="${test}${KV_PATCH}" fi -- cgit v1.2.3-65-gdbad