From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id wOSlACN4U2VGiQAAauVa8A:P1 (envelope-from ) for ; Tue, 14 Nov 2023 14:37:39 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id wOSlACN4U2VGiQAAauVa8A (envelope-from ) for ; Tue, 14 Nov 2023 14:37:39 +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 B08F34145A for ; Tue, 14 Nov 2023 14:37:38 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b="mL/rg/mK"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1699969058; a=rsa-sha256; cv=none; b=Zxe6gCzlSHW4Gq9m1VQSN/ZuITgnp7tmHAiEzw+A2TgkfyGjmZTJ4RQMTq+juD/HPDzg6i FIoHLbAuBY53qslhR6uuXA038lpYgbcP5HBClRl/rafBx/7g0Dc3lcvOBeXxQ3nX7jy78z wviF2jHU+ByFnK4bPcVWx15+oW7pFe0SIuIX85FCM9Nl1CHp01eU1Ai6GYZbrvgvPxuKUj NsiCiABcxXxtvIm/a3spcgJUcozgYQZRA2RDl7ABOvD/101XbWdT7+nJsnbHW3vYxA/0x9 pC/pszYe6c5WwWom7e2AuieWld4XFJe4g3sL+/iGp5EzQn91ckcJo4JTCjw4bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1699969058; 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:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=ok/uAKjMCy/oQGrwNt/rf/KNm6Bb0NevxF0AwmWp/K0=; b=hR4T6KBhX/02I4o0ZHaX7f+HFbHgKsnfudR5n60L3vvc2//EWRxgGeipN7ji4UXsfwXaU1 rjUOKOetmmw1hYc3+LvBJl4x1mesSBzsgYoTTzr85hWREGiJasMgb92XnrBy4uZNL9kbJB rK/wC6WoCCULxSAx2YFMpTPus2z0K9fX4APmXYeOLnzVdLC+7BNjAtGXg9BWg0ZBPJwPZE Ztsc9+oUGIit9nVIZ17Bch7D2AuLUhW2IXFI1msIkjAhJKykrK00ZrSEDgpmfb+YJRmUYL 8OSfDDd1wgBwQXb3rioNuBBMggVBj14Ds/xzUpRIQofelbtCLG31HhIdb1adrw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b="mL/rg/mK"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r2tbg-0007hQ-7S; Tue, 14 Nov 2023 08:37:32 -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 1r2tbX-0007Xn-Gu for guix-patches@gnu.org; Tue, 14 Nov 2023 08:37: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 1r2tbV-0003Jf-Lz; Tue, 14 Nov 2023 08:37:23 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r2tc9-0004gu-Kd; Tue, 14 Nov 2023 08:38:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67172] [PATCH 2/2] gexp: #:references-graphs accepts and honors records. 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:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 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-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 67172-submit@debbugs.gnu.org id=B67172.169996904417988 (code B ref 67172); Tue, 14 Nov 2023 13:38:01 +0000 Received: (at 67172) by debbugs.gnu.org; 14 Nov 2023 13:37:24 +0000 Received: from localhost ([127.0.0.1]:60505 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2tbX-0004g4-Ky for submit@debbugs.gnu.org; Tue, 14 Nov 2023 08:37:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34728) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2tbV-0004fp-GU for 67172@debbugs.gnu.org; Tue, 14 Nov 2023 08:37:21 -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 1r2tah-0003Ae-Kt; Tue, 14 Nov 2023 08:36:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=ok/uAKjMCy/oQGrwNt/rf/KNm6Bb0NevxF0AwmWp/K0=; b=mL/rg/mKv/D8KZVzr+lG RTuarVYGKPh+rqGoXtF1Agua3f+T4/4fAfcvurnth0TET9ChjeNpxQXlipFFRLkrTWeAs0Df/Isi5 Fd2cvGSFSZjSEiZAmH701FRPgRAwhk8VkYZEXTfzx7UXtC9O3zsP//m/1UyMcLmOmgkrsV4Ck/1dR IkALdGrKt8IQGsFdR0PKNR/2uv/NYaPcRhaE8jKX3LlLUjvcIYivM3U/Gbc50ZApDfe0juP9piQVI 0K6ZNlksf6Lh8OdXtQACRqDVL1Ob3quEm7Rk/Kv9oMI+mnn1kkibhS99OT5hDH007SMo3LZaWWVzb +193STFPojOIjw==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Tue, 14 Nov 2023 14:35:48 +0100 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx11.migadu.com X-Spam-Score: -4.29 X-Migadu-Queue-Id: B08F34145A X-Migadu-Spam-Score: -4.29 X-TUID: 6hAQSXx0L0zI * guix/gexp.scm (lower-reference-graphs)[tuple->gexp-input]: Add ‘gexp-input?’ case. (gexp->derivation): Update docstring. * doc/guix.texi (G-Expressions): Adjust accordingly. * tests/gexp.scm ("references-file, non-default output"): New test. Change-Id: I595cb75da0867ab8ab44552887dc06ed1d23315e --- doc/guix.texi | 7 +++---- guix/gexp.scm | 12 ++++++++---- tests/gexp.scm | 30 ++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 8 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 8492f0ada3..5f90ec6eb4 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -12213,10 +12213,9 @@ G-Expressions following forms: @example -(@var{file-name} @var{package}) -(@var{file-name} @var{package} @var{output}) -(@var{file-name} @var{derivation}) -(@var{file-name} @var{derivation} @var{output}) +(@var{file-name} @var{obj}) +(@var{file-name} @var{obj} @var{output}) +(@var{file-name} @var{gexp-input}) (@var{file-name} @var{store-item}) @end example diff --git a/guix/gexp.scm b/guix/gexp.scm index a7f4256d24..29819878fa 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -934,6 +934,11 @@ (define* (lower-reference-graphs graphs #:key system target) corresponding or store item." (define tuple->gexp-input (match-lambda + (((? gexp-input? input)) + ;; This case lets users specify the output of interest more + ;; conveniently, for instance by passing (gexp-input hwloc "lib") to + ;; the 'references-file' procedure. + input) ((thing) (%gexp-input thing "out" (not target))) ((thing output) @@ -1152,10 +1157,9 @@ (define* (gexp->derivation name exp When REFERENCES-GRAPHS is true, it must be a list of tuples of one of the following forms: - (FILE-NAME PACKAGE) - (FILE-NAME PACKAGE OUTPUT) - (FILE-NAME DERIVATION) - (FILE-NAME DERIVATION OUTPUT) + (FILE-NAME OBJ) + (FILE-NAME OBJ OUTPUT) + (FILE-NAME GEXP-INPUT) (FILE-NAME STORE-ITEM) The right-hand-side of each element of REFERENCES-GRAPHS is automatically made diff --git a/tests/gexp.scm b/tests/gexp.scm index a3147405d7..481755138e 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -1651,6 +1651,36 @@ (define shebang read) refs))))))) +(test-assertm "references-file, non-default output" + (let* ((exp #~(begin + (mkdir #$output) + (symlink #$%bootstrap-guile #$output:extra))) + (computed (computed-file "computed" exp + #:guile %bootstrap-guile)) + (refs1 (references-file computed + #:guile %bootstrap-guile)) + ;; Wrap COMPUTE in 'gexp-input' to get the "extra" output. + (refs2 (references-file (gexp-input computed "extra") + #:guile %bootstrap-guile))) + (mlet* %store-monad ((drv0 (lower-object %bootstrap-guile)) + (drv1 (lower-object computed)) + (drv2 (lower-object refs2)) + (drv3 (lower-object refs1))) + (mbegin %store-monad + (built-derivations (list drv2 drv3)) + (mlet %store-monad ((refs ((store-lift requisites) + (list (derivation->output-path + drv1 "extra"))))) + (return + (and (lset= string=? + (call-with-input-file (derivation->output-path drv2) + read) + refs) + (lset= string=? + (call-with-input-file (derivation->output-path drv3) + read) + (list (derivation->output-path drv1)))))))))) + (test-assert "lower-object & gexp-input-error?" (guard (c ((gexp-input-error? c) (gexp-error-invalid-input c))) -- 2.41.0