From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert Vollmert Subject: bug#36772: feature request: checked variant of "substitute*" Date: Tue, 23 Jul 2019 14:49:46 +0200 Message-ID: Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:47194) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hpuFz-0001Tl-1w for bug-guix@gnu.org; Tue, 23 Jul 2019 08:51:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hpuFy-0007mo-4y for bug-guix@gnu.org; Tue, 23 Jul 2019 08:51:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:53548) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hpuFy-0007mZ-25 for bug-guix@gnu.org; Tue, 23 Jul 2019 08:51:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hpuFx-0001eK-V6 for bug-guix@gnu.org; Tue, 23 Jul 2019 08:51:01 -0400 Sender: "Debbugs-submit" Resent-Message-ID: Received: from eggs.gnu.org ([2001:470:142:3::10]:46726) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hpuF8-0001JJ-OC for bug-guix@gnu.org; Tue, 23 Jul 2019 08:50:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hpuF7-0007DG-SW for bug-guix@gnu.org; Tue, 23 Jul 2019 08:50:10 -0400 Received: from mx1.mailbox.org ([2001:67c:2050:104:0:1:25:1]:19642) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hpuF7-0007Bg-M4 for bug-guix@gnu.org; Tue, 23 Jul 2019 08:50:09 -0400 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id E8876509FD for ; Tue, 23 Jul 2019 14:50:04 +0200 (CEST) Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id 2b-YWzYIE7zN for ; Tue, 23 Jul 2019 14:50:01 +0200 (CEST) List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: 36772@debbugs.gnu.org I think it would be great to have the following variant of substitute*: (substitute*-once filename (pattern vars) body) which acts like the usual substitute-*, except it also asserts that the substitution applies to exactly one line in the file, causing a build failure otherwise. In the cases where this is sufficient (I believe most), it would make substitution work quite a bit more reliably, making it both easier to debug substitution when first packaging, and noticing more easily when they need to be adapted on upgrades. (It would be possible to make the signature a bit more flexible and to allow multiple files or patterns as in substitute*, but that would make the meaning of =E2=80=9Capplies exactly once=E2=80=9D a bit = unclear, so I=E2=80=99d prefer to not do that. Similarly, I find it cleaner to potentially call substitute*-once several times in a row with different substitutions to make the ordering of effects explicit.) (I=E2=80=99d be happy to supply a patch myself eventually, but the = syntax rule business is a bit out of reach at this point.)