/[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.64 Revision 1.71
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.64 2009/09/06 23:12:29 robbat2 Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.71 2009/09/08 12:34:21 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
349 352
350# got the jist yet? 353# got the jist yet?
351 354
352kernel_is() { 355kernel_is() {
353 # if we haven't determined the version yet, we need to. 356 # if we haven't determined the version yet, we need to.
354 get_version 357 linux-info_get_any_version
358
355 local operator test value x=0 y=0 z=0 359 local operator test value x=0 y=0 z=0
356 360
357 case ${1} in 361 case ${1} in
358 lt) operator="-lt"; shift;; 362 -lt|lt) operator="-lt"; shift;;
359 gt) operator="-gt"; shift;; 363 -gt|gt) operator="-gt"; shift;;
360 le) operator="-le"; shift;; 364 -le|le) operator="-le"; shift;;
361 ge) operator="-ge"; shift;; 365 -ge|ge) operator="-ge"; shift;;
362 eq) operator="-eq"; shift;; 366 -eq|eq) operator="-eq"; shift;;
363 *) operator="-eq";; 367 *) operator="-eq";;
364 esac 368 esac
365 369
366 for x in ${@}; do 370 for x in ${@}; do
367 for((y=0; y<$((3 - ${#x})); y++)); do value="${value}0"; done 371 for((y=0; y<$((3 - ${#x})); y++)); do value="${value}0"; done
368 value="${value}${x}" 372 value="${value}${x}"
505 fi 509 fi
506 # and if we STILL have not got it, then we better just set it to KV_DIR 510 # and if we STILL have not got it, then we better just set it to KV_DIR
507 KV_OUT_DIR="${KV_OUT_DIR:-${KV_DIR}}" 511 KV_OUT_DIR="${KV_OUT_DIR:-${KV_DIR}}"
508 512
509 KV_LOCAL="${KV_LOCAL}$(get_localversion ${KV_DIR})" 513 KV_LOCAL="${KV_LOCAL}$(get_localversion ${KV_DIR})"
510 if linux_config_exists; then 514 if linux_config_src_exists; then
511 KV_LOCAL="${KV_LOCAL}$(linux_chkconfig_string LOCALVERSION)" 515 KV_LOCAL="${KV_LOCAL}$(linux_chkconfig_string LOCALVERSION)"
512 KV_LOCAL="${KV_LOCAL//\"/}" 516 KV_LOCAL="${KV_LOCAL//\"/}"
513 517
514 # For things like git that can append extra stuff: 518 # For things like git that can append extra stuff:
515 [ -e ${KV_DIR}/scripts/setlocalversion ] && 519 [ -e ${KV_DIR}/scripts/setlocalversion ] &&
552 && KV_EXTRA="-${KV_FULL#*-}" 556 && KV_EXTRA="-${KV_FULL#*-}"
553 fi 557 fi
554 return 0 558 return 0
555} 559}
556 560
561# This next function is named with the eclass prefix to avoid conflicts with
562# some old versionator-like eclass functions.
563
564# @FUNCTION: linux-info_get_any_version
565# @DESCRIPTION:
566# This attempts to find the version of the sources, and otherwise falls back to
567# the version of the running kernel.
568linux-info_get_any_version() {
569 get_version
570 if [[ $? -ne 0 ]]; then
571 ewarn "Unable to calculate Linux Kernel version for build, attempting to use running version"
572 get_running_version
573 fi
574}
575
557 576
558# ebuild check functions 577# ebuild check functions
559# --------------------------------------- 578# ---------------------------------------
560 579
561# @FUNCTION: check_kernel_built 580# @FUNCTION: check_kernel_built
605check_extra_config() { 624check_extra_config() {
606 local config negate die error reworkmodulenames 625 local config negate die error reworkmodulenames
607 local soft_errors_count=0 hard_errors_count=0 config_required=0 626 local soft_errors_count=0 hard_errors_count=0 config_required=0
608 627
609 # if we haven't determined the version yet, we need to 628 # if we haven't determined the version yet, we need to
610 get_version 629 linux-info_get_any_version
611 630
612 # Determine if we really need a .config. The only time when we don't need 631 # Determine if we really need a .config. The only time when we don't need
613 # one is when all of the CONFIG_CHECK options are prefixed with "~". 632 # one is when all of the CONFIG_CHECK options are prefixed with "~".
614 for config in ${CONFIG_CHECK} 633 for config in ${CONFIG_CHECK}
615 do 634 do
802# @FUNCTION: linux-info_pkg_setup 821# @FUNCTION: linux-info_pkg_setup
803# @DESCRIPTION: 822# @DESCRIPTION:
804# Force a get_version() call when inherited from linux-mod.eclass and then check if the kernel is configured 823# Force a get_version() call when inherited from linux-mod.eclass and then check if the kernel is configured
805# to support the options specified in CONFIG_CHECK (if not null) 824# to support the options specified in CONFIG_CHECK (if not null)
806linux-info_pkg_setup() { 825linux-info_pkg_setup() {
807 get_version 826 linux-info_get_any_version
808 if [[ $rc -ne 0 ]]; then
809 ewarn "Unable to calculate Linux Kernel version for build, attempting to use running version"
810 get_running_version
811 fi
812 827
813 if kernel_is 2 4; then 828 if kernel_is 2 4; then
814 if [ "$( gcc-major-version )" -eq "4" ] ; then 829 if [ "$( gcc-major-version )" -eq "4" ] ; then
815 echo 830 echo
816 ewarn "Be warned !! >=sys-devel/gcc-4.0.0 isn't supported with" 831 ewarn "Be warned !! >=sys-devel/gcc-4.0.0 isn't supported with"

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

  ViewVC Help
Powered by ViewVC 1.1.20