qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Cleber Rosa" <crosa@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"John Snow" <jsnow@redhat.com>
Subject: [RFC PATCH 7/9] scripts/get_maintainer.py: add support for -f
Date: Thu, 11 Dec 2025 18:01:30 +0000	[thread overview]
Message-ID: <20251211180132.3186564-8-alex.bennee@linaro.org> (raw)
In-Reply-To: <20251211180132.3186564-1-alex.bennee@linaro.org>

Now we have our sections we can add support for checking each file
against the maintainer list and gathering the ones we want. Finally we
can print the list out.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 scripts/get_maintainer.py | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/scripts/get_maintainer.py b/scripts/get_maintainer.py
index 7b8ce2b65e3..bf45865438e 100755
--- a/scripts/get_maintainer.py
+++ b/scripts/get_maintainer.py
@@ -129,6 +129,32 @@ def __init__(self, section, entries):
             else:
                 raise UnhandledTag(f"'{tag}' is not understood.")
 
+    def __str__(self) -> str:
+        entries = []
+
+        for m in self.maintainers:
+            entries.append(f"{m.name} <{m.email}> (maintainer: {self.section})")
+
+        for r in self.reviewers:
+            entries.append(f"{r.name} <{r.email}> (reviewer: {self.section})")
+
+        for l in self.lists:
+            entries.append(f"{l} (open list: {self.section})")
+
+        return "\n".join(entries)
+
+    def is_file_covered(self, filename):
+        "Is filename covered by this maintainer section"
+
+        for fx in self.files_exclude:
+            if filename.match(fx):
+                return False
+
+        for f in self.files:
+            if filename.match(f):
+                return True
+
+        return False
 
 
 def read_maintainers(src):
@@ -279,6 +305,15 @@ def main():
         print(f"loaded {len(maint_sections)} from MAINTAINERS")
         exit(0)
 
+    relevent_maintainers = None
+
+    if args.file:
+        relevent_maintainers = [ms for ms in maint_sections if
+                                ms.is_file_covered(args.file)]
+
+    for rm in relevent_maintainers:
+        print(rm)
+
 
 if __name__ == '__main__':
     main()
-- 
2.47.3



  parent reply	other threads:[~2025-12-11 18:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-11 18:01 [RFC PATCH 0/9] for 11.0 conversion* of get_maintainers.pl to python Alex Bennée
2025-12-11 18:01 ` [RFC PATCH 1/9] MAINTAINERS: fix missing names Alex Bennée
2025-12-11 18:01 ` [RFC PATCH 2/9] MAINTAINERS: fix libvirt entry Alex Bennée
2025-12-12  6:45   ` Philippe Mathieu-Daudé
2025-12-12 11:00     ` Alex Bennée
2025-12-12 11:12       ` Ján Tomko
2025-12-11 18:01 ` [RFC PATCH 3/9] MAINTAINERS: regularise the status fields Alex Bennée
2025-12-12  6:43   ` Philippe Mathieu-Daudé
2025-12-11 18:01 ` [RFC PATCH 4/9] scripts/get_maintainer.py: minimal argument parsing Alex Bennée
2025-12-11 18:01 ` [RFC PATCH 5/9] scripts/get_maintainer.py: resolve the source path Alex Bennée
2025-12-11 18:01 ` [RFC PATCH 6/9] scripts/get_maintainer.py: initial parsing of MAINTAINERS Alex Bennée
2025-12-11 18:01 ` Alex Bennée [this message]
2025-12-11 18:01 ` [RFC PATCH 8/9] scripts/get_maintainer.py: add support reading patch files Alex Bennée
2025-12-11 18:01 ` [RFC PATCH 9/9] gitlab: add a check-maintainers task Alex Bennée
2025-12-12  8:15 ` [RFC PATCH 0/9] for 11.0 conversion* of get_maintainers.pl to python Daniel P. Berrangé
2025-12-12 11:00   ` Alex Bennée
2025-12-12 11:25     ` Peter Maydell
2025-12-12 11:27 ` Peter Maydell
2025-12-12 14:38 ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251211180132.3186564-8-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=crosa@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).