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 0E1F7A0C54 for ; Mon, 6 Sep 2021 17:46:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 09CDE410F0; Mon, 6 Sep 2021 17:46:40 +0200 (CEST) Received: from AZHDRRW-EX01.nvidia.com (azhdrrw-ex01.nvidia.com [20.51.104.162]) by mails.dpdk.org (Postfix) with ESMTP id A1B40410E9 for ; Mon, 6 Sep 2021 17:46:38 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.176) 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:37 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D1Tx1o9+sbwMq+r224iL8Vvjd2ApPgkqJczUOSvWUJZig8hbGZ6QdJAY1W8jejik6y/BvV6vRPNdQk3yC0qxlP1Z1qHfRYBEbzGlFuq+zfE0V1wFd0VfV0KNRt39i+Hmv0mOfkWd4QDlu2difzuDwtrQUD1XvgfCBj/PQUxXs0eYy6lyh+2MbKk+doHH05cT2rskimESktYKltSk/6dWL2lro2h0ou1ZDTA/E9B+9TDapEiSHOnfC++HZGu+VIPbOwaPEvXGiBFKZvvlSsh4vwkFvpXdP1XukH98rlyJQlaP8lUxwNodxzKy4cbrs610GNrq/mJCAT3Hxg8Cuym5XQ== 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=GU4qsVmKzSEQsDTEXaV1Z46K7vCGy8MJKh8ViMAz3fg=; b=FnhnQQEuqI9FuIO/yOY2yjCGVHj4pW3c43aC7c801e0H17HLFe5KDy1fhh+ZjgIoQdXCroBkCwbEbFlic9aU7axwqDZEPfwDDldqurN3N9K2nDc9wv+KRuSp+FiQaLxjwCXOl/cpmk9j1z7mcELaCBcxS6OUN5ltMA84xHqH+voOq0MlZlixUL9e3/rkE+ineMhrotRP9U1kc6Au6oPcfxE3U4SfVhsvK/Vv/Smde4yzr6zpCmTzxskECVAoS11/a0Pg/VSQlFOjUN/JAUPUunLauXn+1qWJJeIUO9n3LZCgRG3Sk24aZuSZh7uHZf0hGwaSXSBnWWK/oM+EfsKVLQ== 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=GU4qsVmKzSEQsDTEXaV1Z46K7vCGy8MJKh8ViMAz3fg=; b=Z7KNJN4zwgg1eI8k+t5FvDx1/H9x4svczvC9F7uEd33vSMqekPsqDWOcb6fSmZF7PKR70ciVZpjFyj5l8to4a2JkIi+/BG3J8WhUdu7qWBFAAtGNzozw2X3tENc+bVddwaAX5zMdlUROzMxV/tZC5W1OpL07CrdRLDMSx1ungvX+5OK/CV2jQPSKRgwBNFiA+4oGgi3r7Pnn3FQgviPkiZE1ujjXldy8BCyr4YknMfaPJWPJDrLVApUQqb2LQ5J3BoscfUZRsCv4AwkgrdnXtSffsbxZpEv6cRsaqZvoMaQkNcluIsdJ8zSskJXZwB0gNk7WRlw+WZbpKXJOCkA+cQ== Received: from DM5PR21CA0038.namprd21.prod.outlook.com (2603:10b6:3:ed::24) by DM8PR12MB5400.namprd12.prod.outlook.com (2603:10b6:8:3b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.21; Mon, 6 Sep 2021 15:46:37 +0000 Received: from DM6NAM11FT020.eop-nam11.prod.protection.outlook.com (2603:10b6:3:ed:cafe::92) by DM5PR21CA0038.outlook.office365.com (2603:10b6:3:ed::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.3 via Frontend Transport; Mon, 6 Sep 2021 15:46:37 +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 DM6NAM11FT020.mail.protection.outlook.com (10.13.172.224) 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:37 +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; Mon, 6 Sep 2021 15:46:36 +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:34 +0000 From: Ali Alnubani To: CC: , , , Date: Mon, 6 Sep 2021 18:45:30 +0300 Message-ID: <20210906154537.1299-3-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: ad573a0a-f876-430f-8697-08d9714d82e1 X-MS-TrafficTypeDiagnostic: DM8PR12MB5400: 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: V4rV55PTYKOg/Yw2rAtseXFVFmnJiMU+8k7krPX3FRPdLf7latdPUsLmO0PUXIid+MijrEzBg84W8CHT9PwvEXaDuSB6OoDIvCJiZ5mzR/gDsysaI4dlI+a6gQkt88D+LbmPrnVLl+6YFP+G0y7GYvBnp+clYT+P64Gah9ndvV9DrI+BIvKH/q0HzGJOdaeFbyn3OAnKaNAdEZEglvaRxglx7anA7DyrmqbMif/GqhQYEFfrslFPRFPhpGKsYyFVkRLKfdI1SR4qT7d+Y+CgZRzcEKlqvj36HswyisID8I3TFOpqaIZI1mlEt5pfRke/zUOQXqrTWFgpF/wpAvwEotTBfvuz+iosZMVM0y6w9XByIDq7NcoyuZqvnlW6FNvR5R8IS0kzC6PouGLQmF2ls6xsMytIvNNwQhjHcuD5hNn4u09q/7saqKbkid74E6D4jQTCHKl2CF2sMIguGt9CpiohxFl2qkyJjy7lwg/Jn9KZvgIVCKSGCzBkgxD8ieP9jpR9OPoNXEC2PzGWIM8RgM+tjozCL7XDxqEeV1Mjn1dqpQTguZ2Ws6/h+slsmZqDu3Pd+Ue3z3LwdqVf7EEWZYXSMK/CWlyI/MgyNAwMuYwKHEINAuozlalxyBdxzBM4UR3YK+HR44ufGBN1QhBVxTI7WE8Iv5ElbAOhQIatNfdmhnmMmvLue1+OqDDQH7lEHJj3QjO4cQou0QMyezcR1g== 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)(86362001)(16526019)(186003)(4326008)(70586007)(8676002)(83380400001)(54906003)(7636003)(356005)(336012)(1076003)(55016002)(26005)(6666004)(107886003)(8936002)(508600001)(82310400003)(6916009)(36860700001)(6286002)(70206006)(7696005)(47076005)(316002)(426003)(5660300002)(2906002)(36756003)(36906005)(2616005); DIR:OUT; SFP:1101; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2021 15:46:37.0765 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ad573a0a-f876-430f-8697-08d9714d82e1 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: DM6NAM11FT020.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR12MB5400 Subject: [dpdk-ci] [PATCH 2/9] 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" 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/maintainers.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/tools/maintainers.py b/tools/maintainers.py index 0cf1907..22933d5 100755 --- a/tools/maintainers.py +++ b/tools/maintainers.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