aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2024-09-23 10:35:27 +0300
committerEfraim Flashner <efraim@flashner.co.il>2024-09-29 14:38:57 +0300
commit5bda3f8a3424adb7c677f349bd5b6e639eb18673 (patch)
tree988667c27f9510d09ea1c6625bf1227713c0cea6
parente464a3e166b826a040aea7140ee33f3e89da6a88 (diff)
downloadguix-5bda3f8a3424adb7c677f349bd5b6e639eb18673.tar.gz
guix-5bda3f8a3424adb7c677f349bd5b6e639eb18673.zip
lint: Check for minimal variants.
* guix/lint.scm (check-inputs-should-use-a-minimal-variant): New procedure. (%local-checkers): Add it. Change-Id: Ifbf808063e4e125c7070505a8a6215128d84b40b
-rw-r--r--guix/lint.scm22
1 files changed, 21 insertions, 1 deletions
diff --git a/guix/lint.scm b/guix/lint.scm
index 7612832a5a..8c6c20c723 100644
--- a/guix/lint.scm
+++ b/guix/lint.scm
@@ -7,7 +7,7 @@
;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;; Copyright © 2017 Alex Kost <alezost@gmail.com>
;;; Copyright © 2017, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
-;;; Copyright © 2017, 2018, 2020 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2017, 2018, 2020, 2024 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2018, 2019 Arun Isaac <arunisaac@systemreboot.net>
;;; Copyright © 2020 Chris Marusich <cmmarusich@gmail.com>
;;; Copyright © 2020 Timothy Sample <samplet@ngyro.com>
@@ -96,6 +96,7 @@
#:export (check-description-style
check-inputs-should-be-native
check-inputs-should-not-be-an-input-at-all
+ check-inputs-should-use-a-minimal-variant
check-input-labels
check-wrapper-inputs
check-patch-file-names
@@ -598,6 +599,21 @@ of a package, and INPUT-NAMES, a list of package specifications such as
(package-input-intersection (package-direct-inputs package)
input-names))))
+(define (check-inputs-should-use-a-minimal-variant package)
+ ;; Emit a warning if some inputs of PACKAGE should likely be replaced
+ ;; with their minimal variant.
+ (let ((input-names '("bash"
+ "cmake"
+ "gettext")))
+ (map (lambda (input)
+ (make-warning
+ package
+ (G_ "'~a' should probably switched for its minimal variant")
+ (list input)
+ #:field 'inputs))
+ (package-input-intersection (package-direct-inputs package)
+ input-names))))
+
(define (check-input-labels package)
"Emit a warning for labels that differ from the corresponding package name."
(define (check input-kind package-inputs)
@@ -1979,6 +1995,10 @@ them for PACKAGE."
(description "Identify inputs that shouldn't be inputs at all")
(check check-inputs-should-not-be-an-input-at-all))
(lint-checker
+ (name 'inputs-should-be-minimal)
+ (description "Identify inputs that should use their minimal variant")
+ (check check-inputs-should-use-a-minimal-variant))
+ (lint-checker
(name 'input-labels)
(description "Identify input labels that do not match package names")
(check check-input-labels))