summary refs log tree commit diff
diff options
context:
space:
mode:
authorLiliana Marie Prikler <liliana.prikler@gmail.com>2022-09-09 17:27:23 +0200
committerMathieu Othacehe <othacehe@gnu.org>2022-09-25 09:27:59 +0200
commitb1a7a5723b6a817e9d30ea19154ebc8f12d9f5de (patch)
tree1f0bd4c4f34b6efded0328371458c9dec97ffd8f
parent2a663045351eeb74b8f84e82f073f1e681263152 (diff)
downloadguix-b1a7a5723b6a817e9d30ea19154ebc8f12d9f5de.tar.gz
etc: teams: Add regular expression support to scopes.
* 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>
-rw-r--r--etc/teams.scm.in9
1 files changed, 6 insertions, 3 deletions
diff --git a/etc/teams.scm.in b/etc/teams.scm.in
index 549e31d9f0..a2b22cb165 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))
@@ -289,9 +290,11 @@ 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))
+                (any (match-lambda
+                       ((? string? scope)
+                        (string=? scope file))
+                       ((? regexp? scope)
+                        (regexp-exec scope file)))
                      (team-scope team)))
               files)
          (cons team acc)