Subject: [PATCH] etc: teams: Add regular expression support to scopes.

From: Liliana Marie Prikler <[email-masked]>
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