From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 427E67EF0 for ; Fri, 8 Jun 2018 09:25:38 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id B7A112127C; Fri, 8 Jun 2018 03:25:37 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 08 Jun 2018 03:25:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:date:from:message-id:subject:to:x-me-sender:x-me-sender :x-sasl-enc; s=mesmtp; bh=gDvAJyinp4U7IdP/FB0lvVN+Aih/H/QMUDHPb6 5BegE=; b=p536XFviSM+EVUaDZwBM0KqrvRdgaSmb+KqgdMPgJpOlRUjDWXq+Hk u1mxA0gzJ0eBgNSfFgMxxbzwCE/Zor/ZEpI4XsA+32KQBTG369v5OPzjTmHlfW4e A6PYmG0i7XReKa4NSGGc/jE3hR1cgX4O0lUoqxF1F3m14JRK9MIWg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=gDvAJyinp4U7IdP/F B0lvVN+Aih/H/QMUDHPb65BegE=; b=m6HAM70jchHwT6VC/LjFrU+NA3AwG8QhK vuczgVeCG+oXCXz5D9kwQEZB1IgEFPraEs8F2ZrPKxA3X4gbCkEoeE6nFfAkcXqY gYvxER3TzNJPw++zWMXrr9kWfwkZk8qdIKjiaoH0evGjz/DdgMxoEASRbzcZOQuD DL8NqlHIXoIBZUycYd4pzZqIgkfVjpnlVOV0BgkVLM+WWMThaijnZ5nER3lxuEFn iBwP7xbgfUMv687ov5TkIbbgQu1VXx0fjrhVBD4NPOY7td2K6THdPbkzsPh/BBOd JbRj3XoEc6gFKMBBPNIXmWZrPVq50T/QY/jLfYIY6Pf5LTVsrfhHQ== X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Sender: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id E6F3010261; Fri, 8 Jun 2018 03:25:36 -0400 (EDT) From: Thomas Monjalon To: ci@dpdk.org Cc: Ali Alnubani Date: Fri, 8 Jun 2018 09:25:26 +0200 Message-Id: <20180608072526.24409-1-thomas@monjalon.net> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-ci] [PATCH] tools: add patchwork polling X-BeenThere: ci@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK CI discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jun 2018 07:25:38 -0000 This script should be run as a daemon to launch a per-patch command. Signed-off-by: Thomas Monjalon Signed-off-by: Ali Alnubani --- tools/poll-pw | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 tools/poll-pw diff --git a/tools/poll-pw b/tools/poll-pw new file mode 100755 index 0000000..b533591 --- /dev/null +++ b/tools/poll-pw @@ -0,0 +1,56 @@ +#! /bin/sh -e + +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2017 6WIND S.A. +# Copyright 2018 Mellanox Technologies, Ltd + +print_usage () { + cat <<- END_OF_HELP + usage: $(basename $0) + + 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 () # +{ + eval $cmd +} + +checkid () # +{ + curl -sfIo /dev/null https://dpdk.org/dev/patchwork/api/patches/$1/ || + curl -sfIo /dev/null https://dpdk.org/dev/patchwork/api/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 -- 2.17.1