[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
06/09: file-systems: Preserve UUID types when serializing.
From: |
Ludovic Courtès |
Subject: |
06/09: file-systems: Preserve UUID types when serializing. |
Date: |
Wed, 11 Oct 2017 05:12:49 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 9976c76aab2fe75d7fc672034090e19bdab6879c
Author: Ludovic Courtès <address@hidden>
Date: Tue Oct 3 22:27:27 2017 +0200
file-systems: Preserve UUID types when serializing.
Reported by Roel Janssen <address@hidden>
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 bcb0c53..093f60d 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 92f0404..27734e8 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)
@@ -161,7 +162,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?))))
@@ -170,7 +171,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?)))))
- branch master updated (22d1060 -> 50fcf37), Ludovic Courtès, 2017/10/11
- 03/09: gnu: Add xyce-parallel., Ludovic Courtès, 2017/10/11
- 08/09: uuid: Change "fat32" to "fat"., Ludovic Courtès, 2017/10/11
- 01/09: gnu: Add lapack-3.5., Ludovic Courtès, 2017/10/11
- 02/09: gnu: Add xyce-serial., Ludovic Courtès, 2017/10/11
- 04/09: gnu: Add freehdl., Ludovic Courtès, 2017/10/11
- 06/09: file-systems: Preserve UUID types when serializing.,
Ludovic Courtès <=
- 07/09: file-systems: Add support for FAT16., Ludovic Courtès, 2017/10/11
- 09/09: doc: Give an example with a FAT UUID., Ludovic Courtès, 2017/10/11
- 05/09: file-systems: 'mount-file-system' now takes a <file-system> object., Ludovic Courtès, 2017/10/11