glob: Add an extra glob pattern compilation stage.

* guix/glob.scm (compile-glob-pattern): Rename to...
(string->sglob): ... this.
(compile-sglob, string->compiled-sglob): New procedures.
(glob-match?): Replace '?, 'range, and 'set with a single clause.
* tests/glob.scm (test-compile-glob-pattern): Rename to...
(test-string->sglob): ... this.  Adjust accordingly.
(test-glob-match): Use 'string->compiled-sglob' instead of
'compile-glob-pattern'.
* gnu/build/linux-modules.scm (read-module-aliases): Use
'string->compiled-sglob' instead of 'compile-glob-pattern'.
This commit is contained in:
Ludovic Courtès 2018-03-18 22:54:34 +01:00
parent e914b398af
commit 71e08fde28
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
3 changed files with 41 additions and 26 deletions

View file

@ -329,7 +329,7 @@ The modules corresponding to these aliases can then be found using
list of alias/module pairs where each alias is a glob pattern as like the
result of:
(compile-glob-pattern \"scsi:t-0x01*\")
(string->compiled-sglob \"scsi:t-0x01*\")
and each module is a module name like \"snd_hda_intel\"."
(define (comment? str)
@ -354,7 +354,7 @@ and each module is a module name like \"snd_hda_intel\"."
(line
(match (tokenize line)
(("alias" alias module)
(loop (alist-cons (compile-glob-pattern alias) module
(loop (alist-cons (string->compiled-sglob alias) module
aliases)))
(() ;empty line
(loop aliases)))))))