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 43C4DA0C4C for ; Tue, 21 Sep 2021 16:36:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3F4F541145; Tue, 21 Sep 2021 16:36:41 +0200 (CEST) Received: from AZHDRRW-EX01.nvidia.com (azhdrrw-ex01.nvidia.com [20.51.104.162]) by mails.dpdk.org (Postfix) with ESMTP id 3E42D4113F for ; Tue, 21 Sep 2021 16:36:39 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.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:38 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g5DOFSuxMZhyi2czlKPR/4McdLFqTNtlqiggmGTe2t8CpupxHM5w/F5znNxqoDfLe7+Aujlm97f9CU85JxgsWtkbhYOit6C4bOtvE9amKmXHudCRQq6zZEUZUHR1OE0+DC6uRueaij5X3stdEw9d1joDLI2lPZdzAf7wdpGZyvTTP/OENAUAtwx6vzFAETFzeVHIru3FS9M7fmVEPJ2saCTV3YnlTUBp0ckmRLzNUsjOAVPrE2gJxyB/EaVvxXo88lDzYlGOKhjOQ5kKZFMe5dikIRGykO6RNDbPzWbMDU2gPf2/1XtuLjDeBox+y+Xp4UOSJuXkSiDpr0Jha6qYPA== 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=LQuzDS3eLt8sKjbCGQ1csSNIebaJC/qPYoKInfw122I=; b=J5z3XHkqS7CzPcMhD7AFPEUTd7zDKm0VEM3FFEPK1mFRdmX+Jgdj0gn6XFPAVqoHPY57I2omL4UYhPEFp2PQseYk4mn+tiT3E8Jb/haU/ZLz9dZIQC1j0lBH30fXHvsOlJIeCPaxMYuQ/a/NLFMr5MDNDn7jwnWJ1jF/tvLbZZnDOkuTXRbROcnXh5VmP7nGOWLF4tiBY7LrR28FZAVz8u8x5edN+Tor0taJVRE2DyNRJnK3/rEBdvArQlcDc5Ry8lDCiffSjGXvxoLLEJ3rDUZlqqhjb9Vp9gbfX+EiTKDQxX8cpAP7n6aUPDhgDuya4w27k7G4jVTKyWVL95fx/A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.35) 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=LQuzDS3eLt8sKjbCGQ1csSNIebaJC/qPYoKInfw122I=; b=cfNOrgScVcaUfk8l1Ys+SbINWAaFkzVclEkv8o1lSdSTm1QOi3+1KNQzkxsEdT8WtYDrt/O4tMMRqPiVgc/2/KhsGfaiMvPro3cy8yS8mBP4QK5GbvIacs2rMqq4j1kaYbeq/CgUbskYc7mG0zBTp7WYpy/kk3AFoceaOjFGYvbVZQJfGNd1lhhjSqCBKMwUzHh23oBO4noG7vrK4vG09V+pdKoEUkCbIN+QfV94REfve/VGF11wddU99dc7xZkLbcv3Bu6mNNf8tAfuXheUKmU/N/xY8D29I3IfmPDh/bpkBAfijzY31H5sHjvCiN2hifnuz62uucDvasS9hX8ucQ== Received: from BN9PR03CA0174.namprd03.prod.outlook.com (2603:10b6:408:f4::29) by BN8PR12MB3601.namprd12.prod.outlook.com (2603:10b6:408:46::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:32 +0000 Received: from BN8NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f4:cafe::d2) by BN9PR03CA0174.outlook.office365.com (2603:10b6:408:f4::29) 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:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.35) 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.35 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.35; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.35) by BN8NAM11FT032.mail.protection.outlook.com (10.13.177.88) 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:32 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 21 Sep 2021 14:36:31 +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:29 +0000 From: To: CC: , , , , Date: Tue, 21 Sep 2021 17:35:34 +0300 Message-ID: <20210921143542.4412-3-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: 9f0499b0-29d9-4f79-4b23-08d97d0d3506 X-MS-TrafficTypeDiagnostic: BN8PR12MB3601: 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:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m41ofi5bos4Tc67iqtJKTgISvG6ikuM+SF9GDKrMXB/XbRkP93GqM7axnV7PwFqstcC0TFlR8goeSGr4brgEBZz/D74iNdL2EXVkGBPRoHAup8jlOQcwnIX6qjNKHd+mHSVJoCdoO1m1P7kj9WBZ11DdReEBaFGoIPCopqRbPBl0hbNfYI5yfqk6IfFsVn7gY/CdlbtXGnBEh4iaryHsZ383MCUeRkPiXLszd81flTlLJDb5di5CCpFNDi3uwLqDRLmcq2ZoTPK/eKxXZfGiGWRMhQwAwNOGBPXrT7OADVRawY4pMVGywP4Qu2IpVXJ0t3v10TUUw181/Qw2zT/GEzej6SZAhl3C0pwTt9qwQiQqClbThA/83x+iAGNp2jIbWgyDySfzW7oFYgEPLSMA8iUny2uwY1UT4h00FPQLCwf2HL/ITkxmLu3JgmVqfb0+fb10qyxnwbEYtdDuJim+4RceLV8l0k+NO3AOhgVZFxYjHUCtcivA9ZEZ0I3NCbkbZvKjUcpniG5Atf+IfCrTWv6uVEHlk8obJ+hYxyaNbaXlOxkdgS+b+DmjGEx5JSAn0PaBU0oZfnXhsV6ja7BwHYKcM9R2BUolvfqbVpDpOZvKwldTKU8nWWHiGpI6RrTDdx/FRANWPRXELefzs0Hu4tsCpiBkLDFbq0vBcxZd2uQEFeHB91zr4LolwTRUl7EDpoD7u0DGZR+GVFwO9RPFGg== X-Forefront-Antispam-Report: CIP:216.228.112.35; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid02.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(2616005)(426003)(107886003)(26005)(5660300002)(356005)(6916009)(36906005)(6666004)(1076003)(316002)(36756003)(6286002)(16526019)(186003)(47076005)(336012)(82310400003)(36860700001)(508600001)(70586007)(7636003)(86362001)(70206006)(55016002)(83380400001)(7696005)(54906003)(4326008)(2906002)(2876002)(8936002)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2021 14:36:32.5748 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9f0499b0-29d9-4f79-4b23-08d97d0d3506 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.35]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3601 Subject: [dpdk-ci] [PATCH v2 02/10] tools: match by tree url instead of tree name 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 The tree url has more information. It can be used to get the maintainer of a tree, and it includes the tree name anyway. Also try to use named capture groups as much as possible. Signed-off-by: Ali Alnubani --- tools/pw_maintainers_cli.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/tools/pw_maintainers_cli.py b/tools/pw_maintainers_cli.py index a31f605..343e9f5 100755 --- a/tools/pw_maintainers_cli.py +++ b/tools/pw_maintainers_cli.py @@ -46,7 +46,8 @@ Or if you want to use inside other scripts: maintainers = Maintainers() patch_id = 52199 files = Diff.find_filenames(_git_pw.api_get('patches', patch_id)['diff']) - tree = maintainers.get_tree(files) + tree_url = maintainers.get_tree(files) + tree_name = tree_url.split('/')[-1] """ @@ -116,9 +117,9 @@ class Diff(object): class Maintainers(object): file_regex = r'F:\s(.*)' - tree_regex = r'T: git:\/\/dpdk\.org(?:\/next)*\/(.*)' + tree_regex = r'T: (?Pgit:\/\/dpdk\.org(?:\/next)*\/(?P.*))' section_regex = r'([^\n]*)\n-+.*?(?=([^\n]*\n-+)|\Z)' - subsection_regex = r'[^\n](?:(?!\n{{2}}).)*?^F: {}(?:(?!\n{{2}}).)*' + subsection_regex = r'[^\n](?:(?!\n{{2}}).)*?^{}: {}$(?:(?!\n{{2}}).)*' def __init__(self): with open(MAINTAINERS_FILE_PATH) as fd: @@ -151,8 +152,8 @@ class Maintainers(object): if _tree: tree_list.append(_tree) tree = self.get_common_denominator(tree_list) - if tree == '': - tree = 'dpdk' + if not tree: + tree = 'git://dpdk.org/dpdk' return tree def _get_tree(self, filename): @@ -180,7 +181,7 @@ class Maintainers(object): found_match = False # Find the block containing filename. - regex = self.subsection_regex.format(re.escape(matching_pattern)) + regex = self.subsection_regex.format('F', re.escape(matching_pattern)) subsection_match = re.findall( regex, self.maintainers_txt, @@ -191,7 +192,7 @@ class Maintainers(object): tree_match = re.search( self.tree_regex, subsection) if tree_match: - tree = tree_match.group(1) + tree = tree_match.group('url') self.matched[matching_pattern] = tree found_match = True @@ -204,7 +205,7 @@ class Maintainers(object): self.tree_regex, section.group(0).split('\n\n')[0]) if tree_match: - tree = tree_match.group(1) + tree = tree_match.group('url') self.matched[matching_pattern] = tree return tree @@ -228,8 +229,8 @@ class Maintainers(object): os.path.commonprefix(_tree_list).rstrip('-').replace( 'dpdk-next-net-virtio', 'dpdk-next-virtio') # There is no 'dpdk-next' named tree. - if common_prefix == 'dpdk-next': - common_prefix = 'dpdk' + if common_prefix.endswith('dpdk-next') or common_prefix.endswith('/'): + common_prefix = 'git://dpdk.org/dpdk' return common_prefix @@ -289,4 +290,4 @@ if __name__ == '__main__': files = [] for patch in patch_list: files += Diff.find_filenames(patch['diff']) - print(maintainers.get_tree(files)) + print(maintainers.get_tree(files).split('/')[-1]) -- 2.25.1