GNU bug report logs - #55680
[PATCH] packages: Add 'specifications->packages'.

Previous Next

Package: guix-patches;

Reported by: Antero Mejr <antero <at> mailbox.org>

Date: Fri, 27 May 2022 17:15:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55680 in the body.
You can then email your comments to 55680 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#55680; Package guix-patches. (Fri, 27 May 2022 17:15:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Antero Mejr <antero <at> mailbox.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 27 May 2022 17:15:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Antero Mejr <antero <at> mailbox.org>
To: guix-patches <at> gnu.org
Cc: Antero Mejr <antero <at> mailbox.org>
Subject: [PATCH] packages: Add 'specifications->packages'.
Date: Fri, 27 May 2022 13:13:28 -0400
* gnu/packages.scm (specifications->packages): New procedure.
* guix/scripts/home/import.scm (manifest+configuration-files->code): Use it.
---
Users of 'guix home' may not know the Scheme 'map' and 'compose' procedures.
However 'guix home import' creates boilerplate with those procedures.
Add 'specificiations->packages' procedure to make it more like a guix manifest.
'specfications->packages' can also help with guix system declarations.

 gnu/packages.scm             | 11 ++++++++++-
 guix/scripts/home/import.scm |  4 ++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/gnu/packages.scm b/gnu/packages.scm
index 2ba838fd0a..0cc22e64f9 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2014 Eric Bavier <bavier <at> member.fsf.org>
 ;;; Copyright © 2016, 2017 Alex Kost <alezost <at> gmail.com>
 ;;; Copyright © 2016 Mathieu Lirzin <mthl <at> gnu.org>
+;;; Copyright © 2022 Antero Mejr <antero <at> mailbox.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -65,6 +66,7 @@ (define-module (gnu packages)
             specification->package+output
             specification->location
             specifications->manifest
+            specifications->packages
 
             package-unique-version-prefix
 
@@ -554,13 +556,20 @@ (define* (specification->package+output spec #:optional (output "out"))
                   (package-full-name package)
                   sub-drv))))))
 
+(define (specifications->packages specs)
+  "Given SPECS, a list of specifications such as \"emacs <at> 25.2\" or
+\"guile:debug\", return a list of packages."
+  ;; This procedure exists so users of 'guix home' don't have to write out the
+  ;; (map (compose list specification->package+output)... boilerplate.
+  (map (compose list specification->package+output) specs))
+
 (define (specifications->manifest specs)
   "Given SPECS, a list of specifications such as \"emacs <at> 25.2\" or
 \"guile:debug\", return a profile manifest."
   ;; This procedure exists mostly so users of 'guix package -m' don't have to
   ;; fiddle with multiple-value returns.
   (packages->manifest
-   (map (compose list specification->package+output) specs)))
+   (specifications->packages specs)))
 
 (define (package-unique-version-prefix name version)
   "Search among all the versions of package NAME that are available, and
diff --git a/guix/scripts/home/import.scm b/guix/scripts/home/import.scm
index 575fe8f688..825ccb1e73 100644
--- a/guix/scripts/home/import.scm
+++ b/guix/scripts/home/import.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2021 Andrew Tropin <andrew <at> trop.in>
 ;;; Copyright © 2021-2022 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2022 Arjan Adriaanse <arjan <at> adriaan.se>
+;;; Copyright © 2022 Antero Mejr <antero <at> mailbox.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -170,8 +171,7 @@ (define (manifest+configuration-files->code manifest
                         ,@(delete-duplicates (concatenate modules)))
 
            (home-environment
-            (packages (map (compose list specification->package+output)
-                           ,packages))
+            (packages (specifications->packages ,packages))
             (services (list ,@services)))))))))
 
 (define* (import-manifest
-- 
2.36.1





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Mon, 06 Jun 2022 21:10:02 GMT) Full text and rfc822 format available.

Notification sent to Antero Mejr <antero <at> mailbox.org>:
bug acknowledged by developer. (Mon, 06 Jun 2022 21:10:02 GMT) Full text and rfc822 format available.

Message #10 received at 55680-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Antero Mejr <antero <at> mailbox.org>
Cc: 55680-done <at> debbugs.gnu.org
Subject: Re: bug#55680: [PATCH] packages: Add 'specifications->packages'.
Date: Mon, 06 Jun 2022 23:08:50 +0200
Hi Antero,

Antero Mejr <antero <at> mailbox.org> skribis:

> * gnu/packages.scm (specifications->packages): New procedure.
> * guix/scripts/home/import.scm (manifest+configuration-files->code): Use it.

I adjusted the docstring and tests/home-import.scm and pushed as
7041fe0646a9603e7d1d6bde139a284146515917.

Thanks,
Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 05 Jul 2022 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 289 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.