GNU bug report logs - #60218
[PATCH 0/2] New teams.scm 'get-maintainer' command (for integration with patman)

Previous Next

Package: guix-patches;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Tue, 20 Dec 2022 13:59:01 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 60218 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60218 <at> debbugs.gnu.org
Cc: Josselin Poiret <dev <at> jpoiret.xyz>, Tobias Geerinckx-Rice <me <at> tobias.gr>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 Simon Tournier <zimon.toutoune <at> gmail.com>, Mathieu Othacehe <othacehe <at> gnu.org>,
 Ludovic Courtès <ludo <at> gnu.org>,
 Christopher Baines <mail <at> cbaines.net>, Ricardo Wurmus <rekado <at> elephly.net>
Subject: [PATCH 1/2] teams: Add a "get-maintainer" command.
Date: Tue, 20 Dec 2022 09:13:29 -0500
This can be used as a compatibility mode with the get_maintainer.pl Perl
script included in the Linux (or U-Boot) source tree.

* etc/teams.scm.in (git-patch->commit-id): New procedure.
(main) <get-maintainer>: Register new command.  Document it.
---

 etc/teams.scm.in | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index aa38a3b798..4f02df79d5 100644
--- a/etc/teams.scm.in
+++ b/etc/teams.scm.in
@@ -5,6 +5,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2022 Ricardo Wurmus <rekado <at> elephly.net>
 ;;; Copyright © 2022 Mathieu Othacehe <othacehe <at> gnu.org>
+;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -34,6 +35,7 @@
              (ice-9 format)
              (ice-9 regex)
              (ice-9 match)
+             (ice-9 rdelim)
              (guix ui)
              (git))
 
@@ -608,6 +610,15 @@ (define (diff-revisions rev-start rev-end)
      (const 0))
     files))
 
+(define (git-patch->commit-id file)
+  "Parse the commit ID from the first line of FILE, a patch produced with git."
+  (call-with-input-file file
+    (lambda (port)
+      (let ((m (string-match "^From ([0-9a-f]{40})" (read-line port))))
+        (unless m
+          (error "invalid patch file:" file))
+        (match:substring m 1)))))
+
 
 (define (main . args)
   (match args
@@ -616,6 +627,14 @@ (define (main . args)
     (("cc-members" rev-start rev-end)
      (apply cc (find-team-by-scope
                 (diff-revisions rev-start rev-end))))
+    (("get-maintainer" patch-file)
+     (let* ((rev-end (git-patch->commit-id patch-file))
+            (rev-start (string-append rev-end "^")))
+       (apply main "list-members"
+              (map symbol->string
+                   (map team-id
+                        (find-team-by-scope
+                         (diff-revisions rev-start rev-end)))))))
     (("list-teams" . args)
      (list-teams))
     (("list-members" . team-names)
@@ -631,6 +650,7 @@ (define (main . args)
   cc <team-name>            get git send-email flags for cc-ing <team-name>
   cc-members <start> <end>  cc teams related to files changed between revisions
   list-teams                list teams and their members
-  list-members <team-name>  list members belonging to <team-name>~%"))))
+  list-members <team-name>  list members belonging to <team-name>~%
+  get-maintainer <patch>    compatibility mode with Linux get_maintainer.pl"))))
 
 (apply main (cdr (command-line)))

base-commit: f28ca2447c5e2eef1ba6a3a11587380a665b0e26
-- 
2.38.1





This bug report was last modified 2 years and 132 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.