From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 0DkHNYcD2mETFAEAgWs5BA (envelope-from ) for ; Sat, 08 Jan 2022 22:35:03 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id ABq4LYcD2mH91gAAG6o9tA (envelope-from ) for ; Sat, 08 Jan 2022 22:35:03 +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 53D191637B for ; Sat, 8 Jan 2022 22:35:03 +0100 (CET) Received: from localhost ([::1]:40436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n6JMc-0004ha-4N for larch@yhetil.org; Sat, 08 Jan 2022 16:35:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:32952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n6JLy-0004fF-IU for guix-devel@gnu.org; Sat, 08 Jan 2022 16:34:26 -0500 Received: from [2a0c:e300::1] (port=45756 helo=hera.aquilenet.fr) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n6JLw-0007ef-Q5 for guix-devel@gnu.org; Sat, 08 Jan 2022 16:34:22 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 7123E283; Sat, 8 Jan 2022 22:34:17 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id c6WLGUAF5cgp; Sat, 8 Jan 2022 22:34:16 +0100 (CET) Received: from ribbon (unknown [IPv6:2a01:e0a:1d:7270:af76:b9b:ca24:c465]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 1551D212; Sat, 8 Jan 2022 22:34:16 +0100 (CET) From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Ricardo Wurmus Subject: Re: RFC: new syntax for inline patches References: <87ee5ne7z5.fsf@elephly.net> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 19 =?utf-8?Q?Niv=C3=B4se?= an 230 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sat, 08 Jan 2022 22:34:15 +0100 In-Reply-To: <87ee5ne7z5.fsf@elephly.net> (Ricardo Wurmus's message of "Tue, 04 Jan 2022 17:50:31 +0100") Message-ID: <87zgo53oa0.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: / X-Rspamd-Server: hera X-Rspamd-Queue-Id: 7123E283 X-Spamd-Result: default: False [0.46 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; R_MIXED_CHARSET(0.56)[subject]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a0c:e300::1 (failed) Received-SPF: softfail client-ip=2a0c:e300::1; envelope-from=ludo@gnu.org; helo=hera.aquilenet.fr X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel@gnu.org Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" 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=1641677703; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=DOaz1S1+Uxq35yEW2EW9s+Nf4FxijBPQxmKUXHg2DdA=; b=TCUCVCCdrFhhtaOgLbxkDYBfVSv+HCFC3FVVcyo2DWuny2LVAqZQ3ZVZckJsI5ZJlg9yMa jEHdaimWqC58kM0AbVzvMwNJGG86a9RETZwFk62x3OKYD8u9b0hkbCwrDHgTvAWPd7ttXn bqAbg5Nap5H4k+f61qaPGQOnalWoXwmASLuk7dDej2CJ0vl8k3roOpltX+WnYMJ46CloKI 4rOIVZKpFMgJP3nq0snmRh5LkLbgmL8Q/jmSEO5rqbqfVrT7hOuwPEFxvMRx6sA2IdD+Hr EYKRBPshY8pMUr09zQ9X78j5cTh+bMQbh+WtQubT+8cx4kSYjwg/bLOsNMeXYA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1641677703; a=rsa-sha256; cv=none; b=e23coHUiOzpw8sDeQMKg2KrTlqkrBVmvwA9Yvz5CZLkinF+3aiiLsC1rbKLAQ7YoLUoD3b eIJVT4aRWTz2XUKl2UKMqjAk1lZX8FLysLOdADyphYqztFaM9IGGvy648gDeXn/caUW5dZ aDiauS+qYdp7/GJsTK8SkzAGvieEP7xeiV3vyyd+UBJVV0c9sZcBvZwJ/aXLK5Ki5VLbCx G+sJyxxi7WxSmGnXPryzDz3eRGi7NqXTyEs71Gd3Sksiao0ZRn6+t3xT49eDiv5fKQ/9kr uG2rXksIjrBpXrT0AAexXsNgnDjyVDP2C3PdEvAVuPiBQmevjxiqscfTM1fqrQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.60 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 53D191637B X-Spam-Score: -3.60 X-Migadu-Scanner: scn1.migadu.com X-TUID: MkwOTNEWBfin Hi! Ricardo Wurmus skribis: > (arguments > (list > #:phases > '(modify-phases %standard-phases > (add-after 'unpack 'i-dont-care > (lambda _ > (substitute* "this-file" > (("^# some unique string, oh, careful! gotta \\(escape\\) thi= s\\." m) > (string-append m "\nI ONLY WANTED TO ADD THIS LINE!\n"))))))= )) [...] > There are a few reasons why we don=E2=80=99t use patches as often: > > 1. the source code is precious and we prefer to modify the original > sources as little as necessary, so that users can get the source code as > upstream intended with =E2=80=9Cguix build -S foo=E2=80=9D. We patch the= sources > primarily to get rid of bundled source code, pre-built binaries, or > code that encroaches on users=E2=80=99 freedom. > > 2. the (patches =E2=80=A6) field uses patch files. These are annoying and > inflexible. They have to be added to dist_patch_DATA in gnu/local.mk, > and they cannot contain computed store locations. They are separate > from the package definition, which is inconvenient. > > 3. snippets feel like less convenient build phases. Snippets are not > thunked, so we can=E2=80=99t do some things that we would do in a build p= hase > substitution. We also can=E2=80=99t access %build-inputs or %outputs. (= I don=E2=80=99t > know if we can use Gexps there.) I agree that #1 is overrated. As for #3, we could make =E2=80=98snippet=E2=80=99 thunked (a snippet can b= e a gexp already). We cannot refer to build inputs there, but that=E2=80=99s on pur= pose: snippets, like patches, are supposed to be architecture-independent and unable to insert store file names. [...] > (We have something remotely related in etc/committer.scm.in, where we > define a record describing a diff hunk.) > > Here=E2=80=99s a colour sample for the new bikeshed: > > (arguments > (list > #:patches > #~(patch "the-file" > ((line 10) > (+ "I ONLY WANTED TO ADD THIS LINE")) > ((line 3010) > (- "maybe that=E2=80=99s better") > (+ (string-append #$guix " is better")) > (+ "but what do you think?"))))) Like Attila my first reaction was skepticism. =E2=80=A6 but thinking about it, we could have a record, similar to the record you mention; it would be a file-like object that, when lowered, would give an actual patch. So you could write: (origin ;; =E2=80=A6 (patches (list (computed-patch (hunk (line 10) (+ "new line") (- "old line")))))) The good thing is that the implementation of would be entirely orthogonal, separate from the package machinery. OTOH, if we do that, we might as well write the actual patch right away. I wonder how frequent the pattern we=E2=80=99re discussing is. I know I=E2= =80=99ve used it a few times, but I wonder if it warrants sophisticated tooling. Thoughts? Ludo=E2=80=99.