all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] gnu packages: Add 'specifications->inputs'.
@ 2017-01-29 15:40 Mathieu Lirzin
  2017-02-01 22:32 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Mathieu Lirzin @ 2017-01-29 15:40 UTC (permalink / raw)
  To: guix-devel

* gnu/packages.scm (specifications->inputs): New procedure.
---

Hi,

Using 'specification->package' is not convenient for package inputs in
'guix.scm' development packages because it involves either using it over and
over or defining a custom procedure.  I think it would be nice if Guix was
providing a concise way to achieve the desired result.

This patch is an attempt to fix that inconvenience.  Thanks.

  Mathieu

 gnu/packages.scm | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/gnu/packages.scm b/gnu/packages.scm
index 0aa289d56..8b47ed83f 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -3,7 +3,7 @@
 ;;; Copyright © 2013 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2016 Alex Kost <alezost@gmail.com>
-;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
+;;; Copyright © 2016, 2017 Mathieu Lirzin <mthl@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -53,7 +53,8 @@
             find-newest-available-packages
 
             specification->package
-            specification->package+output))
+            specification->package+output
+            specifications->inputs))
 
 ;;; Commentary:
 ;;;
@@ -356,3 +357,14 @@ version; if SPEC does not specify an output, return OUTPUT."
            (leave (_ "package `~a' lacks output `~a'~%")
                   (package-full-name package)
                   sub-drv))))))
+
+(define (specifications->inputs specs)
+  "Return an alist that can be used in package definition.  This alist is
+composed of entries of type '(KEY . (PACKAGE OUTPUT))' where KEY is an element
+from SPECS, PACKAGE is its associated package, and OUTPUT is its associated
+output."
+  (map (lambda (spec)
+         (let-values (((package output)
+                       (specification->package+output spec)))
+           (list spec package output)))
+       specs))
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] gnu packages: Add 'specifications->inputs'.
  2017-01-29 15:40 [PATCH] gnu packages: Add 'specifications->inputs' Mathieu Lirzin
@ 2017-02-01 22:32 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2017-02-01 22:32 UTC (permalink / raw)
  To: Mathieu Lirzin; +Cc: guix-devel

Mathieu Lirzin <mthl@gnu.org> skribis:

> * gnu/packages.scm (specifications->inputs): New procedure.
> ---
>
> Hi,
>
> Using 'specification->package' is not convenient for package inputs in
> 'guix.scm' development packages because it involves either using it over and
> over or defining a custom procedure.  I think it would be nice if Guix was
> providing a concise way to achieve the desired result.
>
> This patch is an attempt to fix that inconvenience.  Thanks.

Makes sense.

What about adding an example for --load under “Invoking guix
environment”?  For instance just showing how the example already there
is written when using ‘specifications->inputs’ instead of explicit
variable reference.

OK with something along these lines!

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-01 22:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-29 15:40 [PATCH] gnu packages: Add 'specifications->inputs' Mathieu Lirzin
2017-02-01 22:32 ` Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.