summary refs log tree commit diff
path: root/etc/teams.scm.in
blob: a2b22cb16580d56e036133abb74e380b0c88830f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
#!@GUILE@ \
--no-auto-compile -s
!#

;;; 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.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;; 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 regex)
             (ice-9 match)
             (guix ui)
             (git))

(define-record-type <team>
  (make-team id name description members scope)
  team?
  (id          team-id)
  (name        team-name)
  (description team-description)
  (members     team-members set-team-members!)
  (scope       team-scope))

(define-record-type <person>
  (make-person name email)
  person?
  (name    person-name)
  (email   person-email))

(define* (person name #:optional email)
  (make-person name email))

(define* (team id #:key name description (members '())
               (scope '()))
  (make-team id
             (or name (symbol->string id))
             description
             members
             scope))

(define %teams
  (make-hash-table))

(define-syntax define-team
  (lambda (x)
    (syntax-case x ()
      ((_ id value)
       #`(begin
           (define-public id value)
           (hash-set! %teams 'id id))))))

(define-syntax-rule (define-member person teams ...)
  (let ((p person))
    (for-each (lambda (team-id)
                (let ((team
                       (hash-ref %teams team-id
                                 (lambda ()
                                   (error (format #false
                                                  "Unknown team ~a for ~a~%"
                                                  team-id p))))))
                  (set-team-members!
                   team (cons p (team-members team)))))
              (quote (teams ...)))))


(define-team python
  (team 'python
        #:name "Python team"
        #:description
        "Python, Python packages, the \"pypi\" importer, and the python-build-system."))

(define-team haskell
  (team 'haskell
        #:name "Haskell team"
        #:description
        "GHC, Hugs, Haskell packages, the \"hackage\" and \"stackage\" importers, and
the haskell-build-system."))

(define-team r
  (team 'r
        #:name "R team"
        #:description
        "The R language, CRAN and Bioconductor repositories, the \"cran\" importer,
and the r-build-system."))

(define-team julia
  (team 'julia
        #:name "Julia team"
        #:description
        "The Julia language, Julia packages, and the julia-build-system."))

(define-team ocaml
  (team 'ocaml
        #:name "OCaml and Dune team"
        #:description
        "The OCaml language, the Dune build system, OCaml packages, the \"opam\"
importer, and the ocaml-build-system."))

(define-team java
  (team 'java
        #:name "Java and Maven team"
        #:description
        "The JDK and JRE, the Maven build system, Java packages, the ant-build-system,
and the maven-build-system."))

(define-team science
  (team 'science
        #:name "Science team"))

(define-team emacs
  (team 'emacs
        #:name "Emacs team"))

(define-team lisp
  (team 'lisp
        #:name "Lisp team"))

(define-team ruby
  (team 'ruby
        #:name "Ruby team"))

(define-team go
  (team 'go
        #:name "Go team"))

(define-team embedded-bootstrap
  (team 'embedded-bootstrap
        #:name "Embedded / Bootstrap"))

(define-team rust
  (team 'rust
        #:name "Rust"))

(define-team kernel
  (team 'kernel
        #:name "Linux-libre kernel team"))

(define-team core
  (team 'core
        #:name "Core / Tools / Internals"))

(define-team games
  (team 'games
        #:name "Games and Videos"))

(define-team translations
  (team 'translations
        #:name "Translations"))

(define-team installer
  (team 'installer
        #:name "Installer script and system installer"))

(define-team home
  (team 'home
        #:name "Team for \"Guix Home\""))

(define-team mentors
  (team 'mentors
        #:name "Mentors"
        #:description
        "A group of mentors who chaperone contributions by newcomers."))

(define-team mozilla
  (team 'mozilla
        #:name "Mozilla"
        #:description
        "Taking care about Icecat and Icedove, built from Mozilla Firefox
and Thunderbird."))

(define-team racket
  (team 'racket
        #:name "Racket team"
        #:description
        "The Racket language and Racket-based languages, Racket packages,
Racket's variant of Chez Scheme, and development of a Racket build system and
importer."))


(define-member (person "Thiago Jung Bauermann"
                       "bauermann@kolabnow.com")
  embedded-bootstrap translations)

(define-member (person "Eric Bavier"
                       "bavier@posteo.net")
  science)

(define-member (person "Lars-Dominik Braun"
                       "lars@6xq.net")
  python haskell)

(define-member (person "Jonathan Brielmaier"
                       "jonathan.brielmaier@web.de")
  mozilla)

(define-member (person "Ludovic Courtès"
                       "ludo@gnu.org")
  core home embedded-bootstrap mentors)

(define-member (person "Andreas Enge"
                       "andreas@enge.fr")
  science)

(define-member (person "Björn Höfling"
                       "bjoern.hoefling@bjoernhoefling.de")
  java)

(define-member (person "Leo Famulari"
                       "leo@famulari.name")
  kernel)

(define-member (person "Efraim Flashner"
                       "efraim@flashner.co.il")
  embedded-bootstrap julia rust science)

(define-member (person "jgart"
                       "jgart@dismail.de")
  python lisp mentors)

(define-member (person "Guillaume Le Vaillant"
                       "glv@posteo.net")
  lisp)

(define-member (person "Julien Lepiller"
                       "julien@lepiller.eu")
  java ocaml translations)

(define-member (person "Philip McGrath"
                       "philip@philipmcgrath.com")
  racket)

(define-member (person "Mathieu Othacehe"
                       "othacehe@gnu.org")
  core installer mentors)

(define-member (person "Florian Pelz"
                       "pelzflorian@pelzflorian.de")
  translations)

(define-member (person "Liliana Marie Prikler"
                       "liliana.prikler@gmail.com")
  emacs games)

(define-member (person "Ricardo Wurmus"
                       "rekado@elephly.net")
  r core mentors)

(define-member (person "Christopher Baines"
                       "mail@cbaines.net")
  core mentors ruby)

(define-member (person "Andrew Tropin"
                       "andrew@trop.in")
  home emacs)


(define (find-team name)
  (or (hash-ref %teams (string->symbol 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 (match-lambda
                       ((? string? scope)
                        (string=? scope file))
                       ((? regexp? scope)
                        (regexp-exec 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."
  (format #true
          "~{--add-header=\"X-Debbugs-Cc: ~a\"~^ ~}"
          (map person-email
               (delete-duplicates (append-map team-members teams) equal?))))

(define* (list-members team #:optional port (prefix ""))
  "Print the members of the given TEAM."
  (define port* (or port (current-output-port)))
  (for-each
   (lambda (member)
     (format port*
             "~a~a <~a>~%"
             prefix
             (person-name member)
             (person-email member)))
   (team-members team)))

(define (list-teams)
  "Print all teams, their scope and their members."
  (define port* (current-output-port))
  (define width* (%text-width))
  (hash-for-each
   (lambda (key team)
     (format port*
             "\
id: ~a
name: ~a
description: ~a
~amembers:
"
             (team-id team)
             (team-name team)
             (or (and=> (team-description team)
                        (lambda (text)
                          (string->recutils
                           (fill-paragraph text width*
                                           (string-length "description: ")))))
                 "<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)
     (for-each
      (lambda (team-name)
        (list-members (find-team team-name)))
      team-names))
    (anything
     (format (current-error-port)
             "Usage: etc/teams.scm <command> [<args>]~%"))))

(apply main (cdr (command-line)))