X-Loop: help-debbugs@HIDDEN Subject: bug#66510: `this-package' references reintroduce pre-transformation packages. Resent-From: Ulf Herrman <striness@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-guix@HIDDEN Resent-Date: Fri, 13 Oct 2023 03:59:02 +0000 Resent-Message-ID: <handler.66510.B.1697169494435 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 66510 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 66510 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-guix@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.1697169494435 (code B ref -1); Fri, 13 Oct 2023 03:59:02 +0000 Received: (at submit) by debbugs.gnu.org; 13 Oct 2023 03:58:14 +0000 Received: from localhost ([127.0.0.1]:44555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qr9JV-00006x-Iv for submit <at> debbugs.gnu.org; Thu, 12 Oct 2023 23:58:13 -0400 Received: from lists.gnu.org ([2001:470:142::17]:43776) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <striness@HIDDEN>) id 1qr9JP-00006Q-CQ for submit <at> debbugs.gnu.org; Thu, 12 Oct 2023 23:58:11 -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 <striness@HIDDEN>) id 1qr9Iw-0007RA-LQ for bug-guix@HIDDEN; Thu, 12 Oct 2023 23:57:38 -0400 Received: from tilde.club ([142.44.150.184]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <striness@HIDDEN>) id 1qr9Iu-0004Ja-QY for bug-guix@HIDDEN; Thu, 12 Oct 2023 23:57:38 -0400 Received: by tilde.club (Postfix, from userid 5378) id DF6682204ECD3; Fri, 13 Oct 2023 03:57:34 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 tilde.club DF6682204ECD3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tilde.club; s=mail; t=1697169454; bh=RaFJNMUOZZsOrjAEtX8icDj5e5J61xMnM57nBSGgeUU=; h=From:To:Subject:Date:From; b=BF83EKtoeVxE/FIQSjskKpTtfdPPQjYq/fVBjHFIVsdwwK6QQQZjLxyrU7Jdh5IG5 yxjnwDuelVPrDyHR2Tnp5EemacjK0N9pZyYpl0Hje6GbeTgSL80EI7B2brGHMJTMxL XMchUjiQoWPKzqffzD+WWZ4ZBIoQt3G04+xLgQY8= From: Ulf Herrman <striness@HIDDEN> Date: Thu, 12 Oct 2023 22:57:14 -0500 Message-ID: <87sf6fdvj9.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Received-SPF: pass client-ip=142.44.150.184; envelope-from=striness@HIDDEN; helo=tilde.club X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.1 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Suppose you have a package that is using a gexp in its argument list and, like a good citizen of the gexp world, it uses this-package-input to refer to its own input packages. In fact, let's suppose that it's the model citizen depicted in https://guix.gnu.org/en/blog/2021/the-big-change/ under the "G-expressions and self-referential records" heading: (define hello (package (name "hello") ;; =E2=80=A6 (arguments (list #:configure-flags #~(list (string-append "--with-gawk=3D" #$(this-package-input "gawk"))))) (inputs `(("gawk" ,gawk))))) If we define a variant like so: (define hello-variant (package (inherit hello) (name "hello-variant") (inputs `(("gawk" ,gawk-4.0))))) it will work just fine. But if we define a variant like SO: (define hello-variant (package (inherit hello) (name "hello-variant") (inputs `(("gawk" ,gawk-4.0))) (arguments (substitute-keyword-arguments (package-arguments hello) ((#:configure-flags flags #~'()) #~(cons "--with-hospitality=3Dice-cream" #$flags)))))) it will NOT work just fine. When (package-arguments hello) is evaluated, it will execute the field definition for `hello' with `this-package' bound to `hello', rather than `hello-variant'. Consequently, `this-package-input' will return gawk rather than gawk-4.0. We need a way to access the "parent" package's fields while keeping `this-package' bound to its current value. The most general form of this would look something like this: (define (package-arguments-with-package p0 p) (match p0 (($ <package> _ _ _ _ arguments-proc) (arguments-proc p)))) Then hello-variant could be changed to use (package-arguments-with-package hello this-package) instead of (package-arguments hello). This may be needlessly general, though; the problem could also be solved with an interface more along the lines of (parent-package-arguments hello) which expands into the aforementioned package-arguments-with-package call. Another option would be to, yet again, extend the record syntax. It's always bugged me a bit to have to explicitly reference the original record in more than one place when using derived fields, so this might be generally useful as well: (define hello-variant (package (inherit hello (arguments hello-arguments)) (name "hello-variant") (inputs `(("gawk" ,gawk-4.0))) (arguments (substitute-keyword-arguments hello-arguments ((#:configure-flags flags #~'()) #~(cons "--with-hospitality=3Dice-cream" #$flags)))))) This would create a macro named `hello-arguments' within the scope of the (package ...) form which expands into something equivalent to a `parent-package-arguments' call. Adjust syntax to taste. Thoughts? =2D Ulf --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQHIBAEBCAAyFiEEn6BUn0yca1D9JsMa1lV76sJM9mgFAmUowBoUHHN0cmluZXNz QHRpbGRlLmNsdWIACgkQ1lV76sJM9mhMggv+KB3jA1cTdS9iUoGC2tJWHNvWYAjp tq6kaKJgop/2hgxcdPuhB37Lcx3TOCTJoVFzL7Mpni6o4k2UolgERYMy9hUCzXul XZhqoLrSvDWfQEpoKzFNMZaVGC6PSirFdFb3XteyrfiWyjH/INgL/IX+V91g93Si /ZR7Ks6CiRuQ5MReW2LzyhiDx64KXEnE3oUCnqKUfDJgLtHD/bFqqK3ZqjIPeIir 4pPDfq2pyH8MqQAx5cQjfmQwVoX1RNKITISHlvIAZvTVsp7oCJV0Rvg/Pg+8kpFI P6eKyzsJJbZx4NYVRpXAXXpfcn5D02CjGErOYrFolK+HLT5KlyNc6FYFQstOyoB2 vAu/WYaSBD4rfaT6iSL4m9zH4kMb6pl2sLkgMP5QPYK2i0zsnvjAqBc+2SPOwpvE n52+uq7w/WtqzcZCYzmezunTK9VvGy50+HkfC2aVDpckpC3HSklotkDhJkn8PHwy bxxxDRP9nfcG9YirGPJrJ+Y5G0UmBvAniMkR =8Su+ -----END PGP SIGNATURE----- --=-=-=--
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Ulf Herrman <striness@HIDDEN> Subject: bug#66510: Acknowledgement (`this-package' references reintroduce pre-transformation packages.) Message-ID: <handler.66510.B.1697169494435.ack <at> debbugs.gnu.org> References: <87sf6fdvj9.fsf@HIDDEN> X-Gnu-PR-Message: ack 66510 X-Gnu-PR-Package: guix Reply-To: 66510 <at> debbugs.gnu.org Date: Fri, 13 Oct 2023 03:59:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-guix@HIDDEN If you wish to submit further information on this problem, please send it to 66510 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 66510: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D66510 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
Received: (at control) by debbugs.gnu.org; 21 Oct 2023 22:34:20 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 21 18:34:20 2023 Received: from localhost ([127.0.0.1]:45216 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1quKXw-0001XZ-QE for submit <at> debbugs.gnu.org; Sat, 21 Oct 2023 18:34:20 -0400 Received: from tilde.club ([2607:5300:204:4340::114]:40230 ident=postfix) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <striness@HIDDEN>) id 1quKXr-0001XJ-Fe for control <at> debbugs.gnu.org; Sat, 21 Oct 2023 18:34:15 -0400 Received: by tilde.club (Postfix, from userid 5378) id CE654224101FA; Sat, 21 Oct 2023 22:33:41 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 tilde.club CE654224101FA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tilde.club; s=mail; t=1697927621; bh=16BzXhth4up2eBhlwRIjWEqSWdkBnFNL4hOaFZR5ADc=; h=From:To:Subject:Date:From; b=GCUG8ZgDR/2aaR0Y7IZ9PA78hyrknzcZOzZwSupT8ddCm3aXQUGGQ0FoZ5mPnZ+rk SMFJK0nNj1jS+B3F5QBikJ1nRDZB3bcftIZ08tK44tlG2hNt0cxntv1OseKtnichgQ yDIju+TVFF9zx7iz9jHeDhyBVmi4pTXFRSfdCGh8= From: Ulf Herrman <striness@HIDDEN> To: control <at> debbugs.gnu.org Subject: Merge new duplicate Date: Sat, 21 Oct 2023 17:33:30 -0500 Message-ID: <87y1fvppvp.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) forcemerge 50335 66510
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.