import: print: Fix deprecation warning for origin-sha256.
* 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 <ludo@gnu.org>master
parent
1f39175d1a
commit
a9105c2c4c
|
@ -74,7 +74,7 @@ when evaluated."
|
||||||
(define (source->code source version)
|
(define (source->code source version)
|
||||||
(let ((uri (origin-uri source))
|
(let ((uri (origin-uri source))
|
||||||
(method (origin-method source))
|
(method (origin-method source))
|
||||||
(sha256 (origin-sha256 source))
|
(hash (origin-hash source))
|
||||||
(file-name (origin-file-name source))
|
(file-name (origin-file-name source))
|
||||||
(patches (origin-patches source)))
|
(patches (origin-patches source)))
|
||||||
`(origin
|
`(origin
|
||||||
|
@ -82,9 +82,12 @@ when evaluated."
|
||||||
(uri (string-append ,@(match (factorize-uri uri version)
|
(uri (string-append ,@(match (factorize-uri uri version)
|
||||||
((? string? uri) (list uri))
|
((? string? uri) (list uri))
|
||||||
(factorized factorized))))
|
(factorized factorized))))
|
||||||
(sha256
|
,(if (equal? (content-hash-algorithm hash) 'sha256)
|
||||||
(base32
|
`(sha256 (base32 ,(bytevector->nix-base32-string
|
||||||
,(format #f "~a" (bytevector->nix-base32-string sha256))))
|
(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,
|
;; FIXME: in order to be able to throw away the directory prefix,
|
||||||
;; we just assume that the patch files can be found with
|
;; we just assume that the patch files can be found with
|
||||||
;; "search-patches".
|
;; "search-patches".
|
||||||
|
|
Reference in New Issue