/[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.101 Revision 1.102
1# Copyright 1999-2013 Gentoo Foundation 1# Copyright 1999-2013 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.101 2013/09/29 02:36:17 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.102 2013/09/29 02:49:40 vapier Exp $
4 4
5# @ECLASS: linux-info.eclass 5# @ECLASS: linux-info.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# kernel-misc@gentoo.org 7# kernel-misc@gentoo.org
8# @AUTHOR: 8# @AUTHOR:
427# 427#
428# The KV_DIR is set using the KERNEL_DIR env var, the KV_DIR_OUT is set using a valid 428# The KV_DIR is set using the KERNEL_DIR env var, the KV_DIR_OUT is set using a valid
429# KBUILD_OUTPUT (in a decreasing priority list, we look for the env var, makefile var or the 429# KBUILD_OUTPUT (in a decreasing priority list, we look for the env var, makefile var or the
430# symlink /lib/modules/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}/build). 430# symlink /lib/modules/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}/build).
431get_version() { 431get_version() {
432 local mkfunc tmplocal 432 local tmplocal
433 433
434 # no need to execute this twice assuming KV_FULL is populated. 434 # no need to execute this twice assuming KV_FULL is populated.
435 # we can force by unsetting KV_FULL 435 # we can force by unsetting KV_FULL
436 [ -n "${KV_FULL}" ] && return 0 436 [ -n "${KV_FULL}" ] && return 0
437 437
491 local OUTPUT_DIR=${KBUILD_OUTPUT} 491 local OUTPUT_DIR=${KBUILD_OUTPUT}
492 492
493 # keep track of it 493 # keep track of it
494 KERNEL_MAKEFILE="${KV_DIR}/Makefile" 494 KERNEL_MAKEFILE="${KV_DIR}/Makefile"
495 495
496 # Decide the function used to extract makefile variables.
497 mkfunc="$(get_makefile_extract_function "${KERNEL_MAKEFILE}")"
498
499 # And if we didn't pass it, we can take a nosey in the Makefile
500 if [[ -z ${OUTPUT_DIR} ]]; then 496 if [[ -z ${OUTPUT_DIR} ]]; then
497 # Decide the function used to extract makefile variables.
498 local mkfunc=$(get_makefile_extract_function "${KERNEL_MAKEFILE}")
499
500 # And if we didn't pass it, we can take a nosey in the Makefile.
501 OUTPUT_DIR=$(${mkfunc} KBUILD_OUTPUT "${KERNEL_MAKEFILE}") 501 OUTPUT_DIR=$(${mkfunc} KBUILD_OUTPUT "${KERNEL_MAKEFILE}")
502 fi 502 fi
503 503
504 # And contrary to existing functions I feel we shouldn't trust the 504 # And contrary to existing functions I feel we shouldn't trust the
505 # directory name to find version information as this seems insane. 505 # directory name to find version information as this seems insane.
506 # so we parse ${KERNEL_MAKEFILE} 506 # So we parse ${KERNEL_MAKEFILE}. We should be able to trust that
507 # the Makefile is simple enough to use the noexec extract function.
508 # This has been true for every release thus far, and it's faster
509 # than using make to evaluate the Makefile every time.
507 KV_MAJOR="$(${mkfunc} VERSION ${KERNEL_MAKEFILE})" 510 KV_MAJOR=$(getfilevar_noexec VERSION "${KERNEL_MAKEFILE}")
508 KV_MINOR="$(${mkfunc} PATCHLEVEL ${KERNEL_MAKEFILE})" 511 KV_MINOR=$(getfilevar_noexec PATCHLEVEL "${KERNEL_MAKEFILE}")
509 KV_PATCH="$(${mkfunc} SUBLEVEL ${KERNEL_MAKEFILE})" 512 KV_PATCH=$(getfilevar_noexec SUBLEVEL "${KERNEL_MAKEFILE}")
510 KV_EXTRA="$(${mkfunc} EXTRAVERSION ${KERNEL_MAKEFILE})" 513 KV_EXTRA=$(getfilevar_noexec EXTRAVERSION "${KERNEL_MAKEFILE}")
511 514
512 if [ -z "${KV_MAJOR}" -o -z "${KV_MINOR}" -o -z "${KV_PATCH}" ] 515 if [ -z "${KV_MAJOR}" -o -z "${KV_MINOR}" -o -z "${KV_PATCH}" ]
513 then 516 then
514 if [ -z "${get_version_warning_done}" ]; then 517 if [ -z "${get_version_warning_done}" ]; then
515 get_version_warning_done=1 518 get_version_warning_done=1

Legend:
Removed from v.1.101  
changed lines
  Added in v.1.102

  ViewVC Help
Powered by ViewVC 1.1.20