From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 20 09:28:36 2022 Received: (at 58660) by debbugs.gnu.org; 20 Oct 2022 13:28:36 +0000 Received: from localhost ([127.0.0.1]:33432 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olVb9-0004DD-Aq for submit@debbugs.gnu.org; Thu, 20 Oct 2022 09:28:36 -0400 Received: from mail-wm1-f52.google.com ([209.85.128.52]:54816) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olVb2-0004CL-1s for 58660@debbugs.gnu.org; Thu, 20 Oct 2022 09:28:32 -0400 Received: by mail-wm1-f52.google.com with SMTP id iv17so14927511wmb.4 for <58660@debbugs.gnu.org>; Thu, 20 Oct 2022 06:28:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=tlxw45bJgxFmdISskOiVJdcY3N1Hv8dnBrqsrdR4u2o=; b=VfEGZXO68oedg5bbb3BNEVZeL091rRFouqlI1wfMPIt6LuD4CKpDnsG6uEZHj+oy4W EQ0RuXtkWqCTUK5+Dd1v+4QUjRp9MOR9NHv9R6kqBD58pIwkh3Gdg/1uxW1NEhSKfizj ryFqUdIz5QjxkdcJ/HapIICBLBDZgkdzHzdU+H02bgR05/ik6JrtuyB1lB4MiG311UuJ UBG0LUld8r7KuiB//88xHKZ7+pq6zSdeVlGd0e2jOQs7Na57Jo+E2T2z2PkZJNArnc27 N5O/SClEwKPwDMO7+r7rfmXDfcqm+ApiTwyT5197mFkbweQ5OZ7ULtLRidFi4q7R0BIp atzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=tlxw45bJgxFmdISskOiVJdcY3N1Hv8dnBrqsrdR4u2o=; b=B8CNrdu3ppFlo7iRJB25WXVEFgsec1+L80/wzJpkBbMb+Jfa+F7suuf9MclZDwBrGh qr46qAB/elWaBF4YWDcQVC8v5U2n9ECVppr8IsF1goghDp8Hqihjv6hHouVqbnZrwosh tv/kyaH03Uo/BE6LACjpsMgKQ9ni3CUMuuSbsJr6OM/CDog9BmN4XmlseC8kmKlmCnr4 9m/XihsSBesnmds4KJbuehkWyKNeV0lkuXmLCwWIqZwynI+NRbtHdY2Ymi+oKkAchUyG KW3uGWlLrPNYQ5yNMgN7pnz0ZM6TqkIXgbXz800k2JxMkKljLGk4/tBE5WjscbX87KyZ XmzA== X-Gm-Message-State: ACrzQf208PInykrZ08IQGvXv9mSIPU7fA3SKErQKtjanSwwHh58fxtKB UyI40fjSrUsPyrvQ+sqf7286JcQJJZg= X-Google-Smtp-Source: AMsMyM41MAbGx1dGLzszKJ22ar13X7LMTPyCA11369kuaSvO9bjDEW9+YRsc48wFC+0KijAYgduOTw== X-Received: by 2002:a05:600c:2f08:b0:3c6:befc:9778 with SMTP id r8-20020a05600c2f0800b003c6befc9778mr9229943wmn.101.1666272501179; Thu, 20 Oct 2022 06:28:21 -0700 (PDT) Received: from localhost.localdomain ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id q3-20020a1c4303000000b003a8434530bbsm2864668wma.13.2022.10.20.06.28.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 06:28:20 -0700 (PDT) From: zimoun To: 58660@debbugs.gnu.org Subject: [PATCH 1/4] etc: teams: Improve scope display. Date: Thu, 20 Oct 2022 15:28:11 +0200 Message-Id: <20221020132814.1549436-1-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.36.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 58660 Cc: zimoun X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * etc/teams.scm.in (): New record type. (make-regexp*, regexp-exec*): New procedures. (python, haskell, julia, java, emacs, rust, core, translations, installer, home): Use it. (find-team-by-scope): Use it. (list-teams): Use it and sort scope files. --- etc/teams.scm.in | 62 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/etc/teams.scm.in b/etc/teams.scm.in index c27ea5271e..394e4d7d46 100644 --- a/etc/teams.scm.in +++ b/etc/teams.scm.in @@ -5,6 +5,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2022 Ricardo Wurmus ;;; Copyright © 2022 Mathieu Othacehe +;;; Copyright © 2022 Simon Tournier ;;; ;;; This file is part of GNU Guix. ;;; @@ -37,6 +38,25 @@ (guix ui) (git)) +;;; Work around regexp implementation. +;;; This record allows to track the regexp pattern and then display it. +(define-record-type + (regexp* pat flag) + regexp*? + (pat regexp-pattern*) + (flag regexp-flag*)) + +(define* (make-regexp* pat #:optional flag) + (regexp* pat flag)) + +(define (regexp-exec* rx* str) + (let ((rx (make-regexp + (regexp-pattern* rx*) + (or (regexp-flag* rx*) + regexp/extended)))) + (regexp-exec rx str))) + + (define-record-type (make-team id name description members scope) team? @@ -97,7 +117,7 @@ (define-team python (list "gnu/packages/django.scm" "gnu/packages/jupyter.scm" ;; Match haskell.scm and haskell-*.scm. - (make-regexp "^gnu/packages/python(-.+|)\\.scm$") + (make-regexp* "^gnu/packages/python(-.+|)\\.scm$") "gnu/packages/sphinx.scm" "gnu/packages/tryton.scm" "guix/build/python-build-system.scm" @@ -115,7 +135,7 @@ (define-team haskell #:scope (list "gnu/packages/dhall.scm" ;; Match haskell.scm and haskell-*.scm. - (make-regexp "^gnu/packages/haskell(-.+|)\\.scm$") + (make-regexp* "^gnu/packages/haskell(-.+|)\\.scm$") "gnu/packages/purescript.scm" "guix/build/haskell-build-system.scm" "guix/build-system/haskell.scm" @@ -143,7 +163,7 @@ (define-team julia #:name "Julia team" #:description "The Julia language, Julia packages, and the julia-build-system." - #:scope (list (make-regexp "^gnu/packages/julia(-.+|)\\.scm$") + #:scope (list (make-regexp* "^gnu/packages/julia(-.+|)\\.scm$") "guix/build/julia-build-system.scm" "guix/build-system/julia.scm"))) @@ -172,14 +192,14 @@ (define-team java and the maven-build-system." #:scope (list ;; Match java.scm and java-*.scm. - (make-regexp "^gnu/packages/java(-.+|)\\.scm$") + (make-regexp* "^gnu/packages/java(-.+|)\\.scm$") ;; Match maven.scm and maven-*.scm - (make-regexp "^gnu/packages/maven(-.+|)\\.scm$") + (make-regexp* "^gnu/packages/maven(-.+|)\\.scm$") "guix/build/ant-build-system.scm" "guix/build/java-utils.scm" "guix/build/maven-build-system.scm" ;; The maven directory - (make-regexp "^guix/build/maven/") + (make-regexp* "^guix/build/maven/") "guix/build-system/ant.scm" "guix/build-system/maven.scm"))) @@ -192,7 +212,7 @@ (define-team emacs #:name "Emacs team" #:description "The extensible, customizable text editor and its ecosystem." - #:scope (list (make-regexp "^gnu/packages/emacs(-.+|)\\.scm$") + #:scope (list (make-regexp* "^gnu/packages/emacs(-.+|)\\.scm$") "guix/build/emacs-build-system.scm" "guix/build/emacs-utils.scm" "guix/build-system/emacs.scm" @@ -206,7 +226,7 @@ (define-team lisp #:description "Common Lisp and similar languages, Common Lisp packages and the asdf-build-system." - #:scope (list (make-regexp "^gnu/packages/lisp(-.+|)\\.scm$") + #:scope (list (make-regexp* "^gnu/packages/lisp(-.+|)\\.scm$") "guix/build/asdf-build-system.scm" "guix/build/lisp-utils.scm" "guix/build-system/asdf.scm"))) @@ -238,7 +258,7 @@ (define-team embedded-bootstrap (define-team rust (team 'rust #:name "Rust" - #:scope (list (make-regexp "^gnu/packages/(crates|rust)(-.+|)\\.scm$") + #:scope (list (make-regexp* "^gnu/packages/(crates|rust)(-.+|)\\.scm$") "guix/build/cargo-build-system.scm" "guix/build/cargo-utils.scm" "guix/build-system/cargo.scm" @@ -336,9 +356,9 @@ (define-team core "guix/upstream.scm" "guix/utils.scm" "guix/workers.scm" - (make-regexp "^guix/platforms/") - (make-regexp "^guix/scripts/") - (make-regexp "^guix/store/")))) + (make-regexp* "^guix/platforms/") + (make-regexp* "^guix/scripts/") + (make-regexp* "^guix/store/")))) (define-team games (team 'games @@ -355,17 +375,17 @@ (define-team translations (team 'translations #:name "Translations" #:scope (list "etc/news.scm" - (make-regexp "^po/")))) + (make-regexp* "^po/")))) (define-team installer (team 'installer #:name "Installer script and system installer" - #:scope (list (make-regexp "^gnu/installer(\\.scm$|/)")))) + #:scope (list (make-regexp* "^gnu/installer(\\.scm$|/)")))) (define-team home (team 'home #:name "Team for \"Guix Home\"" - #:scope (list (make-regexp "^(gnu|guix/scripts)/home(\\.scm$|/)") + #:scope (list (make-regexp* "^(gnu|guix/scripts)/home(\\.scm$|/)") "tests/guix-home.sh" "tests/home-import.scm" "tests/home-services.scm"))) @@ -501,8 +521,8 @@ (define (find-team-by-scope files) (any (match-lambda ((? string? scope) (string=? scope file)) - ((? regexp? scope) - (regexp-exec scope file))) + ((? regexp*? scope) + (regexp-exec* scope file))) (team-scope team))) files) (cons team acc) @@ -553,7 +573,13 @@ (define width* (%text-width)) "") (match (team-scope team) (() "") - (scope (format #f "scope: ~{~s ~}~%" scope)))) + (scope (format #f "scope: ~{~s ~}~%" + (sort + (map (match-lambda + ((? regexp*? rx*) (regexp-pattern* rx*)) + ((? string? str) str)) + scope) + string<=?))))) (list-members team port* "+ ") (newline)) %teams)) -- 2.36.0