diff options
author | Eric Bavier <bavier@member.fsf.org> | 2016-12-12 21:57:09 -0600 |
---|---|---|
committer | Eric Bavier <bavier@member.fsf.org> | 2016-12-12 22:22:33 -0600 |
commit | d391ad57d69facc25bba74d959421f7725cbf000 (patch) | |
tree | 728f87e4b1e91fa12dcdba8081aef0558e8d3c5a | |
parent | 63773200d7ac68fcaee6efd9ffe8ea7aa3fafa38 (diff) | |
download | gnu-guix-d391ad57d69facc25bba74d959421f7725cbf000.tar gnu-guix-d391ad57d69facc25bba74d959421f7725cbf000.tar.gz |
import: cpan: Move core-module? to top-level.
* guix/import/cpan.scm (cpan-module->sexp): Move local core-module?
procedure to ...
(core-module?): ... here.
-rw-r--r-- | guix/import/cpan.scm | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm index d244969c9e..f3dd01bfea 100644 --- a/guix/import/cpan.scm +++ b/guix/import/cpan.scm @@ -116,6 +116,31 @@ if the original's domain was metacpan." (and (access? core X_OK) core)))) +(define core-module? + (let ((perl-version (package-version perl)) + (rx (make-regexp + (string-append "released with perl v?([0-9\\.]*)" + "(.*and removed from v?([0-9\\.]*))?")))) + (lambda (name) + (define (version-between? lower version upper) + (and (version>=? version lower) + (or (not upper) + (version>? upper version)))) + (and (force %corelist) + (parameterize ((current-error-port (%make-void-port "w"))) + (let* ((corelist (open-pipe* OPEN_READ (force %corelist) name))) + (let loop () + (let ((line (read-line corelist))) + (if (eof-object? line) + (begin (close-pipe corelist) #f) + (or (and=> (regexp-exec rx line) + (lambda (m) + (let ((first (match:substring m 1)) + (last (match:substring m 3))) + (version-between? + first perl-version last)))) + (loop))))))))))) + (define (cpan-module->sexp meta) "Return the `package' s-expression for a CPAN module from the metadata in META." @@ -132,31 +157,6 @@ META." ((? number? vrs) (number->string vrs)) ((? string? vrs) vrs))) - (define core-module? - (let ((perl-version (package-version perl)) - (rx (make-regexp - (string-append "released with perl v?([0-9\\.]*)" - "(.*and removed from v?([0-9\\.]*))?")))) - (lambda (name) - (define (version-between? lower version upper) - (and (version>=? version lower) - (or (not upper) - (version>? upper version)))) - (and (force %corelist) - (parameterize ((current-error-port (%make-void-port "w"))) - (let* ((corelist (open-pipe* OPEN_READ (force %corelist) name))) - (let loop () - (let ((line (read-line corelist))) - (if (eof-object? line) - (begin (close-pipe corelist) #f) - (or (and=> (regexp-exec rx line) - (lambda (m) - (let ((first (match:substring m 1)) - (last (match:substring m 3))) - (version-between? - first perl-version last)))) - (loop))))))))))) - (define (convert-inputs phases) ;; Convert phase dependencies into a list of name/variable pairs. (match (flatten |