uuid: Add 'uuid=?' and use it.

* gnu/system/uuid.scm (uuid=?): New procedure.
* tests/uuid.scm ("uuid=?"): New test.
* gnu/build/file-systems.scm (partition-uuid-predicate)
(luks-partition-uuid-predicate): Use it instead of 'bytevector=?'.
This commit is contained in:
Ludovic Courtès 2017-10-04 21:34:09 +02:00
parent 67a08f1809
commit aed1f1b049
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
3 changed files with 21 additions and 2 deletions

View file

@ -29,6 +29,7 @@
uuid?
uuid-type
uuid-bytevector
uuid=?
bytevector->uuid
@ -281,3 +282,15 @@ corresponding bytevector; otherwise return #f."
((_ . (? procedure? unparse)) (unparse bv))))
(((? uuid? uuid))
(uuid->string (uuid-bytevector uuid) (uuid-type uuid)))))
(define uuid=?
;; Return true if A is equal to B, comparing only the actual bits.
(match-lambda*
(((? bytevector? a) (? bytevector? b))
(bytevector=? a b))
(((? uuid? a) (? bytevector? b))
(bytevector=? (uuid-bytevector a) b))
(((? uuid? a) (? uuid? b))
(bytevector=? (uuid-bytevector a) (uuid-bytevector b)))
((a b)
(uuid=? b a))))