From f6b5ef2faea0f0e50b9941b740434ed371863abc Mon Sep 17 00:00:00 2001 From: Jacob Keller Date: Mon, 10 Mar 2014 16:46:13 -0700 Subject: [PATCH] email: add "debug" section to configuration file 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 Signed-off-by: Artem Bityutskiy --- doc/email/example-aiaiai.cfg | 10 ++++++++++ email/aiaiai-email-lda | 12 +++--------- email/aiaiai-email-sh-functions | 9 +++++++-- email/aiaiai-email-test-patchset | 21 +++++---------------- 4 files changed, 25 insertions(+), 27 deletions(-) diff --git a/doc/email/example-aiaiai.cfg b/doc/email/example-aiaiai.cfg index f94b495..e41c361 100644 --- a/doc/email/example-aiaiai.cfg +++ b/doc/email/example-aiaiai.cfg @@ -44,6 +44,16 @@ # 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. diff --git a/email/aiaiai-email-lda b/email/aiaiai-email-lda index ded1641..c0a1887 100755 --- a/email/aiaiai-email-lda +++ b/email/aiaiai-email-lda @@ -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" &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"