[dpdk-ci] [PATCH v2 08/10] tools: add support for fetching new series IDs

alialnu at oss.nvidia.com alialnu at oss.nvidia.com
Tue Sep 21 16:35:40 CEST 2021


From: Ali Alnubani <alialnu at nvidia.com>

The script can now fetch new series IDs the same way
it fetches new patch IDs.

Example usage:
$ export TZ="Europe/Paris"
$ 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>
---
 tools/poll-pw | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/tools/poll-pw b/tools/poll-pw
index 6ac8a61..bf1af70 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] <series|patches> </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 specifed file is updated after each pull.
 	END_OF_HELP
 }
@@ -31,16 +31,22 @@ 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 ! curl -sfIo /dev/null $URL/$resource_type ; then
+	echo "API endpoint '$URL/$resource_type' doesn't exist or inaccessible."
+	exit 1
+fi
+
 if [ ! -f "$since_file" ] ; then
 	echo "The file '$since_file' doesn't exist."
 	exit 1
@@ -52,7 +58,7 @@ if [ ! $? -eq 0 ] ; then
 	exit 1
 fi
 
-URL="${URL}/patches/?"
+URL="${URL}/${resource_type}/?"
 
 callcmd () # <patchwork id>
 {
-- 
2.25.1



More information about the ci mailing list