From 04d929570ad816793d7e0024a11314124ce87f98 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 29 Oct 2021 21:51:39 +0200 Subject: import: print: Properly render packages with origins as inputs. * guix/import/print.scm (package->code)[source->code]: Check whether VERSION is true before calling 'factorize-uri'. [package-lists->code]: Add clause for inputs that are origins. * tests/print.scm (pkg-with-origin-input, pkg-with-origin-input-source): New variables. ("package with origin input"): New test. --- guix/import/print.scm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'guix/import') diff --git a/guix/import/print.scm b/guix/import/print.scm index 0310739b3a..8acf5d52f6 100644 --- a/guix/import/print.scm +++ b/guix/import/print.scm @@ -89,9 +89,11 @@ when evaluated." (guix hg-download) (guix svn-download))) (procedure-name method))) - (uri (string-append ,@(match (factorize-uri uri version) - ((? string? uri) (list uri)) - (factorized factorized)))) + (uri ,(if version + `(string-append ,@(match (factorize-uri uri version) + ((? string? uri) (list uri)) + (factorized factorized))) + uri)) ,(if (equal? (content-hash-algorithm hash) 'sha256) `(sha256 (base32 ,(bytevector->nix-base32-string (content-hash-value hash)))) @@ -109,7 +111,7 @@ when evaluated." (map (match-lambda ((? symbol? s) (list (symbol->string s) (list 'unquote s))) - ((label pkg . out) + ((label (? package? pkg) . out) (let ((mod (package-module-name pkg))) (cons* label ;; FIXME: using '@ certainly isn't pretty, but it @@ -117,7 +119,9 @@ when evaluated." ;; modules. (list 'unquote (list '@ mod (variable-name pkg mod))) - out)))) + out))) + ((label (? origin? origin)) + (list label (list 'unquote (source->code origin #f))))) lsts))) (let ((name (package-name package)) -- cgit v1.2.3