summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2025-05-23 18:08:05 +0200
committerLudovic Courtès <ludo@gnu.org>2025-05-28 19:20:23 +0200
commit1b7a11efb0e5efd987f795006437888e681751c4 (patch)
tree229c86f5a65681e04d6d1d3d023365b36c5ec5d2
parent38b05ff27bf650f2973524bce7d3164b97f79c35 (diff)
teams: Use suitable team identifiers for Codeberg.
The “c++” team has to be called “cpp”. * etc/teams.scm (team-id->forgejo-id): New procedure. (team->codeowners-snippet): Use it. Change-Id: I10619d8833b5c747504f26b7b0eedb9d61bfd812
-rwxr-xr-xetc/teams.scm16
1 files changed, 15 insertions, 1 deletions
diff --git a/etc/teams.scm b/etc/teams.scm
index a57d132787..9fa189a92c 100755
--- a/etc/teams.scm
+++ b/etc/teams.scm
@@ -1024,13 +1024,27 @@ and REV-END, two git revision strings."
(find-team-by-scope (apply diff-revisions
(git-patch->revisions patch-file)))))
+(define (team-id->forgejo-id id)
+ "Return a name (string) suitable as a Forgejo team name."
+ (define valid ;"AlphaDashDot"
+ (char-set-union char-set:ascii (char-set #\-) (char-set #\.)))
+
+ (define (valid? chr)
+ (char-set-contains? valid chr))
+
+ (string-map (match-lambda
+ (#\+ #\p) ;special case for "c++"
+ ((? valid? chr) chr)
+ (_ #\-))
+ (symbol->string id)))
+
(define (team->codeowners-snippet team)
(string-join (map (lambda (scope)
(format #f "~50a @guix/~a"
(if (regexp*? scope)
(regexp*-pattern scope)
(regexp-quote scope))
- (team-id team)))
+ (team-id->forgejo-id (team-id team))))
(team-scope team))
"\n"
'suffix))