diff options
author | Marius Bakke <mbakke@fastmail.com> | 2017-06-10 02:57:50 +0200 |
---|---|---|
committer | Marius Bakke <mbakke@fastmail.com> | 2017-06-10 02:57:50 +0200 |
commit | ea45e2c500c7ed5b22ea5c21516db40dfd8fbd0b (patch) | |
tree | c743e4905419232e6a342694760bf446cd41b5d4 /gnu/build/file-systems.scm | |
parent | 202342fdda708d8e4554e0514a58849584eddbd0 (diff) | |
parent | 8caf5bac4c89512793276054770386c343c73e7b (diff) |
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/build/file-systems.scm')
-rw-r--r-- | gnu/build/file-systems.scm | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm index 7737de3d03..1c733f43b4 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) |