[PATCH 07/15] email-sh-functions: rename project configuration variables

Artem Bityutskiy dedekind1 at gmail.com
Wed Feb 5 07:10:36 PST 2014


From: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>

This is another cosmetic change which is supposed to improve the readability.
Let's distinguish between global and project parameters by using slightly
differnet variabls prefix: "cfg_" for global parameters and "pcfg_" for
per-project. Then in the contexts where we do not yet know the project, we'd
not use any of the "pcfg_" variables, and possibly avoid introducing bugs.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
---
 email/aiaiai-email-lda           |  2 +-
 email/aiaiai-email-sh-functions  | 30 +++++++++++++++---------------
 email/aiaiai-email-test-patchset | 23 ++++++++++++-----------
 3 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/email/aiaiai-email-lda b/email/aiaiai-email-lda
index 02a4a6b..2f75c3e 100755
--- a/email/aiaiai-email-lda
+++ b/email/aiaiai-email-lda
@@ -103,7 +103,7 @@ reject_and_reply()
 	verbose "Project \"$prj\""
 	parse_prj_config "$cfgfile" "$prj"
 
-	if [ -n "$cfg_name" ] && [ "$cfg_reply_to_all" == "1" ]; then
+	if [ -n "$pcfg_name" ] && [ "$pcfg_reply_to_all" == "1" ]; then
 		# Strip own address
 		to=$(strip_address "$to" "$cfg_ownmail")
 	else
diff --git a/email/aiaiai-email-sh-functions b/email/aiaiai-email-sh-functions
index 4bb0c09..01acc9d 100644
--- a/email/aiaiai-email-sh-functions
+++ b/email/aiaiai-email-sh-functions
@@ -162,11 +162,11 @@ parse_config()
 # Similar to "parse_config", but parses a project configuration section. If the
 # project is found, the following variables are defined:
 #
-# cfg_name. cfg_description, cfg_path, cfg_configs, cfg_branch,
-# cfg_reply_to_all, # cfg_accept_notify, cfg_always_cc, cfg_unwanted_keywords,
-# and cfg_kmake_opts.
+# cfg_name. pcfg_description, pcfg_path, pcfg_configs, pcfg_branch,
+# pcfg_reply_to_all, pcfg_accept_notify, pcfg_always_cc,
+# pcfg_unwanted_keywords, and pcfg_kmake_opts.
 #
-# If the project is not found, this function only defined an empty "cfg_name"
+# If the project is not found, this function only defined an empty "pcfg_name"
 # variable.
 #
 # Usage: parse_prj_config <cfgfile> <prj>
@@ -175,19 +175,19 @@ parse_prj_config()
 	local cfgfile="$1"; shift
 	local prj="$1"; shift
 
-	cfg_name="$(ini_config_get "$cfgfile" "prj_$prj" "name")"
-	[ -n "$cfg_name" ] || return 0
+	pcfg_name="$(ini_config_get "$cfgfile" "prj_$prj" "name")"
+	[ -n "$pcfg_name" ] || return 0
 
-	ini_config_get_or_die cfg_description   "$cfgfile" "prj_$prj" "description"
-	ini_config_get_or_die cfg_path          "$cfgfile" "prj_$prj" "path"
-	ini_config_get_or_die cfg_configs       "$cfgfile" "prj_$prj" "configs"
-	ini_config_get_or_die cfg_branch        "$cfgfile" "prj_$prj" "branch"
-	ini_config_get_or_die cfg_reply_to_all  "$cfgfile" "prj_$prj" "reply_to_all"
-	ini_config_get_or_die cfg_accept_notify "$cfgfile" "prj_$prj" "accept_notify"
+	ini_config_get_or_die pcfg_description   "$cfgfile" "prj_$prj" "description"
+	ini_config_get_or_die pcfg_path          "$cfgfile" "prj_$prj" "path"
+	ini_config_get_or_die pcfg_configs       "$cfgfile" "prj_$prj" "configs"
+	ini_config_get_or_die pcfg_branch        "$cfgfile" "prj_$prj" "branch"
+	ini_config_get_or_die pcfg_reply_to_all  "$cfgfile" "prj_$prj" "reply_to_all"
+	ini_config_get_or_die pcfg_accept_notify "$cfgfile" "prj_$prj" "accept_notify"
 
