guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] gnu packages: Add 'specifications->inputs'.


From: Mathieu Lirzin
Subject: [PATCH] gnu packages: Add 'specifications->inputs'.
Date: Sun, 29 Jan 2017 16:40:36 +0100

* 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 <address@hidden>
 ;;; Copyright © 2014 Eric Bavier <address@hidden>
 ;;; Copyright © 2016 Alex Kost <address@hidden>
-;;; Copyright © 2016 Mathieu Lirzin <address@hidden>
+;;; Copyright © 2016, 2017 Mathieu Lirzin <address@hidden>
 ;;;
 ;;; 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]