From patchwork Tue Nov 14 13:24:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 1976 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 0093227BBEA; Tue, 14 Nov 2023 13:25:58 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 5D7B827BBE2 for ; Tue, 14 Nov 2023 13:25:58 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r2tQ6-0003NJ-MH; Tue, 14 Nov 2023 08:25:34 -0500 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 1r2tPv-0003KL-Rn for guix-patches@gnu.org; Tue, 14 Nov 2023 08:25:24 -0500 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 1r2tPv-0001Hv-Ir; Tue, 14 Nov 2023 08:25:23 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r2tQY-0004NY-GS; Tue, 14 Nov 2023 08:26:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67172] [PATCH 0/2] Turning into lowerable objects Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Tue, 14 Nov 2023 13:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 67172 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 67172@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by submit@debbugs.gnu.org id=B.169996834616806 (code B ref -1); Tue, 14 Nov 2023 13:26:02 +0000 Received: (at submit) by debbugs.gnu.org; 14 Nov 2023 13:25:46 +0000 Received: from localhost ([127.0.0.1]:60477 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2tQI-0004My-7n for submit@debbugs.gnu.org; Tue, 14 Nov 2023 08:25:46 -0500 Received: from lists.gnu.org ([2001:470:142::17]:45448) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2tQF-0004Mh-EP for submit@debbugs.gnu.org; Tue, 14 Nov 2023 08:25:44 -0500 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 1r2tPT-0003Eq-P7 for guix-patches@gnu.org; Tue, 14 Nov 2023 08:24:55 -0500 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 1r2tPS-000133-Qy; Tue, 14 Nov 2023 08:24:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=iuHkF3KAoOFNqmbEfX0puuiJ/tBf/ogkk8SoFzS/6tE=; b=SS+YJ62aY3XL+I jIUQyVkpRF28VuyevY6qnj63Q0Oi+6C4MkQV6cnDVgT1XUdLtTVAtEh8x/mVqxXd4NF1cYnAtv86p AQ6ba8YdKNp8FGpGJCtk34eBgqoCXK5V1R0r/F7S2eq1uQ2laD44IDof7c6Z7oWrMXOmblKPdVX3v xg+bTrco33MlirmG8eERn3NkXTAc1CKusSE78pE1KFsFxFgQASm0vAU5o3WVdCTsjf2i/Ri0lsGWN DXqVHRHGk/+ZEqofQ0Qsen+wCNuyMLc4zQ58EfYD+ahu3mzgTCjCB9e70AO2tXv8yi312xUcw+fQG 0NmXRdBr85ct4txd1ElQ==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Tue, 14 Nov 2023 14:24:45 +0100 Message-ID: X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Hello there! These patches address a long-standing issue with gexps: the gexp writer has full control over the type of references used in the gexp (they get to choose between ‘ungexp’ and ‘ungexp-native’, they also choose which output of the file-like to refer to), but whoever passes a value that ends up in the gexp has no power over the type of reference. The goal here is to provide a more control over that, as shown in this manual excerpt added here: --8<---------------cut here---------------start------------->8--- -- Procedure: gexp-input OBJ [OUTPUT] [#:native? #f] Return a “gexp input” record for the given OUTPUT of file-like object OBJ, with ‘#:native?’ determining whether this is a native reference (as with ‘ungexp-native’) or not. This procedure is helpful when you want to pass a reference to a specific output of an object to some procedure that may not know about that output. For example, assume you have this procedure, which takes one file-like object: (define (make-symlink target) (computed-file "the-symlink" #~(symlink #$target #$output))) Here ‘make-symlink’ can only ever refer to the default output of TARGET—the ‘"out"’ output (*note Packages with Multiple Outputs::). To have it refer to, say, the ‘"lib"’ output of the ‘hwloc’ package, you can call it like so: (make-symlink (gexp-input hwloc "lib")) You can also compose it like any other file-like object: (make-symlink (file-append (gexp-input hwloc "lib") "/lib/libhwloc.so")) --8<---------------cut here---------------end--------------->8--- Thoughts? Ludo’. Ludovic Courtès (2): gexp: Add compiler for . gexp: #:references-graphs accepts and honors records. doc/guix.texi | 45 ++++++++++++++++++++++++++++++++++++---- guix/gexp.scm | 31 +++++++++++++++++++++++----- tests/gexp.scm | 56 +++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 122 insertions(+), 10 deletions(-) base-commit: 08d94fe20eca47b69678b3eced8749dd02c700a4