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 IB3bCqSZdmOXYAAAbAwnHQ (envelope-from ) for ; Thu, 17 Nov 2022 21:29:24 +0100 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 8KD2CaSZdmPEEgAAG6o9tA (envelope-from ) for ; Thu, 17 Nov 2022 21:29:24 +0100 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 9FB813F7F6 for ; Thu, 17 Nov 2022 21:29:23 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ovlVQ-0006yg-CB; Thu, 17 Nov 2022 15:29:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ovlVO-0006xX-Mv for guix-patches@gnu.org; Thu, 17 Nov 2022 15:29:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ovlVO-0007OE-DR for guix-patches@gnu.org; Thu, 17 Nov 2022 15:29:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ovlVO-0003TT-9O for guix-patches@gnu.org; Thu, 17 Nov 2022 15:29:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#58660] [PATCH v2 3/3] etc: teams: Improve display of regular expression in 'scope' field. Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 17 Nov 2022 20:29:02 +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: othacehe@gnu.org, zimoun Received: via spool by 58660-submit@debbugs.gnu.org id=B58660.166871692613310 (code B ref 58660); Thu, 17 Nov 2022 20:29:02 +0000 Received: (at 58660) by debbugs.gnu.org; 17 Nov 2022 20:28:46 +0000 Received: from localhost ([127.0.0.1]:34510 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ovlV3-0003SW-Qe for submit@debbugs.gnu.org; Thu, 17 Nov 2022 15:28:46 -0500 Received: from mail-wr1-f46.google.com ([209.85.221.46]:47000) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ovlUy-0003Rq-92 for 58660@debbugs.gnu.org; Thu, 17 Nov 2022 15:28:38 -0500 Received: by mail-wr1-f46.google.com with SMTP id d9so5728878wrm.13 for <58660@debbugs.gnu.org>; Thu, 17 Nov 2022 12:28:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SBu6/VncbabV8y7Zd9kk9WioD6SVms8n859TA92vlFE=; b=ETlQFvKpx4/Fx15LoR5Kl1xenmJuoAEw08LE4hcc8Dkbth/Aq5c11ePeNtEZFFn4sp M6UgH9ofKg2Ydxi0qosRL2GzmcTyu/bmD9Y20bw1GzqOGJwNhLnAZzAnhLMBIMir8oxU BjFfGLBtG4bttI7QHQhFUeSZ5sHt0/tB+6qMHHYSgOq2rWA5bpoMMy/hcQWfir/FV8Oe QRIt7ePE0Yqrw3AfR3gqKb6PRhdrzK6PH+jtnR1rR9RgDwT/B50qjz3AZsYv0fNoDy8O O5DMg/kyswYG8TQW6rnuiBjzKOs2vAgScaj4PLUA3mrHNKPZGtlxfbe7745cvJ8WLJvZ 3FVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SBu6/VncbabV8y7Zd9kk9WioD6SVms8n859TA92vlFE=; b=0GIE+8r5k0Mt8xyDt6OJxD+A1CkZ8dX7FUII3MvrdijeXmA9URTsfGG6wioJD8r9wP VDC6Sz7rtuymvLtJSp8qYA6X8UiBafNUh+CG5YFSLm4f7W2Hl0ebojSO+LWdCMj7sZY/ y3xMvYp5Eb5/ix9T4soRmLcKoNNtFXqGtMsc2zV06gs4tSWz7TfjpDdUsvJxT92XGPnH sLGGt2OsBpJgFA7OTLJw93yVxqTTyjAMJBppi5edL8GYb3151ne86Cn7KZK2IRJIizJU vvVuxYy0HVYcJ8aWSkbaonNImwB8GPDTH3bRVwk5wdpad96uzO7Pose6fI4xKmBk/Vwi 09Nw== X-Gm-Message-State: ANoB5plv1Nq39/3P7Izt/Euh1gQCB77X779AdBkohgfY73lMaAZ1f33U dK5GohL6DLZT6JTteUHqHkYLEqyBqRA= X-Google-Smtp-Source: AA0mqf49QoJ9Ie/7cXTXuArclTDNgBIgRDIPJ8aY+n60fh1o6loWq50274XOa3QWcbi26uRKv7hSCw== X-Received: by 2002:adf:b606:0:b0:22e:2efe:3176 with SMTP id f6-20020adfb606000000b0022e2efe3176mr2469122wre.241.1668716910586; Thu, 17 Nov 2022 12:28:30 -0800 (PST) Received: from localhost.localdomain ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id p6-20020a1c5446000000b003b47e75b401sm6539516wmi.37.2022.11.17.12.28.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 12:28:30 -0800 (PST) From: zimoun Date: Thu, 17 Nov 2022 21:28:20 +0100 Message-Id: <20221117202820.2054593-3-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221117202820.2054593-1-zimon.toutoune@gmail.com> References: <20221117202820.2054593-1-zimon.toutoune@gmail.com> MIME-Version: 1.0 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-bounces+larch=yhetil.org@gnu.org 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=1668716963; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: 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=ffV95gFzm3qEzMiaWpKVDmx+nR2d1uaUByLw/P85S34=; b=DrqheiFdZsZioeZDXi0y2picKRJLLUyzkH8mz0xWS1kI0JP/vTruugZsHO+31HwCVoYhaz VUm8Y7S26360Wki0TUgJprBfBOAtoIJedJaRrUb8mTliFepY6PDrDRCHJHLRDyhjwa2EFg C5mKvM1rG6AxdXCCn4RDOPjesu97mmwW4HeumSod94uTxvVWDOcyW999XiUFuT6cxuExHD 5XwbaziAdh5H6O1zKnDieBA0C39hRm8Y6UC78005mKXEZtvLW8qmNOE/44O6zFTx2dY9Bb f4r0JEOrRqqvcaPS1wQbgUg9+1YA7Nd2fCu3WJgpBRaJmMmsBu657MyWKzPYEg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1668716963; a=rsa-sha256; cv=none; b=qoVGHTbJS1JXlvpOp57gLvbMiYSkA8DucVnWu37nMbJAUGZvPhVV+If52xDnwOsbXVj/Zk NXhFapFFiC+bxdhqKNHRQITeZnUE3mOZKvCESaExLFhGBnYHhJtwupLus4KRyxiP3HiOAE LafV2ty9/WIOUGobthM5CjSbU5Ik2xu4r99T9HrQAs5Ipq+pHpaJiXXrDR/YHk91FzIoQP UH/UC1nKpMinirbxvDt91b5AAZLxIg+xStMiknS6THLJZdfWI+1MA4JFrHTKvtOCdW4af/ trfrXplONJHKJUzyr8QsD041KA5zt3/6mte21gR0DvnYXU/Rw8te1+81nPb0fA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b=ETlQFvKp; 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: 5.37 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b=ETlQFvKp; 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: 9FB813F7F6 X-Spam-Score: 5.37 X-Migadu-Scanner: scn0.migadu.com X-TUID: 0Pb21CMcFMqu * 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. --- etc/teams.scm.in | 59 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/etc/teams.scm.in b/etc/teams.scm.in index 3f90e0e6f2..3bdf91597f 100644 --- a/etc/teams.scm.in +++ b/etc/teams.scm.in @@ -38,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? @@ -98,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/pyproject-build-system.scm" @@ -118,7 +137,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" @@ -146,7 +165,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"))) @@ -175,14 +194,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"))) @@ -195,7 +214,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" @@ -209,7 +228,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"))) @@ -241,7 +260,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" @@ -339,9 +358,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 @@ -358,17 +377,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"))) @@ -508,8 +527,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) @@ -568,7 +587,11 @@ (define width* (%text-width)) (string-append fmt str)) (format #f "scope:~%") (sort - (map (lambda (scope) (format #f "+ ~a~%" scope)) scope-files) + (map (compose (cut format #f "+ ~a~%" <>) + (match-lambda + ((? regexp*? rx*) (regexp-pattern* rx*)) + ((? string? str) str))) + scope-files) string<=?))))) (list-members team port* "+ ") (newline)) -- 2.38.1