[dpdk-ci] [PATCH v3 08/10] tools: support fetching series
Ali Alnubani
alialnu at oss.nvidia.com
Mon Oct 18 09:44:58 CEST 2021
The script can now fetch new series IDs by filtering the events
API with category 'series-completed'. See:
https://patchwork.readthedocs.io/en/latest/usage/overview/#series-completed
Example usage:
$ export MAINTAINERS_FILE_PATH=/path/to/dpdk/MAINTAINERS
$ ./tools/poll-pw series /path/to/last.txt \
'/path/to/pw_maintainers_cli.py --type series set_pw_delegate $1'
Signed-off-by: Ali Alnubani <alialnu at nvidia.com>
---
Changes in v3:
- Fetch new series IDs by filtering the events API with
category "series-completed".
- Updated usage (renamed 'patches' arg to 'patch') so that
it feeds directly into the 'patch-completed' category.
tools/poll-pw | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/tools/poll-pw b/tools/poll-pw
index ccc58f0..77f6b79 100755
--- a/tools/poll-pw
+++ b/tools/poll-pw
@@ -9,11 +9,11 @@ PAUSE_SECONDS=100
print_usage () {
cat <<- END_OF_HELP
- usage: $(basename $0) [OPTIONS] </path/to/last.txt> <command>
+ usage: $(basename $0) [OPTIONS] <patch|series> </path/to/last.txt> <command>
- Poll patchwork and call command for each patch.
+ Poll patchwork and call a command for each new patch/series id.
The first date to filter with is read from the specified file.
- The command should use '$1' to be evaluated as the patch id.
+ The command should use '$1' to be evaluated as the patch/series id.
The date in the specified file is updated after each pull.
END_OF_HELP
}
@@ -31,14 +31,15 @@ while getopts h arg ; do
esac
done
-if [ $# -lt 2 ] ; then
+if [ $# -lt 3 ] ; then
printf 'missing argument(s)\n\n' >&2
print_usage >&2
exit 1
fi
shift $(($OPTIND - 1))
-since_file=$1
-shift
+resource_type=$1
+since_file=$2
+shift 2
cmd=$*
if [ ! -f "$since_file" ] ; then
@@ -52,7 +53,13 @@ if [ ! $? -eq 0 ] ; then
exit 1
fi
-URL="${URL}/events/?category=patch-completed"
+if [ "$resource_type" != "patch" ] & [ "$resource_type" != "series" ] ; then
+ printf "Unknown resource type '$resource_type'.\n\n" >&2
+ print_usage >&2
+ exit 1
+fi
+
+URL="${URL}/events/?category=${resource_type}-completed"
callcmd () # <patchwork id>
{
@@ -66,7 +73,7 @@ while true ; do
page=1
while true ; do
ids=$(curl -s "${URL}&page=${page}&since=${since}" \
- | jq 'try ( .[].payload.patch.id )')
+ | jq "try ( .[].payload.${resource_type}.id )")
[ -z "$(echo $ids | tr -d '\n')" ] && break
for id in $ids ; do
callcmd $id
--
2.25.1
More information about the ci
mailing list