From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id IDMjL98Y32H9DAEAgWs5BA (envelope-from ) for ; Wed, 12 Jan 2022 19:07:27 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id UMluLN8Y32FpegEA9RJhRA (envelope-from ) for ; Wed, 12 Jan 2022 19:07:27 +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 4062DF2B6 for ; Wed, 12 Jan 2022 19:07:27 +0100 (CET) Received: from localhost ([::1]:40152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n7i1r-0007o8-Ae for larch@yhetil.org; Wed, 12 Jan 2022 13:07:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7i1I-0007ny-IZ for guix-devel@gnu.org; Wed, 12 Jan 2022 13:06:48 -0500 Received: from flashner.co.il ([178.62.234.194]:33128) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n7i1G-0006rd-OA; Wed, 12 Jan 2022 13:06:48 -0500 Received: from localhost (unknown [141.226.10.247]) by flashner.co.il (Postfix) with ESMTPSA id 4E0E6404DE; Wed, 12 Jan 2022 18:06:44 +0000 (UTC) Date: Wed, 12 Jan 2022 20:06:06 +0200 From: Efraim Flashner To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: RFC: new syntax for inline patches Message-ID: Mail-Followup-To: Ludovic =?utf-8?Q?Court=C3=A8s?= , Ricardo Wurmus , guix-devel@gnu.org References: <87ee5ne7z5.fsf@elephly.net> <87zgo53oa0.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Khf5BdMXcq2neYlt" Content-Disposition: inline In-Reply-To: <87zgo53oa0.fsf@gnu.org> X-PGP-Key-ID: 0x41AAE7DCCA3D8351 X-PGP-Key: https://flashner.co.il/~efraim/efraim_flashner.asc X-PGP-Fingerprint: A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Received-SPF: pass client-ip=178.62.234.194; envelope-from=efraim@flashner.co.il; helo=flashner.co.il X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham 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=1642010847; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=IznwvMagLqajfpS4uUf9e006pZw3KdH5PRyAhzjSscE=; b=nBHFAjWJn05F0HJjcjHZi6G/lXBh6LgfYEYrHtG3kT4miVetvRfer3OYlJ7rI516BA9OGi jTSqHazXXZWqv7uWMNFPwc+OM0ilmPXwEPEktcUy8Esu4TPxvkyvuthvMBFPqVmLgjBjCt kf7VjC3+rgvP2/mCvtDKmPJjxKsuL/YqnRHmxll1IndeweCqwmPTscOVp0iLRda8qqP1FW cvYvwySVX4Pnr1tyOXDZmsiedRS+umnqNJOPelU430IoLaDfi1EcLBZSSQLQS2SMYwImde TY/58oV0s1KBOGRmFClw0y8m32umoDutQRZAIpmDnU3SvaNOESK7/sb1UzDNaw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1642010847; a=rsa-sha256; cv=none; b=E7rJghhibBEIiunAHhOPIBcqHQ61JHEdUzOEwcMZLIxhCHY/axgAHCa3umpCOJnVpJkoX7 eF4TOkI+dG9ObKJS0SmGyxETEqDfBgAlSEtu6mWy8RPuT04O6vVH4+55F67AnUKJr5YWVJ znL0jEjbStEzhYW1kJdk+SG8b3jExLN70r1IHy8C6opth05D1MgNxX/PaCXi6pHdwF/1A3 tzUuhvRPZZPvBTu9WnKkiD3l1GUIfUHGmO2FjrKELgmrQtKPylqkZ7FHHY361BdzeV/z6j Pe/BqlVyjoAHCg+tknFwqbB/vR0YEBY45OhxcVzp28SxWZpIQ0Q5BuGOHp3ywA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; 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: -4.72 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; 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: 4062DF2B6 X-Spam-Score: -4.72 X-Migadu-Scanner: scn0.migadu.com X-TUID: Rp/T/eEgUQId --Khf5BdMXcq2neYlt Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jan 08, 2022 at 10:34:15PM +0100, Ludovic Court=C3=A8s wrote: > Hi! >=20 > Ricardo Wurmus skribis: >=20 > > (arguments > > (list > > #:phases > > '(modify-phases %standard-phases > > (add-after 'unpack 'i-dont-care > > (lambda _ > > (substitute* "this-file" > > (("^# some unique string, oh, careful! gotta \\(escape\\) t= his\\." m) > > (string-append m "\nI ONLY WANTED TO ADD THIS LINE!\n"))))= )))) >=20 > [...] >=20 > > 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 t= he 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= phase > > substitution. We also can=E2=80=99t access %build-inputs or %outputs. = (I don=E2=80=99t > > know if we can use Gexps there.) >=20 > I agree that #1 is overrated. >=20 > As for #3, we could make =E2=80=98snippet=E2=80=99 thunked (a snippet can= be a gexp > already). We cannot refer to build inputs there, but that=E2=80=99s on p= urpose: > snippets, like patches, are supposed to be architecture-independent and > unable to insert store file names. >=20 > [...] >=20 > > (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?"))))) >=20 > Like Attila my first reaction was skepticism. >=20 > =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. >=20 > So you could write: >=20 > (origin > ;; =E2=80=A6 > (patches (list (computed-patch > (hunk (line 10) (+ "new line") (- "old line")))))) >=20 > The good thing is that the implementation of would be > entirely orthogonal, separate from the package machinery. >=20 > OTOH, if we do that, we might as well write the actual patch right away. >=20 > 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. >=20 > Thoughts? I'm OK with needing to change the exact line needed if it moves (EXACTLY line 10, not 8 or 12 or 25). It comes up a lot when glibc headers move or split, suddenly we're looking at the sources, trying to find somewhere to stuff in an extra include statement. Or qt-5.11, I think we came up with 3 different ways of dealing with the missing header over the 10 patches. --=20 Efraim Flashner =D7=A8=D7=A0=D7=A9=D7=9C=D7=A4 = =D7=9D=D7=99=D7=A8=D7=A4=D7=90 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --Khf5BdMXcq2neYlt Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmHfGI4ACgkQQarn3Mo9 g1HKEA/+Ke585bivdmbW4o0OIWAx/tSV1pUQ0ZwViXsudWkEJOAxsOFXp080s7vD zP1AjwBKOhobLuu6Qd8G+4lYpJ5F/WbpmDvXK/HpFifqb9ViQlJzzYBFkbRzZQ6M BjwAs/yWURoW9bfEbQEYOINDJqUOs7p2e/QYVWJBTw5KtvdxTz66qCxDQGi6wC+g wK2F/UKvhibdQIQAMKhBxpV+1mAgF8eHQgISPVvVWBGQ5HqmochiGjH76Bi9+HIL S1P1RBxWPbILA8GExXCAcuQWhX6UwtLNCKdGQJy6Y5dComEcVtrnfkw0/4dNhfml DBetZBWaOaQUB2hOTo8rpcNNPERRSeZnxJYAmC6RUOT5tOFX/tfDcD77FCkj7GFX j7W0XrQaMseKrSOPDvyGpPDa6VQV24oKec5LA5mJHAXpACD9c4xNyvhMLtCxZoZB Gwbf8Pdk3FuBYgp5+7niHn56MY2t1aD6Vr12cq6llxbOS3KtbDSOUPdBp10OxY4I O6oT3qzO1qlmIppxlQ1IyOHFymfwdq/3jTox8SAoXiIABDv25if9arX5j7nirm1w QrBTaqwCGDVwkuy7UmmvJTQzwAO1F+OhTDsoamwMdTO+I5kmGKDRzG4ChmXd7CKm jBLDPY+47K2nHNpEF1ogIosZ/eczLoXrviLNSyFssnZi5ea+u1E= =hGgc -----END PGP SIGNATURE----- --Khf5BdMXcq2neYlt--