lint: 'inputs-should-be-native' checks for intltool, itstool and glib:bin.
* guix/scripts/lint.scm (check-inputs-should-be-native): Warn when intltool, itstool or glib:bin isn't a native-input. * tests/lint.scm (inputs: glib:bin is probably a native input): Add test. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
0f53b886e2
commit
99fe215cc1
|
@ -203,14 +203,25 @@ by two spaces; possible infraction~p at ~{~a~^, ~}")
|
||||||
(define (check-inputs-should-be-native package)
|
(define (check-inputs-should-be-native package)
|
||||||
;; Emit a warning if some inputs of PACKAGE are likely to belong to its
|
;; Emit a warning if some inputs of PACKAGE are likely to belong to its
|
||||||
;; native inputs.
|
;; native inputs.
|
||||||
(let ((inputs (package-inputs package)))
|
(let ((linted package)
|
||||||
|
(inputs (package-inputs package))
|
||||||
|
(native-inputs '("pkg-config" "glib:bin" "intltool" "itstool")))
|
||||||
(match inputs
|
(match inputs
|
||||||
(((labels packages . _) ...)
|
(((labels packages . outputs) ...)
|
||||||
(when (member "pkg-config"
|
(for-each (lambda (package output)
|
||||||
(map package-name (filter package? packages)))
|
(when (package? package)
|
||||||
(emit-warning package
|
(let ((input (string-append
|
||||||
(_ "pkg-config should probably be a native input")
|
(package-name package)
|
||||||
'inputs))))))
|
(if (> (length output) 0)
|
||||||
|
(string-append ":" (car output))
|
||||||
|
""))))
|
||||||
|
(when (member input native-inputs)
|
||||||
|
(emit-warning linted
|
||||||
|
(format #f (_ "'~a' should probably \
|
||||||
|
be a native input")
|
||||||
|
input)
|
||||||
|
'inputs)))))
|
||||||
|
packages outputs)))))
|
||||||
|
|
||||||
(define (package-name-regexp package)
|
(define (package-name-regexp package)
|
||||||
"Return a regexp that matches PACKAGE's name as a word at the beginning of a
|
"Return a regexp that matches PACKAGE's name as a word at the beginning of a
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#:use-module (guix scripts lint)
|
#:use-module (guix scripts lint)
|
||||||
#:use-module (guix ui)
|
#:use-module (guix ui)
|
||||||
#:use-module (gnu packages)
|
#:use-module (gnu packages)
|
||||||
|
#:use-module (gnu packages glib)
|
||||||
#:use-module (gnu packages pkg-config)
|
#:use-module (gnu packages pkg-config)
|
||||||
#:use-module (web server)
|
#:use-module (web server)
|
||||||
#:use-module (web server http)
|
#:use-module (web server http)
|
||||||
|
@ -319,7 +320,16 @@ string) on HTTP requests."
|
||||||
(let ((pkg (dummy-package "x"
|
(let ((pkg (dummy-package "x"
|
||||||
(inputs `(("pkg-config" ,pkg-config))))))
|
(inputs `(("pkg-config" ,pkg-config))))))
|
||||||
(check-inputs-should-be-native pkg)))
|
(check-inputs-should-be-native pkg)))
|
||||||
"pkg-config should probably be a native input")))
|
"'pkg-config' should probably be a native input")))
|
||||||
|
|
||||||
|
(test-assert "inputs: glib:bin is probably a native input"
|
||||||
|
(->bool
|
||||||
|
(string-contains
|
||||||
|
(with-warnings
|
||||||
|
(let ((pkg (dummy-package "x"
|
||||||
|
(inputs `(("glib" ,glib "bin"))))))
|
||||||
|
(check-inputs-should-be-native pkg)))
|
||||||
|
"'glib:bin' should probably be a native input")))
|
||||||
|
|
||||||
(test-assert "patches: file names"
|
(test-assert "patches: file names"
|
||||||
(->bool
|
(->bool
|
||||||
|
|
Loading…
Reference in New Issue