all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#57646] [PATCH 0/3] teams: Add scope support.
@ 2022-09-07 15:16 Mathieu Othacehe
  2022-09-07 15:21 ` [bug#57646] [PATCH 1/3] etc: " Mathieu Othacehe
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Mathieu Othacehe @ 2022-09-07 15:16 UTC (permalink / raw)
  To: 57646; +Cc: Mathieu Othacehe

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





^ permalink raw reply	[flat|nested] 14+ messages in thread

* [bug#57646] [PATCH 1/3] etc: teams: Add scope support.
  2022-09-07 15:16 [bug#57646] [PATCH 0/3] teams: Add scope support Mathieu Othacehe
@ 2022-09-07 15:21 ` Mathieu Othacehe
  2022-09-07 15:21   ` [bug#57646] [PATCH 2/3] etc: teams: Define core team scope Mathieu Othacehe
  2022-09-07 15:21   ` [bug#57646] [PATCH 3/3] etc: installer: Define installer " Mathieu Othacehe
  2022-09-09 15:27 ` [bug#57646] [PATCH] etc: teams: Add regular expression support to scopes Liliana Marie Prikler
  2022-09-12 13:55 ` [bug#57646] [PATCH v2 1/4] etc: teams: Add scope support Mathieu Othacehe
  2 siblings, 2 replies; 14+ messages in thread
From: Mathieu Othacehe @ 2022-09-07 15:21 UTC (permalink / raw)
  To: 57646; +Cc: Mathieu Othacehe

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@elephly.net>
+;;; Copyright © 2022 Mathieu Othacehe <othacehe@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))
 
