GNU bug report logs - #27290
[PATCH] file-systems: Provide string->iso9660-uuid.

Previous Next

Package: guix-patches;

Reported by: Danny Milosavljevic <dannym <at> scratchpost.org>

Date: Thu, 8 Jun 2017 19:28:02 UTC

Severity: normal

Tags: patch

Done: Danny Milosavljevic <dannym <at> scratchpost.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 27290 in the body.
You can then email your comments to 27290 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#27290; Package guix-patches. (Thu, 08 Jun 2017 19:28:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Danny Milosavljevic <dannym <at> scratchpost.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 08 Jun 2017 19:28:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: guix-patches <at> gnu.org
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>
Subject: [PATCH] file-systems: Provide string->iso9660-uuid.
Date: Thu,  8 Jun 2017 21:26:52 +0200
* gnu/build/file-systems.scm (string->iso9660-uuid): New variable.  Export it.
---
 gnu/build/file-systems.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index 7737de3d0..1c733f43b 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -43,6 +43,7 @@
 
             uuid->string
             string->uuid
+            string->iso9660-uuid
 
             bind-mount
 
@@ -235,6 +236,27 @@ Trailing spaces are trimmed."
 
 ;; <http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-119.pdf>.
 
+(define %iso9660-uuid-rx
+  ;;                   Y                m                d                H                M                S                ss
+  (make-regexp "^([[:digit:]]{4})-([[:digit:]]{2})-([[:digit:]]{2})-([[:digit:]]{2})-([[:digit:]]{2})-([[:digit:]]{2})-([[:digit:]]{2})$"))
+
+(define (string->iso9660-uuid str)
+  "Parse STR as a ISO9660 UUID (which is really a timestamp - see /dev/disk/by-uuid).
+Return its contents as a 16-byte bytevector.  Return #f if STR is not a valid
+ISO9660 UUID representation."
+  (and=> (regexp-exec %iso9660-uuid-rx str)
+         (lambda (match)
+           (letrec-syntax ((match-numerals
+                            (syntax-rules ()
+                              ((_ index (name rest ...) body)
+                               (let ((name (match:substring match index)))
+                                 (match-numerals (+ 1 index) (rest ...) body)))
+                              ((_ index () body)
+                               body))))
+            (match-numerals 1 (year month day hour minute second hundredths)
+              (string->utf8 (string-append year month day
+                                           hour minute second hundredths)))))))
+
 (define (iso9660-superblock? sblock)
   "Return #t when SBLOCK is an iso9660 volume descriptor."
   (bytevector=? (sub-bytevector sblock 1 6)




Information forwarded to guix-patches <at> gnu.org:
bug#27290; Package guix-patches. (Thu, 08 Jun 2017 21:21:02 GMT) Full text and rfc822 format available.

Message #8 received at 27290 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: 27290 <at> debbugs.gnu.org
Subject: Re: bug#27290: [PATCH] file-systems: Provide string->iso9660-uuid.
Date: Thu, 08 Jun 2017 23:20:32 +0200
Danny Milosavljevic <dannym <at> scratchpost.org> skribis:

> * gnu/build/file-systems.scm (string->iso9660-uuid): New variable.  Export it.

LGTM, thanks!

Ludo'.




bug closed, send any further explanations to 27290 <at> debbugs.gnu.org and Danny Milosavljevic <dannym <at> scratchpost.org> Request was from Danny Milosavljevic <dannym <at> scratchpost.org> to control <at> debbugs.gnu.org. (Fri, 09 Jun 2017 11:29:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 08 Jul 2017 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 44 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.