me
/
guix
Archived
1
0
Fork 0

lint: Adjust patch file length check.

With the switch to "ustar" format in commit
bdf5c16ac0, the maximum file length has
increased.

* guix/lint.scm (check-patch-file-names): Adjust margin used to check for
  patch file lengths. Increase allowable patch file length appropriate to new
  tar format. Extend warning to explain that long files may break 'make dist'.
* tests/lint.scm: Update tests accordingly.
master
Vagrant Cascadian 2021-11-26 12:13:45 -08:00
parent 3b2b42034c
commit 5f547a5c42
No known key found for this signature in database
GPG Key ID: DC518FC87F9716AA
2 changed files with 11 additions and 7 deletions

View File

@ -990,8 +990,12 @@ patch could not be found."
;; 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-2.0.0rc3-10000-1234567890/")) ;; Margin approximating the largest path that "make dist" might
(max 99)) ;; create, with a release candidate version, 123456 commits, and
;; git commit hash abcde0.
(margin (string-length "guix-92.0.0rc3-123456-abcde0/"))
;; Tested maximum patch file length for ustar format.
(max 151))
(filter-map (match-lambda (filter-map (match-lambda
((? string? patch) ((? string? patch)
(if (> (+ margin (if (string-prefix? (%distro-directory) (if (> (+ margin (if (string-prefix? (%distro-directory)
@ -1001,7 +1005,7 @@ patch could not be found."
max) max)
(make-warning (make-warning
package package
(G_ "~a: file name is too long") (G_ "~a: file name is too long, which may break 'make dist'")
(list (basename patch)) (list (basename patch))
#:field 'patch-file-names) #:field 'patch-file-names)
#f)) #f))

View File

@ -520,17 +520,17 @@
(file-name "x.patch"))))))))) (file-name "x.patch")))))))))
(check-patch-file-names pkg))) (check-patch-file-names pkg)))
(test-equal "patches: file name too long" (test-equal "patches: file name too long, which may break 'make dist'"
(string-append "x-" (string-append "x-"
(make-string 100 #\a) (make-string 152 #\a)
".patch: file name is too long") ".patch: file name is too long, which may break 'make dist'")
(single-lint-warning-message (single-lint-warning-message
(let ((pkg (dummy-package (let ((pkg (dummy-package
"x" "x"
(source (source
(dummy-origin (dummy-origin
(patches (list (string-append "x-" (patches (list (string-append "x-"
(make-string 100 #\a) (make-string 152 #\a)
".patch")))))))) ".patch"))))))))
(check-patch-file-names pkg)))) (check-patch-file-names pkg))))