From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.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 CDmPFrGWMWWruQAAG6o9tA:P1 (envelope-from ) for ; Thu, 19 Oct 2023 22:50:57 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id CDmPFrGWMWWruQAAG6o9tA (envelope-from ) for ; Thu, 19 Oct 2023 22:50:57 +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 1F9A042F5C for ; Thu, 19 Oct 2023 22:50:57 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b="cqY4Eog/"; dmarc=pass (policy=none) header.from=gnu.org; 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=1697748657; a=rsa-sha256; cv=none; b=N06TNR1BGh0jiJeip5fnplTRs2kYlo1hitwsRVDRAwPjq0bX0rm9k8szGYZIfWvCucSkVv 1V/CakE0x2PfxjXrcyThbphO8Rxms+0u0Luf7vBmC6LsANYLqWKEyjz0D6Veq9vlKOz8yD sy5NqX7gwln2tFpoeNp7tOWtfW/vIHLb1EzPMuNvQXWJxXpvTNSBPu3zDBh8/sY0YS3Z2F 38OqGHI/djt11/hk/+sbSqP1q4CbV6tTsWpcs+lCI1hdGKU3mpddqeEfBCWe4peQPjMNdb Uq6qQW21a85uyKxZggniLPrekIsWnV5gkVmzw6YyeoivFMA5wdGIIIal2JQdEQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b="cqY4Eog/"; dmarc=pass (policy=none) header.from=gnu.org; 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=1697748657; 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=zuWWY0EBa6XTUOyTJOGcuek5mx1N2NbbFt3fZW8glSg=; b=Ba5JpOro0z4R78ha4ZavrEVpzKr0/18+UAjXiMGTXrrEVgkb0kxaakChJITsXjYBHRmbQT jSOVMaiQIglJhCzDqw4Po5WXydPHAyqw5VQiUFewrGC0SCIPXYvlpZKbibzyK/MmsE4b/j l1ldiQ4dDvCkh9eEeV4tolmCONMilA2RavRhPJbT3weCBZWkpGuJ9qGPNoxWaMCmZIulc1 LB9ZYaCV8ONekTMwtAhIL2smZPLPTP2ldoJcxuKbH25as3zf7FAkB3vFYSbZ/eRkVtFX4K nEp5cP1Ex9dEPJ0z7KLRqna7be960PI3RJhscGvnkFy54aO0e7QI0LKUd3SHvA== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtZyb-0003qa-A6; Thu, 19 Oct 2023 16:50:41 -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 1qtZyW-0003i1-BS for guix-patches@gnu.org; Thu, 19 Oct 2023 16:50:38 -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 1qtZyV-0005J1-9Q for guix-patches@gnu.org; Thu, 19 Oct 2023 16:50:35 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qtZyv-0003zG-M7 for guix-patches@gnu.org; Thu, 19 Oct 2023 16:51:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#42146] [PATCH core-updates 1/?] build: substitute: Don't fail silently. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 19 Oct 2023 20:51:01 +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: Maxim Cournoyer 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.169774862515272 (code B ref 42146); Thu, 19 Oct 2023 20:51:01 +0000 Received: (at 42146) by debbugs.gnu.org; 19 Oct 2023 20:50:25 +0000 Received: from localhost ([127.0.0.1]:37982 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtZyK-0003yF-R5 for submit@debbugs.gnu.org; Thu, 19 Oct 2023 16:50:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38680) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtZyF-0003xz-Lc for 42146@debbugs.gnu.org; Thu, 19 Oct 2023 16:50:22 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtZxi-0004tl-PQ; Thu, 19 Oct 2023 16:49:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=zuWWY0EBa6XTUOyTJOGcuek5mx1N2NbbFt3fZW8glSg=; b=cqY4Eog/vabsZCVrfZrC Z1Nwl7xXWRiKfkEC8nIy4hYkJxvOmVNz+UljIG6GQ6fe8hgac42bKWLMFzea+UzEEO5aRLOc2arrE 40bh3AXtjAphGWo/pUITBXvgibapg0I9cf1/QpdwNUFWEOIARHMfKN62LA2IW4WBLXfzw5LOHXsqr cpUHXTZ5iKhhNgAgztdPQVf/YCmmgFg5hK7VsTUECUzdI6OxcmuzIAHlQHhr5ph3nAbFKddgxnK7Z vtAyl9TBtaKxqYlyvuetfNLxpc//fXGDplQ30eW9QeiI+yoz4kTLVwrD0QHf5DsusNbujv1g1eas1 M/1dQKhLABRa2g==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: (Maxim Cournoyer's message of "Thu, 19 Oct 2023 16:33:33 -0400") References: Date: Thu, 19 Oct 2023 22:49:44 +0200 Message-ID: <878r7yxrpz.fsf_-_@gnu.org> 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: -6.76 X-Spam-Score: -6.76 X-Migadu-Queue-Id: 1F9A042F5C X-TUID: MBDsNkCJ5XN9 Maxim Cournoyer skribis: > From: Jakub K=C4=85dzio=C5=82ka > > * guix/build/utils.scm (substitute, substitute*) > [require-matches?]: New argument. > * tests/build-utils.scm ("substitute*"): New test group. > ("substitute*, no match error") > ("substitute*, partial no match error"): New tests. > > Co-authored-by: Maxim Cournoyer > Change-Id: I66ed33d72aa73cd35e5642521efec70bf756f86e [...] > -(define (substitute file pattern+procs) > +(define* (substitute file pattern+procs #:key (require-matches? #t)) > "PATTERN+PROCS is a list of regexp/two-argument-procedure pairs. For = each > line of FILE, and for each PATTERN that it matches, call the correspondi= ng As discussed on IRC recently, I=E2=80=99d suggest: #:key (require-matches? (%substitute-requires-matches?)) where: (define %substitute-requires-matches? (make-parameter #t)) That way it=E2=80=99ll be easier to change the default for entire builds if= we need to. > + (when require-matches? > + (let ((failed-patterns (lset-difference > + string=3D? > + (delete-duplicates > + (map rx->pattern failed-matches= )) > + (delete-duplicates > + (map rx->pattern ok-matches))))) That=E2=80=99s potentially costly. Would it be enough to thread a list of unmatched regexps, and to (delq rx unmatched) every time RX is matched? (This is O(N) but N, the number of regexps, is typically a handful.) Then at the end, we=E2=80=99d check whether UNMATCHED is empty. > + (when (not (null? failed-patterns)) > + (raise (make-condition failed-patterns))))) SRFI-35 =E2=80=98make-condition=E2=80=99 expects different arguments. Should probably be: (raise (condition (&substitute-error =E2=80=A6))). > + ((substitute* file #:require-matches? require-matches? > + ((regexp match-var ...) body ...) ...) Maybe rather: (substitute* file ((regexp match-var ...) body ...) ... #:require-matches? require-matches?) That way we formatting remains unchanged. > +(test-group "substitute*" I=E2=80=99d avoid groups: they=E2=80=99re not super useful and the output w= ith the Automake driver is terrible. Ludo=E2=80=99.