-	cfg_always_cc="$(ini_config_get "$cfgfile" "prj_$prj" "always_cc")"
-	cfg_unwanted_keywords="$(ini_config_get "$cfgfile" ""prj_$prj"" "unwanted_keywords")"
-	cfg_kmake_opts="$(ini_config_get "$cfgfile" "prj_$prj" "kmake_opts")"
+	pcfg_always_cc="$(ini_config_get "$cfgfile" "prj_$prj" "always_cc")"
+	pcfg_unwanted_keywords="$(ini_config_get "$cfgfile" ""prj_$prj"" "unwanted_keywords")"
+	pcfg_kmake_opts="$(ini_config_get "$cfgfile" "prj_$prj" "kmake_opts")"
 }
 
 # Compose (but not send) e-mail reply. This function assumes that the following
diff --git a/email/aiaiai-email-test-patchset b/email/aiaiai-email-test-patchset
index ee071f8..3abc960 100755
--- a/email/aiaiai-email-test-patchset
+++ b/email/aiaiai-email-test-patchset
@@ -194,9 +194,9 @@ $cfg_built_preamble
 
 $(fetch_header_per_patch "Subject" < "$mbox" | sort)
 
-Project: $cfg_name ($cfg_description)
+Project: $pcfg_name ($pcfg_description)
 
-Configurations: $cfg_configs
+Configurations: $pcfg_configs
 
 $(cat -- $tmpdir/test-patchset.log)
 EOF
@@ -314,14 +314,14 @@ fi
 parse_prj_config "$cfgfile" "$prj"
 
 # Check if we have this project in our config file
-if [ -z "$cfg_name" ]; then
+if [ -z "$pcfg_name" ]; then
 	error_project_not_found
 fi
 
 # Merge the "To" and "Cc" addresses
 to="$(merge_addresses "$to" "$cc")"
 
-if [ "$cfg_reply_to_all" != "1" ]; then
+if [ "$pcfg_reply_to_all" != "1" ]; then
 	to=
 else
 	# Strip own address
@@ -329,19 +329,20 @@ else
 fi
 
 # Notify the sender that the patches have been accepted
-if [ "$cfg_accept_notify" = "1" ]; then
+if [ "$pcfg_accept_notify" = "1" ]; then
 	verbose "Sending \"accepted\" e-mail"
 	send_accepted_email
 fi
 
 # Test the path (or patch-set)
-verbose "Test configs \"$cfg_configs\" branch \"$cfg_branch\" of \"$cfg_path\""
-aiaiai-test-patchset $verbose $preserve $bisectability $sparse $smatch $cppcheck $coccinelle \
-	-i "$mbox" -j "$cfg_jobs" -c "$cfg_branch" -w "$tmpdir" \
+verbose "Test configs \"$pcfg_configs\" branch \"$pcfg_branch\" of \"$pcfg_path\""
+aiaiai-test-patchset $verbose $preserve \
+	$bisectability $sparse $smatch $cppcheck $coccinelle \
+	-i "$mbox" -j "$cfg_jobs" -c "$pcfg_branch" -w "$tmpdir" \
 	${confdir:+-C "$confdir"} \
-	${cfg_unwanted_keywords:+-K "$cfg_unwanted_keywords"} -- \
-	${cfg_kmake_opts:+-M "$cfg_kmake_opts"} \
-	"$cfg_path" "$cfg_configs" > "$tmpdir/test-patchset.log" ||
+	${pcfg_unwanted_keywords:+-K "$pcfg_unwanted_keywords"} -- \
+	${pcfg_kmake_opts:+-M "$pcfg_kmake_opts"} \
+	"$pcfg_path" "$pcfg_configs" > "$tmpdir/test-patchset.log" ||
 {
 	verbose "aiaiai-test-patchset failed"
 	error_test_patchset_failed
-- 
1.8.5.2




More information about the aiaiai mailing list