From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 649AEA0C54 for ; Mon, 6 Sep 2021 17:46:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6084B410ED; Mon, 6 Sep 2021 17:46:52 +0200 (CEST) Received: from AZHDRRW-EX01.nvidia.com (azhdrrw-ex01.nvidia.com [20.51.104.162]) by mails.dpdk.org (Postfix) with ESMTP id 04840410E9 for ; Mon, 6 Sep 2021 17:46:51 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.44) by mxs.oss.nvidia.com (10.13.234.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.858.15; Mon, 6 Sep 2021 08:46:50 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Weul6jwY79X+RaK3IC+QwwzIKqER2oFeV3O+428vjDLMUCBLWB37r/iQmxAH96xk1FA+RjXspOIm/iYiCY8cO4Ifldzqs74kBGGhXiOEecFOa33aPEObsZvG6C2RDIcivCR4avyXiZJPWFeqWbDyyG7bRUcS/N21Ug6ylUjj3kxI5kghqeZIfhwPuVjrwe7p8cvLD7AFKM65YzWpNJHs3C9IH98KbjsmZGvEEnDv8E5tBCGCtk6n2JMkKJQHp+nc6gJxhpd87i7mXrrjGw7Ub5SNA+lvpQSVJAZwHmaJQAQMlvhKXJ/r3U4sCnBFZ2egXS47gU0tpSCdrnd1lgndyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=XxMhrEgQXMndPtTKJzYx/uwr2u6TB/Ar+11e97ebZfE=; b=iKyxDIVQJFZMnODK6HuZNDy4R3hnCXEDYU35vJAw8vqhEM2/WvyolZPaBw7Q8cvmB0WbQN6VbYuDIGK9FaQqjmOpSMfWKnvl8Te2A9j/KFcugy1D9fjsuki06LqkJzlyBJZW/speLAg5BJ4j2TJeXP1qUnD/COyOcmqUgjv8LhhqjrMNM7h5ynBUpgmBIBv/sOxBtEJb8VhV3lA7pc4zThJ7wSwT0A6IpbUXKfQvzSgSSfLOdr/qKx7vIfTtB6C6qod9LHNrS5HomfpB45+Fsoc5SaSaxQg6t5fXCSm7aNu4drNQIQSremQ1uKh2N4+TYzTU2p9muWQGTshSPgonnw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XxMhrEgQXMndPtTKJzYx/uwr2u6TB/Ar+11e97ebZfE=; b=e8fiYxkafu6U8/UPvYkVTg65oKjYlNr0+CeRTPlg5JZ7+VeXsaO8G92roVGwVHkM9wQ8JYzE9jyxBMwXFS9eVLowh6rX+8mkiDktnDh2oowNo6G02NVZPwKs604Tf78TuWRSRuHaMus1045ZizboePyowGUNSorVQG1haeWU5B+K3RtvgUysy2ctIF9/xXJwNEU/j2tqeMLd5c4njizQg2PDe0SDfltepATSxq1/1Yb0srgFyyOSIv2hMywfKkL1l82it1DYgL09Hv14QOCprtWdmSO/j6uimCuqnPr5iwnEpoMzCi5IKHMUNOMfZqifPpVl6uOrVZDMmcrykDGFBA== Received: from BN9PR03CA0045.namprd03.prod.outlook.com (2603:10b6:408:fb::20) by BN8PR12MB3218.namprd12.prod.outlook.com (2603:10b6:408:6b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19; Mon, 6 Sep 2021 15:46:45 +0000 Received: from BN8NAM11FT015.eop-nam11.prod.protection.outlook.com (2603:10b6:408:fb:cafe::8a) by BN9PR03CA0045.outlook.office365.com (2603:10b6:408:fb::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19 via Frontend Transport; Mon, 6 Sep 2021 15:46:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT015.mail.protection.outlook.com (10.13.176.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4478.19 via Frontend Transport; Mon, 6 Sep 2021 15:46:45 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 6 Sep 2021 15:46:44 +0000 Received: from nvidia.com (172.20.187.6) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 6 Sep 2021 15:46:41 +0000 From: Ali Alnubani To: CC: , , , Date: Mon, 6 Sep 2021 18:45:33 +0300 Message-ID: <20210906154537.1299-6-alialnu@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210906154537.1299-1-alialnu@nvidia.com> References: <20210906154537.1299-1-alialnu@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4821840b-1961-487b-ce5d-08d9714d87b7 X-MS-TrafficTypeDiagnostic: BN8PR12MB3218: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-Transport-Forked: True X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Sxct7B9tevpkS0O6K54OeALYNLpBMXGpSG88HHrt65Mb4Uv1tVOVU3g4LdlorI0/QAqQ6fq7OTbHyk0irBxyZE7F4YyCqvA6xM4In8U1wtdm3XnsJhv8q/LhgSyD0poui9MmoXvTx/k+yHJNP/SGGT5xJFHpTaq8bV8AQPQf2JauqvMG/AGXMfgkBWp2ucnSgc/hYmhx/Xai81W3AOrjJ1Unv8PWpDkMmEiEXzz8A84DC6OxII0DEm+y6kOjpoMw8k1Djfmrz1kIryaXvd4n7eM8kyw5soNdOoJ+TUAqV82HU+t3RD2TK7IQ0eLOjjZMLWGIjhYU3Jiu3EmvcKhtXHxiAsaOMn66YkOrjrvMmxr0gv5tQdGvvfIg6l7iHvpzf0eJub44fG8FR3WPGhDbW08EhxfgT++e4vEvLvbBpny+wCUxnatJOTCKZp0y9SO5Hz2QO5U2MbHfV8tuNs++vzkAqyCzY+iWql7b6VOlqKSbt88c5fl+VyD3w0kFcZmvoxBXQcT3DOLJXHyPjWFCRSMeDYeTAurMcUMlccLbzYUgui004lTxWB2GBEGBq2otW6xhmaVufUsM3cV6S3kRssnFuXMtvLe5nD8iv6hCQT1hq2aX3aW0l9RwFyODrkOcM3bNkXSuokTFaEakINwjFp5s1WmMsbZP9rCJgH2acoTWMSWxaqSkyWPtC9XkFrQJQmpGC4j5lhe1vpHez8/LnIs08ec90ayqJxI30rElCmgHyhdgVJyK+YNOg5pA4M3iBvqoV8AWMjSvABFS7uvH4T+QcvPTJIVQI5EdmFV7J3I= X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(2906002)(107886003)(8936002)(86362001)(70586007)(70206006)(47076005)(7636003)(336012)(26005)(5660300002)(4326008)(7696005)(8676002)(1076003)(54906003)(508600001)(2616005)(36756003)(426003)(6286002)(83380400001)(966005)(356005)(6666004)(36860700001)(36906005)(55016002)(82310400003)(316002)(186003)(16526019)(6916009); DIR:OUT; SFP:1101; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2021 15:46:45.1317 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4821840b-1961-487b-ce5d-08d9714d87b7 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT015.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3218 Subject: [dpdk-ci] [PATCH 5/9] tools: add functionality for setting pw delegates X-BeenThere: ci@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK CI discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ci-bounces@dpdk.org Sender: "ci" A new command was added to set patch delegates in Patchwork based on the emails found in DPDK's MAINTAINERS file. Example usage: $ export MAINTAINERS_FILE_PATH=/path/to/dpdk/MAINTAINERS $ ./maintainers.py --command set_pw_delegate --type series SERIES_ID Signed-off-by: Ali Alnubani --- tools/maintainers.py | 46 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/tools/maintainers.py b/tools/maintainers.py index c9b0502..a1ba5fc 100755 --- a/tools/maintainers.py +++ b/tools/maintainers.py @@ -14,6 +14,7 @@ from requests.exceptions import HTTPError from git_pw import config from git_pw import api from git_pw import utils +from git_pw import patch as git_pw_patch """ Description: @@ -84,6 +85,29 @@ class GitPW(object): else: raise + def set_delegate(self, patch_list, delegate): + """Set the delegate for a patch. + Only tries to set a delegate for patches that don't have one set already. + + Reference: + https://github.com/getpatchwork/git-pw/blob/76b79097dc0a57c89b45dd53d9cacb7ff7b31bb2/git_pw/patch.py#L167 + """ + users = api.index('users', [('q', delegate)]) + if len(users) != 1: + # Zero or multiple users found + print('Cannot choose a Patchwork user to delegate to from ' + 'user list ({}). Skipping..'.format(users)) + return + for patch in patch_list: + if patch['delegate']: + print('Patch {} is already delegated to {}. ' + 'Skipping..'.format(patch['id'], patch['delegate']['email'])) + continue + print("Delegating patch {} to {}.".format( + patch['id'], users[0]['email'])) + _ = api.update( + 'patches', patch['id'], [('delegate', users[0]['id'])]) + class Diff(object): @@ -267,7 +291,8 @@ if __name__ == '__main__': '--command', choices=( 'list_trees', - 'list_maintainers'), + 'list_maintainers', + 'set_pw_delegate'), required=True, help='Command to perform') options_parser.add_argument( '--type', @@ -325,5 +350,20 @@ if __name__ == '__main__': if command == 'list_trees': print(tree.split('/')[-1]) - elif command == 'list_maintainers': - print(*maintainers.get_maintainers(tree), sep='\n') + if command in ['list_maintainers', 'set_pw_delegate']: + maintainer_list = maintainers.get_maintainers(tree) + if command == 'list_maintainers': + print(*maintainer_list, sep='\n') + elif command == 'set_pw_delegate': + if len(maintainer_list) > 0: + # Get the email of the first maintainer in the list. + try: + delegate = re.match( + r".*\<(?P.*)\>", + maintainer_list[0]).group('email') + except AttributeError: + print("Unexpected format: '{}'".format(maintainer_list[0])) + sys.exit(1) + _git_pw.set_delegate(patch_list, delegate) + else: + print('No maintainers found. Not setting a delegate.') -- 2.25.1