/[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.62 Revision 1.63
1# Copyright 1999-2006 Gentoo Foundation 1# Copyright 1999-2006 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.62 2009/09/06 22:54:58 robbat2 Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.63 2009/09/06 23:04:37 robbat2 Exp $
4# 4#
5# Original author: John Mylchreest <johnm@gentoo.org> 5# Original author: John Mylchreest <johnm@gentoo.org>
6# Maintainer: kernel-misc@gentoo.org 6# Maintainer: kernel-misc@gentoo.org
7# 7#
8# Please direct your bugs to the current eclass maintainer :) 8# Please direct your bugs to the current eclass maintainer :)
395 done 395 done
396 x=${x/ /} 396 x=${x/ /}
397 echo ${x} 397 echo ${x}
398} 398}
399 399
400# internal variable, so we know to only print the warning once
401get_version_warning_done=
402
400# @FUNCTION: get_version 403# @FUNCTION: get_version
401# @DESCRIPTION: 404# @DESCRIPTION:
402# It gets the version of the kernel inside KERNEL_DIR and populates the KV_FULL variable 405# It gets the version of the kernel inside KERNEL_DIR and populates the KV_FULL variable
403# (if KV_FULL is already set it does nothing). 406# (if KV_FULL is already set it does nothing).
404# 407#
417 # if we dont know KV_FULL, then we need too. 420 # if we dont know KV_FULL, then we need too.
418 # make sure KV_DIR isnt set since we need to work it out via KERNEL_DIR 421 # make sure KV_DIR isnt set since we need to work it out via KERNEL_DIR
419 unset KV_DIR 422 unset KV_DIR
420 423
421 # KV_DIR will contain the full path to the sources directory we should use 424 # KV_DIR will contain the full path to the sources directory we should use
425 [ -z "${get_version_warning_done}" ] && \
422 qeinfo "Determining the location of the kernel source code" 426 qeinfo "Determining the location of the kernel source code"
423 [ -h "${KERNEL_DIR}" ] && KV_DIR="$(readlink -f ${KERNEL_DIR})" 427 [ -h "${KERNEL_DIR}" ] && KV_DIR="$(readlink -f ${KERNEL_DIR})"
424 [ -d "${KERNEL_DIR}" ] && KV_DIR="${KERNEL_DIR}" 428 [ -d "${KERNEL_DIR}" ] && KV_DIR="${KERNEL_DIR}"
425 429
426 if [ -z "${KV_DIR}" ] 430 if [ -z "${KV_DIR}" ]
427 then 431 then
432 if [ -z "${get_version_warning_done}" ]; then
433 get_version_warning_done=1
428 qeerror "Unable to find kernel sources at ${KERNEL_DIR}" 434 qeerror "Unable to find kernel sources at ${KERNEL_DIR}"
429 qeinfo "This package requires Linux sources." 435 #qeinfo "This package requires Linux sources."
430 if [ "${KERNEL_DIR}" == "/usr/src/linux" ] ; then 436 if [ "${KERNEL_DIR}" == "/usr/src/linux" ] ; then
431 qeinfo "Please make sure that ${KERNEL_DIR} points at your running kernel, " 437 qeinfo "Please make sure that ${KERNEL_DIR} points at your running kernel, "
432 qeinfo "(or the kernel you wish to build against)." 438 qeinfo "(or the kernel you wish to build against)."
433 qeinfo "Alternatively, set the KERNEL_DIR environment variable to the kernel sources location" 439 qeinfo "Alternatively, set the KERNEL_DIR environment variable to the kernel sources location"
434 else 440 else
435 qeinfo "Please ensure that the KERNEL_DIR environment variable points at full Linux sources of the kernel you wish to compile against." 441 qeinfo "Please ensure that the KERNEL_DIR environment variable points at full Linux sources of the kernel you wish to compile against."
442 fi
436 fi 443 fi
437 return 1 444 return 1
438 fi 445 fi
439 446
447 if [ -z "${get_version_warning_done}" ]; then
440 qeinfo "Found kernel source directory:" 448 qeinfo "Found kernel source directory:"
441 qeinfo " ${KV_DIR}" 449 qeinfo " ${KV_DIR}"
450 fi
442 451
443 if [ ! -s "${KV_DIR}/Makefile" ] 452 if [ ! -s "${KV_DIR}/Makefile" ]
444 then 453 then
454 if [ -z "${get_version_warning_done}" ]; then
455 get_version_warning_done=1
445 qeerror "Could not find a Makefile in the kernel source directory." 456 qeerror "Could not find a Makefile in the kernel source directory."
446 qeerror "Please ensure that ${KERNEL_DIR} points to a complete set of Linux sources" 457 qeerror "Please ensure that ${KERNEL_DIR} points to a complete set of Linux sources"
458 fi
447 return 1 459 return 1
448 fi 460 fi
449 461
450 # OK so now we know our sources directory, but they might be using 462 # OK so now we know our sources directory, but they might be using
451 # KBUILD_OUTPUT, and we need this for .config and localversions-* 463 # KBUILD_OUTPUT, and we need this for .config and localversions-*
465 KV_PATCH="$(getfilevar_noexec SUBLEVEL ${KV_DIR}/Makefile)" 477 KV_PATCH="$(getfilevar_noexec SUBLEVEL ${KV_DIR}/Makefile)"
466 KV_EXTRA="$(getfilevar_noexec EXTRAVERSION ${KV_DIR}/Makefile)" 478 KV_EXTRA="$(getfilevar_noexec EXTRAVERSION ${KV_DIR}/Makefile)"
467 479
468 if [ -z "${KV_MAJOR}" -o -z "${KV_MINOR}" -o -z "${KV_PATCH}" ] 480 if [ -z "${KV_MAJOR}" -o -z "${KV_MINOR}" -o -z "${KV_PATCH}" ]
469 then 481 then
482 if [ -z "${get_version_warning_done}" ]; then
483 get_version_warning_done=1
470 qeerror "Could not detect kernel version." 484 qeerror "Could not detect kernel version."
471 qeerror "Please ensure that ${KERNEL_DIR} points to a complete set of Linux sources." 485 qeerror "Please ensure that ${KERNEL_DIR} points to a complete set of Linux sources."
486 fi
472 return 1 487 return 1
473 fi 488 fi
474 489
475 # and in newer versions we can also pull LOCALVERSION if it is set. 490 # and in newer versions we can also pull LOCALVERSION if it is set.
476 # but before we do this, we need to find if we use a different object directory. 491 # but before we do this, we need to find if we use a different object directory.

Legend:
Removed from v.1.62  
changed lines
  Added in v.1.63

  ViewVC Help
Powered by ViewVC 1.1.20