mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 21:20:33 +02:00
packages: Introduce <content-hash> and use it in <origin>.
* guix/packages.scm (<content-hash>): New record type.
(define-content-hash-constructor, build-content-hash)
(content-hash): New macros.
(print-content-hash): New procedure.
(<origin>): Rename constructor to '%origin'.
[sha256]: Remove field.
[hash]: New field. Adjust users.
(origin-compatibility-helper, origin): New macros.
(origin-sha256): New deprecated procedure.
(origin->derivation): Adjust accordingly.
* tests/packages.scm ("package-source-derivation, origin, sha512"): New
test.
* guix/tests.scm: Hide (gcrypt hash) 'sha256' for proper syntax
matching.
* tests/challenge.scm: Add #:prefix for (gcrypt hash) and adjust users.
* tests/derivations.scm: Likewise.
* tests/store.scm: Likewise.
* tests/graph.scm ("bag DAG, including origins"): Provide 'sha256' field
with the right length.
* gnu/packages/aspell.scm (aspell-dictionary)
(aspell-dict-ca, aspell-dict-it): Use 'hash' and 'content-hash' for
proper syntax matching.
* gnu/packages/bash.scm (bash-patch): Rename 'sha256' to 'sha256-bv'.
* gnu/packages/bootstrap.scm (bootstrap-executable): Rename 'sha256' to 'bv'.
* gnu/packages/readline.scm (readline-patch): Likewise.
* gnu/packages/virtualization.scm (qemu-patch): Rename 'sha256' to
'sha256-bv'.
* guix/import/utils.scm: Hide (gcrypt hash) 'sha256'.
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
#:renamer (lambda (name)
|
||||
(cond ((eq? name 'location) 'make-location)
|
||||
(else name))))
|
||||
#:use-module (gcrypt hash)
|
||||
#:use-module ((gcrypt hash) #:hide (sha256))
|
||||
#:use-module (guix derivations)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (guix grafts)
|
||||
@@ -51,6 +51,7 @@
|
||||
#:use-module (srfi srfi-34)
|
||||
#:use-module (srfi srfi-35)
|
||||
#:use-module (srfi srfi-64)
|
||||
#:use-module (rnrs bytevectors)
|
||||
#:use-module (rnrs io ports)
|
||||
#:use-module (ice-9 vlist)
|
||||
#:use-module (ice-9 regex)
|
||||
@@ -497,6 +498,31 @@
|
||||
(search-path %load-path "guix/base32.scm")
|
||||
get-bytevector-all)))))
|
||||
|
||||
(test-equal "package-source-derivation, origin, sha512"
|
||||
"hello"
|
||||
(let* ((bash (search-bootstrap-binary "bash" (%current-system)))
|
||||
(builder (add-text-to-store %store "my-fixed-builder.sh"
|
||||
"echo -n hello > $out" '()))
|
||||
(method (lambda* (url hash-algo hash #:optional name
|
||||
#:rest rest)
|
||||
(and (eq? hash-algo 'sha512)
|
||||
(raw-derivation name bash (list builder)
|
||||
#:sources (list builder)
|
||||
#:hash hash
|
||||
#:hash-algo hash-algo))))
|
||||
(source (origin
|
||||
(method method)
|
||||
(uri "unused://")
|
||||
(file-name "origin-sha512")
|
||||
(hash (content-hash
|
||||
(bytevector-hash (string->utf8 "hello")
|
||||
(hash-algorithm sha512))
|
||||
sha512))))
|
||||
(drv (package-source-derivation %store source))
|
||||
(output (derivation->output-path drv)))
|
||||
(build-derivations %store (list drv))
|
||||
(call-with-input-file output get-string-all)))
|
||||
|
||||
(unless (network-reachable?) (test-skip 1))
|
||||
(test-equal "package-source-derivation, snippet"
|
||||
"OK"
|
||||
|
||||
Reference in New Issue
Block a user