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 69D69A0C4C for ; Tue, 21 Sep 2021 16:36:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5A84141143; Tue, 21 Sep 2021 16:36:46 +0200 (CEST) Received: from AZHDRRW-EX01.nvidia.com (azhdrrw-ex01.nvidia.com [20.51.104.162]) by mails.dpdk.org (Postfix) with ESMTP id 6762641140 for ; Tue, 21 Sep 2021 16:36:44 +0200 (CEST) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.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; Tue, 21 Sep 2021 07:36:43 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MACfPYX4Y+WeX2ZgEOWSdR4T0FD5iEu0Km++Qti0w3Ir0QvGuWjsj3DQ04k904SCBBZOFqsB2H50RvKIaDhTUAdxFJQfGCOYX4UbOeEYCt5ig4Kr+frqpJTu/xqZEgPwmbZQAhdWBsQzXBmqoa8DVd402HyYczl2EVD6D62kmMY58c1dP5IE5xqdqW0cLNnnPBf51x8UJU//fo5JApcUwNn8ZISWQgnHhA3PNqR4fedHu/hPcN984gqwl2+nACP/njt2oShAO4cjDs6LTbKt205X+qzyo6FKdk5P0A4ulG0ixYLtwlsjd5cRtnQjqS3kVqhVJP+5gWUyXc3irl3AVg== 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=l11JjaNe12rMHU0pOrtoyB0qJafkhedXI0AB2OSD9Lk=; b=OUrjdDjgsaUR9jijbbydGrc//uRcwawlXYVs8AnlYUjvkx2PV2+Vwqx8JTYdk4SiJry041PzCh4LV0tGKJw4m+t/CJIGvezWT5j7PrfzgqOhf+H2mgGGbA+1hBiId/p2RSgEX+iSEBbUFcLZZX4SmgghJ7TuxA6uW27SpWhwTEkN5GAUNJKu1lV16fSrqW7Rhe3jUqv13TSWF2cXMV5n9XgmARgh+e1rjBOUlQAHiZC5UGAdO1AW3PCEqpYh7MuQZ85jqdeZ8JRBeUdtbzb3NiCUUg6/z/qkuQEmgx74z7zPRwD9BZiQS0Ca1U5Y3fNZGQ/RnsNKyDvjDmiRYDst+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.36) 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=l11JjaNe12rMHU0pOrtoyB0qJafkhedXI0AB2OSD9Lk=; b=BsBFbXwQ24TdG3LPI76D3KHhF9k788+B9gxU7N17723XDdKOCVF7UvJM8SmdoWFtt+OEvx7c3EAtM8Mkt4nNjSJUDEINPSRhBrXO8hiezX2mbEjyL0wXrL8/miuVA5/gtM2m/pLUoaOJmkNOODklrM9N7Mrlm+oE/c4a8yIurASgAafa4DRZ0CF1n4hHVtBrRgVnZimFYR4MVV4O/2PT84XiuTI6FQ7cORXeOk+3vX7N7NvfPLS1Mfvp6c9dhroixLpFWuPCMlsjx7X+N7W3w/JxA0ojE8DGl/21mfvfUCFooemecWxfcvZoRnCRYC9llX0GgiQ8zqkvUARkb0rWAQ== Received: from BN9PR03CA0448.namprd03.prod.outlook.com (2603:10b6:408:113::33) by BYAPR12MB2805.namprd12.prod.outlook.com (2603:10b6:a03:72::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.17; Tue, 21 Sep 2021 14:36:41 +0000 Received: from BN8NAM11FT049.eop-nam11.prod.protection.outlook.com (2603:10b6:408:113:cafe::17) by BN9PR03CA0448.outlook.office365.com (2603:10b6:408:113::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Tue, 21 Sep 2021 14:36:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.36) 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.36 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.36; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.36) by BN8NAM11FT049.mail.protection.outlook.com (10.13.177.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4523.14 via Frontend Transport; Tue, 21 Sep 2021 14:36:40 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 21 Sep 2021 14:36:40 +0000 Received: from nvidia.com (172.20.187.5) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 21 Sep 2021 14:36:37 +0000 From: To: CC: , , , , Date: Tue, 21 Sep 2021 17:35:37 +0300 Message-ID: <20210921143542.4412-6-alialnu@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210921143542.4412-1-alialnu@nvidia.com> References: <20210906154537.1299-1-alialnu@nvidia.com> <20210921143542.4412-1-alialnu@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] 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: a2f1efb9-b3c8-4d59-68a3-08d97d0d39ec X-MS-TrafficTypeDiagnostic: BYAPR12MB2805: 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: uq55ptsRGiKLNxUTlWh5DAF6K1LhH02vlLHJrOCIcwqQfh7cS+iWy/EcmSbjG5i17vq0mb6FivQTE67ID+UB4+1SLVQxuPX4/pYUu7JNxNnhiQT6C36Z7YpnGOduxhx6Uktuf0pLjH39s46LnaEclT/nkK+LkwvHvoyl4+d4rpXRY561lQT0/j9Hue29k7Vy/wGPGt6AF/5zZnSS13npntAvf2qQvlrOyTMmiNfgajJ1WKC7YI/cpBxXrdG2G5FSXAXb5LfbXC01RAuJl12Bo1jtaGMfFG2kvNxhBzWLGMb1/gGg/zx6TocpJxffKLT4cPhlabcIJdUm5QTvMdqdJExkGuo4lSOO4ondwUDSUKmlVSzePMAYURHBYerxecXBawAw1qhipKzMLWhRpFskJmNDrSHeu6cqH0H2CVw9k3lTus+z9HLlPw2OcOjPTLdsCe7Fj3eS8fYnjtK/iqicbPw6SVgRbLXNHij8MFPvB4SIOFU2ECh2UoyAEMrjQcY7pxFgflOiIRXkNp6n6NUKsl4Lo8H3BPOA8m7fJn3ZcrTQRRm4m3CRZfgKiqowzTewdj2dEaVlOnu6tQ7cXZ+kppRlnjo9bbvqqx4koX87KhHBDs0ajq9wKxFbyPNJ8h9RyyeNx3gxVDZzuvOEYpnjDFglfEZPrgVMgJOzXMyUzSu2rt2w9RYxJJsBDk18RxftYa5zOVXPwY9TwWaeIuMwvq/eUYvWKBvobl1rNXaf8y9EBs71HuLkfYI8tdQNKEGT9fAay0QDTm9lZ+BroMfJrbBHZjH9w7V3KHmlcGO9CkU= X-Forefront-Antispam-Report: CIP:216.228.112.36; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid05.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(6286002)(55016002)(6916009)(107886003)(86362001)(1076003)(8936002)(8676002)(54906003)(336012)(2876002)(5660300002)(2906002)(36906005)(2616005)(36756003)(426003)(83380400001)(70206006)(186003)(966005)(16526019)(26005)(36860700001)(82310400003)(508600001)(70586007)(316002)(47076005)(356005)(7636003)(4326008)(7696005); DIR:OUT; SFP:1101; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2021 14:36:40.7238 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a2f1efb9-b3c8-4d59-68a3-08d97d0d39ec 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.36]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT049.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2805 Subject: [dpdk-ci] [PATCH v2 05/10] 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" From: Ali Alnubani 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 $ ./pw_maintainers_cli.py --type series set_pw_delegate SERIES_ID Signed-off-by: Ali Alnubani --- tools/pw_maintainers_cli.py | 47 ++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/tools/pw_maintainers_cli.py b/tools/pw_maintainers_cli.py index 9b77e77..e68f049 100755 --- a/tools/pw_maintainers_cli.py +++ b/tools/pw_maintainers_cli.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,31 @@ 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): @@ -288,7 +314,7 @@ if __name__ == '__main__': parser.add_argument( 'command', choices=[ - 'list_trees', 'list_maintainers'], + 'list_trees', 'list_maintainers', 'set_pw_delegate'], help='Command to perform') parser.add_argument( 'id', type=int, help='patch/series id') @@ -324,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