public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Robin H. Johnson (robbat2)" <robbat2@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] gentoo-x86 commit in eclass: linux-info.eclass
Date: Fri, 11 Dec 2009 20:54:06 +0000	[thread overview]
Message-ID: <E1NJCV4-0006Tz-OB@stork.gentoo.org> (raw)

robbat2     09/12/11 20:54:06

  Modified:             linux-info.eclass
  Log:
  Add a QA warning if you call linux_chkconfig* and linux_config* was not called.

Revision  Changes    Path
1.75                 eclass/linux-info.eclass

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/linux-info.eclass?rev=1.75&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/linux-info.eclass?rev=1.75&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/linux-info.eclass?r1=1.74&r2=1.75

Index: linux-info.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v
retrieving revision 1.74
retrieving revision 1.75
diff -p -w -b -B -u -u -r1.74 -r1.75
--- linux-info.eclass	11 Dec 2009 20:42:51 -0000	1.74
+++ linux-info.eclass	11 Dec 2009 20:54:06 -0000	1.75
@@ -1,6 +1,6 @@
 # Copyright 1999-2006 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.74 2009/12/11 20:42:51 robbat2 Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.75 2009/12/11 20:54:06 robbat2 Exp $
 #
 # Original author: John Mylchreest <johnm@gentoo.org>
 # Maintainer: kernel-misc@gentoo.org
@@ -223,12 +223,28 @@ getfilevar_noexec() {
 	fi
 }
 
+# @PRIVATE-VARIABLE: _LINUX_CONFIG_EXISTS_DONE
+# @DESCRIPTION:
+# This is only set if one of the linux_config_*exists functions has been called.
+# We use it for a QA warning that the check for a config has not been performed,
+# as linux_chkconfig* in non-legacy mode WILL return an undefined value if no
+# config is available at all.
+_LINUX_CONFIG_EXISTS_DONE=
+
+linux_config_qa_check() {
+	local funcname="$1"
+	if [ -z "${_LINUX_CONFIG_EXISTS_DONE}" ]; then
+		ewarn "QA: You called $1 before any linux_config_exists!"
+		ewarn "QA: The return value of $1 will NOT gaurenteed later!"
+	fi
+}
 
 # @FUNCTION: linux_config_src_exists
 # @RETURN: true or false
 # @DESCRIPTION:
 # It returns true if .config exists in a build directory otherwise false
 linux_config_src_exists() {
+	export _LINUX_CONFIG_EXISTS_DONE=1
 	[ -s "${KV_OUT_DIR}/.config" ]
 }
 
