/[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.65
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.65 2009/09/06 23:16: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 :)
108# And to ensure all the weirdness with crosscompile 108# And to ensure all the weirdness with crosscompile
109inherit toolchain-funcs versionator 109inherit toolchain-funcs versionator
110 110
111EXPORT_FUNCTIONS pkg_setup 111EXPORT_FUNCTIONS pkg_setup
112 112
113DEPEND=""
114RDEPEND=""
115
116[ -z "${I_KNOW_WHAT_I_AM_DOING}" ] && \
113DEPEND="kernel_linux? ( virtual/linux-sources )" 117DEPEND="kernel_linux? ( virtual/linux-sources )"
114RDEPEND=""
115 118
116# Overwritable environment Var's 119# Overwritable environment Var's
117# --------------------------------------- 120# ---------------------------------------
118KERNEL_DIR="${KERNEL_DIR:-${ROOT}usr/src/linux}" 121KERNEL_DIR="${KERNEL_DIR:-${ROOT}usr/src/linux}"
119 122
200 ERROR=0 203 ERROR=0
201 mycat='cat' 204 mycat='cat'
202 205
203 [ -z "${1}" ] && ERROR=1 206 [ -z "${1}" ] && ERROR=1
204 [ ! -f "${2}" ] && ERROR=1 207 [ ! -f "${2}" ] && ERROR=1
205 [ "${2#.gz}" != "${2}" ] && mycat='zcat' 208 [ "${2%.gz}" != "${2}" ] && mycat='zcat'
206 209
207 if [ "${ERROR}" = 1 ] 210 if [ "${ERROR}" = 1 ]
208 then 211 then
209 echo -e "\n" 212 echo -e "\n"
210 eerror "getfilevar_noexec requires 2 variables, with the second a valid file." 213 eerror "getfilevar_noexec requires 2 variables, with the second a valid file."
395 done 398 done
396 x=${x/ /} 399 x=${x/ /}
397 echo ${x} 400 echo ${x}
398} 401}
399 402
403# internal variable, so we know to only print the warning once
404get_version_warning_done=
405
400# @FUNCTION: get_version 406# @FUNCTION: get_version
401# @DESCRIPTION: 407# @DESCRIPTION:
402# It gets the version of the kernel inside KERNEL_DIR and populates the KV_FULL variable 408# 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). 409# (if KV_FULL is already set it does nothing).
404# 410#
417 # if we dont know KV_FULL, then we need too. 423 # 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 424 # make sure KV_DIR isnt set since we need to work it out via KERNEL_DIR
419 unset KV_DIR 425 unset KV_DIR
420 426
421 # KV_DIR will contain the full path to the sources directory we should use 427 # KV_DIR will contain the full path to the sources directory we should use
428 [ -z "${get_version_warning_done}" ] && \
422 qeinfo "Determining the location of the kernel source code" 429 qeinfo "Determining the location of the kernel source code"
423 [ -h "${KERNEL_DIR}" ] && KV_DIR="$(readlink -f ${KERNEL_DIR})" 430 [ -h "${KERNEL_DIR}" ] && KV_DIR="$(readlink -f ${KERNEL_DIR})"
424 [ -d "${KERNEL_DIR}" ] && KV_DIR="${KERNEL_DIR}" 431 [ -d "${KERNEL_DIR}" ] && KV_DIR="${KERNEL_DIR}"
425 432
426 if [ -z "${KV_DIR}" ] 433 if [ -z "${KV_DIR}" ]
427 then 434 then
435 if [ -z "${get_version_warning_done}" ]; then
436 get_version_warning_done=1
428 qeerror "Unable to find kernel sources at ${KERNEL_DIR}" 437 qeerror "Unable to find kernel sources at ${KERNEL_DIR}"
429 qeinfo "This package requires Linux sources." 438 #qeinfo "This package requires Linux sources."
430 if [ "${KERNEL_DIR}" == "/usr/src/linux" ] ; then 439 if [ "${KERNEL_DIR}" == "/usr/src/linux" ] ; then
431 qeinfo "Please make sure that ${KERNEL_DIR} points at your running kernel, " 440 qeinfo "Please make sure that ${KERNEL_DIR} points at your running kernel, "
432 qeinfo "(or the kernel you wish to build against)." 441 qeinfo "(or the kernel you wish to build against)."
433 qeinfo "Alternatively, set the KERNEL_DIR environment variable to the kernel sources location" 442 qeinfo "Alternatively, set the KERNEL_DIR environment variable to the kernel sources location"
434 else 443 else
435 qeinfo "Please ensure that the KERNEL_DIR environment variable points at full Linux sources of the kernel you wish to compile against." 444 qeinfo "Please ensure that the KERNEL_DIR environment variable points at full Linux sources of the kernel you wish to compile against."
445 fi
436 fi 446 fi
437 return 1 447 return 1
438 fi 448 fi
439 449
450 if [ -z "${get_version_warning_done}" ]; then
440 qeinfo "Found kernel source directory:" 451 qeinfo "Found kernel source directory:"
441 qeinfo " ${KV_DIR}" 452 qeinfo " ${KV_DIR}"
453 fi
442 454
443 if [ ! -s "${KV_DIR}/Makefile" ] 455 if [ ! -s "${KV_DIR}/Makefile" ]
444 then 456 then
457 if [ -z "${get_version_warning_done}" ]; then
458 get_version_warning_done=1
445 qeerror "Could not find a Makefile in the kernel source directory." 459 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" 460 qeerror "Please ensure that ${KERNEL_DIR} points to a complete set of Linux sources"
461 fi
447 return 1 462 return 1
448 fi 463 fi
449 464
450 # OK so now we know our sources directory, but they might be using 465 # OK so now we know our sources directory, but they might be using
451 # KBUILD_OUTPUT, and we need this for .config and localversions-* 466 # KBUILD_OUTPUT, and we need this for .config and localversions-*
465 KV_PATCH="$(getfilevar_noexec SUBLEVEL ${KV_DIR}/Makefile)" 480 KV_PATCH="$(getfilevar_noexec SUBLEVEL ${KV_DIR}/Makefile)"
466 KV_EXTRA="$(getfilevar_noexec EXTRAVERSION ${KV_DIR}/Makefile)" 481 KV_EXTRA="$(getfilevar_noexec EXTRAVERSION ${KV_DIR}/Makefile)"
467 482
468 if [ -z "${KV_MAJOR}" -o -z "${KV_MINOR}" -o -z "${KV_PATCH}" ] 483 if [ -z "${KV_MAJOR}" -o -z "${KV_MINOR}" -o -z "${KV_PATCH}" ]
469 then 484 then
485 if [ -z "${get_version_warning_done}" ]; then
486 get_version_warning_done=1
470 qeerror "Could not detect kernel version." 487 qeerror "Could not detect kernel version."
471 qeerror "Please ensure that ${KERNEL_DIR} points to a complete set of Linux sources." 488 qeerror "Please ensure that ${KERNEL_DIR} points to a complete set of Linux sources."
489 fi
472 return 1 490 return 1
473 fi 491 fi
474 492
475 # and in newer versions we can also pull LOCALVERSION if it is set. 493 # 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. 494 # 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 626 # 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 627 # if the user has no .config as there is nothing to do. Otherwise
610 # code later will cause a failure due to missing .config. 628 # code later will cause a failure due to missing .config.
611 if ! linux_config_exists; then 629 if ! linux_config_exists; then
612 ewarn "Unable to check for the following kernel config options due" 630 ewarn "Unable to check for the following kernel config options due"
613 ewarn "to absence of any configured kernel sources:" 631 ewarn "to absence of any configured kernel sources or compiled"
632 ewarn "config:"
614 for config in ${CONFIG_CHECK}; do 633 for config in ${CONFIG_CHECK}; do
615 ewarn " - ${config#\~}" 634 ewarn " - ${config#\~}"
616 done 635 done
617 ewarn "You're on your own to make sure they are set if needed." 636 ewarn "You're on your own to make sure they are set if needed."
618 return 0 637 return 0
619 fi 638 fi
620 else 639 else
621 require_configured_kernel 640 [ -n "${I_KNOW_WHAT_I_AM_DOING}" ] && require_configured_kernel
622 fi 641 fi
623 642
624 einfo "Checking for suitable kernel configuration options..." 643 einfo "Checking for suitable kernel configuration options..."
625 644
626 for config in ${CONFIG_CHECK} 645 for config in ${CONFIG_CHECK}

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

  ViewVC Help
Powered by ViewVC 1.1.20