+\f
+(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))
+
+\f
 (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





^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [bug#57646] [PATCH 2/3] etc: teams: Define core team scope.
  2022-09-07 15:21 ` [bug#57646] [PATCH 1/3] etc: " Mathieu Othacehe
@ 2022-09-07 15:21   ` Mathieu Othacehe
  2022-09-07 15:21   ` [bug#57646] [PATCH 3/3] etc: installer: Define installer " Mathieu Othacehe
  1 sibling, 0 replies; 14+ messages in thread
From: Mathieu Othacehe @ 2022-09-07 15:21 UTC (permalink / raw)
  To: 57646; +Cc: Mathieu Othacehe

* 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





^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [bug#57646] [PATCH 3/3] etc: installer: Define installer team scope.
  2022-09-07 15:21 ` [bug#57646] [PATCH 1/3] etc: " Mathieu Othacehe
  2022-09-07 15:21   ` [bug#57646] [PATCH 2/3] etc: teams: Define core team scope Mathieu Othacehe
@ 2022-09-07 15:21   ` Mathieu Othacehe
  1 sibling, 0 replies; 14+ messages in thread
From: Mathieu Othacehe @ 2022-09-07 15:21 UTC (permalink / raw)
  To: 57646; +Cc: Mathieu Othacehe

* 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





^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [bug#57646] [PATCH] etc: teams: Add regular expression support to scopes.
  2022-09-07 15:16 [bug#57646] [PATCH 0/3] teams: Add scope support Mathieu Othacehe
  2022-09-07 15:21 ` [bug#57646] [PATCH 1/3] etc: " Mathieu Othacehe
@ 2022-09-09 15:27 ` Liliana Marie Prikler
  2022-09-11 16:36   ` Mathieu Othacehe
  2022-09-12 13:55 ` [bug#57646] [PATCH v2 1/4] etc: teams: Add scope support Mathieu Othacehe
  2 siblings, 1 reply; 14+ messages in thread
From: Liliana Marie Prikler @ 2022-09-09 15:27 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: 57646

* 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





^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [bug#57646] [PATCH] etc: teams: Add regular expression support to scopes.
  2022-09-09 15:27 ` [bug#57646] [PATCH] etc: teams: Add regular expression support to scopes Liliana Marie Prikler
@ 2022-09-11 16:36   ` Mathieu Othacehe
  2022-09-12 10:30     ` Ricardo Wurmus
  0 siblings, 1 reply; 14+ messages in thread
From: Mathieu Othacehe @ 2022-09-11 16:36 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: Ricardo Wurmus, 57646


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




^ permalink raw reply	[flat|nested] 14+ messages in thread

* [bug#57646] [PATCH] etc: teams: Add regular expression support to scopes.
  2022-09-11 16:36   ` Mathieu Othacehe
@ 2022-09-12 10:30     ` Ricardo Wurmus
  2022-09-12 13:49       ` Mathieu Othacehe
  0 siblings, 1 reply; 14+ messages in thread
From: Ricardo Wurmus @ 2022-09-12 10:30 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: 57646, Liliana Marie Prikler


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




^ permalink raw reply	[flat|nested] 14+ messages in thread

* [bug#57646] [PATCH] etc: teams: Add regular expression support to scopes.
  2022-09-12 10:30     ` Ricardo Wurmus
@ 2022-09-12 13:49       ` Mathieu Othacehe
  0 siblings, 0 replies; 14+ messages in thread
From: Mathieu Othacehe @ 2022-09-12 13:49 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: 57646, Liliana Marie Prikler


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




^ permalink raw reply	[flat|nested] 14+ messages in thread

* [bug#57646] [PATCH v2 1/4] etc: teams: Add scope support.
  2022-09-07 15:16 [bug#57646] [PATCH 0/3] teams: Add scope support Mathieu Othacehe
  2022-09-07 15:21 ` [bug#57646] [PATCH 1/3] etc: " Mathieu Othacehe
  2022-09-09 15:27 ` [bug#57646] [PATCH] etc: teams: Add regular expression support to scopes Liliana Marie Prikler
@ 2022-09-12 13:55 ` Mathieu Othacehe
  2022-09-12 13:55   ` [bug#57646] [PATCH v2 2/4] etc: teams: Add regular expression support to scopes Mathieu Othacehe
                     ` (3 more replies)
  2 siblings, 4 replies; 14+ messages in thread
From: Mathieu Othacehe @ 2022-09-12 13:55 UTC (permalink / raw)
  To: 57646; +Cc: Mathieu Othacehe

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@elephly.net>
+;;; Copyright © 2022 Mathieu Othacehe <othacehe@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))
 
+\f
+(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))
+
+\f
 (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





^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [bug#57646] [PATCH v2 2/4] etc: teams: Add regular expression support to scopes.
  2022-09-12 13:55 ` [bug#57646] [PATCH v2 1/4] etc: teams: Add scope support Mathieu Othacehe
@ 2022-09-12 13:55   ` Mathieu Othacehe
  2022-09-12 13:55   ` [bug#57646] [PATCH v2 3/4] etc: teams: Define core team scope Mathieu Othacehe
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 14+ messages in thread
From: Mathieu Othacehe @ 2022-09-12 13:55 UTC (permalink / raw)
  To: 57646; +Cc: Mathieu Othacehe, Liliana Marie Prikler

From: Liliana Marie Prikler <liliana.prikler@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@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





^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [bug#57646] [PATCH v2 3/4] etc: teams: Define core team scope.
  2022-09-12 13:55 ` [bug#57646] [PATCH v2 1/4] etc: teams: Add scope support Mathieu Othacehe
  2022-09-12 13:55   ` [bug#57646] [PATCH v2 2/4] etc: teams: Add regular expression support to scopes Mathieu Othacehe
@ 2022-09-12 13:55   ` Mathieu Othacehe
  2022-09-12 13:55   ` [bug#57646] [PATCH v2 4/4] etc: installer: Define installer " Mathieu Othacehe
  2022-09-24 10:21   ` [bug#57646] [PATCH 0/3] teams: Add scope support Ludovic Courtès
  3 siblings, 0 replies; 14+ messages in thread
From: Mathieu Othacehe @ 2022-09-12 13:55 UTC (permalink / raw)
  To: 57646; +Cc: Mathieu Othacehe

* 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





^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [bug#57646] [PATCH v2 4/4] etc: installer: Define installer team scope.
  2022-09-12 13:55 ` [bug#57646] [PATCH v2 1/4] etc: teams: Add scope support Mathieu Othacehe
  2022-09-12 13:55   ` [bug#57646] [PATCH v2 2/4] etc: teams: Add regular expression support to scopes Mathieu Othacehe
  2022-09-12 13:55   ` [bug#57646] [PATCH v2 3/4] etc: teams: Define core team scope Mathieu Othacehe
@ 2022-09-12 13:55   ` Mathieu Othacehe
  2022-09-24 10:21   ` [bug#57646] [PATCH 0/3] teams: Add scope support Ludovic Courtès
  3 siblings, 0 replies; 14+ messages in thread
From: Mathieu Othacehe @ 2022-09-12 13:55 UTC (permalink / raw)
  To: 57646; +Cc: Mathieu Othacehe

* 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





^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [bug#57646] [PATCH 0/3] teams: Add scope support.
  2022-09-12 13:55 ` [bug#57646] [PATCH v2 1/4] etc: teams: Add scope support Mathieu Othacehe
                     ` (2 preceding siblings ...)
  2022-09-12 13:55   ` [bug#57646] [PATCH v2 4/4] etc: installer: Define installer " Mathieu Othacehe
@ 2022-09-24 10:21   ` Ludovic Courtès
  2022-09-25 11:54     ` bug#57646: " Mathieu Othacehe
  3 siblings, 1 reply; 14+ messages in thread
From: Ludovic Courtès @ 2022-09-24 10:21 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: 57646

Hi,

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

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#57646: [PATCH 0/3] teams: Add scope support.
  2022-09-24 10:21   ` [bug#57646] [PATCH 0/3] teams: Add scope support Ludovic Courtès
@ 2022-09-25 11:54     ` Mathieu Othacehe
  0 siblings, 0 replies; 14+ messages in thread
From: Mathieu Othacehe @ 2022-09-25 11:54 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 57646-done


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




^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-09-25 12:38 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-07 15:16 [bug#57646] [PATCH 0/3] teams: Add scope support Mathieu Othacehe
2022-09-07 15:21 ` [bug#57646] [PATCH 1/3] etc: " Mathieu Othacehe
2022-09-07 15:21   ` [bug#57646] [PATCH 2/3] etc: teams: Define core team scope Mathieu Othacehe
2022-09-07 15:21   ` [bug#57646] [PATCH 3/3] etc: installer: Define installer " Mathieu Othacehe
2022-09-09 15:27 ` [bug#57646] [PATCH] etc: teams: Add regular expression support to scopes Liliana Marie Prikler
2022-09-11 16:36   ` Mathieu Othacehe
2022-09-12 10:30     ` Ricardo Wurmus
2022-09-12 13:49       ` Mathieu Othacehe
2022-09-12 13:55 ` [bug#57646] [PATCH v2 1/4] etc: teams: Add scope support Mathieu Othacehe
2022-09-12 13:55   ` [bug#57646] [PATCH v2 2/4] etc: teams: Add regular expression support to scopes Mathieu Othacehe
2022-09-12 13:55   ` [bug#57646] [PATCH v2 3/4] etc: teams: Define core team scope Mathieu Othacehe
2022-09-12 13:55   ` [bug#57646] [PATCH v2 4/4] etc: installer: Define installer " Mathieu Othacehe
2022-09-24 10:21   ` [bug#57646] [PATCH 0/3] teams: Add scope support Ludovic Courtès
2022-09-25 11:54     ` bug#57646: " Mathieu Othacehe

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.