/[gentoo-x86]/eclass/linux-info.eclass
Gentoo

Diff of /eclass/linux-info.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.5 Revision 1.6
1# Copyright 1999-2004 Gentoo Foundation 1# Copyright 1999-2004 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.5 2004/12/01 18:08:57 johnm Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.6 2004/12/01 23:26:43 johnm Exp $
4# 4#
5# This eclass provides functions for querying the installed kernel 5# This eclass provides functions for querying the installed kernel
6# source version, selected kernel options etc. 6# source version, selected kernel options etc.
7# 7#
8 8
18 18
19# getfilevar accepts 2 vars as follows: 19# getfilevar accepts 2 vars as follows:
20# getfilevar <VARIABLE> <CONFIGFILE> 20# getfilevar <VARIABLE> <CONFIGFILE>
21 21
22getfilevar() { 22getfilevar() {
23local ERROR curpwd 23local ERROR workingdir basefname basedname arch
24 ERROR=0 24 ERROR=0
25 25
26 [ -z "${1}" ] && ERROR=1 26 [ -z "${1}" ] && ERROR=1
27 [ ! -f "${2}" ] && ERROR=1 27 [ ! -f "${2}" ] && ERROR=1
28 28
29 if [ "${ERROR}" = 1 ] 29 if [ "${ERROR}" = 1 ]
30 then 30 then
31 ebeep
32 echo -e "\n"
31 eerror "getfilevar requires 2 variables, with the second a valid file." 33 eerror "getfilevar requires 2 variables, with the second a valid file."
32 eerror " getfilevar <VARIABLE> <CONFIGFILE>" 34 eerror " getfilevar <VARIABLE> <CONFIGFILE>"
33 else 35 else
34 curpwd="${PWD}" 36 workingdir=${PWD}
37 basefname=$(basename ${2})
35 cd $(dirname ${2}) 38 basedname=$(dirname ${2})
39 arch=${ARCH}
40 unset ARCH
41
42 cd ${basedname}
36 echo $(echo -e "include $(basename ${2})\ne:\n\t@echo \$(${1})" | make -f - e) 43 echo -e "include ${basefname}\ne:\n\t@echo \$(${1})" | make -f - e
37 cd ${curpwd} 44 cd ${workingdir}
38 # grep -e "^$1[= ]" $2 | sed 's: = :=:' | cut -d= -f2- 45
46 ARCH=${arch}
39 fi 47 fi
40} 48}
41 49
42getfilevar_isset() { 50getfilevar_isset() {
43local RESULT 51local RESULT
123 # KBUILD_OUTPUT, and we need this for .config and localversions-* 131 # KBUILD_OUTPUT, and we need this for .config and localversions-*
124 # so we better find it eh? 132 # so we better find it eh?
125 # do we pass KBUILD_OUTPUT on the CLI? 133 # do we pass KBUILD_OUTPUT on the CLI?
126 OUTPUT_DIR="${OUTPUT_DIR:-${KBUILD_OUTPUT}}" 134 OUTPUT_DIR="${OUTPUT_DIR:-${KBUILD_OUTPUT}}"
127 135
128 # Or maybe KBUILD_OUTPUT is set in Makefile? 136 # And if we didn't pass it, we can take a nosey in the Makefile
129 kbuild_output="$(getfilevar KBUILD_OUTPUT ${KV_DIR}/Makefile)" 137 kbuild_output="$(getfilevar KBUILD_OUTPUT ${KV_DIR}/Makefile)"
130 OUTPUT_DIR="${OUTPUT_DIR:-${kbuild_output}}" 138 OUTPUT_DIR="${OUTPUT_DIR:-${kbuild_output}}"
131 139
132 # And contrary to existing functions I feel we shouldn't trust the 140 # And contrary to existing functions I feel we shouldn't trust the
133 # directory name to find version information as this seems insane. 141 # directory name to find version information as this seems insane.

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.20