/[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.39 Revision 1.46
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.39 2006/02/08 12:57:52 brix Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.46 2006/07/20 05:34:10 marineam 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
52# And to ensure all the weirdness with crosscompile 52# And to ensure all the weirdness with crosscompile
53inherit toolchain-funcs versionator 53inherit toolchain-funcs versionator
54 54
55EXPORT_FUNCTIONS pkg_setup 55EXPORT_FUNCTIONS pkg_setup
56 56
57DEPEND="virtual/linux-sources" 57DEPEND="kernel_linux? ( virtual/linux-sources )"
58RDEPEND="" 58RDEPEND=""
59 59
60# Overwritable environment Var's 60# Overwritable environment Var's
61# --------------------------------------- 61# ---------------------------------------
62KERNEL_DIR="${KERNEL_DIR:-${ROOT}usr/src/linux}" 62KERNEL_DIR="${KERNEL_DIR:-${ROOT}usr/src/linux}"
117 basefname="$(basename ${2})" 117 basefname="$(basename ${2})"
118 basedname="$(dirname ${2})" 118 basedname="$(dirname ${2})"
119 unset ARCH 119 unset ARCH
120 120
121 cd "${basedname}" 121 cd "${basedname}"
122 echo -e "include ${basefname}\ne:\n\t@echo \$(${1})" | \ 122 echo -e "e:\\n\\t@echo \$(${1})\\ninclude ${basefname}" | \
123 make ${BUILD_FIXES} -s -f - e 2>/dev/null 123 make ${BUILD_FIXES} -s -f - 2>/dev/null
124 cd "${workingdir}" 124 cd "${workingdir}"
125 125
126 ARCH=${myARCH} 126 ARCH=${myARCH}
127 fi 127 fi
128} 128}
290 qeinfo "Found kernel object directory:" 290 qeinfo "Found kernel object directory:"
291 qeinfo " ${KV_OUT_DIR}" 291 qeinfo " ${KV_OUT_DIR}"
292 292
293 KV_LOCAL="$(get_localversion ${KV_OUT_DIR})" 293 KV_LOCAL="$(get_localversion ${KV_OUT_DIR})"
294 fi 294 fi
295 # and if we STILL haven't got it, then we better just set it to KV_DIR 295 # and if we STILL have not got it, then we better just set it to KV_DIR
296 KV_OUT_DIR="${KV_OUT_DIR:-${KV_DIR}}" 296 KV_OUT_DIR="${KV_OUT_DIR:-${KV_DIR}}"
297
298 KV_LOCAL="${KV_LOCAL}$(get_localversion ${KV_DIR})"
299 KV_LOCAL="${KV_LOCAL}$(linux_chkconfig_string LOCALVERSION)"
300 KV_LOCAL="${KV_LOCAL//\"/}"
301
302 # And we should set KV_FULL to the full expanded version
303 KV_FULL="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}${KV_LOCAL}"
304
305 qeinfo "Found sources for kernel version:"
306 qeinfo " ${KV_FULL}"
307 297
308 if [ ! -s "${KV_OUT_DIR}/.config" ] 298 if [ ! -s "${KV_OUT_DIR}/.config" ]
309 then 299 then
310 qeerror "Could not find a usable .config in the kernel source directory." 300 qeerror "Could not find a usable .config in the kernel source directory."
311 qeerror "Please ensure that ${KERNEL_DIR} points to a configured set of Linux sources." 301 qeerror "Please ensure that ${KERNEL_DIR} points to a configured set of Linux sources."
312 qeerror "If you are using KBUILD_OUTPUT, please set the environment var so that" 302 qeerror "If you are using KBUILD_OUTPUT, please set the environment var so that"
313 qeerror "it points to the necessary object directory so that it might find .config." 303 qeerror "it points to the necessary object directory so that it might find .config."
314 return 1 304 return 1
315 fi 305 fi
306
307 KV_LOCAL="${KV_LOCAL}$(get_localversion ${KV_DIR})"
308 KV_LOCAL="${KV_LOCAL}$(linux_chkconfig_string LOCALVERSION)"
309 KV_LOCAL="${KV_LOCAL//\"/}"
310
311 # For things like git that can append extra stuff:
312 [ -e ${KV_DIR}/scripts/setlocalversion ] &&
313 KV_LOCAL="${KV_LOCAL}$(sh ${KV_DIR}/scripts/setlocalversion ${KV_DIR})"
314
315 # And we should set KV_FULL to the full expanded version
316 KV_FULL="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}${KV_LOCAL}"
317
318 qeinfo "Found sources for kernel version:"
319 qeinfo " ${KV_FULL}"
316 320
317 return 0 321 return 0
318} 322}
319 323
320get_running_version() { 324get_running_version() {
376 die "No support for external modules in ${KV_FULL} config" 380 die "No support for external modules in ${KV_FULL} config"
377 fi 381 fi
378} 382}
379 383
380check_extra_config() { 384check_extra_config() {
381 local config negate error local_error i n
382 local temp_config die reworkmodulenames 385 local config negate die error reworkmodulenames
386 local soft_errors_count=0 hard_errors_count=0
383 387
384 # if we haven't determined the version yet, we need too. 388 # if we haven't determined the version yet, we need too.
385 get_version; 389 get_version;
386 390
387 einfo "Checking for suitable kernel configuration options:" 391 einfo "Checking for suitable kernel configuration options..."
388 for config in ${CONFIG_CHECK} 392 for config in ${CONFIG_CHECK}
389 do 393 do
390 # if we specify any fatal, ensure we honor them 394 # if we specify any fatal, ensure we honor them
391 die=1 395 die=1
392 error=0 396 error=0
393 negate=0 397 negate=0
394 reworkmodulenames=0 398 reworkmodulenames=0
395 399
400 if [[ -z ${config/\~*} ]]; then
401 die=0
402 config=${config:1}
403 elif [[ -z ${config/\@*} ]]; then
404 die=0
405 reworkmodulenames=1
406 config=${config:1}
407 fi
396 if [[ -z ${config//\!*} ]]; then 408 if [[ -z ${config//\!*} ]]; then
397 negate=1 409 negate=1
398 config=${config:1} 410 config=${config:1}
399 fi 411 fi
400 if [[ -z ${config/\@*} ]]; then
401 die=2
402 reworkmodulenames=1
403 config=${config:1}
404 fi
405 if [[ -z ${config/\~*} ]]; then
406 die=0
407 config=${config:1}
408 fi
409 412
410 if [[ ${negate} == 1 ]]; then 413 if [[ ${negate} == 1 ]]; then
411 linux_chkconfig_present ${config} && error=2 414 linux_chkconfig_present ${config} && error=2
412 elif [[ ${reworkmodulenames} == 1 ]]; then 415 elif [[ ${reworkmodulenames} == 1 ]]; then
413 temp_config="${config//*:}" 416 local temp_config="${config//*:}" i n
414 config="${config//:*}" 417 config="${config//:*}"
415 if linux_chkconfig_present ${config}; then 418 if linux_chkconfig_present ${config}; then
416 for i in ${MODULE_NAMES}; do 419 for i in ${MODULE_NAMES}; do
417 n="${i//${temp_config}}" 420 n="${i//${temp_config}}"
418 [[ -z ${n//\(*} ]] && \ 421 [[ -z ${n//\(*} ]] && \
422 fi 425 fi
423 else 426 else
424 linux_chkconfig_present ${config} || error=1 427 linux_chkconfig_present ${config} || error=1
425 fi 428 fi
426 429
427 if [[ ${die} == 0 ]]; then
428 ebegin "CONFIG_${config}"
429 eend ${error}
430 else
431 if [[ ${error} > 0 ]]; then 430 if [[ ${error} > 0 ]]; then
431 local report_func="eerror" local_error
432 local_error="ERROR_${config}" 432 local_error="ERROR_${config}"
433 local_error="${!local_error}"
434
435 if [[ -z "${local_error}" ]]; then
436 # using old, deprecated format.
437 local_error="${config}_ERROR"
433 local_error="${!local_error}" 438 local_error="${!local_error}"
434 439 fi
435 if [[ -z "${local_error}" ]]; then 440 if [[ ${die} == 0 && -z "${local_error}" ]]; then
436 # using old, deprecated format. 441 #soft errors can be warnings
437 local_error="${config}_ERROR" 442 local_error="WARNING_${config}"
438 local_error="${!local_error}" 443 local_error="${!local_error}"
444 if [[ -n "${local_error}" ]] ; then
445 report_func="ewarn"
439 fi 446 fi
447 fi
440 448
441 if [[ -z "${local_error}" ]]; then 449 if [[ -z "${local_error}" ]]; then
442 [[ ${error} == 1 ]] \ 450 [[ ${error} == 1 ]] \
443 && local_error="is not set when it should be." \ 451 && local_error="is not set when it should be." \
444 || local_error="should not be set. But it is." 452 || local_error="should not be set. But it is."
445 local_error="CONFIG_${config}:\t ${local_error}" 453 local_error="CONFIG_${config}:\t ${local_error}"
446 fi 454 fi
455 if [[ ${die} == 0 ]]; then
447 eerror " ${local_error}" 456 ${report_func} " ${local_error}"
457 soft_errors_count=$[soft_errors_count + 1]
458 else
459 ${report_func} " ${local_error}"
460 hard_errors_count=$[hard_errors_count + 1]
448 fi 461 fi
449 fi 462 fi
450 done 463 done
451 464
452 if [[ ${error} > 0 ]]; then 465 if [[ ${hard_errors_count} > 0 ]]; then
453 eerror "Please check to make sure these options are set correctly." 466 eerror "Please check to make sure these options are set correctly."
454 eerror "Failure to do so may cause unexpected problems." 467 eerror "Failure to do so may cause unexpected problems."
455 if [[ ${die} == 1 ]]; then
456 eerror "Once you have satisfied these options, please try merging" 468 eerror "Once you have satisfied these options, please try merging"
457 eerror "this package again." 469 eerror "this package again."
458 die "Incorrect kernel configuration options" 470 die "Incorrect kernel configuration options"
459 fi 471 elif [[ ${soft_errors_count} > 0 ]]; then
472 ewarn "Please check to make sure these options are set correctly."
473 ewarn "Failure to do so may cause unexpected problems."
474 else
475 eend 0
460 fi 476 fi
461} 477}
462 478
463check_zlibinflate() { 479check_zlibinflate() {
464 # if we haven't determined the version yet, we need too. 480 # if we haven't determined the version yet, we need too.

Legend:
Removed from v.1.39  
changed lines
  Added in v.1.46

  ViewVC Help
Powered by ViewVC 1.1.20