/[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.18 Revision 1.19
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.18 2005/01/15 21:46:00 johnm Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.19 2005/01/18 21:38:59 johnm Exp $
4# 4#
5# Description: This eclass is used as a central eclass for accessing kernel 5# Description: This eclass is used as a central eclass for accessing kernel
6# related information for sources already installed. 6# related information for sources already installed.
7# It is vital for linux-mod to function correctly, and is split 7# It is vital for linux-mod to function correctly, and is split
8# out so that any ebuild behaviour "templates" are abstracted out 8# out so that any ebuild behaviour "templates" are abstracted out
252get_version() { 252get_version() {
253 local kbuild_output 253 local kbuild_output
254 254
255 # no need to execute this twice assuming KV_FULL is populated. 255 # no need to execute this twice assuming KV_FULL is populated.
256 # we can force by unsetting KV_FULL 256 # we can force by unsetting KV_FULL
257 [ -n "${KV_FULL}" ] && return 257 [ -n "${KV_FULL}" ] && return 0
258 258
259 # if we dont know KV_FULL, then we need too. 259 # if we dont know KV_FULL, then we need too.
260 # make sure KV_DIR isnt set since we need to work it out via KERNEL_DIR 260 # make sure KV_DIR isnt set since we need to work it out via KERNEL_DIR
261 unset KV_DIR 261 unset KV_DIR
262 262
274 qeinfo "(or the kernel you wish to build against)." 274 qeinfo "(or the kernel you wish to build against)."
275 qeinfo "Alternatively, set the KERNEL_DIR environment variable to the kernel sources location" 275 qeinfo "Alternatively, set the KERNEL_DIR environment variable to the kernel sources location"
276 else 276 else
277 qeinfo "Please ensure that the KERNEL_DIR environment variable points at full Linux sources of the kernel you wish to compile against." 277 qeinfo "Please ensure that the KERNEL_DIR environment variable points at full Linux sources of the kernel you wish to compile against."
278 fi 278 fi
279 die "Cannot locate Linux sources at ${KERNEL_DIR}" 279 return 1
280 fi 280 fi
281 281
282 qeinfo "Found kernel source directory:" 282 qeinfo "Found kernel source directory:"
283 qeinfo " ${KV_DIR}" 283 qeinfo " ${KV_DIR}"
284 284
285 if [ ! -s "${KV_DIR}/Makefile" ] 285 if [ ! -s "${KV_DIR}/Makefile" ]
286 then 286 then
287 qeerror "Could not find a Makefile in the kernel source directory." 287 qeerror "Could not find a Makefile in the kernel source directory."
288 qeerror "Please ensure that ${KERNEL_DIR} points to a complete set of Linux sources" 288 qeerror "Please ensure that ${KERNEL_DIR} points to a complete set of Linux sources"
289 die "Makefile not found in ${KV_DIR}" 289 return 1
290 fi 290 fi
291 291
292 # OK so now we know our sources directory, but they might be using 292 # OK so now we know our sources directory, but they might be using
293 # KBUILD_OUTPUT, and we need this for .config and localversions-* 293 # KBUILD_OUTPUT, and we need this for .config and localversions-*
294 # so we better find it eh? 294 # so we better find it eh?
308 KV_EXTRA="$(getfilevar EXTRAVERSION ${KV_DIR}/Makefile)" 308 KV_EXTRA="$(getfilevar EXTRAVERSION ${KV_DIR}/Makefile)"
309 309
310 if [ -z "${KV_MAJOR}" -o -z "${KV_MINOR}" -o -z "${KV_PATCH}" ] 310 if [ -z "${KV_MAJOR}" -o -z "${KV_MINOR}" -o -z "${KV_PATCH}" ]
311 then 311 then
312 qeerror "Could not detect kernel version." 312 qeerror "Could not detect kernel version."
313 qeerror "Please ensure that ${KERNEL_DIR} points to a complete set of Linux sources" 313 qeerror "Please ensure that ${KERNEL_DIR} points to a complete set of Linux sources."
314 die "Could not parse version info from ${KV_DIR}/Makefile" 314 return 1
315 fi 315 fi
316 316
317 # and in newer versions we can also pull LOCALVERSION if it is set. 317 # and in newer versions we can also pull LOCALVERSION if it is set.
318 # but before we do this, we need to find if we use a different object directory. 318 # but before we do this, we need to find if we use a different object directory.
319 # This *WILL* break if the user is using localversions, but we assume it was 319 # This *WILL* break if the user is using localversions, but we assume it was
347 then 347 then
348 qeerror "Could not find a usable .config in the kernel source directory." 348 qeerror "Could not find a usable .config in the kernel source directory."
349 qeerror "Please ensure that ${KERNEL_DIR} points to a configured set of Linux sources." 349 qeerror "Please ensure that ${KERNEL_DIR} points to a configured set of Linux sources."
350 qeerror "If you are using KBUILD_OUTPUT, please set the environment var so that" 350 qeerror "If you are using KBUILD_OUTPUT, please set the environment var so that"
351 qeerror "it points to the necessary object directory so that it might find .config." 351 qeerror "it points to the necessary object directory so that it might find .config."
352 die ".config not found in ${KV_OUT_DIR}" 352 return 1
353 fi 353 fi
354
355 return 0
354} 356}
355 357
356 358
357 359
358 360
527################################ 529################################
528# Default pkg_setup 530# Default pkg_setup
529# Also used when inheriting linux-mod to force a get_version call 531# Also used when inheriting linux-mod to force a get_version call
530 532
531linux-info_pkg_setup() { 533linux-info_pkg_setup() {
532 get_version; 534 get_version || die "Unable to calculate Linux Kernel version"
533 [ -n "${CONFIG_CHECK}" ] && check_extra_config; 535 [ -n "${CONFIG_CHECK}" ] && check_extra_config;
534} 536}

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

  ViewVC Help
Powered by ViewVC 1.1.20