From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id mLITOEV9UWN69gAAbAwnHQ (envelope-from ) for ; Thu, 20 Oct 2022 18:54:30 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id oC4TN0V9UWMTOwEAG6o9tA (envelope-from ) for ; Thu, 20 Oct 2022 18:54:29 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 848F23FF2D for ; Thu, 20 Oct 2022 18:54:29 +0200 (CEST) Received: from localhost ([::1]:53728 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olYnu-0006Me-0Z for larch@yhetil.org; Thu, 20 Oct 2022 12:54:00 -0400 Received: from [::1] (helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olYnp-0004Ig-Ph for larch@yhetil.org; Thu, 20 Oct 2022 12:53:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38726) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olVbc-00070E-VY for guix-patches@gnu.org; Thu, 20 Oct 2022 09:29:10 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:34357) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1olVbc-0002ph-0a for guix-patches@gnu.org; Thu, 20 Oct 2022 09:29:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1olVbb-0004EL-RV for guix-patches@gnu.org; Thu, 20 Oct 2022 09:29:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58660] [PATCH 1/4] etc: teams: Improve scope display. References: <20221020132140.1546684-1-zimon.toutoune@gmail.com> In-Reply-To: <20221020132140.1546684-1-zimon.toutoune@gmail.com> Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 20 Oct 2022 13:29:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58660 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 58660@debbugs.gnu.org Cc: zimoun Received: via spool by 58660-submit@debbugs.gnu.org id=B58660.166627251616206 (code B ref 58660); Thu, 20 Oct 2022 13:29:03 +0000 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 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1666284869; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=j7dF3lPctfpUTLwrvpQGhXKXeqzH5BBOSZXqK0TBScU=; b=aSSWdqdLNHywxMNz6e5R/8XjXyATb7FEhGxG1tEq3FXXdeVaBZ8R0Jx/eXEy4xmpS4yABw 4fHMEym8hj9bqN57qr+OOiRFjB+bWdeFXsZlDnl1ovRTTV100kCV7U4zjOaHhx4RV0ObhE U0vpzYnsvj/Reod1gER/S/2dWsOtXHDNgJrB67One9q3RkPIESWIzSUe48zZC/sQm0UaOK K9GoM02G99iZQ9onO7MFgpUOuJBs4vEYuRNb+QtHW7xVqgF2r1D6/jLAHKKYaUCBocDWCh Z/bGHHJvbOmSlOyMGel2o/BO7OEXmfmc/tUReA7jw+iJg49knctVzsnzL9kTpQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1666284869; a=rsa-sha256; cv=none; b=IKb0fDy/XuVjNWHnnr8fzzdxvjZahTav3W2BDUSd2KkjeZlkF31Ko0GItpadIVMDjeKJF8 AtcbpxaFvDe6qyo43HuC8uhRiR0LqjdJAENOGbhbdaEDV62mvpko7yByuoX9B9xfHF1sOo sgozIWymUyIXM6YICoZGO21eDwCh9yddEUdeKPv1NKk3JnlMUfkZNssEjV9qpveXKYVfDO lOrlsPY4gS0iKoO9M8dVNh+G9lr3WlDKBNfm1l5WO4d8+veMWBjiKo+gzVsD2EjK+aPrJh swU/Z6nxwEOy0LGrJ6x4NSK4FliXQtytjzbzW1wxyS4OViim/qhjIQpygnP5ZA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b=VfEGZXO6; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 4.47 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b=VfEGZXO6; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 848F23FF2D X-Spam-Score: 4.47 X-Migadu-Scanner: scn0.migadu.com X-TUID: NKypvhi5tPQZ * 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