summary refs log tree commit diff
path: root/tests/packages.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-06-15 10:38:46 +0200
committerLudovic Courtès <ludo@gnu.org>2016-06-15 15:26:30 +0200
commitda675305ddf2ba574e309e515d18ae1f778297be (patch)
tree3ba9f81530c70b315a9235861e27e19ddb0ad97e /tests/packages.scm
parent789510640d8ac30298c45d0edc80ec9078aa3afd (diff)
downloadguix-da675305ddf2ba574e309e515d18ae1f778297be.tar.gz
packages: The 'source' can be any lowerable object.
* guix/packages.scm (expand-input): Use 'struct?' instead of 'origin?'
when matching SOURCE.
(package-source-derivation): Use 'lower-object' instead of
'origin->derivation'.
* tests/packages.scm ("package-source-derivation, local-file"): New
test.
* doc/guix.texi (package Reference): Update 'source' documentation
accordingly.
Diffstat (limited to 'tests/packages.scm')
-rw-r--r--tests/packages.scm15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/packages.scm b/tests/packages.scm
index 94e8150b75..d3f432ada2 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -21,6 +21,7 @@
   #:use-module (guix store)
   #:use-module (guix monads)
   #:use-module (guix grafts)
+  #:use-module ((guix gexp) #:select (local-file local-file-file))
   #:use-module ((guix utils)
                 ;; Rename the 'location' binding to allow proper syntax
                 ;; matching when setting the 'location' field of a package.
@@ -295,6 +296,20 @@
     (and (direct-store-path? source)
          (string-suffix? "utils.scm" source))))
 
+(test-assert "package-source-derivation, local-file"
+  (let* ((file    (local-file "../guix/base32.scm"))
+         (package (package (inherit (dummy-package "p"))
+                    (source file)))
+         (source  (package-source-derivation %store
+                                             (package-source package))))
+    (and (store-path? source)
+         (string-suffix? "base32.scm" source)
+         (valid-path? %store source)
+         (equal? (call-with-input-file source get-bytevector-all)
+                 (call-with-input-file
+                     (search-path %load-path "guix/base32.scm")
+                   get-bytevector-all)))))
+
 (unless (network-reachable?) (test-skip 1))
 (test-equal "package-source-derivation, snippet"
   "OK"