~ruther/guix-local

99e17dc9274c82911c284eaeccdba08b7425f018 — Ludovic Courtès 12 years ago c5cd288
derivations: Fix 'fixed-output-derivation?'.

Reported by Nikita Karetnikov <nikita@karetnikov.org>.

* guix/derivations.scm (fixed-output-derivation?): Fix pattern.
* tests/derivations.scm ("fixed-output-derivation?"): Add test.
2 files changed, 11 insertions(+), 1 deletions(-)

M guix/derivations.scm
M tests/derivations.scm
M guix/derivations.scm => guix/derivations.scm +1 -1
@@ 121,7 121,7 @@
download with a fixed hash (aka. `fetchurl')."
  (match drv
    (($ <derivation>
        (($ <derivation-output> _ (? symbol?) (? string?))))
        (("out" . ($ <derivation-output> _ (? symbol?) (? bytevector?)))))
     #t)
    (_ #f)))


M tests/derivations.scm => tests/derivations.scm +10 -0
@@ 159,6 159,16 @@
         ;; the contents.
         (valid-path? %store (derivation->output-path drv)))))

(test-assert "fixed-output-derivation?"
  (let* ((builder    (add-text-to-store %store "my-fixed-builder.sh"
                                        "echo -n hello > $out" '()))
         (hash       (sha256 (string->utf8 "hello")))
         (drv        (derivation %store "fixed"
                                 %bash `(,builder)
                                 #:inputs `((,builder))
                                 #:hash hash #:hash-algo 'sha256)))
    (fixed-output-derivation? drv)))

(test-assert "fixed-output derivation"
  (let* ((builder    (add-text-to-store %store "my-fixed-builder.sh"
                                        "echo -n hello > $out" '()))