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 7B29EA0C4C for ; Tue, 21 Sep 2021 16:36:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7126441143; Tue, 21 Sep 2021 16:36:47 +0200 (CEST) Received: from AZHDRRW-EX01.nvidia.com (azhdrrw-ex01.nvidia.com [20.51.104.162]) by mails.dpdk.org (Postfix) with ESMTP id 5F1E041140 for ; Tue, 21 Sep 2021 16:36:45 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.106) 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:44 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Egrj291jet/0zR+smyICXw7IrxzYypsE1TDp6tFovigs88TRgCyQI3/kf1NowvKS0KIr/PaxA15N28ok4FuyNpjSL+7fpv/1KzNys+SoCPO5gY+lPNrHAHyGbeqMBaWzZfa64ZHaV/EhYGDF5P3RPu54Cev2imbmJDTXnipqPg+c9gdnV6wm/9d6ILih5a0EvoM9ted2rOUwn0feQtb/88yQYUCm13yhCLtddZlW7oAhLK5jE996j2OEm8GOUcCWpWCC0WAblyWe/QarbWYFIxmcq1SHAiZnTjx7WueWYjOfFj0nt+zyEEY11gOVt8VYtKHbQ4aPYgQUC/X9HBuAQg== 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=JXRdrNd3F1c8ZlvQjX1OF8vkJ9q4BO5nI3P4HrXgO2w=; b=D8GF7XAbcBulzQBbvQGQjiG4HzVAj8OAmdYmz976VLS/oOL3lEKNrJyDa6crnLH2o7Zr1r2vpPq1FyRm83WSK2LMss42UI/N/hR2oMgZJvBQntiNkVj39REFNCoClcUJ9LVn7sI9/gDH/gxoKg74NQz63/jJNAkVdbI+HUj7RJDj+qXPqj3GrCQIK2yqr/63tNPVLUH7vg1DXSkcjIalK+gU+5O2cC7FPNyXF9DfdOy6fGGWGL3tc+1CCDi23uodDavyb/WcLPDbk9HnRKuPFOiGxGKgv0NoKMM18FkfsrmOTyHqvYLGlNm1Whqt95JBf+I0zlGtWP0iYEAFAVk7SA== 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=JXRdrNd3F1c8ZlvQjX1OF8vkJ9q4BO5nI3P4HrXgO2w=; b=BmY3ONdickTEhwVTCwIBhGNWfUoGQfjbpeLiBbe8AFW+0+9Z1Z2hq4w/5gDrIWD/m2odnF+rgx/NrgrSGDcR8e3pJ2DkEL6Sp10lAmZYQzLSa6WjUekBd8AHNX1CZFB1D6yKJnbqWIwe6LuePJ3x/UxL1KQlzqSOKHZQwuw8xG1XK4gf20izVRA7eOt7q7F3mFyxhCi8kUd+jOiMXintoqeY/D347pmLc7uqKAVSOeSRyZdRzbPK37ogOyHq4XsjdJgtxaO2YNOjE50K9L471usl7xphB3srNs2JBSffZAV+q2vp6Na9YJHlTLBKjKs/qOANIcM7CH1YqZ38oXz6Tg== Received: from BN0PR04CA0002.namprd04.prod.outlook.com (2603:10b6:408:ee::7) by BY5PR12MB4833.namprd12.prod.outlook.com (2603:10b6:a03:1f6::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16; Tue, 21 Sep 2021 14:36:42 +0000 Received: from BN8NAM11FT024.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ee:cafe::93) by BN0PR04CA0002.outlook.office365.com (2603:10b6:408:ee::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Tue, 21 Sep 2021 14:36:42 +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 BN8NAM11FT024.mail.protection.outlook.com (10.13.177.38) 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:42 +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; Tue, 21 Sep 2021 14:36:37 +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:34 +0000 From: To: CC: , , , , Date: Tue, 21 Sep 2021 17:35:36 +0300 Message-ID: <20210921143542.4412-5-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: fc49d77c-c0b4-4062-ab90-08d97d0d3ac9 X-MS-TrafficTypeDiagnostic: BY5PR12MB4833: 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: Zs7wccQ+mtU/4mPPuruNUz3CEFx5sSQM3zIcAINQb49Qu7qSi9zVHHvtzFTVcda9wquHx6iUHrNUR6HQFMa64309yS0/FxtIT540pr3CGaqshqFQHdfNSLkhs0qhK8HgplbjjJVPd1ang6SrGIT0SyXGLZKmZLyIV/T+SmaiqwInMVnLFyGzB44sh+HBjdyOTLhZaVgOqX+kD/qm3+UjkrssxQrk1fNPBFcROA9D62XlhBBKjWa11C5/D3XaGUEgo2JLxBKuxJIxAmRhCv5qg5NSXlpLsoWuFDY+SilKiB5XBpQjMyS1r1t0tsI16Wxv1k8g4mhzLnnwuiDbWswPiEzDf5UNh4fI1FTnPM1DHC8Lj3rPotPoq4888+RWmg64pUudwN4s3wRhkJvaAizhMP86vQPJ0l8bbIkMUBlG2PmdYuQ0BDiW23PfEbDj88n5HIPIq0FPTCEyhZa3ofJrjDAKiZGEQ+rQCMDvB5cXQl6uYQx/j7g1PaMX3kzp9pMbi8Xj1BxpqDtxT42Iiopjgqg2tLnqsDhENEnCzPZlhmOx2uJm2BxfGhkPM4EqAOJ21PAJ4K4pD4nVHyL0pZvQ2q0frfr40VXGVDpCgod6hdY1FXfAO062w5+9acuLq5tDKFPOVY8MIUStVWPgTGXESEPFSQkzQ05aXBosklFFaCEj/XnURIHtPdLOEjXSLYOamBdtu+om0tRDXnfox6WjRg== 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)(2616005)(36756003)(186003)(70206006)(36860700001)(6916009)(107886003)(336012)(2906002)(7636003)(1076003)(70586007)(356005)(82310400003)(54906003)(16526019)(5660300002)(316002)(7696005)(55016002)(508600001)(86362001)(26005)(8676002)(4326008)(2876002)(426003)(6286002)(47076005)(36906005)(8936002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2021 14:36:42.1709 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fc49d77c-c0b4-4062-ab90-08d97d0d3ac9 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: BN8NAM11FT024.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4833 Subject: [dpdk-ci] [PATCH v2 04/10] 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" From: Ali Alnubani 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/pw_maintainers_cli.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/tools/pw_maintainers_cli.py b/tools/pw_maintainers_cli.py index d4c0056..9b77e77 100755 --- a/tools/pw_maintainers_cli.py +++ b/tools/pw_maintainers_cli.py @@ -33,6 +33,7 @@ to load the git configurations pw.{server,project,token}. Example usage: ./pw_maintainers_cli.py --type series list_trees 2054 ./pw_maintainers_cli.py --type patch list_trees 2054 + ./pw_maintainers_cli.py --type patch list_maintainers 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.""" @@ -265,7 +288,7 @@ if __name__ == '__main__': parser.add_argument( 'command', choices=[ - 'list_trees'], + 'list_trees', 'list_maintainers'], help='Command to perform') parser.add_argument( 'id', type=int, help='patch/series id') @@ -301,3 +324,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