diff options
author | Marius Bakke <mbakke@fastmail.com> | 2020-03-27 00:12:15 +0100 |
---|---|---|
committer | Marius Bakke <mbakke@fastmail.com> | 2020-03-27 00:12:15 +0100 |
commit | 18af6870370226b4d502d7372844e7f2aded5887 (patch) | |
tree | 749d93209bd0cb9710ccaae2207df670f37eaa36 /guix/scripts/lint.scm | |
parent | 0ab8ad46322bea331ed5f5592843ba35e7f38b37 (diff) | |
parent | 3089b70d766bd9ec70e1464867130b7b864fbe17 (diff) |
Merge branch 'master' into core-updates
Conflicts:
gnu/packages/icu4c.scm
gnu/packages/man.scm
gnu/packages/python-xyz.scm
guix/scripts/environment.scm
guix/scripts/pack.scm
guix/scripts/package.scm
guix/scripts/pull.scm
guix/store.scm
Diffstat (limited to 'guix/scripts/lint.scm')
-rw-r--r-- | guix/scripts/lint.scm | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm index 8d08c484f5..97ffd57301 100644 --- a/guix/scripts/lint.scm +++ b/guix/scripts/lint.scm @@ -30,6 +30,7 @@ #:use-module (guix packages) #:use-module (guix lint) #:use-module (guix ui) + #:use-module (guix store) #:use-module (guix scripts) #:use-module (guix scripts build) #:use-module (gnu packages) @@ -53,7 +54,7 @@ (lint-warning-message lint-warning)))) warnings)) -(define (run-checkers package checkers) +(define* (run-checkers package checkers #:key store) "Run the given CHECKERS on PACKAGE." (let ((tty? (isatty? (current-error-port)))) (for-each (lambda (checker) @@ -63,7 +64,9 @@ (lint-checker-name checker)) (force-output (current-error-port))) (emit-warnings - ((lint-checker-check checker) package))) + (if (lint-checker-requires-store? checker) + ((lint-checker-check checker) package #:store store) + ((lint-checker-check checker) package)))) checkers) (when tty? (format (current-error-port) "\x1b[K") @@ -167,12 +170,27 @@ run the checkers on all packages.\n")) (_ #f)) (reverse opts))) (checkers (or (assoc-ref opts 'checkers) %all-checkers))) - (cond - ((assoc-ref opts 'list?) + + (when (assoc-ref opts 'list?) (list-checkers-and-exit checkers)) - ((null? args) - (fold-packages (lambda (p r) (run-checkers p checkers)) '())) - (else - (for-each (lambda (spec) - (run-checkers (specification->package spec) checkers)) - args))))) + + (let ((any-lint-checker-requires-store? + (any lint-checker-requires-store? checkers))) + + (define (call-maybe-with-store proc) + (if any-lint-checker-requires-store? + (with-store store + (proc store)) + (proc #f))) + + (call-maybe-with-store + (lambda (store) + (cond + ((null? args) + (fold-packages (lambda (p r) (run-checkers p checkers + #:store store)) '())) + (else + (for-each (lambda (spec) + (run-checkers (specification->package spec) checkers + #:store store)) + args)))))))) |