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 47820A0C54 for ; Mon, 6 Sep 2021 17:46:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4376541103; Mon, 6 Sep 2021 17:46:45 +0200 (CEST) Received: from AZHDRRW-EX02.NVIDIA.COM (azhdrrw-ex02.nvidia.com [20.64.145.131]) by mails.dpdk.org (Postfix) with ESMTP id 806E7410ED for ; Mon, 6 Sep 2021 17:46:44 +0200 (CEST) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (104.47.73.171) by mxs.oss.nvidia.com (10.13.234.37) 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:43 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cTblp9XjW590mEUn61uhhtXLNDKnyWORFFcL1dm+0cXPQmbztWJXRepJBafwihprNPRMCWyS4KPa0yTS8UWc+/CmHIGFbWmHC2aFeoyWucOwkTYtan/4VpxJpdkh4zlS8GXPy5FHFL2xhLpl4s8XZs+8o2Ue3DL/eiGTYuCOpUo6ImFJhhJ5hv0k/sK9vaEmc6OY1POldQDoJeEL+gqiCBZZGjCAgQclwrOUoOdqTlEVnboo528GXRX8Z+D5eL2zEeOc1u7/K0b+2/tq8N37zbd5yCTMM5gRCCA3jqINkDCwoWAxkrj+GsiMQyXQBg/zwUIpPECaa2BqFbVJgY+R9g== 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=b7S516Gs+hIkiTEqhz3zpqE7Rg4LjUbYgImPkkEJYwU=; b=WeuRnEXROrC11FO+NAwZWnwb3k3TeOqP+Wx2wRCx9zbhRBXoO/i336oDlkhPbJ2q7jLMqa6JcXGMf1FZLeHKRIHio2ZqKStoE9xZ2UVyufr93AB2JbuNtklMORWsasxqcqMXkz22cEwmf0zvHaTS7/rcB/07c0SGRdSMfkCH+H2vrirVB1dznON2oeZc5/PXWtSZ5WU4UoftamyV0QXz59TgStd+MPm3P1vEZJoGCJQovVjEuhsarQ1far4F9nR6a9hi00ZZzpd9/4+8oJAX6ivPXSY+2tVbXCO+SHRXIUud7NwKPkKjbThCgyfMaQdeBo8OCvDslLMM+E9RCT6EkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.32) 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=b7S516Gs+hIkiTEqhz3zpqE7Rg4LjUbYgImPkkEJYwU=; b=TvKSpwPbnjPv6atYrs80QcP38T9zmFBM8+CO4cVPW3NDhPnbwx0Qp8VdRV+SpmIzA9ZeZ+rfBHi7ROAiTjy5ZbYg92lk6Vt/Fp4wtS8wcs8EekM70OyRyl1BL2IHmY83u4swSAUkm0Xpt2hN4YBTd0x5/kekZ4tDmt1GR7TjGZQhge0S2p8yvDc8303vcizsFQwWa5B3qrhxpqWc+Xh37SnpYve3lK0L4BrReu19cezrujsEHT+AnsevTNEmWuqg+1fMSfPRZhZBjppvomgWANnO4egKPDpAjeafeOhP9FS7KtyUSHqSFLvhs6/+KEDr+VJ88LeYoXaRDcMAco2Fig== Received: from BN0PR04CA0059.namprd04.prod.outlook.com (2603:10b6:408:e8::34) by MWHPR12MB1503.namprd12.prod.outlook.com (2603:10b6:301:b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.17; Mon, 6 Sep 2021 15:46:43 +0000 Received: from BN8NAM11FT063.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e8:cafe::6f) by BN0PR04CA0059.outlook.office365.com (2603:10b6:408:e8::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.21 via Frontend Transport; Mon, 6 Sep 2021 15:46:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.32) 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.32 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.32; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.32) by BN8NAM11FT063.mail.protection.outlook.com (10.13.177.110) 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:42 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 6 Sep 2021 08:46:41 -0700 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:39 +0000 From: Ali Alnubani To: CC: , , , Date: Mon, 6 Sep 2021 18:45:32 +0300 Message-ID: <20210906154537.1299-5-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: 6f0fb3d6-270b-4d65-118f-08d9714d8635 X-MS-TrafficTypeDiagnostic: MWHPR12MB1503: 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:369; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: clVBn0sm+hRbOZyI26Bej//mnWgOmM+WOFiJUwBJD1iHidahx+cpYxpcL7o4V0fLaG0cDd8+IhNsZxGmdS8ASRzHJHplM+9nxmMIU5WN4saStLm4Nj1xvIaP4v24McqWJ0O5g4FGH+aoz6Bzq7gBK700QjieFzqMsXjRP2lF/SW+wcGAzgSxlUuQb0uFqYrkhcintGML69S5DslBwlq5jsZTocKZS+R0ajZ8GWHRK/BlWwf0kKe8h+qgQUlUWJBNX1chUX0tBQfRJRZ2a7FQ2Y+bJjpRnF1r6H4jEIlYj/K+YFu2BLyH1Woa8gXTzZsaBkaKTrUvjnJJGIl/zf1qObN2TsbFkfqL6QKeYAHyT8PHzZl4EG+Gc2ZlWldq8UvYSyJuvi2/3XEBXg1+kL9ngLERKlNgzBKcqKVPDPPx8l+ihYrl39c5EVOGHVCFkW+RgZYjUdZxYUrpQSrvrZOOoiNaCTf03CmxYY4ABFX3/nB7DCBzq5NXnjAc6v5nfXTog1eXeIr4+D1OqjnA9rV3ND80F3ZcqXiL4wNiikRI50NIKUMDuRK0wlye8Xrv3Ks2uO9C+7bK6ws9KqVnQBmq6j4eXWwd4UjmpVxzo+xgFkIycnjVngUNIxs4lo9hyxftn4f9yxrPsLqhfLCKsjG1D0XR0QWsXCCbbUY24qxYjCYHuNbHYqgXN8oM/MEsIRhAI6S5yJmWmSSAgRrv9kVuUA== X-Forefront-Antispam-Report: CIP:216.228.112.32; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid01.nvidia.com; CAT:NONE; SFS:(4636009)(136003)(396003)(39860400002)(376002)(346002)(46966006)(36840700001)(336012)(356005)(47076005)(4326008)(426003)(7636003)(82310400003)(5660300002)(316002)(26005)(2906002)(54906003)(82740400003)(1076003)(86362001)(7696005)(16526019)(8936002)(107886003)(36860700001)(186003)(55016002)(6666004)(70586007)(2616005)(83380400001)(6916009)(8676002)(36756003)(70206006)(6286002)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2021 15:46:42.5922 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6f0fb3d6-270b-4d65-118f-08d9714d8635 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.32]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT063.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1503 Subject: [dpdk-ci] [PATCH 4/9] tools: add functionality for detecting tree maintainers 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" Detecting a maintainer works by searching the 'General Project Administration' section for subsections containing the provided tree, and then returning the maintainers specified in that subsection. Signed-off-by: Ali Alnubani --- tools/maintainers.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/tools/maintainers.py b/tools/maintainers.py index e4ea317..c9b0502 100755 --- a/tools/maintainers.py +++ b/tools/maintainers.py @@ -33,6 +33,7 @@ to load the git configurations pw.{server,project,token}. Example usage: ./maintainers.py --command list_trees --type series 2054 ./maintainers.py --command list_trees --type patch 2054 + ./maintainers.py --command list_maintainers --type patch 2054 Or if you want to use inside other scripts: @@ -48,6 +49,7 @@ Or if you want to use inside other scripts: files = Diff.find_filenames(_git_pw.api_get('patches', patch_id)['diff']) tree_url = maintainers.get_tree(files) tree_name = tree_url.split('/')[-1] + maintainers = maintainers.get_maintainers(tree_url) """ @@ -118,6 +120,7 @@ class Maintainers(object): file_regex = r'F:\s(.*)' tree_regex = r'T: (?Pgit:\/\/dpdk\.org(?:\/next)*\/(?P.*))' + maintainer_regex = r'M:\s(.*)' section_regex = r'([^\n]*)\n-+.*?(?=([^\n]*\n-+)|\Z)' subsection_regex = r'[^\n](?:(?!\n{{2}}).)*?^{}: {}$(?:(?!\n{{2}}).)*' @@ -141,6 +144,26 @@ class Maintainers(object): # Save already matched patterns. self.matched = {} + def get_maintainers(self, tree): + """ + Return a list of a tree's maintainers.""" + maintainers = [] + for section in self.sections: + if section.group(1) == 'General Project Administration': + # Find the block containing the tree. + regex = self.subsection_regex.format('T', re.escape(tree)) + subsection_match = re.findall( + regex, + section.group(0), + re.DOTALL | re.MULTILINE) + if len(subsection_match): + subsection = subsection_match[-1] + # Look for maintainers + maintainers = re.findall( + self.maintainer_regex, subsection) + return maintainers + break + def get_tree(self, files): """ Return a git tree that matches a list of files.""" @@ -243,7 +266,8 @@ if __name__ == '__main__': options_parser.add_argument( '--command', choices=( - 'list_trees'), + 'list_trees', + 'list_maintainers'), required=True, help='Command to perform') options_parser.add_argument( '--type', @@ -301,3 +325,5 @@ if __name__ == '__main__': if command == 'list_trees': print(tree.split('/')[-1]) + elif command == 'list_maintainers': + print(*maintainers.get_maintainers(tree), sep='\n') -- 2.25.1