teams.scm.in 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777
  1. #!@GUILE@ \
  2. --no-auto-compile -s
  3. !#
  4. ;;; GNU Guix --- Functional package management for GNU
  5. ;;; Copyright © 2022, 2023 Ricardo Wurmus <rekado@elephly.net>
  6. ;;; Copyright © 2022 Mathieu Othacehe <othacehe@gnu.org>
  7. ;;; Copyright © 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
  8. ;;;
  9. ;;; This file is part of GNU Guix.
  10. ;;;
  11. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  12. ;;; under the terms of the GNU General Public License as published by
  13. ;;; the Free Software Foundation; either version 3 of the License, or (at
  14. ;;; your option) any later version.
  15. ;;;
  16. ;;; GNU Guix is distributed in the hope that it will be useful, but
  17. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  18. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. ;;; GNU General Public License for more details.
  20. ;;;
  21. ;;; You should have received a copy of the GNU General Public License
  22. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  23. ;;; Commentary:
  24. ;; This code defines development teams and team members, as well as their
  25. ;; scope.
  26. ;;; Code:
  27. (use-modules (srfi srfi-1)
  28. (srfi srfi-9)
  29. (srfi srfi-26)
  30. (ice-9 format)
  31. (ice-9 regex)
  32. (ice-9 match)
  33. (ice-9 rdelim)
  34. (guix ui)
  35. (git))
  36. (define-record-type <team>
  37. (make-team id name description members scope)
  38. team?
  39. (id team-id)
  40. (name team-name)
  41. (description team-description)
  42. (members team-members set-team-members!)
  43. (scope team-scope))
  44. (define-record-type <person>
  45. (make-person name email)
  46. person?
  47. (name person-name)
  48. (email person-email))
  49. (define* (person name #:optional email)
  50. (make-person name email))
  51. (define* (team id #:key name description (members '())
  52. (scope '()))
  53. (make-team id
  54. (or name (symbol->string id))
  55. description
  56. members
  57. scope))
  58. (define %teams
  59. (make-hash-table))
  60. (define-syntax define-team
  61. (lambda (x)
  62. (syntax-case x ()
  63. ((_ id value)
  64. #`(begin
  65. (define-public id value)
  66. (hash-set! %teams 'id id))))))
  67. (define-syntax-rule (define-member person teams ...)
  68. (let ((p person))
  69. (for-each (lambda (team-id)
  70. (let ((team
  71. (hash-ref %teams team-id
  72. (lambda ()
  73. (error (format #false
  74. "Unknown team ~a for ~a~%"
  75. team-id p))))))
  76. (set-team-members!
  77. team (cons p (team-members team)))))
  78. (quote (teams ...)))))
  79. (define-team python
  80. (team 'python
  81. #:name "Python team"
  82. #:description
  83. "Python, Python packages, the \"pypi\" importer, and the python-build-system."
  84. #:scope
  85. (list "gnu/packages/django.scm"
  86. "gnu/packages/jupyter.scm"
  87. ;; Match haskell.scm and haskell-*.scm.
  88. (make-regexp "^gnu/packages/python(-.+|)\\.scm$")
  89. "gnu/packages/sphinx.scm"
  90. "gnu/packages/tryton.scm"
  91. "guix/build/pyproject-build-system.scm"
  92. "guix/build-system/pyproject.scm"
  93. "guix/build/python-build-system.scm"
  94. "guix/build-system/python.scm"
  95. "guix/import/pypi.scm"
  96. "guix/scripts/import/pypi.scm"
  97. "tests/pypi.scm")))
  98. (define-team haskell
  99. (team 'haskell
  100. #:name "Haskell team"
  101. #:description
  102. "GHC, Hugs, Haskell packages, the \"hackage\" and \"stackage\" importers, and
  103. the haskell-build-system."
  104. #:scope
  105. (list "gnu/packages/dhall.scm"
  106. ;; Match haskell.scm and haskell-*.scm.
  107. (make-regexp "^gnu/packages/haskell(-.+|)\\.scm$")
  108. "gnu/packages/purescript.scm"
  109. "guix/build/haskell-build-system.scm"
  110. "guix/build-system/haskell.scm"
  111. "guix/import/cabal.scm"
  112. "guix/import/hackage.scm"
  113. "guix/import/stackage.scm"
  114. "guix/scripts/import/hackage.scm")))
  115. (define-team r
  116. (team 'r
  117. #:name "R team"
  118. #:description
  119. "The R language, CRAN and Bioconductor repositories, the \"cran\" importer,
  120. and the r-build-system."
  121. #:scope (list "gnu/packages/bioconductor.scm"
  122. "gnu/packages/cran.scm"
  123. "guix/build/r-build-system.scm"
  124. "guix/build-system/r.scm"
  125. "guix/import/cran.scm"
  126. "guix/scripts/import/cran.scm"
  127. "tests/cran.scm")))
  128. (define-team tex
  129. (team 'tex
  130. #:name "TeX team"
  131. #:description
  132. "TeX, LaTeX, XeLaTeX, LuaTeX, TeXLive, the texlive-build-system, and
  133. the \"texlive\" importer."
  134. #:scope (list "gnu/packages/tex.scm"
  135. "guix/build/texlive-build-system.scm"
  136. "guix/build-system/texlive.scm"
  137. "guix/import/texlive.scm"
  138. "guix/scripts/import/texlive.scm"
  139. "tests/texlive.scm")))
  140. (define-team julia
  141. (team 'julia
  142. #:name "Julia team"
  143. #:description
  144. "The Julia language, Julia packages, and the julia-build-system."
  145. #:scope (list (make-regexp "^gnu/packages/julia(-.+|)\\.scm$")
  146. "guix/build/julia-build-system.scm"
  147. "guix/build-system/julia.scm")))
  148. (define-team ocaml
  149. (team 'ocaml
  150. #:name "OCaml and Dune team"
  151. #:description
  152. "The OCaml language, the Dune build system, OCaml packages, the \"opam\"
  153. importer, and the ocaml-build-system."
  154. #:scope
  155. (list "gnu/packages/ocaml.scm"
  156. "gnu/packages/coq.scm"
  157. "guix/build/ocaml-build-system.scm"
  158. "guix/build/dune-build-system.scm"
  159. "guix/build-system/ocaml.scm"
  160. "guix/build-system/dune.scm"
  161. "guix/import/opam.scm"
  162. "guix/scripts/import/opam.scm"
  163. "tests/opam.scm")))
  164. (define-team java
  165. (team 'java
  166. #:name "Java and Maven team"
  167. #:description
  168. "The JDK and JRE, the Maven build system, Java packages, the ant-build-system,
  169. and the maven-build-system."
  170. #:scope
  171. (list ;; Match java.scm and java-*.scm.
  172. (make-regexp "^gnu/packages/java(-.+|)\\.scm$")
  173. ;; Match maven.scm and maven-*.scm
  174. (make-regexp "^gnu/packages/maven(-.+|)\\.scm$")
  175. "guix/build/ant-build-system.scm"
  176. "guix/build/java-utils.scm"
  177. "guix/build/maven-build-system.scm"
  178. ;; The maven directory
  179. (make-regexp "^guix/build/maven/")
  180. "guix/build-system/ant.scm"
  181. "guix/build-system/maven.scm")))
  182. (define-team science
  183. (team 'science
  184. #:name "Science team"
  185. #:description "The main science disciplines and fields related
  186. packages (e.g. Astronomy, Chemistry, Math, Physics etc.)"
  187. #:scope (list "gnu/packages/algebra.scm"
  188. "gnu/packages/astronomy.scm"
  189. "gnu/packages/geo.scm"
  190. "gnu/packages/chemistry.scm"
  191. "gnu/packages/maths.scm")))
  192. (define-team emacs
  193. (team 'emacs
  194. #:name "Emacs team"
  195. #:description "The extensible, customizable text editor and its
  196. ecosystem."
  197. #:scope (list (make-regexp "^gnu/packages/emacs(-.+|)\\.scm$")
  198. "guix/build/emacs-build-system.scm"
  199. "guix/build/emacs-utils.scm"
  200. "guix/build-system/emacs.scm"
  201. "guix/import/elpa.scm"
  202. "guix/scripts/import/elpa.scm"
  203. "tests/elpa.scm")))
  204. (define-team lisp
  205. (team 'lisp
  206. #:name "Lisp team"
  207. #:description
  208. "Common Lisp and similar languages, Common Lisp packages and the
  209. asdf-build-system."
  210. #:scope (list (make-regexp "^gnu/packages/lisp(-.+|)\\.scm$")
  211. "guix/build/asdf-build-system.scm"
  212. "guix/build/lisp-utils.scm"
  213. "guix/build-system/asdf.scm")))
  214. (define-team ruby
  215. (team 'ruby
  216. #:name "Ruby team"
  217. #:scope (list "gnu/packages/ruby.scm"
  218. "guix/build/ruby-build-system.scm"
  219. "guix/build-system/ruby.scm"
  220. "guix/import/gem.scm"
  221. "guix/scripts/import/gem.scm"
  222. "tests/gem.scm")))
  223. (define-team go
  224. (team 'go
  225. #:name "Go team"
  226. #:scope (list "gnu/packages/golang.scm"
  227. "guix/build/go-build-system.scm"
  228. "guix/build-system/go.scm"
  229. "guix/import/go.scm"
  230. "guix/scripts/import/go.scm"
  231. "tests/go.scm")))
  232. (define-team bootstrap
  233. (team 'bootstrap
  234. #:name "Bootstrap"
  235. #:scope (list "gnu/packages/mes.scm")))
  236. (define-team embedded
  237. (team 'embedded
  238. #:name "Embedded"
  239. #:scope (list "gnu/packages/bootloaders.scm"
  240. "gnu/packages/firmware.scm")))
  241. (define-team rust
  242. (team 'rust
  243. #:name "Rust"
  244. #:scope (list (make-regexp "^gnu/packages/(crates|rust)(-.+|)\\.scm$")
  245. "gnu/packages/sequoia.scm"
  246. "guix/build/cargo-build-system.scm"
  247. "guix/build/cargo-utils.scm"
  248. "guix/build-system/cargo.scm"
  249. "guix/import/crate.scm"
  250. "guix/scripts/import/crate.scm"
  251. "tests/crate.scm")))
  252. (define-team kernel
  253. (team 'kernel
  254. #:name "Linux-libre kernel team"
  255. #:scope (list "gnu/build/linux-modules.scm"
  256. "gnu/packages/linux.scm"
  257. "gnu/tests/linux-modules.scm"
  258. "guix/build/linux-module-build-system.scm"
  259. "guix/build-system/linux-module.scm")))
  260. (define-team core
  261. (team 'core
  262. #:name "Core / Tools / Internals"
  263. #:scope
  264. (list "guix/avahi.scm"
  265. "guix/base16.scm"
  266. "guix/base32.scm"
  267. "guix/base64.scm"
  268. "guix/bzr-download.scm"
  269. "guix/cache.scm"
  270. "guix/channels.scm"
  271. "guix/ci.scm"
  272. "guix/colors.scm"
  273. "guix/combinators.scm"
  274. "guix/config.scm"
  275. "guix/cpio.scm"
  276. "guix/cpu.scm"
  277. "guix/cve.scm"
  278. "guix/cvs-download.scm"
  279. "guix/deprecation.scm"
  280. "guix/derivations.scm"
  281. "guix/describe.scm"
  282. "guix/diagnostics.scm"
  283. "guix/discovery.scm"
  284. "guix/docker.scm"
  285. "guix/download.scm"
  286. "guix/elf.scm"
  287. "guix/ftp-client.scm"
  288. "guix/gexp.scm"
  289. "guix/git-authenticate.scm"
  290. "guix/git-download.scm"
  291. "guix/git.scm"
  292. "guix/glob.scm"
  293. "guix/gnu-maintenance.scm"
  294. "guix/gnupg.scm"
  295. "guix/grafts.scm"
  296. "guix/graph.scm"
  297. "guix/hash.scm"
  298. "guix/hg-download.scm"
  299. "guix/http-client.scm"
  300. "guix/i18n.scm"
  301. "guix/inferior.scm"
  302. "guix/ipfs.scm"
  303. "guix/least-authority.scm"
  304. "guix/licenses.scm"
  305. "guix/lint.scm"
  306. "guix/man-db.scm"
  307. "guix/memoization.scm"
  308. "guix/modules.scm"
  309. "guix/monad-repl.scm"
  310. "guix/monads.scm"
  311. "guix/narinfo.scm"
  312. "guix/nar.scm"
  313. "guix/openpgp.scm"
  314. "guix/packages.scm"
  315. "guix/pki.scm"
  316. "guix/platform.scm"
  317. "guix/profiles.scm"
  318. "guix/profiling.scm"
  319. "guix/progress.scm"
  320. "guix/quirks.scm"
  321. "guix/read-print.scm"
  322. "guix/records.scm"
  323. "guix/remote.scm"
  324. "guix/repl.scm"
  325. "guix/search-paths.scm"
  326. "guix/self.scm"
  327. "guix/serialization.scm"
  328. "guix/sets.scm"
  329. "guix/ssh.scm"
  330. "guix/status.scm"
  331. "guix/store.scm"
  332. "guix/substitutes.scm"
  333. "guix/svn-download.scm"
  334. "guix/swh.scm"
  335. "guix/tests.scm"
  336. "guix/transformations.scm"
  337. "guix/ui.scm"
  338. "guix/upstream.scm"
  339. "guix/utils.scm"
  340. "guix/workers.scm"
  341. (make-regexp "^guix/platforms/")
  342. (make-regexp "^guix/scripts/")
  343. (make-regexp "^guix/store/"))))
  344. (define-team games
  345. (team 'games
  346. #:name "Games and Toys"
  347. #:description "Packaging programs for amusement."
  348. #:scope (list "gnu/packages/games.scm"
  349. "gnu/packages/game-development.scm"
  350. "gnu/packages/minetest.scm"
  351. "gnu/packages/esolangs.scm" ; granted, rather niche
  352. "gnu/packages/motti.scm"
  353. "guix/build/minetest-build-system.scm")))
  354. (define-team localization
  355. (team 'localization
  356. #:name "Localization (l10n) team"
  357. #:description
  358. "Localization of your system to specific languages."
  359. #:scope (list "gnu/packages/anthy.scm"
  360. "gnu/packages/fcitx5.scm"
  361. "gnu/packages/fcitx.scm"
  362. "gnu/packages/fonts.scm"
  363. "gnu/packages/ibus.scm")))
  364. (define-team translations
  365. (team 'translations
  366. #:name "Translations"
  367. #:scope (list "etc/news.scm"
  368. (make-regexp "^po/"))))
  369. (define-team installer
  370. (team 'installer
  371. #:name "Installer script and system installer"
  372. #:scope (list (make-regexp "^gnu/installer(\\.scm$|/)"))))
  373. (define-team home
  374. (team 'home
  375. #:name "Team for \"Guix Home\""
  376. #:scope (list (make-regexp "^(gnu|guix/scripts)/home(\\.scm$|/)")
  377. "tests/guix-home.sh"
  378. "tests/home-import.scm"
  379. "tests/home-services.scm")))
  380. (define-team mentors
  381. (team 'mentors
  382. #:name "Mentors"
  383. #:description
  384. "A group of mentors who chaperone contributions by newcomers."))
  385. (define-team mozilla
  386. (team 'mozilla
  387. #:name "Mozilla"
  388. #:description
  389. "Taking care about Icecat and Icedove, built from Mozilla Firefox
  390. and Thunderbird."
  391. #:scope (list "gnu/packages/gnuzilla.scm")))
  392. (define-team racket
  393. (team 'racket
  394. #:name "Racket team"
  395. #:description
  396. "The Racket language and Racket-based languages, Racket packages,
  397. Racket's variant of Chez Scheme, and development of a Racket build system and
  398. importer."
  399. #:scope (list "gnu/packages/chez.scm"
  400. "gnu/packages/racket.scm")))
  401. (define-team reproduciblebuilds
  402. (team 'reproduciblebuilds
  403. #:name "Reproducible Builds team"
  404. #:description
  405. "Reproducible Builds tooling and issues that affect any guix packages."
  406. #:scope (list "gnu/packages/diffoscope.scm")))
  407. (define-team gnome
  408. (team 'gnome
  409. #:name "Gnome team"
  410. #:description
  411. "The Gnome desktop environment, along with core technologies such as
  412. GLib/GIO, GTK, GStreamer and Webkit."
  413. #:scope (list "gnu/packages/glib.scm"
  414. "gnu/packages/gstreamer.scm"
  415. "gnu/packages/gtk.scm"
  416. "gnu/packages/gnome.scm"
  417. "gnu/packages/gnome-xyz.scm"
  418. "gnu/packages/webkit.scm"
  419. "guix/build/glib-or-gtk-build-system.scm"
  420. "guix/build/meson-build-system.scm")))
  421. (define-team xfce
  422. (team 'xfce
  423. #:name "Xfce team"
  424. #:description "Xfce desktop environment."
  425. #:scope (list "gnu/packages/xfce.scm")))
  426. (define-team lxqt
  427. (team 'lxqt
  428. #:name "LXQt team"
  429. #:description "LXQt desktop environment."
  430. #:scope (list "gnu/packages/lxqt.scm"
  431. "gnu/packages/qt.scm")))
  432. (define-member (person "Eric Bavier"
  433. "bavier@posteo.net")
  434. science)
  435. (define-member (person "Lars-Dominik Braun"
  436. "lars@6xq.net")
  437. python haskell)
  438. (define-member (person "Jonathan Brielmaier"
  439. "jonathan.brielmaier@web.de")
  440. mozilla)
  441. (define-member (person "Ludovic Courtès"
  442. "ludo@gnu.org")
  443. core home embedded bootstrap mentors)
  444. (define-member (person "Andreas Enge"
  445. "andreas@enge.fr")
  446. lxqt science)
  447. (define-member (person "Tobias Geerinckx-Rice"
  448. "me@tobias.gr")
  449. core kernel mentors)
  450. (define-member (person "Björn Höfling"
  451. "bjoern.hoefling@bjoernhoefling.de")
  452. java)
  453. (define-member (person "Leo Famulari"
  454. "leo@famulari.name")
  455. kernel)
  456. (define-member (person "Efraim Flashner"
  457. "efraim@flashner.co.il")
  458. embedded bootstrap julia rust science)
  459. (define-member (person "jgart"
  460. "jgart@dismail.de")
  461. python lisp mentors)
  462. (define-member (person "Guillaume Le Vaillant"
  463. "glv@posteo.net")
  464. lisp)
  465. (define-member (person "Julien Lepiller"
  466. "julien@lepiller.eu")
  467. java ocaml translations)
  468. (define-member (person "Philip McGrath"
  469. "philip@philipmcgrath.com")
  470. racket)
  471. (define-member (person "Mathieu Othacehe"
  472. "othacehe@gnu.org")
  473. core installer mentors)
  474. (define-member (person "Florian Pelz"
  475. "pelzflorian@pelzflorian.de")
  476. translations)
  477. (define-member (person "Liliana Marie Prikler"
  478. "liliana.prikler@gmail.com")
  479. emacs games gnome)
  480. (define-member (person "Ricardo Wurmus"
  481. "rekado@elephly.net")
  482. r core mentors tex)
  483. (define-member (person "Christopher Baines"
  484. "mail@cbaines.net")
  485. core mentors ruby)
  486. (define-member (person "Andrew Tropin"
  487. "andrew@trop.in")
  488. home emacs)
  489. (define-member (person "pukkamustard"
  490. "pukkamustard@posteo.net")
  491. ocaml)
  492. (define-member (person "Josselin Poiret"
  493. "dev@jpoiret.xyz")
  494. core installer)
  495. (define-member (person "("
  496. "paren@disroot.org")
  497. home mentors)
  498. (define-member (person "Simon Tournier"
  499. "zimon.toutoune@gmail.com")
  500. julia core mentors)
  501. (define-member (person "Raghav Gururajan"
  502. "rg@raghavgururajan.name")
  503. gnome mentors)
  504. (define-member (person "宋文武"
  505. "iyzsong@envs.net")
  506. games localization lxqt xfce)
  507. (define-member (person "Vagrant Cascadian"
  508. "vagrant@debian.org")
  509. embedded)
  510. (define-member (person "Vagrant Cascadian"
  511. "vagrant@reproducible-builds.org")
  512. reproduciblebuilds)
  513. (define-member (person "Zhu Zihao"
  514. "all_but_last@163.com")
  515. localization xfce)
  516. (define-member (person "Maxim Cournoyer"
  517. "maxim.cournoyer@gmail.com")
  518. gnome)
  519. (define (find-team name)
  520. (or (hash-ref %teams (string->symbol name))
  521. (error (format #false
  522. "no such team: ~a~%" name))))
  523. (define (find-team-by-scope files)
  524. "Return the team(s) which scope matches at least one of the FILES, as list
  525. of file names as string."
  526. (hash-fold
  527. (lambda (key team acc)
  528. (if (any (lambda (file)
  529. (any (match-lambda
  530. ((? string? scope)
  531. (string=? scope file))
  532. ((? regexp? scope)
  533. (regexp-exec scope file)))
  534. (team-scope team)))
  535. files)
  536. (cons team acc)
  537. acc))
  538. '()
  539. %teams))
  540. (define (cc . teams)
  541. "Return arguments for `git send-email' to notify the members of the given
  542. TEAMS when a patch is received by Debbugs."
  543. (let ((members (append-map team-members teams)))
  544. (unless (null? members)
  545. (format #true "--add-header=\"X-Debbugs-Cc: ~{~a~^, ~}\""
  546. (map person-email (sort-members members))))))
  547. (define (sort-members members)
  548. "Deduplicate and sort MEMBERS alphabetically by their name."
  549. (sort (delete-duplicates members equal?)
  550. (lambda (m1 m2)
  551. (string<? (person-name m1) (person-name m2)))))
  552. (define (member->string member)
  553. "Return the 'email <name>' string representation of MEMBER."
  554. (let* ((name (person-name member))
  555. (quoted-name/maybe (if (string-contains name ",")
  556. (string-append "\"" name "\"")
  557. name)))
  558. (format #false "~a <~a>" quoted-name/maybe (person-email member))))
  559. (define* (list-members team #:optional port (prefix ""))
  560. "Print the members of the given TEAM."
  561. (define port* (or port (current-output-port)))
  562. (for-each
  563. (lambda (member)
  564. (format port* "~a~a~%" prefix (member->string member)))
  565. (sort-members (team-members team))))
  566. (define (list-teams)
  567. "Print all teams, their scope and their members."
  568. (define port* (current-output-port))
  569. (define width* (%text-width))
  570. (for-each
  571. (lambda (team)
  572. (format port*
  573. "\
  574. id: ~a
  575. name: ~a
  576. description: ~a
  577. ~amembers:
  578. "
  579. (team-id team)
  580. (team-name team)
  581. (or (and=> (team-description team)
  582. (lambda (text)
  583. (string->recutils
  584. (fill-paragraph text width*
  585. (string-length "description: ")))))
  586. "<none>")
  587. (match (team-scope team)
  588. (() "")
  589. (scope (format #f "scope: ~{~s ~}~%" scope))))
  590. (list-members team port* "+ ")
  591. (newline))
  592. (sort
  593. (hash-map->list (lambda (key value) value) %teams)
  594. (lambda (team1 team2)
  595. (string<? (symbol->string (team-id team1))
  596. (symbol->string (team-id team2)))))))
  597. (define (diff-revisions rev-start rev-end)
  598. "Return the list of added, modified or removed files between REV-START
  599. and REV-END, two git revision strings."
  600. (let* ((repository (repository-open (getcwd)))
  601. (commit1 (commit-lookup repository
  602. (object-id
  603. (revparse-single repository rev-start))))
  604. (commit2 (commit-lookup repository
  605. (object-id
  606. (revparse-single repository rev-end))))
  607. (diff (diff-tree-to-tree repository
  608. (commit-tree commit1)
  609. (commit-tree commit2)))
  610. (files '()))
  611. (diff-foreach
  612. diff
  613. (lambda (delta progress)
  614. (set! files
  615. (cons (diff-file-path (diff-delta-old-file delta)) files))
  616. 0)
  617. (const 0)
  618. (const 0)
  619. (const 0))
  620. files))
  621. (define (git-patch->commit-id file)
  622. "Parse the commit ID from the first line of FILE, a patch produced with git."
  623. (call-with-input-file file
  624. (lambda (port)
  625. (let ((m (string-match "^From ([0-9a-f]{40})" (read-line port))))
  626. (unless m
  627. (error "invalid patch file:" file))
  628. (match:substring m 1)))))
  629. (define (git-patch->revisions file)
  630. "Return the start and end revisions of FILE, a patch file produced with git."
  631. (let* ((rev-end (git-patch->commit-id file))
  632. (rev-start (string-append rev-end "^")))
  633. (list rev-start rev-end)))
  634. (define (patch->teams patch-file)
  635. "Return the name of the teams in scope for the changes in PATCH-FILE."
  636. (map (compose symbol->string team-id)
  637. (find-team-by-scope (apply diff-revisions
  638. (git-patch->revisions patch-file)))))
  639. (define (main . args)
  640. (match args
  641. (("cc" . team-names)
  642. (apply cc (map find-team team-names)))
  643. (("cc-members" patch-file)
  644. (unless (file-exists? patch-file)
  645. (error "patch file does not exist:" patch-file))
  646. (apply main "cc-members" (git-patch->revisions patch-file)))
  647. (("cc-members" rev-start rev-end)
  648. (apply cc (find-team-by-scope
  649. (diff-revisions rev-start rev-end))))
  650. (("cc-members-header-cmd" patch-file)
  651. (let* ((teams (map find-team (patch->teams patch-file)))
  652. (members (sort-members (append-map team-members teams))))
  653. (unless (null? members)
  654. (format #true "X-Debbugs-Cc: ~{~a~^, ~}"
  655. (map member->string members)))))
  656. (("cc-mentors-header-cmd" patch-file)
  657. (format #true "X-Debbugs-Cc: ~{~a~^, ~}"
  658. (map member->string
  659. (sort-members (team-members (find-team "mentors"))))))
  660. (("get-maintainer" patch-file)
  661. (apply main "list-members" (patch->teams patch-file)))
  662. (("list-teams" . args)
  663. (list-teams))
  664. (("list-members" . team-names)
  665. (for-each
  666. (lambda (team-name)
  667. (list-members (find-team team-name)))
  668. team-names))
  669. (anything
  670. (format (current-error-port)
  671. "Usage: etc/teams.scm <command> [<args>]
  672. Commands:
  673. cc <team-name>
  674. get git send-email flags for cc-ing <team-name>
  675. cc-members <start> <end> | <patch>
  676. cc teams related to files changed between revisions or in a patch file
  677. cc-members-header-cmd <patch>
  678. cc-members variant for use with 'git send-email --header-cmd'
  679. cc-mentors-header-cmd <patch>
  680. command to use with 'git send-email --header-cmd' to notify mentors
  681. list-teams
  682. list teams and their members
  683. list-members <team-name>
  684. list members belonging to <team-name>
  685. get-maintainer <patch>
  686. compatibility mode with Linux get_maintainer.pl~%"))))
  687. (apply main (cdr (command-line)))