@@ -237,6 +253,7 @@ linux_config_src_exists() {
 # @DESCRIPTION:
 # It returns true if .config exists in /proc, otherwise false
 linux_config_bin_exists() {
+	export _LINUX_CONFIG_EXISTS_DONE=1
 	[ -n "${I_KNOW_WHAT_I_AM_DOING}" -a -s "/proc/config.gz" ]
 }
 
@@ -273,6 +290,7 @@ require_configured_kernel() {
 # If linux_config_exists returns false, the results of this are UNDEFINED. You
 # MUST call linux_config_exists first.
 linux_chkconfig_present() {
+	linux_config_qa_check
 local	RESULT
 	[ -z "${I_KNOW_WHAT_I_AM_DOING}" ] && require_configured_kernel
 	local config
@@ -290,6 +308,7 @@ local	RESULT
 # If linux_config_exists returns false, the results of this are UNDEFINED. You
 # MUST call linux_config_exists first.
 linux_chkconfig_module() {
+	linux_config_qa_check
 local	RESULT
 	[ -z "${I_KNOW_WHAT_I_AM_DOING}" ] && require_configured_kernel
 	local config
@@ -307,6 +326,7 @@ local	RESULT
 # If linux_config_exists returns false, the results of this are UNDEFINED. You
 # MUST call linux_config_exists first.
 linux_chkconfig_builtin() {
+	linux_config_qa_check
 local	RESULT
 	[ -z "${I_KNOW_WHAT_I_AM_DOING}" ] && require_configured_kernel
 	local config
@@ -324,6 +344,7 @@ local	RESULT
 # If linux_config_exists returns false, the results of this are UNDEFINED. You
 # MUST call linux_config_exists first.
 linux_chkconfig_string() {
+	linux_config_qa_check
 	[ -z "${I_KNOW_WHAT_I_AM_DOING}" ] && require_configured_kernel
 	local config
 	config="${KV_OUT_DIR}/.config"
@@ -624,6 +645,10 @@ check_modules_supported() {
 check_extra_config() {
 	local	config negate die error reworkmodulenames
 	local	soft_errors_count=0 hard_errors_count=0 config_required=0
+	# store the value of the QA check, because otherwise we won't catch usages
+	# after if check_extra_config is called AND other direct calls are done
+	# later.
+	local   old_LINUX_CONFIG_EXISTS_DONE="${_LINUX_CONFIG_EXISTS_DONE}"
 
 	# if we haven't determined the version yet, we need to
 	linux-info_get_any_version
@@ -652,6 +677,7 @@ check_extra_config() {
 				ewarn " - ${config#\~}"
 			done
 			ewarn "You're on your own to make sure they are set if needed."
+			export LINUX_CONFIG_EXISTS_DONE="${old_LINUX_CONFIG_EXISTS_DONE}"
 			return 0
 		fi
 	else
@@ -738,6 +764,7 @@ check_extra_config() {
 		eerror "Failure to do so may cause unexpected problems."
 		eerror "Once you have satisfied these options, please try merging"
 		eerror "this package again."
+		export LINUX_CONFIG_EXISTS_DONE="${old_LINUX_CONFIG_EXISTS_DONE}"
 		die "Incorrect kernel configuration options"
 	elif [[ ${soft_errors_count} > 0 ]]; then
 		ewarn "Please check to make sure these options are set correctly."
@@ -745,6 +772,7 @@ check_extra_config() {
 	else
 		eend 0
 	fi
+	export LINUX_CONFIG_EXISTS_DONE="${old_LINUX_CONFIG_EXISTS_DONE}"
 }
 
 check_zlibinflate() {






             reply	other threads:[~2009-12-11 20:54 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-11 20:54 Robin H. Johnson (robbat2) [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-06-02  7:39 [gentoo-commits] gentoo-x86 commit in eclass: linux-info.eclass Mike Frysinger (vapier)
2015-06-02  4:27 Mike Frysinger (vapier)
2015-05-09  8:03 Ulrich Mueller (ulm)
2014-06-28  7:54 Robin H. Johnson (robbat2)
2013-09-29  2:49 Mike Frysinger (vapier)
2013-09-29  2:36 Mike Frysinger (vapier)
2013-02-10  7:53 Mike Frysinger (vapier)
2013-02-10  6:20 Mike Frysinger (vapier)
2013-02-10  6:18 Mike Frysinger (vapier)
2013-02-10  2:21 Mike Frysinger (vapier)
2013-01-24 20:47 Mike Frysinger (vapier)
2013-01-14 21:19 Mike Frysinger (vapier)
2011-03-29 19:57 Diego Petteno (flameeyes)
2011-01-04 17:53 Doug Goldstein (cardoe)
2010-08-05 21:57 Robin H. Johnson (robbat2)
2010-08-03  7:03 Robin H. Johnson (robbat2)
2010-06-17 23:46 Jonathan Callen (abcd)
2010-01-17 21:46 Robin H. Johnson (robbat2)
2010-01-17 21:34 Robin H. Johnson (robbat2)
2010-01-10  9:26 Robin H. Johnson (robbat2)
2010-01-10  9:25 Robin H. Johnson (robbat2)
2010-01-10  9:01 Robin H. Johnson (robbat2)
2010-01-10  8:47 Robin H. Johnson (robbat2)
2010-01-10  8:25 Robin H. Johnson (robbat2)
2009-12-11 21:33 Robin H. Johnson (robbat2)
2009-12-11 20:42 Robin H. Johnson (robbat2)
2009-10-11 11:48 Markus Meier (maekke)
2009-09-13 20:44 Robin H. Johnson (robbat2)
2009-09-08 12:34 Robin H. Johnson (robbat2)
2009-09-06 23:41 Robin H. Johnson (robbat2)
2009-09-06 23:40 Robin H. Johnson (robbat2)
2009-09-06 23:36 Robin H. Johnson (robbat2)
2009-09-06 23:31 Robin H. Johnson (robbat2)
2009-09-06 23:24 Robin H. Johnson (robbat2)
2009-09-06 23:12 Robin H. Johnson (robbat2)
2009-09-06 23:04 Robin H. Johnson (robbat2)
2009-09-06 22:54 Robin H. Johnson (robbat2)
2009-08-30 22:37 Robin H. Johnson (robbat2)
2009-07-04 18:39 Robin H. Johnson (robbat2)
2009-03-27 20:13 Peter Alfredsen (loki_val)
2009-01-12 23:04 Markus Meier (maekke)
2008-12-03 18:11 Daniel Drake (dsd)
2008-10-31 22:01 Daniel Drake (dsd)
2008-03-21 11:11 Daniel Drake (dsd)
2008-01-23 20:58 Daniel Drake (dsd)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1NJCV4-0006Tz-OB@stork.gentoo.org \
    --to=robbat2@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox