diff options
author | Thomas Monjalon <thomas@monjalon.net> | 2017-03-30 00:46:35 +0200 |
---|---|---|
committer | Thomas Monjalon <thomas@monjalon.net> | 2018-06-08 16:09:06 +0200 |
commit | a030e2983c7c229068c56c2be0dec4ae3194ebc4 (patch) | |
tree | f9aab9d63234e07971d65235d8bb513dcc681b68 | |
parent | 564b2c35603e24b62c000bbba3ef500adbd1d1e8 (diff) | |
download | dpdk-ci-a030e2983c7c229068c56c2be0dec4ae3194ebc4.zip dpdk-ci-a030e2983c7c229068c56c2be0dec4ae3194ebc4.tar.gz dpdk-ci-a030e2983c7c229068c56c2be0dec4ae3194ebc4.tar.xz |
tools: add patchwork polling
This script should be run as a daemon to launch a per-patch command.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Ali Alnubani <alialnu@mellanox.com>
-rwxr-xr-x | tools/poll-pw | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tools/poll-pw b/tools/poll-pw new file mode 100755 index 0000000..ac867d9 --- /dev/null +++ b/tools/poll-pw @@ -0,0 +1,58 @@ +#! /bin/sh -e + +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2017 6WIND S.A. +# Copyright 2018 Mellanox Technologies, Ltd + +URL=http://dpdk.org/dev/patchwork/api + +print_usage () { + cat <<- END_OF_HELP + usage: $(basename $0) <counter> <command> + + Poll patchwork and call command for each patch. + The first patchwork id to be checked is read from the counter file. + The command should use '$1' to be evaluated as patchwork id. + When a patch is found and the command is successful, + then the counter is incremented. + END_OF_HELP +} + +while getopts h arg ; do + case $arg in + h ) print_usage ; exit 0 ;; + ? ) print_usage >&2 ; exit 1 ;; + esac +done +if [ $# -lt 2 ] ; then + printf 'missing argument\n\n' >&2 + print_usage >&2 + exit 1 +fi +shift $(($OPTIND - 1)) +counter=$1 +shift +cmd=$* + +callcmd () # <patchwork id> +{ + eval $cmd +} + +checkid () # <patchwork id> +{ + curl -sfIo /dev/null $URL/patches/$1/ || + curl -sfIo /dev/null $URL/covers/$1/ +} + +pwid=$(cat $counter) +while true ; do + # process all recent patches + while checkid $pwid ; do + callcmd $pwid || break + pwid=$(($pwid + 1)) + echo $pwid >$counter + done + # pause before next check + sleep 100 +done |