From c11392dcdcede5142561d7b99d542b2e16ce32d6 Mon Sep 17 00:00:00 2001 From: Jacob Keller Date: Fri, 28 Feb 2014 16:00:19 -0800 Subject: [PATCH] aiaiai: don't allow arbitrary validator command Since aiaiai-email-test-patchset is the only validator that makes sense, and we should extend it if new features are desired, we don't need to support multiple validators, as this is clunky, and difficult to configure for the user. Now that the configuration file supports all the options from the aiaiai-email-test-patchset, we can just directly call it instead of having to use a passed in parameter. Signed-off-by: Jacob Keller --- doc/TODO.txt | 6 ------ email/aiaiai-email-dispatcher | 18 ++++++++++-------- email/aiaiai-email-dispatcher-helper | 26 +++++++++++++------------- 3 files changed, 23 insertions(+), 27 deletions(-) diff --git a/doc/TODO.txt b/doc/TODO.txt index 204825e..5d7a41e 100644 --- a/doc/TODO.txt +++ b/doc/TODO.txt @@ -15,12 +15,6 @@ implementing them. everythig via options. E.g., would could run 'aiaia-test-patchset --config /aiaiai.cfg' and have all the details defined in 'aiaiai.cfg'. - * Additional item for the previous one: aiaiai-email-dispatcher is too - difficutl to execute because it requires the "" argument. - But there is only one validator which makes sense in Aiaiai context - - "aiaiai-email-test-patchset". So remove the silly argument and - just run the validator, without exposing unnecessary complexity to - the user. * Start assigning versions to the scripts and do official releases, with signed tags, and tarballs. * Provide packages for various distributions. Including packages for the diff --git a/email/aiaiai-email-dispatcher b/email/aiaiai-email-dispatcher index 9057fd3..72e3222 100755 --- a/email/aiaiai-email-dispatcher +++ b/email/aiaiai-email-dispatcher @@ -26,17 +26,19 @@ fi show_usage() { cat <<-EOF -Usage: $PROG [options] +Usage: $PROG [options] This program dispatches the incoming queue of patches in the -directory and runs the program for each patch (or patch series). -Patches are supposed to be in mbox format. +directory and runs the aiaiai-email-test-patchset program for each patch (or +patch series). Patches are supposed to be in mbox format. is used +for general configuration of aiaiai-email-test-patchset. - the directory containing the queue of patches - - the validation command. + - aiaiai-email-test-patchset's configuration file Options: - -J, --bigjobs=N how many validators can be run at the same time (default 1); + -J, --bigjobs=N how many patches (or patch series) can be checked + at the same time (default 1); -v, --verbose be verbose; -h, --help show this text and exit. EOF @@ -129,7 +131,7 @@ program_required "inotifywait" "" mkdir $verbose -p -- "$1" 1>&2 queuedir="$(readlink -fv -- "$1")"; shift -validator="$1"; shift +cfgfile="$1"; shift in_fifo="$(mktemp -dt "$PROG.in_fifo.XXXX")" tmpdir="$(mktemp -dt "$PROG.tmpdir.XXXX")" @@ -142,10 +144,10 @@ mkfifo -- "$fifo" # -P option of xargs provides us the parallelism. # # We execute the below command as a separate process - it will run the -# validator for every file name read from the fifo. +# aiaiai-email-test-patchset for every file name read from the fifo. tail -f -- "$fifo" | xargs -I{} -P"$bigjobs" -- \ aiaiai-email-dispatcher-helper $verbose -- "$in_fifo/{}" "$tmpdir/STOP" \ - "$queuedir" "$validator" >&2 & + "$queuedir" "$cfgfile" >&2 & # Loop forever, wait for new files in the queue directory using inotify and # validate them diff --git a/email/aiaiai-email-dispatcher-helper b/email/aiaiai-email-dispatcher-helper index 63c56e1..998c6ac 100755 --- a/email/aiaiai-email-dispatcher-helper +++ b/email/aiaiai-email-dispatcher-helper @@ -24,22 +24,22 @@ fi show_usage() { cat <<-EOF -Usage: $PROG [options] +Usage: $PROG [options] -This is a helper program which runs the program for the - file. If the validator returns success - just exit. Otherwise -it moves the file back to the directory and create +This is a helper program which runs the aiaiai-email-test-patchset program for +the file. If aiaiai-email-test-patchset returns success - just exit. +Otherwise it moves the file back to the directory and create file . -The validator program should return failure only in case of internal -bug or error, and not if any test on the patch failed. So the -reason we move back to the queue is to make sure we do not -lose the patch in case of an internal bug. +aiaiai-email-test-patchset will return failure only in case of internal bug or +error, and not if any test on the patch failed. So the reason we move + back to the queue is to make sure we do not lose the patch in case of an +internal bug. - - the mbox file to feed to the + - the mbox file to feed to aiaiai-email-test-patchset - the file to create in case of failure - the directory containing the queue of patches - - the validation command. + - aiaiai-email-test-patchset's configuration Options: -v, --verbose be verbose; @@ -88,17 +88,17 @@ done mbox="$(readlink -fv -- "$1")"; shift fail_file="$1"; shift queuedir="$(readlink -fv -- "$1")"; shift -validator="$1"; shift +cfgfile="$1"; shift tmpdir="$(mktemp -dt "$PROG.XXXX")" verbose "Validating \"$mbox\", queue directory is: $queuedir" -verbose "Validator command: $validator" +verbose "Configuration file: $cfgfile" mv $verbose -- "$mbox" "$tmpdir" >&2 file="$tmpdir/${mbox##*/}" -if ! cat -- "$file" | eval "$validator"; then +if ! cat -- "$file" | aiaia-email-test-patchset "$verbose" "$cfgfile"; then verbose "Validation failed" touch -- "$fail_file" mv $verbose -- "$file" "$queuedir" >&2 -- 2.49.0