/[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.82 Revision 1.83
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.82 2010/01/17 21:34:52 robbat2 Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.83 2010/01/17 21:46:55 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 :)
410 done 410 done
411 x=${x/ /} 411 x=${x/ /}
412 echo ${x} 412 echo ${x}
413} 413}
414 414
415# Check if the Makefile is valid for direct parsing.
416# Check status results:
417# - PASS, use 'getfilevar' to extract values
418# - FAIL, use 'getfilevar_noexec' to extract values
419# The check may fail if:
420# - make is not present
421# - corruption exists in the kernel makefile
422get_makefile_extract_function() {
423 local a='' b='' mkfunc='getfilevar'
424 a="$(getfilevar VERSION ${KERNEL_MAKEFILE})"
425 b="$(getfilevar_noexec VERSION ${KERNEL_MAKEFILE})"
426 [[ "${a}" != "${b}" ]] && mkfunc='getfilevar_noexec'
427 echo "${mkfunc}"
428}
429
415# internal variable, so we know to only print the warning once 430# internal variable, so we know to only print the warning once
416get_version_warning_done= 431get_version_warning_done=
417 432
418# @FUNCTION: get_version 433# @FUNCTION: get_version
419# @DESCRIPTION: 434# @DESCRIPTION:
424# 439#
425# The KV_DIR is set using the KERNEL_DIR env var, the KV_DIR_OUT is set using a valid 440# The KV_DIR is set using the KERNEL_DIR env var, the KV_DIR_OUT is set using a valid
426# KBUILD_OUTPUT (in a decreasing priority list, we look for the env var, makefile var or the 441# KBUILD_OUTPUT (in a decreasing priority list, we look for the env var, makefile var or the
427# symlink /lib/modules/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}/build). 442# symlink /lib/modules/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}/build).
428get_version() { 443get_version() {
429 local kbuild_output 444 local kbuild_output mkfunc
430 445
431 # no need to execute this twice assuming KV_FULL is populated. 446 # no need to execute this twice assuming KV_FULL is populated.
432 # we can force by unsetting KV_FULL 447 # we can force by unsetting KV_FULL
433 [ -n "${KV_FULL}" ] && return 0 448 [ -n "${KV_FULL}" ] && return 0
434 449
480 # do we pass KBUILD_OUTPUT on the CLI? 495 # do we pass KBUILD_OUTPUT on the CLI?
481 OUTPUT_DIR="${OUTPUT_DIR:-${KBUILD_OUTPUT}}" 496 OUTPUT_DIR="${OUTPUT_DIR:-${KBUILD_OUTPUT}}"
482 497
483 # keep track of it 498 # keep track of it
484 KERNEL_MAKEFILE="${KV_DIR}/Makefile" 499 KERNEL_MAKEFILE="${KV_DIR}/Makefile"
485 500
486 # Check if the Makefile is valid for direct parsing. 501 # Decide the function used to extract makefile variables.
487 # Check status results: 502 mkfunc="$(get_makefile_extract_function "${KERNEL_MAKEFILE}")"
488 # - PASS, use 'getfilevar' to extract values
489 # - FAIL, use 'getfilevar_noexec' to extract values
490 # The check may fail if:
491 # - make is not present
492 # - corruption exists in the kernel makefile
493 local a='' b='' mkfunc='getfilevar'
494 a="$(getfilevar VERSION ${KERNEL_MAKEFILE})"
495 b="$(getfilevar_noexec VERSION ${KERNEL_MAKEFILE})"
496 [[ "${a}" != "${b}" ]] && mkfunc='getfilevar_noexec'
497 503
498 # And if we didn't pass it, we can take a nosey in the Makefile 504 # And if we didn't pass it, we can take a nosey in the Makefile
499 kbuild_output="$(${mkfunc} KBUILD_OUTPUT ${KERNEL_MAKEFILE})" 505 kbuild_output="$(${mkfunc} KBUILD_OUTPUT ${KERNEL_MAKEFILE})"
500 OUTPUT_DIR="${OUTPUT_DIR:-${kbuild_output}}" 506 OUTPUT_DIR="${OUTPUT_DIR:-${kbuild_output}}"
501 507

Legend:
Removed from v.1.82  
changed lines
  Added in v.1.83

  ViewVC Help
Powered by ViewVC 1.1.20