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 0824841B7B; Thu, 12 Oct 2023 14:59:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EB74B402E9; Thu, 12 Oct 2023 14:59:13 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id CA60F402C8 for ; Thu, 12 Oct 2023 14:59:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697115551; 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=lOtG2J8Zn5D0Qno3cP0K7Ml+jtl2BCl+RlPbOU+3G/g=; b=KSW5i4gqwqCLQAGNvvdBkQRAApouBIeR0Tont3bjby0RPKBNaOZXJd7kzM33dpps1vayFZ Gkr/xGtu9WlsVZiTyYkDZ6q8pYhY2bMOAv5FeMWczX1RQ0zrk1m+ERnISX/aMmj8u+i3od moaRw9qRo9HrXE4+TWb/yslOB36Gkus= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-661-K7dfhAgbOCKoOe_cq0fXow-1; Thu, 12 Oct 2023 08:59:08 -0400 X-MC-Unique: K7dfhAgbOCKoOe_cq0fXow-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DE2D83C23649; Thu, 12 Oct 2023 12:59:07 +0000 (UTC) Received: from RHTPC1VM0NT (unknown [10.22.34.140]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5ACB5400F5B; Thu, 12 Oct 2023 12:59:07 +0000 (UTC) From: Aaron Conole To: Cc: , , , , Subject: Re: [PATCH v2] pw_maintainers_cli: enhance ci tree selection References: <20230929083443.9925-1-pbhagavatula@marvell.com> <20230929131714.12525-1-pbhagavatula@marvell.com> Date: Thu, 12 Oct 2023 08:59:05 -0400 In-Reply-To: <20230929131714.12525-1-pbhagavatula@marvell.com> (pbhagavatula@marvell.com's message of "Fri, 29 Sep 2023 18:47:14 +0530") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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 writes: > 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. If you agree, I can correct when I merge it. > @@ -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