From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id /jxcHubQbWGZiQAAgWs5BA (envelope-from ) for ; Mon, 18 Oct 2021 21:54:14 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id INB4GebQbWGTEAAA1q6Kng (envelope-from ) for ; Mon, 18 Oct 2021 19:54:14 +0000 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 06782127ED for ; Mon, 18 Oct 2021 21:54:14 +0200 (CEST) Received: from localhost ([::1]:35464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcYi5-0008QU-5c for larch@yhetil.org; Mon, 18 Oct 2021 15:54:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcYhw-0008Nu-GA for guix-patches@gnu.org; Mon, 18 Oct 2021 15:54:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37141) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcYhw-0003zs-2E for guix-patches@gnu.org; Mon, 18 Oct 2021 15:54:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mcYhw-0000RO-17 for guix-patches@gnu.org; Mon, 18 Oct 2021 15:54:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50960] [PATCH v3 02/10] profiles: Add 'package->development-manifest'. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 18 Oct 2021 19:54:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50960 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50960@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 50960-submit@debbugs.gnu.org id=B50960.16345867861575 (code B ref 50960); Mon, 18 Oct 2021 19:54:03 +0000 Received: (at 50960) by debbugs.gnu.org; 18 Oct 2021 19:53:06 +0000 Received: from localhost ([127.0.0.1]:48676 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mcYgz-0000PE-B7 for submit@debbugs.gnu.org; Mon, 18 Oct 2021 15:53:05 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53438) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mcYgi-0000Ma-KY for 50960@debbugs.gnu.org; Mon, 18 Oct 2021 15:52:53 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:51628) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcYgc-0002kH-Ar; Mon, 18 Oct 2021 15:52:42 -0400 Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:60778 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcYgb-0007lj-Tp; Mon, 18 Oct 2021 15:52:42 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Mon, 18 Oct 2021 21:52:11 +0200 Message-Id: <20211018195219.13898-3-ludo@gnu.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211018195219.13898-1-ludo@gnu.org> References: <20211011213809.17482-1-ludo@gnu.org> <20211018195219.13898-1-ludo@gnu.org> 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" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1634586854; 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; bh=IJsvhR1/3TTBjcTY4rJxE4MFJZxAYWMTYS3O6WbVHvA=; b=PB5MbQF+VDwz10X+sKIZ9gMa3Mqqng20VmghaKRdNT1OCM4blWJWSGhNR9sty72iaAq3NZ AWOxRrKj8f0VGAKdynQdzd7Ax3A5GpEkGtvnpy81U+Me0v5wH1J7InYpVZady+vYa3oqCb ly6/D0y03Imr4n1PS0uTHstceQNTg9dSv99otHVwRwxfOU/vU0r3F2cIUvGcpAfdOQ5ymI lJ+0r0PNgkDVvAlaI9Vk+RkIuj3t15920KUXhODAfIAMdkt74HEaN32rFHS8BuRkQ15enD K/UBTVjcyAIQsCzqBQf3ptyiI2Y9WYqXoqSrgVcPAMkclFYV1I0Cz5b7IRbsMQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1634586854; a=rsa-sha256; cv=none; b=Z4Z/uh9yrDJfthOoSm/vuW81Hu08BoT8BhMNCroCss+xRr6bo0iRh7kOXt11AIBj8xTbAb v63/DdOAOnE95l1f8fWsjKAU2wA8/RT8qJXq3470U62hKh2a1MQLjTAtxzxckKzNnzz5cB 4zP3bW5sl8AjY0YHusmQVGdQ0hBzGtJcJ3pZXIno10QlnDk88e3oqYNSGcnbtCihDY52WQ zZWMtjqmBJsAzciZ6TsA612fyk6Ay3+wuiBPbcalFDVwGiMJs8vuPt/d6m1TvJaxK3ml7/ v3JkDHqWCt4wG0vLSy6VBS9frlnBX3KE/k4AbuxNsBhp4CFMhGwoeHPHIyM7Pg== 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-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -0.43 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 06782127ED X-Spam-Score: -0.43 X-Migadu-Scanner: scn0.migadu.com X-TUID: 8z2ytMqrCyhh From: Ludovic Courtès * guix/profiles.scm (package->development-manifest): New procedure. * guix/scripts/environment.scm (input->manifest-entry) (package-environment-inputs): Remove. * guix/scripts/environment.scm (options/resolve-packages): Use 'package->development-manifest' instead of 'package-environment-inputs'. * tests/profiles.scm ("package->development-manifest"): New test. --- doc/guix.texi | 11 +++++++++++ guix/profiles.scm | 19 +++++++++++++++++++ guix/scripts/environment.scm | 27 +++++---------------------- tests/profiles.scm | 7 +++++++ 4 files changed, 42 insertions(+), 22 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index deb4eac4ac..c1045b331b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3341,6 +3341,17 @@ objects, like this: '("emacs" "guile@@2.2" "guile@@2.2:debug")) @end lisp +@findex package->development-manifest +You might also want to create a manifest for all the dependencies of a +package, rather than the package itself: + +@lisp +(package->development-manifest (specification->package "emacs")) +@end lisp + +The example above gives you all the software required to develop Emacs, +similar to what @command{guix environment emacs} provides. + @xref{export-manifest, @option{--export-manifest}}, to learn how to obtain a manifest file from an existing profile. diff --git a/guix/profiles.scm b/guix/profiles.scm index 2486f91d09..9f30349c69 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -124,6 +124,7 @@ (define-module (guix profiles) profile-manifest package->manifest-entry + package->development-manifest packages->manifest ca-certificate-bundle %default-profile-hooks @@ -400,6 +401,24 @@ (define* (package->manifest-entry package #:optional (output "out") (properties properties)))) entry)) +(define* (package->development-manifest package + #:optional + (system (%current-system)) + #:key target) + "Return a manifest for the \"development inputs\" of PACKAGE for SYSTEM, +optionally when cross-compiling to TARGET. Development inputs include both +explicit and implicit inputs of PACKAGE." + (manifest + (filter-map (match-lambda + ((label (? package? package)) + (package->manifest-entry package)) + ((label (? package? package) output) + (package->manifest-entry package output)) + ;; TODO: Support . + (_ + #f)) + (package-development-inputs package system #:target target)))) + (define (packages->manifest packages) "Return a list of manifest entries, one for each item listed in PACKAGES. Elements of PACKAGES can be either package objects or package/string tuples diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index 418f11c37e..54f48a7482 100644 --- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm @@ -66,24 +66,6 @@ (define* (show-search-paths profile manifest #:key pure?) (newline))) (profile-search-paths profile manifest))) -(define (input->manifest-entry input) - "Return a manifest entry for INPUT, or #f if INPUT does not correspond to a -package." - (match input - ((_ (? package? package)) - (package->manifest-entry package)) - ((_ (? package? package) output) - (package->manifest-entry package output)) - (_ - #f))) - -(define (package-environment-inputs package) - "Return a list of manifest entries corresponding to the transitive input -packages for PACKAGE." - ;; Remove non-package inputs such as origin records. - (filter-map input->manifest-entry - (package-development-inputs package))) - (define (show-help) (display (G_ "Usage: guix environment [OPTION]... PACKAGE... [-- COMMAND...] Build an environment that includes the dependencies of PACKAGE and execute @@ -297,11 +279,11 @@ (define (packages->outputs packages mode) ((? package? package) (if (eq? mode 'ad-hoc-package) (list (package->manifest-entry* package)) - (package-environment-inputs package))) + (manifest-entries (package->development-manifest package)))) (((? package? package) (? string? output)) (if (eq? mode 'ad-hoc-package) (list (package->manifest-entry* package output)) - (package-environment-inputs package))) + (manifest-entries (package->development-manifest package)))) ((lst ...) (append-map (cut packages->outputs <> mode) lst)))) @@ -313,8 +295,9 @@ (define (packages->outputs packages mode) (specification->package+output spec))) (list (package->manifest-entry* package output)))) (('package 'package (? string? spec)) - (package-environment-inputs - (transform (specification->package+output spec)))) + (manifest-entries + (package->development-manifest + (transform (specification->package+output spec))))) (('expression mode str) ;; Add all the outputs of the package STR evaluates to. (packages->outputs (read/eval str) mode)) diff --git a/tests/profiles.scm b/tests/profiles.scm index 06a0387221..cac5b73347 100644 --- a/tests/profiles.scm +++ b/tests/profiles.scm @@ -265,6 +265,13 @@ (define transform1 (manifest-transaction-removal-candidate? guile-2.0.9 t) (null? install) (null? downgrade) (null? upgrade))))) +(test-assert "package->development-manifest" + (let ((manifest (package->development-manifest packages:hello))) + (every (lambda (name) + (manifest-installed? manifest + (manifest-pattern (name name)))) + '("gcc" "binutils" "glibc" "coreutils" "grep" "sed")))) + (test-assertm "profile-derivation" (mlet* %store-monad ((entry -> (package->manifest-entry %bootstrap-guile)) -- 2.33.0