aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-09-28 23:58:38 +0100
committerChristopher Baines <mail@cbaines.net>2019-09-29 00:21:25 +0100
commitc81d1e04eacb1c5d1d585ff1bc5ab54b0130eb9b (patch)
treebfe6c7adcbc9f8938cdf6e7ad481e49f0a42b67d
parent15b94238c58c0da42d6e534040e79b0e111178bd (diff)
downloaddata-service-c81d1e04eacb1c5d1d585ff1bc5ab54b0130eb9b.tar
data-service-c81d1e04eacb1c5d1d585ff1bc5ab54b0130eb9b.tar.gz
Handle loading revisions without the (guix lint) module
This is a recent addition, so to support loading revisions without it, better handle the error when loading the module.
-rw-r--r--guix-data-service/jobs/load-new-guix-revision.scm127
1 files changed, 68 insertions, 59 deletions
diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm
index 6d99862..f176ab5 100644
--- a/guix-data-service/jobs/load-new-guix-revision.scm
+++ b/guix-data-service/jobs/load-new-guix-revision.scm
@@ -199,19 +199,6 @@ WHERE job_id = $1"
action time-taken)))))
(define (all-inferior-lint-warnings inf store)
- (define checkers
- (inferior-eval
- '(begin
- (use-modules (guix lint))
- (map (lambda (checker)
- (list (lint-checker-name checker)
- (lint-checker-description checker)
- (if (memq checker %network-dependent-checkers)
- #t
- #f)))
- %all-checkers))
- inf))
-
(define locales
'("cs_CZ.utf8"
"da_DK.utf8"
@@ -286,19 +273,41 @@ WHERE job_id = $1"
(check package))))
%package-table)))))
- (map
- (match-lambda
- ((name description network-dependent?)
- (cons
- (list name description network-dependent?)
- (if network-dependent?
- '()
- (log-time
- (simple-format #f "getting ~A lint warnings" name)
- (lambda ()
- (inferior-eval-with-store inf store (lint-warnings-for-checker
- name))))))))
- checkers))
+ (and
+ (catch
+ 'misc-error
+ (lambda ()
+ (inferior-eval '(use-modules (guix lint)) inf)
+ #t)
+ (lambda (key . args)
+ (simple-format (current-error-port)
+ "warning: failed to load the (guix lint) module: ~A ~A\n"
+ key args)
+ #f))
+ (let ((checkers
+ (inferior-eval
+ '(begin
+ (map (lambda (checker)
+ (list (lint-checker-name checker)
+ (lint-checker-description checker)
+ (if (memq checker %network-dependent-checkers)
+ #t
+ #f)))
+ %all-checkers))
+ inf)))
+ (map
+ (match-lambda
+ ((name description network-dependent?)
+ (cons
+ (list name description network-dependent?)
+ (if network-dependent?
+ '()
+ (log-time
+ (simple-format #f "getting ~A lint warnings" name)
+ (lambda ()
+ (inferior-eval-with-store inf store (lint-warnings-for-checker
+ name))))))))
+ checkers))))
(define (all-inferior-package-derivations store inf packages)
(define inferior-%supported-systems
@@ -815,39 +824,39 @@ WHERE job_id = $1"
#t "debug: finished loading information from inferior\n")
(close-inferior inf)
- (let* ((lint-checker-ids
- (lint-checkers->lint-checker-ids
- conn
- (map car inferior-lint-warnings)))
- (lint-warning-ids
- (insert-lint-warnings
- conn
- inferior-package-id->package-database-id
- lint-checker-ids
- inferior-lint-warnings))
- (package-derivation-ids
- (inferior-data->package-derivation-ids
- conn inf inferior-package-id->package-database-id
- inferior-data-4-tuples))
- (guix-revision-id
- (insert-guix-revision conn git-repository-id
- commit store-path)))
-
- (insert-guix-revision-lint-checkers conn
- guix-revision-id
- lint-checker-ids)
-
- (insert-guix-revision-lint-warnings conn
- guix-revision-id
- lint-warning-ids)
-
- (insert-guix-revision-package-derivations conn
- guix-revision-id
- package-derivation-ids)
-
- (simple-format
- #t "Successfully loaded ~A package/derivation pairs\n"
- (length package-derivation-ids)))))
+ (let ((guix-revision-id
+ (insert-guix-revision conn git-repository-id
+ commit store-path)))
+
+ (when inferior-lint-warnings
+ (let* ((lint-checker-ids
+ (lint-checkers->lint-checker-ids
+ conn
+ (map car inferior-lint-warnings)))
+ (lint-warning-ids
+ (insert-lint-warnings
+ conn
+ inferior-package-id->package-database-id
+ lint-checker-ids
+ inferior-lint-warnings)))
+ (insert-guix-revision-lint-checkers conn
+ guix-revision-id
+ lint-checker-ids)
+
+ (insert-guix-revision-lint-warnings conn
+ guix-revision-id
+ lint-warning-ids)))
+ (let ((package-derivation-ids
+ (inferior-data->package-derivation-ids
+ conn inf inferior-package-id->package-database-id
+ inferior-data-4-tuples)))
+
+ (insert-guix-revision-package-derivations conn
+ guix-revision-id
+ package-derivation-ids)
+ (simple-format
+ #t "Successfully loaded ~A package/derivation pairs\n"
+ (length package-derivation-ids))))))
#t)
(lambda (key . args)
(simple-format (current-error-port)