From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48182) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpif9-0002JE-Iw for guix-patches@gnu.org; Wed, 06 Sep 2017 18:19:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dpif4-0000Vy-KP for guix-patches@gnu.org; Wed, 06 Sep 2017 18:19:11 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:44869) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dpif4-0000Vu-HU for guix-patches@gnu.org; Wed, 06 Sep 2017 18:19:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dpif4-0005me-BH for guix-patches@gnu.org; Wed, 06 Sep 2017 18:19:06 -0400 Subject: [bug#28377] [PATCH 07/10] system: Serialize the UUID type in the "parameters" file. Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Thu, 7 Sep 2017 00:17:53 +0200 Message-Id: <20170906221756.17024-7-ludo@gnu.org> In-Reply-To: <20170906221756.17024-1-ludo@gnu.org> References: <20170906221756.17024-1-ludo@gnu.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 28377@debbugs.gnu.org * gnu/system.scm (read-boot-parameters)[device->sexp]: New procedure. Use it for 'root-device' and 'store-device'. (device->sexp): Serialize the UUID type in addition to its bytevector. --- gnu/system.scm | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/gnu/system.scm b/gnu/system.scm index a8d2a8131..6f795d629 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -234,6 +234,15 @@ directly by the user." (define (read-boot-parameters port) "Read boot parameters from PORT and return the corresponding object or #f if the format is unrecognized." + (define device-sexp->device + (match-lambda + (('uuid (? symbol? type) (? bytevector? bv)) + (bytevector->uuid bv type)) + ((? bytevector? bv) ;old format + (bytevector->uuid bv 'dce)) + ((? string? device) + device))) + (match (read port) (('boot-parameters ('version 0) ('label label) ('root-device root) @@ -241,7 +250,7 @@ directly by the user." rest ...) (boot-parameters (label label) - (root-device root) + (root-device (device->sexp root)) (bootloader-name (match (assq 'bootloader-name rest) @@ -269,10 +278,8 @@ directly by the user." (store-device (match (assq 'store rest) - (('store ('device (? bytevector? bv)) _ ...) - (bytevector->uuid bv)) (('store ('device device) _ ...) - device) + (device-sexp->device device)) (_ ;the old format ;; Root might be a device path like "/dev/sda1", which is not a ;; suitable GRUB device identifier. @@ -925,8 +932,7 @@ kernel arguments for that derivation to ." "Serialize DEVICE as an sexp (really, as an object with a read syntax.)" (match device ((? uuid? uuid) - ;; TODO: Preserve the type of UUID. - (uuid-bytevector uuid)) + `(uuid ,(uuid-type uuid) ,(uuid-bytevector uuid))) (_ device))) -- 2.14.1