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 0343A43699; Thu, 7 Dec 2023 14:44:14 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E5EB340278; Thu, 7 Dec 2023 14:44:14 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 01C3840270 for ; Thu, 7 Dec 2023 14:44:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701956653; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HIzJFbfT72zolqsS1DoXEmtiqeR93uDqqlf8Ts9FgC4=; b=BRLlYpNGVVRinkvlv3opEQ1KLP7QbGgzd7DizB//66PZdRKFYlf15FLVk0b3Ar9G1mocWW FFZ7CK5M4RltWISUmjo8zZYJWhqyIcLUkPHzJ2sOaZ17qQ74O2V/VYVZF+MjQXR3yzkiOV PuRMA3wLBkMQLVyaYPyVqNS6hZYV+d8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-298-z_nQV1PbOCGgM02x5w8HfA-1; Thu, 07 Dec 2023 08:44:10 -0500 X-MC-Unique: z_nQV1PbOCGgM02x5w8HfA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1936E85A58F; Thu, 7 Dec 2023 13:44:10 +0000 (UTC) Received: from RHTPC1VM0NT (unknown [10.22.17.96]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BD6E82166AE1; Thu, 7 Dec 2023 13:44:09 +0000 (UTC) From: Aaron Conole To: Pavan Nikhilesh Bhagavatula Cc: Jerin Jacob Kollanukkaran , "alialnu@nvidia.com" , "thomas@monjalon.net" , "david.marchand@redhat.com" , "ci@dpdk.org" Subject: Re: [EXT] Re: [PATCH v2] pw_maintainers_cli: enhance ci tree selection In-Reply-To: (Pavan Nikhilesh Bhagavatula's message of "Thu, 7 Dec 2023 13:33:58 +0000") References: <20230929083443.9925-1-pbhagavatula@marvell.com> <20230929131714.12525-1-pbhagavatula@marvell.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) Date: Thu, 07 Dec 2023 08:44:04 -0500 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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 Pavan Nikhilesh Bhagavatula writes: >> -----Original Message----- >> From: Pavan Nikhilesh Bhagavatula >> Sent: Friday, October 13, 2023 11:25 AM >> To: Aaron Conole >> Cc: Jerin Jacob Kollanukkaran ; alialnu@nvidia.com; >> thomas@monjalon.net; david.marchand@redhat.com; ci@dpdk.org >> Subject: RE: [EXT] Re: [PATCH v2] pw_maintainers_cli: enhance ci tree >> selection >> >> > > From: Pavan Nikhilesh >> > > >> > > When longest prefix match doesnt find a suitable tree, remove the >> > > trees of files belonging to 'drivers/common' and check if there >> > > is any unique tree for the patchset. >> > > >> > > Signed-off-by: Pavan Nikhilesh >> > > --- >> > > v2 Chnages: >> > > - Find tree by removing 'drivers/common' instead of count based >> > > approach. >> > > >> > > tools/pw_maintainers_cli.py | 31 ++++++++++++++++++++++++++----- >> > > 1 file changed, 26 insertions(+), 5 deletions(-) >> > > >> > > diff --git a/tools/pw_maintainers_cli.py b/tools/pw_maintainers_cli.py >> > > index c7b5ba0..ef60df8 100755 >> > > --- a/tools/pw_maintainers_cli.py >> > > +++ b/tools/pw_maintainers_cli.py >> > > @@ -203,13 +203,15 @@ class Maintainers(object): >> > > """ >> > > Return a git tree that matches a list of files.""" >> > > tree_list = [] >> > > + file_tree_map = {} >> > > for _file in files: >> > > _tree = self._get_tree(_file) >> > > # Having no tree means that we accept those changes going >> through >> > a >> > > # subtree (e.g. release notes). >> > > if _tree: >> > > tree_list.append(_tree) >> > > - tree = self.get_common_denominator(tree_list) >> > > + file_tree_map[_file] = _tree >> > > + tree = self.get_common_denominator(tree_list, file_tree_map) >> > > if not tree: >> > > tree = 'git://dpdk.org/dpdk' >> > > return tree >> > > @@ -268,7 +270,7 @@ class Maintainers(object): >> > > self.matched[matching_pattern] = tree >> > > return tree >> > > >> > > - def get_common_denominator(self, tree_list): >> > > + def get_common_denominator(self, tree_list, file_tree_map): >> > > """Finds a common tree by finding the longest common prefix. >> > > Examples for expected output: >> > > dpdk-next-virtio + dpdk = dpdk >> > > @@ -278,7 +280,6 @@ class Maintainers(object): >> > > """ >> > > # Make sure the list is unique. >> > > tree_list = list(set(tree_list)) >> > > - >> > > # Rename dpdk-next-virtio internally to match dpdk-next-net >> > > _tree_list = [ >> > > tree.replace('dpdk-next-virtio', 'dpdk-next-net-virtio') >> > >> > Any reason why this whitespace is dropped here? Otherwise, the patch >> > looks okay - but I don't think this line should be dropped. >> >> The new line removal can be ignored. >> >> > >> > If you agree, I can correct when I merge it. >> > >> >> Yes, please. >> > > Ping Apologies - applied, Thanks! >> Thanks, >> Pavan. >> >> > > @@ -286,11 +287,31 @@ class Maintainers(object): >> > > common_prefix = \ >> > > os.path.commonprefix(_tree_list).rstrip('-').replace( >> > > 'dpdk-next-net-virtio', 'dpdk-next-virtio') >> > > - # There is no 'dpdk-next' named tree. >> > > - if common_prefix.endswith('dpdk-next') or >> > common_prefix.endswith('/'): >> > > + # There is no 'dpdk-next' named tree, remove files that belong >> > > + # to 'drivers/common' and see if we find a tree. >> > > + if common_prefix.endswith('dpdk-next'): >> > > + common_prefix = self.get_filtered_tree(file_tree_map) >> > > + elif common_prefix.endswith('/'): >> > > common_prefix = 'git://dpdk.org/dpdk' >> > > return common_prefix >> > > >> > > + def get_common_files(self, files): >> > > + match_list = [] >> > > + for f in files: >> > > + if re.match(r"drivers\/common", f) is not None: >> > > + match_list.append(f) >> > > + return match_list >> > > + >> > > + def get_filtered_tree(self, file_tree_map): >> > > + # Get list of files that are in 'drivers/common' >> > > + common_list = self.get_common_files(file_tree_map.keys()) >> > > + for c in common_list: >> > > + file_tree_map.pop(c, None) >> > > + tree_list = list(set(file_tree_map.values())) >> > > + if len(tree_list) == 1: >> > > + return tree_list[0] >> > > + return None >> > > + >> > > >> > > if __name__ == '__main__': >> > > """Main procedure.""" >> > > -- >> > > 2.25.1