]> www.infradead.org Git - users/dedekind/aiaiai.git/commitdiff
email: add "debug" section to configuration file
authorJacob Keller <jacob.e.keller@intel.com>
Mon, 10 Mar 2014 23:46:13 +0000 (16:46 -0700)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Tue, 11 Mar 2014 07:59:39 +0000 (09:59 +0200)
This patch further extends the configuration file so that it has a debug
section which currently includes replacements for test-mode and preserve
options. These options are very useful for debugging aiaiai, but today
cannot easily be changed without modifying the command line. Instead,
remove them from the options and include them via the configuration
file.

I chose not to add "verbose" to this list, because we actually use
verbose earlier than we parse the configuration. It may still be worth
coming up with some interface where command line options overwrite
configuration options, but I wasn't sure the best way to handle this
yet.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
doc/email/example-aiaiai.cfg
email/aiaiai-email-lda
email/aiaiai-email-sh-functions
email/aiaiai-email-test-patchset

index f94b4958f14ce502c4ce8fdce3e15e6ffe79fa26..e41c361431370c0d6bcd577ed693dea14c5a7d91 100644 (file)
        # aiaiai will insert it for you.
        built_preamble = I have tested your changes
 
+# These options are probably not useful, but may help debug issues with aiaiai
+[debug]
+       # Set to (1) to disable sending reply emails when a patch is tested.
+       # This can help prevent spam while testing or debugging aiaiai.
+       disable_notifications = 0
+
+       # Set to (1) to preserve generated files instead of allowing aiaiai to
+       # cleanup after itself.
+       preserve_files = 0
+
 # The "defaults" section specifies various default settings for projects. These
 # values are overridden by the same values in the prj_* sections, so you may
 # customize the settings per project if desired.
index ded1641b2d94d62f01b5a07bfe92525bd26c2b82..c0a18875ff20d962b4e81e09daa9443ffd64375a 100755 (executable)
@@ -51,8 +51,6 @@ Options:
                              minutes ago from the mail archive directory;
       --reap-incomplete=MIN  remove all incomplete patch series older than
                              current time minus MIN minutes;
-      --test-mode            test mode - work as usually, but do not send
-                             replies;
   -v, --verbose              be verbose;
   -h, --help                 show this text and exit.
 EOF
@@ -111,10 +109,10 @@ reject_and_reply()
 
        [ -z "$verbose" ] || cat -- "$lda_tmp/mail" >&2
 
-       if [ -z "$test_mode" ]; then
+       if [ "$cfg_disable_notifications" != "1" ]; then
                mutt -x -H "$lda_tmp/mail" </dev/null
        else
-               verbose "Do not actually send the email - we are in test mode"
+               verbose "Email notifications have been disabled in the configuration file"
        fi
 }
 
@@ -470,20 +468,16 @@ cleanup_handler()
 }
 set_cleanup_handler cleanup_handler
 
-TEMP=`getopt -n $PROG -o v,h --long test-mode,reap-archive:,reap-incomplete:,verbose,help -- "$@"` ||
+TEMP=`getopt -n $PROG -o v,h --long reap-archive:,reap-incomplete:,verbose,help -- "$@"` ||
        fail_usage ""
 eval set -- "$TEMP"
 
-test_mode=
 archive_min=
 incomplete_min=
 verbose=
 
 while true; do
        case "$1" in
-       --test-mode)
-               test_mode=y
-               ;;
        --reap-archive)
                archive_min="$(opt_check_number "$1" "$2")"
                shift
index 9e17f70cb02b3cf60a8948a1c62763b6d1013b31..440e358daff902fa45f27c0ab1878a4f6931281b 100644 (file)
@@ -139,7 +139,8 @@ ini_config_get_or_die()
 # file:
 #
 # cfg_ownname, cfg_ownmail, cfg_adminname, cfg_adminmail, cfg_workdir,
-# cfg_max_validators, cfg_jobs, cfg_preamble, cfg_signature, cfg_built_preamble
+# cfg_max_validators, cfg_jobs, cfg_preamble, cfg_signature,
+# cfg_built_preamble, cfg_disable_notifications, cfg_preserve_files
 #
 # Additionally, the following variables are set:
 #  o cfg_ownmail_local - the local portion of the ownmail address
