From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id 6DQEOQ3CMWW2VgEAauVa8A:P1 (envelope-from ) for ; Fri, 20 Oct 2023 01:55:58 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 6DQEOQ3CMWW2VgEAauVa8A (envelope-from ) for ; Fri, 20 Oct 2023 01:55:58 +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 8211F4E024 for ; Fri, 20 Oct 2023 01:55:57 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=TjBy8VO9; 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1697759757; a=rsa-sha256; cv=none; b=UoXNT5mEg4o8SKoXvgO91XS6/bVWF2zDIzXz/5IRJgMHmYWPCIb5qqDXuxMzbLZQDcdFNo wLyBC9VRcMNogq2Hqpci7uREhNJ1zr6/DDS+OZecp6S+5vtCQ5d2FJ37gIlH11QL/+4X4z 2ClUfFawzctWHBay9RRq5KnV6Zh3RNgQgaW1aaSNEvbQjrp2xDyUEVBjgcJDHv+ZWD9aj4 pZqd3x0/yueiCsZhajhktaGLFFIf04bSU9sJPll2AyNCxNE1Pm5+/8rnlyh12mFd3zTFHF ht7aTodHBaKv5zIdPv0hxCgdv31F2ffY2AKrh00rcpLp/j4IgLyRQw7LfC18GA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=TjBy8VO9; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1697759757; 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=L9kLZcRUZlfCXVUUHPUJL7lHrlzZ74gYL10hQlIy3O0=; b=nuvwozXSrU0X8faIkQ6cyZmO1eLiMmFT1EWmTFdz+kdD/WzI/c38/ySB2UtFoTAZLB6VCU kDPSt5sKT/eCYCD6AeeQPDpZT4yG1cqxbAJdxYARsEyMRQfX5ST0jJ5KIIP19+V3uPKnwY z9t81zFEpoAfV0imwEkYOUEc6Rk5NHjWBrnQe5Bqixd6u1yoZ9Co5I0/QkWob4OngxuboO tTheWBbQL+85KI4mbvEWxI939sbFAOFyDyu8BwzEqUhTZVLG5SWuhR/qFx37cSeDL4RJsY rIHt97AzOvWSlNxXQy17TcxGExLAffkcx0Uir36CH+TShXo1NaQjo2E3bgyfcA== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtcra-0003Wa-VY; Thu, 19 Oct 2023 19:55:38 -0400 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 1qtcrY-0003W5-22 for guix-patches@gnu.org; Thu, 19 Oct 2023 19:55:36 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtcrX-0002AA-PV for guix-patches@gnu.org; Thu, 19 Oct 2023 19:55:35 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qtcry-0001dL-Ij for guix-patches@gnu.org; Thu, 19 Oct 2023 19:56:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#42146] [PATCH core-updates 1/?] build: substitute: Don't fail silently. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 19 Oct 2023 23:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42146 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: Jakub =?UTF-8?Q?K=C4=85dzio=C5=82ka?= , 42146@debbugs.gnu.org Received: via spool by 42146-submit@debbugs.gnu.org id=B42146.16977597396241 (code B ref 42146); Thu, 19 Oct 2023 23:56:02 +0000 Received: (at 42146) by debbugs.gnu.org; 19 Oct 2023 23:55:39 +0000 Received: from localhost ([127.0.0.1]:38224 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtcrW-0001cS-Ns for submit@debbugs.gnu.org; Thu, 19 Oct 2023 19:55:39 -0400 Received: from mail-yb1-xb2a.google.com ([2607:f8b0:4864:20::b2a]:53435) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtcrQ-0001c5-Ev for 42146@debbugs.gnu.org; Thu, 19 Oct 2023 19:55:33 -0400 Received: by mail-yb1-xb2a.google.com with SMTP id 3f1490d57ef6-d9c2420e417so260083276.2 for <42146@debbugs.gnu.org>; Thu, 19 Oct 2023 16:55:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697759695; x=1698364495; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=L9kLZcRUZlfCXVUUHPUJL7lHrlzZ74gYL10hQlIy3O0=; b=TjBy8VO9eDtND+MhbhRbpbBxako95TrGBxHwFcdGHHS4LnZM9sEkJfleWV7AgQvKBC vJWEf2QKLEkmATTHB9lcq1J+sOpKMo7D9pd5Ev6HVFliYtT1LEo6CoGfMfpgbrZ+4Tff 62UxcPcIudnzM7a78yCcnhaUlymfV2X2JByca8Lo/mnO919GHmK7AN0FbasgWaD2vn8e 1wlBc9JodQl7XtHaKM+wlR9LZBceLZf4/4/pJtriHVSh0zguL7nKDWL7mUT0V7BROYga D7r5etrA0BSLxJGoozNkSkGPzWS0mT7+clGNiGNj0A5vkRCz9G7a95SMsplO0qY/LTFE R8FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697759695; x=1698364495; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=L9kLZcRUZlfCXVUUHPUJL7lHrlzZ74gYL10hQlIy3O0=; b=SbpuvJlsBVK426Ncu7NyReBAXl5G8WyWDzjh7rMR4OG/lStP8k+2zYKlREHomO8V+1 HT7D7rdqCSUnWFzx+BZgOC/qpwH3hsDYhWuVC7q15ic+NN/Y7c9eqy0KDG6rdE4b09S1 /89Z0lmwbGdciWoNg19Gu4YgsNpRAa8UVh5Bo22B2O7DMEBSNS1m02/I2ugBinUfNk3q d+bcKvHVwgf1PedpP06BPeH7HNF7mixwioj9LjEHnnukYyNYzS40Yb7ew8aNQEB6qlFs zQB0c9PwbLR9f59qG6ZzTzEF8bDS20gvGWM3JDA/u4h0yDN7TfJ1EIbyB7li1NAkmxEw PG3A== X-Gm-Message-State: AOJu0YwyQQRegc5QzelfIJ+4/dpQHwP2yv5VDKdnw4vZ2p25tq7sSyPG u0uoPh9asr9WkzO4CDjdiEggJUZZc/jm6g== X-Google-Smtp-Source: AGHT+IFu3+yU+d0J3kp1Tu8835UPtlMfXCbkPMONduRw7O8ZPGgAnM19FMezz+qr93D9aYo+CnD36A== X-Received: by 2002:a05:6902:136d:b0:d9a:3bf2:54a6 with SMTP id bt13-20020a056902136d00b00d9a3bf254a6mr254754ybb.46.1697759695337; Thu, 19 Oct 2023 16:54:55 -0700 (PDT) Received: from hurd (dsl-156-111.b2b2c.ca. [66.158.156.111]) by smtp.gmail.com with ESMTPSA id fu8-20020a05622a5d8800b004181138e0c0sm188009qtb.31.2023.10.19.16.54.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 16:54:54 -0700 (PDT) From: Maxim Cournoyer In-Reply-To: <87lebyxs4y.fsf_-_@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Thu, 19 Oct 2023 22:40:45 +0200") References: <20200630220913.14665-1-kuba@kadziolka.net> <87lebyxs4y.fsf_-_@gnu.org> Date: Thu, 19 Oct 2023 19:54:53 -0400 Message-ID: <87pm1anp6a.fsf_-_@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx1.migadu.com X-Migadu-Spam-Score: 2.84 X-Spam-Score: 2.84 X-Migadu-Queue-Id: 8211F4E024 X-TUID: cJhvCHQIsUDn Hi Ludo, Ludovic Court=C3=A8s writes: > Hi, > > Maxim Cournoyer skribis: > >> * etc/teams.scm.in (, make-regexp*, regexp*-exec): Move to... >> * guix/build/utils.scm: ... here. >> (list-matches*): New procedure. > > > [...] > >> +++ b/guix/build/utils.scm > > [...] > >> +;;; >> +;;; Extend regexp objects with a pattern field. >> +;;; >> +(define-record-type >> + (%make-regexp* pat flag rx) >> + regexp*? >> + (pat regexp*-pattern) ;the regexp pattern, a string >> + (flag regexp*-flag) ;regexp flags >> + (rx regexp*-rx)) ;the compiled regexp object >> + >> +;;; Work around regexp implementation. >> +;;; This record allows to track the regexp pattern and then display it. >> +(define* (make-regexp* pat #:optional (flag regexp/extended)) > > I=E2=80=99m skeptical about the concrete benefits. I would not include i= t in > (guix build utils), or at least not in this patch series. > > (I tend to be super conservative about (guix build utils) because we > rarely get a chance to change it.) The original users are substitute* and the teams.scm script. Since substitute* is from (guix build utils), it makes sense to add it there as well, since they are coupled. The benefit is concrete: it makes it possible to show which regexp pattern failed to match (its textual representation), instead of something much less useful such as a generic placeholder such as " (regexp)". It's in actual use if you look at the definition of substitute: --8<---------------cut here---------------start------------->8--- (let ((rx+proc (map (match-lambda (((or (? regexp? pattern) (? regexp*? pattern)) . p= roc) (cons pattern proc)) ((pattern . proc) (cons (make-regexp* pattern regexp/extended) proc)= )) pattern+procs))) --8<---------------cut here---------------end--------------->8--- The previous version followed a different approach, annotating the rx+proc list with the raw pattern; I think the approach here is a bit cleaner, and it should also enable users to pass pre-computed regexp* objects to substitute* and have useful error messages produced. --=20 Thanks, Maxim