lint: Avoid 'dirname' call at the top level.

* guix/scripts/lint.scm (%distro-directory): Wrap in 'mlambda'.
(check-patch-file-names): Adjust accordingly.
master
Ludovic Courtès 2019-01-07 13:55:32 +01:00
parent 46cf4cd676
commit 54ddb6a154
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 4 additions and 3 deletions

View File

@ -595,7 +595,8 @@ from ~a")
'home-page))))) 'home-page)))))
(define %distro-directory (define %distro-directory
(dirname (search-path %load-path "gnu.scm"))) (mlambda ()
(dirname (search-path %load-path "gnu.scm"))))
(define (check-patch-file-names package) (define (check-patch-file-names package)
"Emit a warning if the patches requires by PACKAGE are badly named or if the "Emit a warning if the patches requires by PACKAGE are badly named or if the
@ -620,12 +621,12 @@ patch could not be found."
'patch-file-names)) 'patch-file-names))
;; Check whether we're reaching tar's maximum file name length. ;; Check whether we're reaching tar's maximum file name length.
(let ((prefix (string-length %distro-directory)) (let ((prefix (string-length (%distro-directory)))
(margin (string-length "guix-0.13.0-10-123456789/")) (margin (string-length "guix-0.13.0-10-123456789/"))
(max 99)) (max 99))
(for-each (match-lambda (for-each (match-lambda
((? string? patch) ((? string? patch)
(when (> (+ margin (if (string-prefix? %distro-directory (when (> (+ margin (if (string-prefix? (%distro-directory)
patch) patch)
(- (string-length patch) prefix) (- (string-length patch) prefix)
(string-length patch))) (string-length patch)))