@@ -162,6 +163,10 @@ parse_config()
        ini_config_get_or_die cfg_signature      "$cfgfile" "global" "signature"
        ini_config_get_or_die cfg_built_preamble "$cfgfile" "global" "built_preamble"
 
+       # Debug options
+       cfg_disable_notifications="$(ini_config_get "$cfgfile" "debug" "disable_notifications")"
+       cfg_preserve_files="$(ini_config_get "$cfgfile" "debug" "preserve_files")"
+
        # Get the contents of the preamble file
        cfg_preamble="$(cat "$cfg_preamble")"
 
@@ -237,7 +242,7 @@ parse_prj_config()
 
        # The following options all take default value from the "defaults"
        # section, and hence "override" those settings. First we need to populate those.
-       _parse_default_config "$cfgfile"
+       __parse_default_config "$cfgfile"
 
        # ini_config_is_set is important here, so that defining a value as
        # empty in the project section actually does define it as empty, rather
index a9ff7ec446ca5b51d9ca974c19fe171dc8f1440f..d7400f6bd07536e4ee0967eddf9cb6df6eabad45 100755 (executable)
@@ -35,9 +35,6 @@ The mbox file containing the patches to test is expected to come from stdin
 
 Options:
   -i, --input=MBOX       use the MBOX file instead of stdin;
-  -p, --preserve         preserve all the temporary files - do not clean up;
-      --test-mode        test mode - work as usually, but do not actually
-                         send replies;
   -v, --verbose          be verbose;
   -h, --help             show this text and exit.
 EOF
@@ -50,7 +47,6 @@ fail_usage()
        exit 1
 }
 
-preserve=
 verbose=
 mbox=
 tmpdir=
@@ -58,7 +54,7 @@ cleanup_handler()
 {
        rm $verbose -rf -- "$mbox" >&2
 
-       if [ -n "$preserve" ]; then
+       if [ "$cfg_preserve_files" = "1" ]; then
                verbose "Preserved tmpdir: $tmpdir"
        else
                [ -z "$tmpdir" ] || verbose "Removing $tmpdir";
@@ -91,10 +87,10 @@ send_email()
 
        [ -z "$verbose" ] || cat -- "$tmpdir/mail" >&2
 
-       if [ -z "$test_mode" ]; then
+       if [ "$cfg_disable_notifications" != "1" ]; then
                mutt -x -H "$tmpdir/mail" </dev/null
        else
-               verbose "Do not actually send the email - we are in test mode"
+               verbose "Email nofications have been disabled in the configuration file"
        fi
 }
 
@@ -176,12 +172,11 @@ $(cat -- $tmpdir/test-patchset.log)
 EOF
 }
 
-TEMP=`getopt -n $PROG -o i:,C:,p,v,h --long test-mode,input:,preserve,verbose,help -- "$@"` ||
+TEMP=`getopt -n $PROG -o i:,C:,p,v,h --long input:,verbose,help -- "$@"` ||
        fail_usage ""
 eval set -- "$TEMP"
 
 mbox=
-test_mode=
 
 while true; do
        case "$1" in
@@ -189,12 +184,6 @@ while true; do
                mbox="$(opt_check_read "$1" "$2")"
                shift
                ;;
-       -p|--preserve)
-               preserve="--preserve"
-               ;;
-       --test-mode)
-               test_mode=y
-               ;;
        -v|--verbose) verbose=-v
                ;;
        -h|--help)
@@ -312,7 +301,7 @@ fi
 
 # Test the path (or patch-set)
 verbose "Test configs \"$pcfg_configs\" branch \"$pcfg_branch\" of \"$pcfg_path\""
-aiaiai-test-patchset $verbose $preserve \
+aiaiai-test-patchset $verbose ${cfg_preserve_files:+--preserve} \
        ${pcfg_targets:+--targets "$pcfg_targets"} $bisectability $sparse $smatch $cppcheck $coccinelle \
        -i "$mbox" -j "$cfg_jobs" -c "$pcfg_branch" -w "$tmpdir" \
        ${pcfg_defconfigdir:+-C "$pcfg_defconfigdir"} \