summary refs log tree commit diff
path: root/tests/scripts-build.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-01-31 23:22:18 +0100
committerLudovic Courtès <ludo@gnu.org>2016-02-01 08:59:13 +0100
commit47c0f92c37dc7d50d9d4598ce5b91c4cdfec6ed1 (patch)
treecef45ca2af85dba6bfa2c6e9e523a81197177b8e /tests/scripts-build.scm
parentf0907d97d43937d5bdde3b6440184325a80e0528 (diff)
downloadguix-47c0f92c37dc7d50d9d4598ce5b91c4cdfec6ed1.tar.gz
guix build: Add '--with-input'.
* guix/scripts/build.scm (transform-package-inputs): New procedure.
(%transformations): Add it.
(%transformation-options, show-transformation-options-help): Add
--with-input.
* tests/scripts-build.scm ("options->transformation, with-input"):
("options->transformation, with-input, no matches"): New tests.
* tests/guix-build.sh: Add tests.
* doc/guix.texi (Package Transformation Options): Document it.
Diffstat (limited to 'tests/scripts-build.scm')
-rw-r--r--tests/scripts-build.scm23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/scripts-build.scm b/tests/scripts-build.scm
index 75dc119e88..94ddaf447b 100644
--- a/tests/scripts-build.scm
+++ b/tests/scripts-build.scm
@@ -22,6 +22,9 @@
   #:use-module (guix packages)
   #:use-module (guix scripts build)
   #:use-module (guix ui)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages busybox)
+  #:use-module (ice-9 match)
   #:use-module (srfi srfi-64))
 
 
@@ -59,6 +62,26 @@
              (string-contains (get-output-string port)
                               "had no effect"))))))
 
+(test-assert "options->transformation, with-input"
+  (let* ((p (dummy-package "guix.scm"
+              (inputs `(("foo" ,coreutils)
+                        ("bar" ,grep)
+                        ("baz" ,(dummy-package "chbouib"
+                                  (native-inputs `(("x" ,grep)))))))))
+         (t (options->transformation '((with-input . "coreutils=busybox")
+                                       (with-input . "grep=findutils")))))
+    (with-store store
+      (let ((new (t store p)))
+        (and (not (eq? new p))
+             (match (package-inputs new)
+               ((("foo" dep1) ("bar" dep2) ("baz" dep3))
+                (and (eq? dep1 busybox)
+                     (eq? dep2 findutils)
+                     (string=? (package-name dep3) "chbouib")
+                     (match (package-native-inputs dep3)
+                       ((("x" dep))
+                        (eq? dep findutils)))))))))))
+
 (test-end)