]> www.infradead.org Git - users/dedekind/aiaiai.git/commitdiff
aiaiai: add initial support for dispatcher hook
authorJacob Keller <jacob.e.keller@intel.com>
Sat, 15 Mar 2014 00:16:00 +0000 (17:16 -0700)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Tue, 18 Mar 2014 13:35:17 +0000 (15:35 +0200)
This patch adds some initial support for a dispatcher hook which could
be used to add custom headers, which will (later) be interpreted by
aiaiai to include specialized settings. A follow-on patch will add the
first initial custom header.

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

index 7e7af5b4c3969cbb741323b64113f8f25dded2cc..e4a7e0353be2c96d3f010b718afe8f0372ac436a 100644 (file)
@@ -156,3 +156,34 @@ specified for each project.
     to make this a bare remote or a local tree. Generally, aiaiai works best if
     the tree is locally stored on the same machine as the aiaiai process.
 
+2.4 Aiaiai Hooks
+~~~~~~~~~~~~~~~~
+
+The [hooks] section can be used to specify scripts which are called by various
+aiaiai tools, and can be used to customize the behavior of aiaiai. This is
+generally done by modifying the mbox to include custom headers, which are
+detailed below.
+
+The two following headers are generally inserted by aiaiai-email-lda and most
+likely don't need to be inserted by a hook, but are included here for
+completeness.
+
+* X-Aiaiai-Cover-Letter-Subject
+    This is the subject of the 0/n email if one is given when sending a patch
+    series.
+* X-Aiaiai-Cover-Letter-Message-Id
+    This is the message Id of the 0/n email if one was given when sending a
+    patch series.
+
+The above two settings are used by aiaiai-email-test-patchset so that it can
+formulate a reply to the 0/n email instead of replying to the 1/n email of a
+patch series. This helps indicate that the entire patch series was validated,
+instead of appearing as though only the first patch was tested.
+
+2.4.1 Dispatcher Hook
+~~~~~~~~~~~~~~~~~~~~~
+
+The dispatcher hook is called by aiaiai-email-dispatcher-helper, and receives
+the mbox file as its first argument, and the cfgfile as its second argument. It
+should modify the mbox file inplace, to include any custom headers specified
+above.
index e41c361431370c0d6bcd577ed693dea14c5a7d91..6101c5824fc69f57a30434b9544b7ae83a20a944 100644 (file)
        # aiaiai will insert it for you.
        built_preamble = I have tested your changes
 
+[hooks]
+       # A hook called by aiaiai-email-dispatcher-helper, which should insert
+       # custom headers into the mbox file. Specific documentation on this is
+       # provided in the doc/email section, including expected argument
+       # format, as well as what headers are recognized by other tools.
+       dispatcher =
+
 # 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.
index 70d1025244f0f102126251fd4c8d35c33e6825ca..018c0d4cdc9b142d2e5227ebe9e6080b1030c2a5 100755 (executable)
@@ -90,8 +90,18 @@ fail_file="$1"; shift
 queuedir="$(readlink -fv -- "$1")"; shift
 cfgfile="$1"; shift
 
+# Parse the configuration file
+parse_config "$cfgfile"
+
 tmpdir="$(mktemp -dt "$PROG.XXXX")"
 
+# Run the dispatcher hook
+if [ -n "$cfg_dispatch_hook" ]; then
+       hook="$(readlink -fv -- "$cfg_dispatch_hook")"
+       verbose "Running \"$hook\" on \"$mbox\""
+       $hook "$mbox" "$cfgfile"
+fi
+
 verbose "Validating \"$mbox\", queue directory is: $queuedir"
 verbose "Configuration file: $cfgfile"
 
index 440e358daff902fa45f27c0ab1878a4f6931281b..f996e9db4a46ecae5e122aac89d12377000d5f86 100644 (file)
@@ -163,6 +163,9 @@ parse_config()
        ini_config_get_or_die cfg_signature      "$cfgfile" "global" "signature"
        ini_config_get_or_die cfg_built_preamble "$cfgfile" "global" "built_preamble"
 
+       # Hooks which can be used to enable custom behavior
+       cfg_dispatch_hook="$(ini_config_get "$cfgfile" "hooks" "dispatcher")"
+
        # Debug options
        cfg_disable_notifications="$(ini_config_get "$cfgfile" "debug" "disable_notifications")"
        cfg_preserve_files="$(ini_config_get "$cfgfile" "debug" "preserve_files")"