GNU bug report logs - #57646
[PATCH 0/3] teams: Add scope support.

Previous Next

Package: guix-patches;

Reported by: Mathieu Othacehe <othacehe <at> gnu.org>

Date: Wed, 7 Sep 2022 15:21:02 UTC

Severity: normal

Tags: patch

Done: Mathieu Othacehe <othacehe <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 57646 in the body.
You can then email your comments to 57646 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#57646; Package guix-patches. (Wed, 07 Sep 2022 15:21:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mathieu Othacehe <othacehe <at> gnu.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 07 Sep 2022 15:21:02 GMT) Full text and rfc822 format available.

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

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: guix-patches <at> gnu.org
Cc: Mathieu Othacehe <othacehe <at> gnu.org>
Subject: [PATCH 0/3] teams: Add scope support.
Date: Wed,  7 Sep 2022 17:16:22 +0200
Hello,

This adds scope support to the teams script. Each team can define the set of
files and directories that it mentors.

The user can then run:

git send-email $(./etc/teams cc-members HEAD^^ HEAD) *.patch

to automatically CC the members that mentoring the impacted files.

This series also proposes a scope for the core and installer teams.

To go further each team could define its own scope and we could
add the above command to the documentation to maximize the
chances that the right members are CC'ed for each new patch.

Thanks,

Mathieu

Mathieu Othacehe (3):
  etc: teams: Add scope support.
  etc: teams: Define core team scope.
  etc: installer: Define installer team scope.

 etc/teams.scm.in | 163 +++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 152 insertions(+), 11 deletions(-)

-- 
2.37.2





Information forwarded to guix-patches <at> gnu.org:
bug#57646; Package guix-patches. (Wed, 07 Sep 2022 15:25:02 GMT) Full text and rfc822 format available.

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

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: 57646 <at> debbugs.gnu.org
Cc: Mathieu Othacehe <othacehe <at> gnu.org>
Subject: [PATCH 1/3] etc: teams: Add scope support.
Date: Wed,  7 Sep 2022 17:21:48 +0200
Add a scope list to each team.  This list defines all the files and
directories that are mentored by the team.

Also add a cc-members command that takes two Git revision strings as input,
add returns the members that should be CC'ed given the files impacted between
the two revisions.

* etc/teams.scm.in (<team>)[scope]: New field.
(team, list-teams): Adapt those procedures.
(find-team-by-scope, diff-revisions): New procedures.
(main): Add a "cc-members" command.
---
 etc/teams.scm.in | 74 ++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 65 insertions(+), 9 deletions(-)

diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index 38b7ab8e1d..37937a02ff 100644
--- a/etc/teams.scm.in
+++ b/etc/teams.scm.in
@@ -4,6 +4,7 @@
 
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2022 Ricardo Wurmus <rekado <at> elephly.net>
+;;; Copyright © 2022 Mathieu Othacehe <othacehe <at> gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -22,23 +23,27 @@
 
 ;;; Commentary:
 
