summaryrefslogtreecommitdiff
path: root/guix/scripts/lint.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2017-12-05 23:41:30 +0100
committerMarius Bakke <mbakke@fastmail.com>2017-12-05 23:41:30 +0100
commit77181815ae70cf573b6fa390a4400b718835aa8a (patch)
tree731ccaaccc7a69ddc90f04bb71a6a39aa5f3be5a /guix/scripts/lint.scm
parente3f9406b7c4b3b1afe3dd6affb7f7898434d607a (diff)
parent35377cfa908340e51fd22af7369aef15499d4a36 (diff)
Merge branch 'master' into core-updates
Diffstat (limited to 'guix/scripts/lint.scm')
-rw-r--r--guix/scripts/lint.scm31
1 files changed, 28 insertions, 3 deletions
diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index 8840b1acb5..1b43b0a63c 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -587,24 +587,49 @@ from ~a")
(package-home-page package))
'home-page)))))
+(define %distro-directory
+ (dirname (search-path %load-path "gnu.scm")))
+
(define (check-patch-file-names package)
"Emit a warning if the patches requires by PACKAGE are badly named or if the
patch could not be found."
(guard (c ((message-condition? c) ;raised by 'search-patch'
(emit-warning package (condition-message c)
'patch-file-names)))
+ (define patches
+ (or (and=> (package-source package) origin-patches)
+ '()))
+
(unless (every (match-lambda ;patch starts with package name?
((? string? patch)
(and=> (string-contains (basename patch)
(package-name package))
zero?))
(_ #f)) ;must be an <origin> or something like that.
- (or (and=> (package-source package) origin-patches)
- '()))
+ patches)
(emit-warning
package
(G_ "file names of patches should start with the package name")
- 'patch-file-names))))
+ 'patch-file-names))
+
+ ;; Check whether we're reaching tar's maximum file name length.
+ (let ((prefix (string-length %distro-directory))
+ (margin (string-length "guix-0.13.0-10-123456789/"))
+ (max 99))
+ (for-each (match-lambda
+ ((? string? patch)
+ (when (> (+ margin (if (string-prefix? %distro-directory
+ patch)
+ (- (string-length patch) prefix)
+ (string-length patch)))
+ max)
+ (emit-warning
+ package
+ (format #f (G_ "~a: file name is too long")
+ (basename patch))
+ 'patch-file-names)))
+ (_ #f))
+ patches))))
(define (escape-quotes str)
"Replace any quote character in STR by an escaped quote character."