guix-commits
[Top][All Lists]
Advanced

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

06/07: import: print: Honor the outputs of inputs (!).


From: guix-commits
Subject: 06/07: import: print: Honor the outputs of inputs (!).
Date: Fri, 7 Jun 2019 17:08:11 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit c0a4db66976dc63decbd612aafb934f44629e321
Author: Ludovic Court├Ęs <address@hidden>
Date:   Fri Jun 7 22:49:47 2019 +0200

    import: print: Honor the outputs of inputs (!).
    
    Fixes <http://bugs.gnu.org/35893>.
    Reported by Jesse Gibbons <address@hidden>.
    
    * guix/import/print.scm (package->code)[package-lists->code]: Preserve
    OUT in the result.
    * tests/print.scm (define-with-source): New macro.
    (pkg): Use it.
    (pkg-source): New variable.
    (pkg-with-inputs, pkg-with-inputs-source): New variables.
    ("simple package"): Refer to 'pkg-source'.
    ("package with inputs"): New test.
---
 guix/import/print.scm | 13 +++++++------
 tests/print.scm       | 48 +++++++++++++++++++++++++++++++-----------------
 2 files changed, 38 insertions(+), 23 deletions(-)

diff --git a/guix/import/print.scm b/guix/import/print.scm
index 0bec32c..4c2a91f 100644
--- a/guix/import/print.scm
+++ b/guix/import/print.scm
@@ -94,12 +94,13 @@ when evaluated."
           (map (match-lambda
                  ((label pkg . out)
                   (let ((mod (package-module-name pkg)))
-                    (list label
-                          ;; FIXME: using '@ certainly isn't pretty, but it
-                          ;; avoids having to import the individual package
-                          ;; modules.
-                          (list 'unquote
-                                (list '@ mod (variable-name pkg mod)))))))
+                    (cons* label
+                           ;; FIXME: using '@ certainly isn't pretty, but it
+                           ;; avoids having to import the individual package
+                           ;; modules.
+                           (list 'unquote
+                                 (list '@ mod (variable-name pkg mod)))
+                           out))))
                lsts)))
 
   (let ((name                (package-name package))
diff --git a/tests/print.scm b/tests/print.scm
index 305807c..d4b2cca 100644
--- a/tests/print.scm
+++ b/tests/print.scm
@@ -24,9 +24,31 @@
   #:use-module (guix licenses)
   #:use-module (srfi srfi-64))
 
+(define-syntax-rule (define-with-source object source expr)
+  (begin
+    (define object expr)
+    (define source 'expr)))
+
 (test-begin "print")
 
-(define pkg
+(define-with-source pkg pkg-source
+  (package
+    (name "test")
+    (version "1.2.3")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "file:///tmp/test-"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))))
+    (build-system gnu-build-system)
+    (home-page "http://gnu.org";)
+    (synopsis "Dummy")
+    (description "This is a dummy package.")
+    (license gpl3+)))
+
+(define-with-source pkg-with-inputs pkg-with-inputs-source
   (package
     (name "test")
     (version "1.2.3")
@@ -38,27 +60,19 @@
                (base32
                 "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))))
     (build-system gnu-build-system)
+    (inputs `(("coreutils" ,(@ (gnu packages base) coreutils))
+              ("glibc" ,(@ (gnu packages base) glibc) "debug")))
     (home-page "http://gnu.org";)
     (synopsis "Dummy")
     (description "This is a dummy package.")
     (license gpl3+)))
 
 (test-equal "simple package"
-  (package->code pkg)
-  '(package
-     (name "test")
-     (version "1.2.3")
-     (source (origin
-               (method url-fetch)
-               (uri (string-append "file:///tmp/test-"
-                                   version ".tar.gz"))
-               (sha256
-                (base32
-                 "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))))
-     (build-system gnu-build-system)
-     (home-page "http://gnu.org";)
-     (synopsis "Dummy")
-     (description "This is a dummy package.")
-     (license gpl3+)))
+  pkg-source
+  (package->code pkg))
+
+(test-equal "package with inputs"
+  pkg-with-inputs-source
+  (package->code pkg-with-inputs))
 
 (test-end "print")



reply via email to

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