-;; This code defines development teams and team members.
+;; This code defines development teams and team members, as well as their
+;; scope.
 
 ;;; Code:
 
 (use-modules (srfi srfi-1)
              (srfi srfi-9)
+             (srfi srfi-26)
              (ice-9 format)
              (ice-9 match)
-             (guix ui))
+             (guix ui)
+             (git))
 
 (define-record-type <team>
-  (make-team id name description members)
+  (make-team id name description members scope)
   team?
   (id          team-id)
   (name        team-name)
   (description team-description)
-  (members     team-members set-team-members!))
+  (members     team-members set-team-members!)
+  (scope       team-scope))
 
 (define-record-type <person>
   (make-person name email)
@@ -49,11 +54,13 @@ (define-record-type <person>
 (define* (person name #:optional email)
   (make-person name email))
 
-(define* (team id #:key name description (members '()))
+(define* (team id #:key name description (members '())
+               (scope '()))
   (make-team id
              (or name (symbol->string id))
              description
-             members))
+             members
+             scope))
 
 (define %teams
   (make-hash-table))
@@ -268,6 +275,22 @@ (define (find-team name)
       (error (format #false
                            "no such team: ~a~%" name))))
 
+(define (find-team-by-scope files)
+  "Return the team(s) which scope matches at least one of the FILES, as list
+of file names as string."
+  (hash-fold
+   (lambda (key team acc)
+     (if (any (lambda (file)
+                (any (lambda (scope)
+                       ;; XXX: Add regex support?
+                       (string-prefix? scope file))
+                     (team-scope team)))
+              files)
+         (cons team acc)
+         acc))
+   '()
+   %teams))
+
 (define (cc . teams)
   "Return arguments for `git send-email' to notify the members of the given
 TEAMS when a patch is received by Debbugs."
@@ -289,7 +312,7 @@ (define port* (or port (current-output-port)))
    (team-members team)))
 
 (define (list-teams)
-  "Print all teams and their members."
+  "Print all teams, their scope and their members."
   (define port* (current-output-port))
   (define width* (%text-width))
   (hash-for-each
@@ -299,7 +322,7 @@ (define width* (%text-width))
 id: ~a
 name: ~a
 description: ~a
-members:
+~amembers:
 "
              (team-id team)
              (team-name team)
@@ -308,15 +331,48 @@ (define width* (%text-width))
                           (string->recutils
                            (fill-paragraph text width*
                                            (string-length "description: ")))))
-                 "<none>"))
+                 "<none>")
+             (if (not (null? (team-scope team)))
+                 (format #f "scope: ~{~s ~}~%" (team-scope team))
+                 ""))
      (list-members team port* "+ ")
      (newline))
    %teams))
 
