/[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.74 Revision 1.75
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.74 2009/12/11 20:42:51 robbat2 Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.75 2009/12/11 20:54:06 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 :)
221 p 221 p
222 }" 222 }"
223 fi 223 fi
224} 224}
225 225
226# @PRIVATE-VARIABLE: _LINUX_CONFIG_EXISTS_DONE
227# @DESCRIPTION:
228# This is only set if one of the linux_config_*exists functions has been called.
229# We use it for a QA warning that the check for a config has not been performed,
230# as linux_chkconfig* in non-legacy mode WILL return an undefined value if no
231# config is available at all.
232_LINUX_CONFIG_EXISTS_DONE=
233
234linux_config_qa_check() {
235 local funcname="$1"
236 if [ -z "${_LINUX_CONFIG_EXISTS_DONE}" ]; then
237 ewarn "QA: You called $1 before any linux_config_exists!"
238 ewarn "QA: The return value of $1 will NOT gaurenteed later!"
239 fi
240}
226 241
227# @FUNCTION: linux_config_src_exists 242# @FUNCTION: linux_config_src_exists
228# @RETURN: true or false 243# @RETURN: true or false
229# @DESCRIPTION: 244# @DESCRIPTION:
230# It returns true if .config exists in a build directory otherwise false 245# It returns true if .config exists in a build directory otherwise false
231linux_config_src_exists() { 246linux_config_src_exists() {
247 export _LINUX_CONFIG_EXISTS_DONE=1
232 [ -s "${KV_OUT_DIR}/.config" ] 248 [ -s "${KV_OUT_DIR}/.config" ]
233} 249}
234 250
235# @FUNCTION: linux_config_bin_exists 251# @FUNCTION: linux_config_bin_exists
236# @RETURN: true or false 252# @RETURN: true or false
237# @DESCRIPTION: 253# @DESCRIPTION:
238# It returns true if .config exists in /proc, otherwise false 254# It returns true if .config exists in /proc, otherwise false
239linux_config_bin_exists() { 255linux_config_bin_exists() {
256 export _LINUX_CONFIG_EXISTS_DONE=1
240 [ -n "${I_KNOW_WHAT_I_AM_DOING}" -a -s "/proc/config.gz" ] 257 [ -n "${I_KNOW_WHAT_I_AM_DOING}" -a -s "/proc/config.gz" ]
241} 258}
242 259
243# @FUNCTION: linux_config_exists 260# @FUNCTION: linux_config_exists
244# @RETURN: true or false 261# @RETURN: true or false
271# @DESCRIPTION: 288# @DESCRIPTION:
272# It checks that CONFIG_<option>=y or CONFIG_<option>=m is present in the current kernel .config 289# It checks that CONFIG_<option>=y or CONFIG_<option>=m is present in the current kernel .config
273# If linux_config_exists returns false, the results of this are UNDEFINED. You 290# If linux_config_exists returns false, the results of this are UNDEFINED. You
274# MUST call linux_config_exists first. 291# MUST call linux_config_exists first.
275linux_chkconfig_present() { 292linux_chkconfig_present() {
293 linux_config_qa_check
276local RESULT 294 local RESULT
277 [ -z "${I_KNOW_WHAT_I_AM_DOING}" ] && require_configured_kernel 295 [ -z "${I_KNOW_WHAT_I_AM_DOING}" ] && require_configured_kernel
278 local config 296 local config
279 config="${KV_OUT_DIR}/.config" 297 config="${KV_OUT_DIR}/.config"
280 [ ! -f "${config}" ] && config="/proc/config.gz" 298 [ ! -f "${config}" ] && config="/proc/config.gz"
281 RESULT="$(getfilevar_noexec CONFIG_${1} "${config}")" 299 RESULT="$(getfilevar_noexec CONFIG_${1} "${config}")"
288# @DESCRIPTION: 306# @DESCRIPTION:
289# It checks that CONFIG_<option>=m is present in the current kernel .config 307# It checks that CONFIG_<option>=m is present in the current kernel .config
290# If linux_config_exists returns false, the results of this are UNDEFINED. You 308# If linux_config_exists returns false, the results of this are UNDEFINED. You
291# MUST call linux_config_exists first. 309# MUST call linux_config_exists first.
292linux_chkconfig_module() { 310linux_chkconfig_module() {
311 linux_config_qa_check
293local RESULT 312 local RESULT
294 [ -z "${I_KNOW_WHAT_I_AM_DOING}" ] && require_configured_kernel 313 [ -z "${I_KNOW_WHAT_I_AM_DOING}" ] && require_configured_kernel
295 local config 314 local config
296 config="${KV_OUT_DIR}/.config" 315 config="${KV_OUT_DIR}/.config"
297 [ ! -f "${config}" ] && config="/proc/config.gz" 316 [ ! -f "${config}" ] && config="/proc/config.gz"
298 RESULT="$(getfilevar_noexec CONFIG_${1} "${config}")" 317 RESULT="$(getfilevar_noexec CONFIG_${1} "${config}")"
305# @DESCRIPTION: 324# @DESCRIPTION:
306# It checks that CONFIG_<option>=y is present in the current kernel .config 325# It checks that CONFIG_<option>=y is present in the current kernel .config
307# If linux_config_exists returns false, the results of this are UNDEFINED. You 326# If linux_config_exists returns false, the results of this are UNDEFINED. You
308# MUST call linux_config_exists first. 327# MUST call linux_config_exists first.
309linux_chkconfig_builtin() { 328linux_chkconfig_builtin() {
329 linux_config_qa_check
310local RESULT 330 local RESULT
311 [ -z "${I_KNOW_WHAT_I_AM_DOING}" ] && require_configured_kernel 331 [ -z "${I_KNOW_WHAT_I_AM_DOING}" ] && require_configured_kernel
312 local config 332 local config
313 config="${KV_OUT_DIR}/.config" 333 config="${KV_OUT_DIR}/.config"
314 [ ! -f "${config}" ] && config="/proc/config.gz" 334 [ ! -f "${config}" ] && config="/proc/config.gz"
315 RESULT="$(getfilevar_noexec CONFIG_${1} "${config}")" 335 RESULT="$(getfilevar_noexec CONFIG_${1} "${config}")"
322# @DESCRIPTION: 342# @DESCRIPTION:
323# It prints the CONFIG_<option> value of the current kernel .config (it requires a configured kernel). 343# It prints the CONFIG_<option> value of the current kernel .config (it requires a configured kernel).
324# If linux_config_exists returns false, the results of this are UNDEFINED. You 344# If linux_config_exists returns false, the results of this are UNDEFINED. You
325# MUST call linux_config_exists first. 345# MUST call linux_config_exists first.
326linux_chkconfig_string() { 346linux_chkconfig_string() {
347 linux_config_qa_check
327 [ -z "${I_KNOW_WHAT_I_AM_DOING}" ] && require_configured_kernel 348 [ -z "${I_KNOW_WHAT_I_AM_DOING}" ] && require_configured_kernel
328 local config 349 local config
329 config="${KV_OUT_DIR}/.config" 350 config="${KV_OUT_DIR}/.config"
330 [ ! -f "${config}" ] && config="/proc/config.gz" 351 [ ! -f "${config}" ] && config="/proc/config.gz"
331 getfilevar_noexec "CONFIG_${1}" "${config}" 352 getfilevar_noexec "CONFIG_${1}" "${config}"
622# It checks the kernel config options specified by CONFIG_CHECK. It dies only when a required config option (i.e. 643# It checks the kernel config options specified by CONFIG_CHECK. It dies only when a required config option (i.e.
623# the prefix ~ is not used) doesn't satisfy the directive. 644# the prefix ~ is not used) doesn't satisfy the directive.
624check_extra_config() { 645check_extra_config() {
625 local config negate die error reworkmodulenames 646 local config negate die error reworkmodulenames
626 local soft_errors_count=0 hard_errors_count=0 config_required=0 647 local soft_errors_count=0 hard_errors_count=0 config_required=0
648 # store the value of the QA check, because otherwise we won't catch usages
649 # after if check_extra_config is called AND other direct calls are done
650 # later.
651 local old_LINUX_CONFIG_EXISTS_DONE="${_LINUX_CONFIG_EXISTS_DONE}"
627 652
628 # if we haven't determined the version yet, we need to 653 # if we haven't determined the version yet, we need to
629 linux-info_get_any_version 654 linux-info_get_any_version
630 655
631 # Determine if we really need a .config. The only time when we don't need 656 # Determine if we really need a .config. The only time when we don't need
650 ewarn "config:" 675 ewarn "config:"
651 for config in ${CONFIG_CHECK}; do 676 for config in ${CONFIG_CHECK}; do
652 ewarn " - ${config#\~}" 677 ewarn " - ${config#\~}"
653 done 678 done
654 ewarn "You're on your own to make sure they are set if needed." 679 ewarn "You're on your own to make sure they are set if needed."
680 export LINUX_CONFIG_EXISTS_DONE="${old_LINUX_CONFIG_EXISTS_DONE}"
655 return 0 681 return 0
656 fi 682 fi
657 else 683 else
658 [ -n "${I_KNOW_WHAT_I_AM_DOING}" ] && require_configured_kernel 684 [ -n "${I_KNOW_WHAT_I_AM_DOING}" ] && require_configured_kernel
659 fi 685 fi
736 if [[ ${hard_errors_count} > 0 ]]; then 762 if [[ ${hard_errors_count} > 0 ]]; then
737 eerror "Please check to make sure these options are set correctly." 763 eerror "Please check to make sure these options are set correctly."
738 eerror "Failure to do so may cause unexpected problems." 764 eerror "Failure to do so may cause unexpected problems."
739 eerror "Once you have satisfied these options, please try merging" 765 eerror "Once you have satisfied these options, please try merging"
740 eerror "this package again." 766 eerror "this package again."
767 export LINUX_CONFIG_EXISTS_DONE="${old_LINUX_CONFIG_EXISTS_DONE}"
741 die "Incorrect kernel configuration options" 768 die "Incorrect kernel configuration options"
742 elif [[ ${soft_errors_count} > 0 ]]; then 769 elif [[ ${soft_errors_count} > 0 ]]; then
743 ewarn "Please check to make sure these options are set correctly." 770 ewarn "Please check to make sure these options are set correctly."
744 ewarn "Failure to do so may cause unexpected problems." 771 ewarn "Failure to do so may cause unexpected problems."
745 else 772 else
746 eend 0 773 eend 0
747 fi 774 fi
775 export LINUX_CONFIG_EXISTS_DONE="${old_LINUX_CONFIG_EXISTS_DONE}"
748} 776}
749 777
750check_zlibinflate() { 778check_zlibinflate() {
751 # if we haven't determined the version yet, we need to 779 # if we haven't determined the version yet, we need to
752 require_configured_kernel 780 require_configured_kernel

Legend:
Removed from v.1.74  
changed lines
  Added in v.1.75

  ViewVC Help
Powered by ViewVC 1.1.20