summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2020-05-10 10:25:41 +0200
committerRicardo Wurmus <rekado@elephly.net>2020-05-10 10:25:41 +0200
commit66e024d07d67ef4ed1bad72ea03011e6c66427d5 (patch)
tree73c89246f53f7ba8b9359c3748419ca53cd84acf
parent02736dc1ff80db306394edd9fdb3a200fd677f71 (diff)
debbugs: Express extract-bug-numbers in terms of filter-index.
* mumi/debbugs.scm (extract-bug-numbers): Rewrite in terms of filter-index.
-rw-r--r--mumi/debbugs.scm23
1 files changed, 7 insertions, 16 deletions
diff --git a/mumi/debbugs.scm b/mumi/debbugs.scm
index d500127..584665d 100644
--- a/mumi/debbugs.scm
+++ b/mumi/debbugs.scm
@@ -138,22 +138,13 @@ search the index of archived issues."
"Open up a Debbugs index file and return the bug numbers for those
lines that match one of PACKAGES. If ARCHIVED? is #T search the index
of archived issues."
- (define index-file
- (format #f "~a/spool/index.~a.realtime" (%config 'data-dir)
- (if archived? "archive" "db")))
- (define (extract-numbers port)
- (let loop ((numbers '()))
- (match (read-line port)
- ((? eof-object? x) numbers)
- (line
- (cond
- ((any (lambda (package)
- (string-prefix? package line))
- packages)
- (loop (cons (second (string-split line #\space))
- numbers)))
- (else (loop numbers)))))))
- (call-with-input-file index-file extract-numbers))
+ (filter-index (lambda (line)
+ (any (lambda (package)
+ (string-prefix? package line))
+ packages))
+ (lambda (line)
+ (second (string-split line #\space)))
+ #:archived? archived?))
(define* (bug-id->log-file bug-id #:key archived?)
(format #f "~a/spool/~a/~a/~a.log"