summary refs log tree commit diff
path: root/gnu/build/file-systems.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-10-03 22:27:27 +0200
committerLudovic Courtès <ludo@gnu.org>2017-10-11 11:12:33 +0200
commit9976c76aab2fe75d7fc672034090e19bdab6879c (patch)
treeca63380f7b926c21df7f9cc4edbedc641d43d41d /gnu/build/file-systems.scm
parent1c65cca5743e9171bbd94307195f123d26c0535e (diff)
downloadguix-9976c76aab2fe75d7fc672034090e19bdab6879c.tar.gz
file-systems: Preserve UUID types when serializing.
Reported by Roel Janssen <roel@gnu.org>
at <https://lists.gnu.org/archive/html/help-guix/2017-09/msg00094.html>.

* gnu/system/file-systems.scm (file-system->spec): When DEVICE is a
UUID, serialize it in a way that preserves its type.
(spec->file-system): Adjust accordingly.
* gnu/build/file-systems.scm (canonicalize-device-spec): Add case for
when SPEC is 'uuid?'.
Diffstat (limited to 'gnu/build/file-systems.scm')
-rw-r--r--gnu/build/file-systems.scm11
1 files changed, 6 insertions, 5 deletions
diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index bcb0c53628..093f60d701 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -450,8 +450,7 @@ the following:
      \"/dev/sda1\";
   • 'label', in which case SPEC is known to designate a partition label--e.g.,
      \"my-root-part\";
-  • 'uuid', in which case SPEC must be a UUID (a 16-byte bytevector)
-     designating a partition;
+  • 'uuid', in which case SPEC must be a UUID designating a partition;
   • 'any', in which case SPEC can be anything.
 "
   (define max-trials
@@ -497,9 +496,11 @@ the following:
      (resolve find-partition-by-label spec identity))
     ((uuid)
      (resolve find-partition-by-uuid
-              (if (string? spec)
-                  (string->uuid spec)
-                  spec)
+              (cond ((string? spec)
+                     (string->uuid spec))
+                    ((uuid? spec)
+                     (uuid-bytevector spec))
+                    (else spec))
               uuid->string))
     (else
      (error "unknown device title" title))))