+
+(define (diff-revisions rev-start rev-end)
+  "Return the list of added, modified or removed files between REV-START
+and REV-END, two git revision strings."
+  (let* ((repository (repository-open (getcwd)))
+         (commit1 (commit-lookup repository
+                                 (object-id
+                                  (revparse-single repository rev-start))))
+         (commit2 (commit-lookup repository
+                                 (object-id
+                                  (revparse-single repository rev-end))))
+         (diff (diff-tree-to-tree repository
+                                  (commit-tree commit1)
+                                  (commit-tree commit2)))
+         (files '()))
+    (diff-foreach
+     diff
+     (lambda (delta progress)
+       (set! files
+             (cons (diff-file-path (diff-delta-old-file delta)) files))
+       0)
+     (const 0)
+     (const 0)
+     (const 0))
+    files))
+
+
 (define (main . args)
   (match args
     (("cc" . team-names)
      (apply cc (map find-team team-names)))
+    (("cc-members" rev-start rev-end)
+     (apply cc (find-team-by-scope
+                (diff-revisions rev-start rev-end))))
     (("list-teams" . args)
      (list-teams))
     (("list-members" . team-names)
-- 
2.37.2





Information forwarded to guix-patches <at> gnu.org:
bug#57646; Package guix-patches. (Wed, 07 Sep 2022 15:25:02 GMT) Full text and rfc822 format available.

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

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: 57646 <at> debbugs.gnu.org
Cc: Mathieu Othacehe <othacehe <at> gnu.org>
Subject: [PATCH 2/3] etc: teams: Define core team scope.
Date: Wed,  7 Sep 2022 17:21:49 +0200
* etc/teams.scm.in (core): Define it.
---
 etc/teams.scm.in | 84 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 83 insertions(+), 1 deletion(-)

diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index 37937a02ff..0979e5cade 100644
--- a/etc/teams.scm.in
+++ b/etc/teams.scm.in
@@ -161,7 +161,89 @@ (define-team kernel
 
 (define-team core
   (team 'core
-        #:name "Core / Tools / Internals"))
+        #:name "Core / Tools / Internals"
+        #:scope
+        '("guix/avahi.scm"
+          "guix/base16.scm"
+          "guix/base32.scm"
+          "guix/base64.scm"
+          "guix/bzr-download.scm"
+          "guix/cache.scm"
+          "guix/channels.scm"
+          "guix/ci.scm"
+          "guix/colors.scm"
+          "guix/combinators.scm"
+          "guix/config.scm"
+          "guix/cpio.scm"
+          "guix/cpu.scm"
+          "guix/cve.scm"
+          "guix/cvs-download.scm"
+          "guix/deprecation.scm"
+          "guix/derivations.scm"
+          "guix/describe.scm"
+          "guix/diagnostics.scm"
+          "guix/discovery.scm"
+          "guix/docker.scm"
+          "guix/download.scm"
+          "guix/elf.scm"
+          "guix/ftp-client.scm"
+          "guix/gexp.scm"
+          "guix/git-authenticate.scm"
+          "guix/git-download.scm"
+          "guix/git.scm"
+          "guix/glob.scm"
+          "guix/gnu-maintenance.scm"
+          "guix/gnupg.scm"
+          "guix/grafts.scm"
+          "guix/graph.scm"
+          "guix/hash.scm"
+          "guix/hg-download.scm"
+          "guix/http-client.scm"
+          "guix/i18n.scm"
+          "guix/inferior.scm"
+          "guix/ipfs.scm"
+          "guix/least-authority.scm"
+          "guix/licenses.scm"
+          "guix/lint.scm"
+          "guix/man-db.scm"
+          "guix/memoization.scm"
+          "guix/modules.scm"
+          "guix/monad-repl.scm"
+          "guix/monads.scm"
+          "guix/narinfo.scm"
+          "guix/nar.scm"
+          "guix/openpgp.scm"
+          "guix/packages.scm"
+          "guix/pki.scm"
+          "guix/platform.scm"
+          "guix/platforms/"
+          "guix/profiles.scm"
+          "guix/profiling.scm"
+          "guix/progress.scm"
+          "guix/quirks.scm"
+          "guix/read-print.scm"
+          "guix/records.scm"
+          "guix/remote.scm"
+          "guix/repl.scm"
+          "guix/scripts/"
+          "guix/search-paths.scm"
+          "guix/self.scm"
+          "guix/serialization.scm"
+          "guix/sets.scm"
+          "guix/ssh.scm"
+          "guix/status.scm"
+          "guix/store.scm"
+          "guix/store/"
+          "guix/substitutes.scm"
+          "guix/svn-download.scm"
+          "guix/swh.scm"
+          "guix/tests.scm"
+          "guix/tests/"
+          "guix/transformations.scm"
+          "guix/ui.scm"
+          "guix/upstream.scm"
+          "guix/utils.scm"
+          "guix/workers.scm")))
 
 (define-team games
   (team 'games
-- 
2.37.2





Information forwarded to guix-patches <at> gnu.org:
bug#57646; Package guix-patches. (Wed, 07 Sep 2022 15:25:03 GMT) Full text and rfc822 format available.

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

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: 57646 <at> debbugs.gnu.org
Cc: Mathieu Othacehe <othacehe <at> gnu.org>
Subject: [PATCH 3/3] etc: installer: Define installer team scope.
Date: Wed,  7 Sep 2022 17:21:50 +0200
* etc/teams.scm.in (installer): Define it.
---
 etc/teams.scm.in | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index 0979e5cade..42da1ab1fc 100644
--- a/etc/teams.scm.in
+++ b/etc/teams.scm.in
@@ -255,7 +255,10 @@ (define-team translations
 
 (define-team installer
   (team 'installer
-        #:name "Installer script and system installer"))
+        #:name "Installer script and system installer"
+        #:scope
+        '("gnu/installer.scm"
+          "gnu/installer/")))
 
 (define-team home
   (team 'home
-- 
2.37.2





Information forwarded to guix-patches <at> gnu.org:
bug#57646; Package guix-patches. (Fri, 09 Sep 2022 15:41:02 GMT) Full text and rfc822 format available.

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

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Mathieu Othacehe <othacehe <at> gnu.org>
Cc: 57646 <at> debbugs.gnu.org
Subject: [PATCH] etc: teams: Add regular expression support to scopes.
Date: Fri, 9 Sep 2022 17:27:23 +0200
* etc/teams.scm (find-teams-by-scope): Differentiate between raw strings
and regexps.  Make raw string matches strict.
---
Hi Mathieu,

this is a fixup to your 1/3 patch, making it so that regexps are supported.
Note, that for the installer team you should now define the scope as
(list "gnu/installer.scm" (make-regexp "^guix/installer/")) or simply
(list (make-regexp "^guix/installer(\\.scm$|/)")).

Cheers

 etc/teams.scm.in | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index 37937a02ff..24664e9c0e 100644
--- a/etc/teams.scm.in
+++ b/etc/teams.scm.in
@@ -32,6 +32,7 @@
              (srfi srfi-9)
              (srfi srfi-26)
              (ice-9 format)
+             (ice-9 regex)
              (ice-9 match)
              (guix ui)
              (git))
@@ -281,9 +282,11 @@ (define (find-team-by-scope files)
   (hash-fold
    (lambda (key team acc)
      (if (any (lambda (file)
-                (any (lambda (scope)
-                       ;; XXX: Add regex support?
-                       (string-prefix? scope file))
+                (any (match-lambda
+                       ((? string? scope)
+                        (string=? scope file))
+                       ((? regexp? scope)
+                        (regexp-exec scope file)))
                      (team-scope team)))
               files)
          (cons team acc)
-- 
2.37.2





Information forwarded to guix-patches <at> gnu.org:
bug#57646; Package guix-patches. (Sun, 11 Sep 2022 16:37:02 GMT) Full text and rfc822 format available.

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

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: Ricardo Wurmus <rekado <at> elephly.net>, 57646 <at> debbugs.gnu.org
Subject: Re: [PATCH] etc: teams: Add regular expression support to scopes.
Date: Sun, 11 Sep 2022 18:36:49 +0200
Hey Liliana,

> this is a fixup to your 1/3 patch, making it so that regexps are supported.
> Note, that for the installer team you should now define the scope as
> (list "gnu/installer.scm" (make-regexp "^guix/installer/")) or simply
> (list (make-regexp "^guix/installer(\\.scm$|/)")).

Thanks for the improvement :) Ricardo, any thoughts on this series?

Mathieu




Information forwarded to guix-patches <at> gnu.org:
bug#57646; Package guix-patches. (Mon, 12 Sep 2022 10:37:02 GMT) Full text and rfc822 format available.

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

From: Ricardo Wurmus <rekado <at> elephly.net>
To: Mathieu Othacehe <othacehe <at> gnu.org>
Cc: 57646 <at> debbugs.gnu.org, Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Subject: Re: [PATCH] etc: teams: Add regular expression support to scopes.
Date: Mon, 12 Sep 2022 12:30:35 +0200
Hi Mathieu,

> Thanks for the improvement :) Ricardo, any thoughts on this series?

This looks like a good idea to me, thanks!

Just three comments:

* the dependency on Guile-Git means that the script must be run inside a
  suitable environment now, whereas previously it had no dependencies
  other than Guile.  If we can assume that people use Guix perhaps we
  should do what doc/build.scm does and use Guix to arrange for
  dependencies to be available.

* I don’t like the “if” + “null?” pattern:

+             (if (not (null? (team-scope team)))
+                 (format #f "scope: ~{~s ~}~%" (team-scope team))
+                 ""))

  I’d prefer using match:

  (match (team-scope team)
    (() "")
    (scope (format #f "scope: ~{~s ~}~%" scope)

* With Liliana’s added support for regexes, the previous patch to record
  scopes for the installer etc should be adjusted.


-- 
Ricardo




Information forwarded to guix-patches <at> gnu.org:
bug#57646; Package guix-patches. (Mon, 12 Sep 2022 13:50:02 GMT) Full text and rfc822 format available.

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

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Ricardo Wurmus <rekado <at> elephly.net>
Cc: 57646 <at> debbugs.gnu.org, Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Subject: Re: [PATCH] etc: teams: Add regular expression support to scopes.
Date: Mon, 12 Sep 2022 15:49:32 +0200
Hey,

> * the dependency on Guile-Git means that the script must be run inside a
>   suitable environment now, whereas previously it had no dependencies
>   other than Guile.  If we can assume that people use Guix perhaps we
>   should do what doc/build.scm does and use Guix to arrange for
>   dependencies to be available.

Right, for now I went for the easiest solution and proposed the following
example in the documentation:

--8<---------------cut here---------------start------------->8---
$ guix shell -D guix
[env]$ git send-email $(./etc/teams.scm cc-members HEAD~2 HEAD) *.patch
--8<---------------cut here---------------end--------------->8---

> * I don’t like the “if” + “null?” pattern:
>
> +             (if (not (null? (team-scope team)))
> +                 (format #f "scope: ~{~s ~}~%" (team-scope team))
> +                 ""))
>
>   I’d prefer using match:
>
>   (match (team-scope team)
>     (() "")
>     (scope (format #f "scope: ~{~s ~}~%" scope)
>
> * With Liliana’s added support for regexes, the previous patch to record
>   scopes for the installer etc should be adjusted.

Fixed!

Thanks,

Mathieu




Information forwarded to guix-patches <at> gnu.org:
bug#57646; Package guix-patches. (Mon, 12 Sep 2022 13:57:02 GMT) Full text and rfc822 format available.

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

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: 57646 <at> debbugs.gnu.org
Cc: Mathieu Othacehe <othacehe <at> gnu.org>,
 Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Subject: [PATCH v2 2/4] etc: teams: Add regular expression support to scopes.
Date: Mon, 12 Sep 2022 15:55:43 +0200
From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>

* etc/teams.scm (find-teams-by-scope): Differentiate between raw strings
and regexps.  Make raw string matches strict.

Signed-off-by: Mathieu Othacehe <othacehe <at> gnu.org>
---
 etc/teams.scm.in | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index 22177422c2..34cc547b26 100644
--- a/etc/teams.scm.in
+++ b/etc/teams.scm.in
@@ -32,6 +32,7 @@
              (srfi srfi-9)
              (srfi srfi-26)
              (ice-9 format)
+             (ice-9 regex)
              (ice-9 match)
              (guix ui)
              (git))
@@ -285,9 +286,11 @@ (define (find-team-by-scope files)
   (hash-fold
    (lambda (key team acc)
      (if (any (lambda (file)
-                (any (lambda (scope)
-                       ;; XXX: Add regex support?
-                       (string-prefix? scope file))
+                (any (match-lambda
+                       ((? string? scope)
+                        (string=? scope file))
+                       ((? regexp? scope)
+                        (regexp-exec scope file)))
                      (team-scope team)))
               files)
          (cons team acc)
-- 
2.37.2





Information forwarded to guix-patches <at> gnu.org:
bug#57646; Package guix-patches. (Mon, 12 Sep 2022 13:57:02 GMT) Full text and rfc822 format available.

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

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: 57646 <at> debbugs.gnu.org
Cc: Mathieu Othacehe <othacehe <at> gnu.org>
Subject: [PATCH v2 1/4] etc: teams: Add scope support.
Date: Mon, 12 Sep 2022 15:55:42 +0200
Add a scope list to each team.  This list defines all the files and
directories that are mentored by the team.

Also add a cc-members command that takes two Git revision strings as input,
add returns the members that should be CC'ed given the files impacted between
the two revisions.

* etc/teams.scm.in (<team>)[scope]: New field.
(team, list-teams): Adapt those procedures.
(find-team-by-scope, diff-revisions): New procedures.
(main): Add a "cc-members" command.
* doc/contributing.texi ("Teams"): Document it.
("Sending a Patch Series"): Adapt it.
---
 doc/contributing.texi | 41 ++++++++++++++++++++++++
 etc/teams.scm.in      | 74 +++++++++++++++++++++++++++++++++++++------
 2 files changed, 106 insertions(+), 9 deletions(-)

diff --git a/doc/contributing.texi b/doc/contributing.texi
index 17a54f94cc..7712f63d67 100644
--- a/doc/contributing.texi
+++ b/doc/contributing.texi
@@ -1406,6 +1406,47 @@ for more information.  You can install @command{git send-email} with
 @command{guix install git:send-email}.
 @c Debbugs bug: https://debbugs.gnu.org/db/15/15361.html
 
+To maximize the chances that you patch series is reviewed, the preferred
+submission way is to use the @code{etc/teams.scm} script to notify the
+appropriate team members (@pxref{Teams}).
+
+@unnumberedsubsec Teams
+@anchor{Teams}
+@cindex teams
+
+There are several teams mentoring different parts of the Guix source
+code.  To list all those teams, you can run from a Guix checkout:
+
+@example
+$ ./etc/teams.scm list-teams
+id: mentors
+name: Mentors
+description: A group of mentors who chaperone contributions by newcomers.
+members:
++ Christopher Baines <mail@@cbaines.net>
++ Ricardo Wurmus <rekado@@elephly.net>
++ Mathieu Othacehe <othacehe@@gnu.org>
++ jgart <jgart@@dismail.de>
++ Ludovic Courtès <ludo@@gnu.org>
+@dots{}
+@end example
+
+You can run the following command to have the @code{Mentors} team put in
+CC of a patch series:
+
+@example
+$ git send-email --to XXX@@debbugs.gnu.org $(./etc/teams.scm cc mentors) *.patch
+@end example
+
+The appropriate team or teams can also be inferred from the modified
+files.  For instance, if you want to send the two latest commits of the
+current Git repository to review, you can run:
+
+@example
+$ guix shell -D guix
+[env]$ git send-email --to XXX@@debbugs.gnu.org $(./etc/teams.scm cc-members HEAD~2 HEAD) *.patch
+@end example
+
 @node Tracking Bugs and Patches
 @section Tracking Bugs and Patches
 
diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index 9f220cc489..22177422c2 100644
--- a/etc/teams.scm.in
+++ b/etc/teams.scm.in
@@ -4,6 +4,7 @@
 
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2022 Ricardo Wurmus <rekado <at> elephly.net>
+;;; Copyright © 2022 Mathieu Othacehe <othacehe <at> gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -22,23 +23,27 @@
 
 ;;; Commentary:
 
-;; This code defines development teams and team members.
+;; This code defines development teams and team members, as well as their
+;; scope.
 
 ;;; Code:
 
 (use-modules (srfi srfi-1)
              (srfi srfi-9)
+             (srfi srfi-26)
              (ice-9 format)
              (ice-9 match)
-             (guix ui))
+             (guix ui)
+             (git))
 
 (define-record-type <team>
-  (make-team id name description members)
+  (make-team id name description members scope)
   team?
   (id          team-id)
   (name        team-name)
   (description team-description)
-  (members     team-members set-team-members!))
+  (members     team-members set-team-members!)
+  (scope       team-scope))
 
 (define-record-type <person>
   (make-person name email)
@@ -49,11 +54,13 @@ (define-record-type <person>
 (define* (person name #:optional email)
   (make-person name email))
 
-(define* (team id #:key name description (members '()))
+(define* (team id #:key name description (members '())
+               (scope '()))
   (make-team id
              (or name (symbol->string id))
              description
-             members))
+             members
+             scope))
 
 (define %teams
   (make-hash-table))
@@ -272,6 +279,22 @@ (define (find-team name)
       (error (format #false
                            "no such team: ~a~%" name))))
 
+(define (find-team-by-scope files)
+  "Return the team(s) which scope matches at least one of the FILES, as list
+of file names as string."
+  (hash-fold
+   (lambda (key team acc)
+     (if (any (lambda (file)
+                (any (lambda (scope)
+                       ;; XXX: Add regex support?
+                       (string-prefix? scope file))
+                     (team-scope team)))
+              files)
+         (cons team acc)
+         acc))
+   '()
+   %teams))
+
 (define (cc . teams)
   "Return arguments for `git send-email' to notify the members of the given
 TEAMS when a patch is received by Debbugs."
@@ -293,7 +316,7 @@ (define port* (or port (current-output-port)))
    (team-members team)))
 
 (define (list-teams)
-  "Print all teams and their members."
+  "Print all teams, their scope and their members."
   (define port* (current-output-port))
   (define width* (%text-width))
   (hash-for-each
@@ -303,7 +326,7 @@ (define width* (%text-width))
 id: ~a
 name: ~a
 description: ~a
-members:
+~amembers:
 "
              (team-id team)
              (team-name team)
@@ -312,15 +335,48 @@ (define width* (%text-width))
                           (string->recutils
                            (fill-paragraph text width*
                                            (string-length "description: ")))))
-                 "<none>"))
+                 "<none>")
+             (match (team-scope team)
+               (() "")
+               (scope (format #f "scope: ~{~s ~}~%" scope))))
      (list-members team port* "+ ")
      (newline))
    %teams))
 
+
+(define (diff-revisions rev-start rev-end)
+  "Return the list of added, modified or removed files between REV-START
+and REV-END, two git revision strings."
+  (let* ((repository (repository-open (getcwd)))
+         (commit1 (commit-lookup repository
+                                 (object-id
+                                  (revparse-single repository rev-start))))
+         (commit2 (commit-lookup repository
+                                 (object-id
+                                  (revparse-single repository rev-end))))
+         (diff (diff-tree-to-tree repository
+                                  (commit-tree commit1)
+                                  (commit-tree commit2)))
+         (files '()))
+    (diff-foreach
+     diff
+     (lambda (delta progress)
+       (set! files
+             (cons (diff-file-path (diff-delta-old-file delta)) files))
+       0)
+     (const 0)
+     (const 0)
+     (const 0))
+    files))
+
+
 (define (main . args)
   (match args
     (("cc" . team-names)
      (apply cc (map find-team team-names)))
+    (("cc-members" rev-start rev-end)
+     (apply cc (find-team-by-scope
+                (diff-revisions rev-start rev-end))))
     (("list-teams" . args)
      (list-teams))
     (("list-members" . team-names)
-- 
2.37.2





Information forwarded to guix-patches <at> gnu.org:
bug#57646; Package guix-patches. (Mon, 12 Sep 2022 13:57:03 GMT) Full text and rfc822 format available.

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

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: 57646 <at> debbugs.gnu.org
Cc: Mathieu Othacehe <othacehe <at> gnu.org>
Subject: [PATCH v2 3/4] etc: teams: Define core team scope.
Date: Mon, 12 Sep 2022 15:55:44 +0200
* etc/teams.scm.in (core): Define it.
---
 etc/teams.scm.in | 83 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 82 insertions(+), 1 deletion(-)

diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index 34cc547b26..347af86005 100644
--- a/etc/teams.scm.in
+++ b/etc/teams.scm.in
@@ -162,7 +162,88 @@ (define-team kernel
 
 (define-team core
   (team 'core
-        #:name "Core / Tools / Internals"))
+        #:name "Core / Tools / Internals"
+        #:scope
+        (list "guix/avahi.scm"
+              "guix/base16.scm"
+              "guix/base32.scm"
+              "guix/base64.scm"
+              "guix/bzr-download.scm"
+              "guix/cache.scm"
+              "guix/channels.scm"
+              "guix/ci.scm"
+              "guix/colors.scm"
+              "guix/combinators.scm"
+              "guix/config.scm"
+              "guix/cpio.scm"
+              "guix/cpu.scm"
+              "guix/cve.scm"
+              "guix/cvs-download.scm"
+              "guix/deprecation.scm"
+              "guix/derivations.scm"
+              "guix/describe.scm"
+              "guix/diagnostics.scm"
+              "guix/discovery.scm"
+              "guix/docker.scm"
+              "guix/download.scm"
+              "guix/elf.scm"
+              "guix/ftp-client.scm"
+              "guix/gexp.scm"
+              "guix/git-authenticate.scm"
+              "guix/git-download.scm"
+              "guix/git.scm"
+              "guix/glob.scm"
+              "guix/gnu-maintenance.scm"
+              "guix/gnupg.scm"
+              "guix/grafts.scm"
+              "guix/graph.scm"
+              "guix/hash.scm"
+              "guix/hg-download.scm"
+              "guix/http-client.scm"
+              "guix/i18n.scm"
+              "guix/inferior.scm"
+              "guix/ipfs.scm"
+              "guix/least-authority.scm"
+              "guix/licenses.scm"
+              "guix/lint.scm"
+              "guix/man-db.scm"
+              "guix/memoization.scm"
+              "guix/modules.scm"
+              "guix/monad-repl.scm"
+              "guix/monads.scm"
+              "guix/narinfo.scm"
+              "guix/nar.scm"
+              "guix/openpgp.scm"
+              "guix/packages.scm"
+              "guix/pki.scm"
+              "guix/platform.scm"
+              "guix/profiles.scm"
+              "guix/profiling.scm"
+              "guix/progress.scm"
+              "guix/quirks.scm"
+              "guix/read-print.scm"
+              "guix/records.scm"
+              "guix/remote.scm"
+              "guix/repl.scm"
+              "guix/search-paths.scm"
+              "guix/self.scm"
+              "guix/serialization.scm"
+              "guix/sets.scm"
+              "guix/ssh.scm"
+              "guix/status.scm"
+              "guix/store.scm"
+              "guix/substitutes.scm"
+              "guix/svn-download.scm"
+              "guix/swh.scm"
+              "guix/tests.scm"
+              "guix/transformations.scm"
+              "guix/ui.scm"
+              "guix/upstream.scm"
+              "guix/utils.scm"
+              "guix/workers.scm"
+              (make-regexp "^guix/platforms/")
+              (make-regexp "^guix/scripts/")
+              (make-regexp "^guix/store/"))))
 
 (define-team games
   (team 'games
-- 
2.37.2





Information forwarded to guix-patches <at> gnu.org:
bug#57646; Package guix-patches. (Mon, 12 Sep 2022 13:57:03 GMT) Full text and rfc822 format available.

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

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: 57646 <at> debbugs.gnu.org
Cc: Mathieu Othacehe <othacehe <at> gnu.org>
Subject: [PATCH v2 4/4] etc: installer: Define installer team scope.
Date: Mon, 12 Sep 2022 15:55:45 +0200
* etc/teams.scm.in (installer): Define it.
---
 etc/teams.scm.in | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index 347af86005..5fe7121f56 100644
--- a/etc/teams.scm.in
+++ b/etc/teams.scm.in
@@ -255,7 +255,9 @@ (define-team translations
 
 (define-team installer
   (team 'installer
-        #:name "Installer script and system installer"))
+        #:name "Installer script and system installer"
+        #:scope
+        (list (make-regexp "^guix/installer(\\.scm$|/)"))))
 
 (define-team home
   (team 'home
-- 
2.37.2





Information forwarded to guix-patches <at> gnu.org:
bug#57646; Package guix-patches. (Sat, 24 Sep 2022 10:22:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Mathieu Othacehe <othacehe <at> gnu.org>
Cc: 57646 <at> debbugs.gnu.org
Subject: Re: bug#57646: [PATCH 0/3] teams: Add scope support.
Date: Sat, 24 Sep 2022 12:21:06 +0200
Hi,

I took a look at v2 and it looks great to me!  I think you can push.

Thanks,
Ludo’.




Reply sent to Mathieu Othacehe <othacehe <at> gnu.org>:
You have taken responsibility. (Sun, 25 Sep 2022 11:56:02 GMT) Full text and rfc822 format available.

Notification sent to Mathieu Othacehe <othacehe <at> gnu.org>:
bug acknowledged by developer. (Sun, 25 Sep 2022 11:56:02 GMT) Full text and rfc822 format available.

Message #46 received at 57646-done <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 57646-done <at> debbugs.gnu.org
Subject: Re: bug#57646: [PATCH 0/3] teams: Add scope support.
Date: Sun, 25 Sep 2022 13:54:53 +0200
Hey,

> I took a look at v2 and it looks great to me!  I think you can push.

Pushed, with a mail to guix-devel to inform people!

Thanks,

Mathieu




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 24 Oct 2022 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 182 days ago.

Previous Next


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