From da675305ddf2ba574e309e515d18ae1f778297be Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 15 Jun 2016 10:38:46 +0200 Subject: 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. --- tests/packages.scm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/packages.scm') 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 @@ (define-module (test-packages) #: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 @@ (define read-at (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" -- cgit v1.2.3