Message ID | 34c99df65a63bafd7868ad025a85ebb3a4457ac2.camel@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id B20B227BBEA; Fri, 9 Sep 2022 16:41:11 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 74EC227BBE9 for <patchwork@mira.cbaines.net>; Fri, 9 Sep 2022 16:41:11 +0100 (BST) Received: from localhost ([::1]:37126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org>) id 1oWg7y-0005T9-JN for patchwork@mira.cbaines.net; Fri, 09 Sep 2022 11:41:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46502) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1oWg7q-0005QW-Jl for guix-patches@gnu.org; Fri, 09 Sep 2022 11:41:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46364) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1oWg7q-0007Jz-AQ for guix-patches@gnu.org; Fri, 09 Sep 2022 11:41:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1oWg7q-0003zw-6z for guix-patches@gnu.org; Fri, 09 Sep 2022 11:41:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57646] [PATCH] etc: teams: Add regular expression support to scopes. References: <20220907151622.4912-1-othacehe@gnu.org> In-Reply-To: <20220907151622.4912-1-othacehe@gnu.org> Resent-From: Liliana Marie Prikler <liliana.prikler@gmail.com> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 09 Sep 2022 15:41:02 +0000 Resent-Message-ID: <handler.57646.B57646.166273804815341@debbugs.gnu.org> Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57646 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mathieu Othacehe <othacehe@gnu.org> Cc: 57646@debbugs.gnu.org Received: via spool by 57646-submit@debbugs.gnu.org id=B57646.166273804815341 (code B ref 57646); Fri, 09 Sep 2022 15:41:02 +0000 Received: (at 57646) by debbugs.gnu.org; 9 Sep 2022 15:40:48 +0000 Received: from localhost ([127.0.0.1]:35063 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1oWg7b-0003zM-5Q for submit@debbugs.gnu.org; Fri, 09 Sep 2022 11:40:47 -0400 Received: from mail-ej1-f66.google.com ([209.85.218.66]:41908) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <liliana.prikler@gmail.com>) id 1oWg7V-0003z5-2q for 57646@debbugs.gnu.org; Fri, 09 Sep 2022 11:40:45 -0400 Received: by mail-ej1-f66.google.com with SMTP id gh9so4883630ejc.8 for <57646@debbugs.gnu.org>; Fri, 09 Sep 2022 08:40:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:content-transfer-encoding:cc:to:subject :date:from:from:to:cc:subject:date; bh=Xsno39Pdjndm+/0eWUPTIA8O9CiIzGo3ZVbrpxLrpZA=; b=hJcclgtNGYpGJLEIWRXD1hip3+p3LpMR4oH04dzMgYft9pF4Kzg/88WQwB/2EdmIPc agd5DpurEJXLt2nxxATjZAqcupQiqBnt8LIvwlJNyV+i8HdI9hwb9xlDPlQ+RRLK5hGM cC9+tD8h7eVcwJQXbzDAhW1+uzmkKDKghf3LR9YQqLN8sk3csicnahHRbM9O2lIH1TXm Lle3/enx1tyfIOK4box804meuhdMKxzlAT3Ym7SBtcWAAd88wRb3+En+s8DATDS//zcz CgsSuufN/AslAWPPUY+qtN5lhplSKgMqO3dHoyiAKukmwPW5X8ueSMadCrlAVL6a/UMQ Zr8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:content-transfer-encoding:cc:to:subject :date:from:x-gm-message-state:from:to:cc:subject:date; bh=Xsno39Pdjndm+/0eWUPTIA8O9CiIzGo3ZVbrpxLrpZA=; b=Ip/YphxyP08/ymbIJAbVyDzrsK78vFCEt5lPpX4EzpgWbGJPXlpqoG17yrqJ2+jVPB wW4ZKmBcZA9VRQzcUVl2ZjW+qozpdBwpMqT9D+cafFodDVsU/yZM4CDyf0Y13pmZSA75 seMZ+GY+f0aKnkpnMMB08gbMsBfBfroSMrAjfCZ2hM/ita+bDIoJypOlpFtsmTX5TUP+ AYQXa4AxEkmBJR3OiuNqhiUjWs3TiekEf1hM+ffsHPG+Jjeo0DSETx9ECNP9lN7NAvm7 mQV7mzvMfElhCubrbTyFWqxD4W4BPwm7NXPf7TWMGH5WU5Z18p/TZHywQFwGrNK+vG3f hfcw== X-Gm-Message-State: ACgBeo3ob+Qiut2VhFisx0vbtSIY6UCuxIER4DgpjSwrg3Hr8ZxH0NzL 7+jN5ZI/RD0wyBC1l1mkKFU= X-Google-Smtp-Source: AA6agR7tx/B/XRltZlP7dJFGqhTq6kIMBhmcCPVpGJKTSQ2a28Wsm/vEh/UTDC3upOtidMU9hvtlLQ== X-Received: by 2002:a17:907:3f88:b0:73e:484d:9d6c with SMTP id hr8-20020a1709073f8800b0073e484d9d6cmr10668076ejc.283.1662738034935; Fri, 09 Sep 2022 08:40:34 -0700 (PDT) Received: from nijino.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id w20-20020a170906185400b007713951ca7asm397344eje.165.2022.09.09.08.40.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Sep 2022 08:40:34 -0700 (PDT) From: Liliana Marie Prikler <liliana.prikler@gmail.com> Date: Fri, 9 Sep 2022 17:27:23 +0200 Content-Transfer-Encoding: 7bit Message-ID: <34c99df65a63bafd7868ad025a85ebb3a4457ac2.camel@gmail.com> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: <guix-patches.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/guix-patches> List-Post: <mailto:guix-patches@gnu.org> List-Help: <mailto:guix-patches-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=subscribe> Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-getmail-retrieved-from-mailbox: Patches |
Series |
[bug#57646] etc: teams: Add regular expression support to scopes.
|
|
Commit Message
Liliana Marie Prikler
Sept. 9, 2022, 3:27 p.m. UTC
* etc/teams.scm (find-teams-by-scope): Differentiate between raw strings and regexps. Make raw string matches strict. --- Hi Mathieu, this is a fixup to your 1/3 patch, making it so that regexps are supported. Note, that for the installer team you should now define the scope as (list "gnu/installer.scm" (make-regexp "^guix/installer/")) or simply (list (make-regexp "^guix/installer(\\.scm$|/)")). Cheers etc/teams.scm.in | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
Comments
Hey Liliana, > this is a fixup to your 1/3 patch, making it so that regexps are supported. > Note, that for the installer team you should now define the scope as > (list "gnu/installer.scm" (make-regexp "^guix/installer/")) or simply > (list (make-regexp "^guix/installer(\\.scm$|/)")). Thanks for the improvement :) Ricardo, any thoughts on this series? Mathieu
Hi Mathieu,
> Thanks for the improvement :) Ricardo, any thoughts on this series?
This looks like a good idea to me, thanks!
Just three comments:
* the dependency on Guile-Git means that the script must be run inside a
suitable environment now, whereas previously it had no dependencies
other than Guile. If we can assume that people use Guix perhaps we
should do what doc/build.scm does and use Guix to arrange for
dependencies to be available.
* I don’t like the “if” + “null?” pattern:
+ (if (not (null? (team-scope team)))
+ (format #f "scope: ~{~s ~}~%" (team-scope team))
+ ""))
I’d prefer using match:
(match (team-scope team)
(() "")
(scope (format #f "scope: ~{~s ~}~%" scope)
* With Liliana’s added support for regexes, the previous patch to record
scopes for the installer etc should be adjusted.
Hey, > * the dependency on Guile-Git means that the script must be run inside a > suitable environment now, whereas previously it had no dependencies > other than Guile. If we can assume that people use Guix perhaps we > should do what doc/build.scm does and use Guix to arrange for > dependencies to be available. Right, for now I went for the easiest solution and proposed the following example in the documentation: --8<---------------cut here---------------start------------->8--- $ guix shell -D guix [env]$ git send-email $(./etc/teams.scm cc-members HEAD~2 HEAD) *.patch --8<---------------cut here---------------end--------------->8--- > * I don’t like the “if” + “null?” pattern: > > + (if (not (null? (team-scope team))) > + (format #f "scope: ~{~s ~}~%" (team-scope team)) > + "")) > > I’d prefer using match: > > (match (team-scope team) > (() "") > (scope (format #f "scope: ~{~s ~}~%" scope) > > * With Liliana’s added support for regexes, the previous patch to record > scopes for the installer etc should be adjusted. Fixed! Thanks, Mathieu
diff --git a/etc/teams.scm.in b/etc/teams.scm.in index 37937a02ff..24664e9c0e 100644 --- a/etc/teams.scm.in +++ b/etc/teams.scm.in @@ -32,6 +32,7 @@ (srfi srfi-9) (srfi srfi-26) (ice-9 format) + (ice-9 regex) (ice-9 match) (guix ui) (git)) @@ -281,9 +282,11 @@ (define (find-team-by-scope files) (hash-fold (lambda (key team acc) (if (any (lambda (file) - (any (lambda (scope) - ;; XXX: Add regex support? - (string-prefix? scope file)) + (any (match-lambda + ((? string? scope) + (string=? scope file)) + ((? regexp? scope) + (regexp-exec scope file))) (team-scope team))) files) (cons team acc)