guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/03: store: 'path-info-deriver' is #f when there is no deriver.


From: Ludovic Courtès
Subject: 03/03: store: 'path-info-deriver' is #f when there is no deriver.
Date: Fri, 26 Feb 2016 22:39:19 +0000

civodul pushed a commit to branch master
in repository guix.

commit 22572d56cb3da5b176b5b5697d4e8e71067eab74
Author: Ludovic Courtès <address@hidden>
Date:   Fri Feb 26 23:14:28 2016 +0100

    store: 'path-info-deriver' is #f when there is no deriver.
    
    * guix/store.scm (read-path-info): Use #f when we get the empty string
    for DERIVER.
    * guix/scripts/publish.scm (narinfo-string): Adjust accordingly.
    * tests/store.scm ("path-info-deriver"): New test.
---
 guix/scripts/publish.scm |    2 +-
 guix/store.scm           |    6 ++++--
 tests/store.scm          |   15 +++++++++++++++
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/guix/scripts/publish.scm b/guix/scripts/publish.scm
index 5306afc..4629213 100644
--- a/guix/scripts/publish.scm
+++ b/guix/scripts/publish.scm
@@ -164,7 +164,7 @@ References: ~a~%"
                              store-path url hash size references))
          ;; Do not render a "Deriver" or "System" line if we are rendering
          ;; info for a derivation.
-         (info       (if (string-null? deriver)
+         (info       (if (not deriver)
                          base-info
                          (catch 'system-error
                            (lambda ()
diff --git a/guix/store.scm b/guix/store.scm
index 3d6cff4..8746d3c 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -242,14 +242,16 @@
 (define-record-type <path-info>
   (path-info deriver hash references registration-time nar-size)
   path-info?
-  (deriver path-info-deriver)
+  (deriver path-info-deriver)                     ;string | #f
   (hash path-info-hash)
   (references path-info-references)
   (registration-time path-info-registration-time)
   (nar-size path-info-nar-size))
 
 (define (read-path-info p)
-  (let ((deriver  (read-store-path p))
+  (let ((deriver  (match (read-store-path p)
+                    ("" #f)
+                    (x  x)))
         (hash     (base16-string->bytevector (read-string p)))
         (refs     (read-store-path-list p))
         (registration-time (read-int p))
diff --git a/tests/store.scm b/tests/store.scm
index 9d651ce..de070ea 100644
--- a/tests/store.scm
+++ b/tests/store.scm
@@ -856,6 +856,21 @@
                   (string->utf8
                    (call-with-output-string (cut write-file item <>))))))))
 
+(test-assert "path-info-deriver"
+  (let* ((b (add-text-to-store %store "build" "echo $foo > $out" '()))
+         (s (add-to-store %store "bash" #t "sha256"
+                          (search-bootstrap-binary "bash"
+                                                   (%current-system))))
+         (d (derivation %store "the-thing"
+                        s `("-e" ,b)
+                        #:env-vars `(("foo" . ,(random-text)))
+                        #:inputs `((,b) (,s))))
+         (o (derivation->output-path d)))
+    (and (build-derivations %store (list d))
+         (not (path-info-deriver (query-path-info %store b)))
+         (string=? (derivation-file-name d)
+                   (path-info-deriver (query-path-info %store o))))))
+
 (test-end "store")
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]