guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] lint: 'inputs-should-be-native' checks for intltool, itstool and


From: David Craven
Subject: [PATCH] lint: 'inputs-should-be-native' checks for intltool, itstool and glib:bin.
Date: Fri, 22 Jul 2016 19:50:54 +0200

* 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.
---
 guix/scripts/lint.scm | 20 +++++++++++++-------
 tests/lint.scm        | 10 ++++++++++
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index d5e9197..586ae88 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -203,14 +203,20 @@ by two spaces; possible infraction~p at ~{~a~^, ~}")
 (define (check-inputs-should-be-native package)
   ;; Emit a warning if some inputs of PACKAGE are likely to belong to its
   ;; native inputs.
-  (let ((inputs (package-inputs package)))
+  (let ((inputs (package-inputs package))
+        (native-inputs '("pkg-config" "glib:bin" "intltool" "itstool")))
     (match inputs
-      (((labels packages . _) ...)
-       (when (member "pkg-config"
-                     (map package-name (filter package? packages)))
-        (emit-warning package
-                      (_ "pkg-config should probably be a native input")
-                      'inputs))))))
+      (((labels packages . outputs) ...)
+        (for-each (lambda (package output)
+          (when (package? package)
+            (let ((input (string-append
+                    (package-name package)
+                    (if (> (length output) 0)
+                      (string-append ":" (car output)) ""))))
+              (when (member input native-inputs)
+                (emit-warning package
+                  (string-append input " should probably be a native 
input"))))))
+        packages outputs)))))
 
 (define (package-name-regexp package)
   "Return a regexp that matches PACKAGE's name as a word at the beginning of a
diff --git a/tests/lint.scm b/tests/lint.scm
index ce751c4..136a5a6 100644
--- a/tests/lint.scm
+++ b/tests/lint.scm
@@ -31,6 +31,7 @@
   #:use-module (guix scripts lint)
   #:use-module (guix ui)
   #:use-module (gnu packages)
+  #:use-module (gnu packages glib)
   #:use-module (gnu packages pkg-config)
   #:use-module (web server)
   #:use-module (web server http)
@@ -321,6 +322,15 @@ string) on HTTP requests."
          (check-inputs-should-be-native pkg)))
          "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"
   (->bool
    (string-contains
-- 
2.9.0



reply via email to

[Prev in Thread] Current Thread [Next in Thread]