/[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.64
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.64 2009/09/06 23:12:29 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 :)
200 ERROR=0 200 ERROR=0
201 mycat='cat' 201 mycat='cat'
202 202
203 [ -z "${1}" ] && ERROR=1 203 [ -z "${1}" ] && ERROR=1
204 [ ! -f "${2}" ] && ERROR=1 204 [ ! -f "${2}" ] && ERROR=1
205 [ "${2#.gz}" != "${2}" ] && mycat='zcat' 205 [ "${2%.gz}" != "${2}" ] && mycat='zcat'
206 206
207 if [ "${ERROR}" = 1 ] 207 if [ "${ERROR}" = 1 ]
208 then 208 then
209 echo -e "\n" 209 echo -e "\n"
210 eerror "getfilevar_noexec requires 2 variables, with the second a valid file." 210 eerror "getfilevar_noexec requires 2 variables, with the second a valid file."
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.
608 # In the case where we don't require a .config, we can now bail out 623 # In the case where we don't require a .config, we can now bail out
609 # if the user has no .config as there is nothing to do. Otherwise 624 # if the user has no .config as there is nothing to do. Otherwise
610 # code later will cause a failure due to missing .config. 625 # code later will cause a failure due to missing .config.
611 if ! linux_config_exists; then 626 if ! linux_config_exists; then
612 ewarn "Unable to check for the following kernel config options due" 627 ewarn "Unable to check for the following kernel config options due"
613 ewarn "to absence of any configured kernel sources:" 628 ewarn "to absence of any configured kernel sources or compiled"
629 ewarn "config:"
614 for config in ${CONFIG_CHECK}; do 630 for config in ${CONFIG_CHECK}; do
615 ewarn " - ${config#\~}" 631 ewarn " - ${config#\~}"
616 done 632 done
617 ewarn "You're on your own to make sure they are set if needed." 633 ewarn "You're on your own to make sure they are set if needed."
618 return 0 634 return 0
619 fi 635 fi
620 else 636 else
621 require_configured_kernel 637 [ -n "${I_KNOW_WHAT_I_AM_DOING}" ] && require_configured_kernel
622 fi 638 fi
623 639
624 einfo "Checking for suitable kernel configuration options..." 640 einfo "Checking for suitable kernel configuration options..."
625 641
626 for config in ${CONFIG_CHECK} 642 for config in ${CONFIG_CHECK}

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

  ViewVC Help
Powered by ViewVC 1.1.20