all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 28696@debbugs.gnu.org
Subject: [bug#28696] [PATCH 2/5] file-systems: Preserve UUID types when serializing.
Date: Wed,  4 Oct 2017 09:25:51 +0200	[thread overview]
Message-ID: <20171004072554.1377-2-ludo@gnu.org> (raw)
In-Reply-To: <20171004072554.1377-1-ludo@gnu.org>

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?'.
---
 gnu/build/file-systems.scm  | 11 ++++++-----
 gnu/system/file-systems.scm | 10 ++++++++--
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index 8b1a4cb19..dea5bc619 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))))
diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm
index 52f16676f..fbd2b11cd 100644
--- a/gnu/system/file-systems.scm
+++ b/gnu/system/file-systems.scm
@@ -18,6 +18,7 @@
 
 (define-module (gnu system file-systems)
   #:use-module (ice-9 match)
+  #:use-module (rnrs bytevectors)
   #:use-module (srfi srfi-1)
   #:use-module (guix records)
   #:use-module (gnu system uuid)
@@ -157,7 +158,7 @@ initrd code."
   (match fs
     (($ <file-system> device title mount-point type flags options _ _ check?)
      (list (if (uuid? device)
-               (uuid-bytevector device)
+               `(uuid ,(uuid-type device) ,(uuid-bytevector device))
                device)
            title mount-point type flags options check?))))
 
@@ -166,7 +167,12 @@ initrd code."
   (match sexp
     ((device title mount-point type flags options check?)
      (file-system
-       (device device) (title title)
+       (device (match device
+                 (('uuid (? symbol? type) (? bytevector? bv))
+                  (bytevector->uuid bv type))
+                 (_
+                  device)))
+       (title title)
        (mount-point mount-point) (type type)
        (flags flags) (options options)
        (check? check?)))))
-- 
2.14.2

  reply	other threads:[~2017-10-04  7:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-04  7:24 [bug#28696] [PATCH 0/5] Support UUIDs for the EFI System Partition (FAT) Ludovic Courtès
2017-10-04  7:25 ` [bug#28696] [PATCH 1/5] file-systems: 'mount-file-system' now takes a <file-system> object Ludovic Courtès
2017-10-04  7:25   ` Ludovic Courtès [this message]
2017-10-04  7:25   ` [bug#28696] [PATCH 3/5] file-systems: Add support for FAT16 Ludovic Courtès
2017-10-04  7:25   ` [bug#28696] [PATCH 4/5] uuid: Change "fat32" to "fat" Ludovic Courtès
2017-10-04  7:25   ` [bug#28696] [PATCH 5/5] doc: Give an example with a FAT UUID Ludovic Courtès
2017-10-09 20:54 ` [bug#28696] [PATCH 0/5] Support UUIDs for the EFI System Partition (FAT) Roel Janssen
2017-10-11 19:49   ` Ludovic Courtès
2017-10-11  9:13 ` bug#28696: " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171004072554.1377-2-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=28696@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.