From a9105c2c4c97ffbdb1b09dadc14773566924ab59 Mon Sep 17 00:00:00 2001 From: Helio Machado <0x2b3bfa0+git@googlemail.com> Date: Mon, 19 Oct 2020 00:15:00 +0200 Subject: import: print: Fix deprecation warning for origin-sha256. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * guix/import/print.scm (source->code source version): Replace 'origin-sha256' by 'origin-hash' and handle non-SHA256 hashes. Co-authored-by: Ludovic Courtès --- guix/import/print.scm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/guix/import/print.scm b/guix/import/print.scm index 11cc218285..d21ce57aeb 100644 --- a/guix/import/print.scm +++ b/guix/import/print.scm @@ -74,7 +74,7 @@ when evaluated." (define (source->code source version) (let ((uri (origin-uri source)) (method (origin-method source)) - (sha256 (origin-sha256 source)) + (hash (origin-hash source)) (file-name (origin-file-name source)) (patches (origin-patches source))) `(origin @@ -82,9 +82,12 @@ when evaluated." (uri (string-append ,@(match (factorize-uri uri version) ((? string? uri) (list uri)) (factorized factorized)))) - (sha256 - (base32 - ,(format #f "~a" (bytevector->nix-base32-string sha256)))) + ,(if (equal? (content-hash-algorithm hash) 'sha256) + `(sha256 (base32 ,(bytevector->nix-base32-string + (content-hash-value hash)))) + `(hash (content-hash ,(bytevector->nix-base32-string + (content-hash-value hash)) + ,(content-hash-algorithm hash)))) ;; FIXME: in order to be able to throw away the directory prefix, ;; we just assume that the patch files can be found with ;; "search-patches". -- cgit v1.2.3