GNU bug report logs - #33575
[PATCH] guix: lint: Add checker to check if inputs are sorted.

Previous Next

Package: guix-patches;

Reported by: Arun Isaac <arunisaac <at> systemreboot.net>

Date: Sun, 2 Dec 2018 07:43:02 UTC

Severity: normal

Tags: patch

Done: Arun Isaac <arunisaac <at> systemreboot.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Arun Isaac <arunisaac <at> systemreboot.net>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#33575: closed ([PATCH] guix: lint: Add checker to check if
 inputs are sorted.)
Date: Tue, 18 Dec 2018 20:38:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Wed, 19 Dec 2018 02:06:51 +0530
with message-id <cu7tvjao9lo.fsf <at> systemreboot.net>
and subject line Re: [bug#33575] [PATCH] guix: lint: Add checker to check if inputs are sorted.
has caused the debbugs.gnu.org bug report #33575,
regarding [PATCH] guix: lint: Add checker to check if inputs are sorted.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
33575: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=33575
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Arun Isaac <arunisaac <at> systemreboot.net>
To: guix-patches <at> gnu.org
Cc: Arun Isaac <arunisaac <at> systemreboot.net>
Subject: [PATCH] guix: lint: Add checker to check if inputs are sorted.
Date: Sun,  2 Dec 2018 13:12:10 +0530
* guix/scripts/lint.scm (check-inputs-should-be-sorted): New procedure.
(%checkers): Add it.
---
 guix/scripts/lint.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index 2314f3b28..37e8a1ec5 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2017 Alex Kost <alezost <at> gmail.com>
 ;;; Copyright © 2017 Tobias Geerinckx-Rice <me <at> tobias.gr>
 ;;; Copyright © 2017 Efraim Flashner <efraim <at> flashner.co.il>
+;;; Copyright © 2018 Arun Isaac <arunisaac <at> systemreboot.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -301,6 +302,22 @@ 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-be-sorted package)
+  ;; Emit a warning if inputs, native inputs or propagated inputs of PACKAGE
+  ;; are not lexicographically ordered.
+  (define (check-inputs inputs-accessor input-type)
+    (unless (sorted? (map (match-lambda
+                            ((name input) name))
+                          (inputs-accessor package))
+                     string<?)
+      (emit-warning
+       package
+       (format #f (G_ "~a should be in lexicographic order") input-type))))
+
+  (check-inputs package-inputs (G_ "inputs"))
+  (check-inputs package-native-inputs (G_ "native inputs"))
+  (check-inputs package-propagated-inputs (G_ "propagated inputs")))
+
 (define (package-name-regexp package)
   "Return a regexp that matches PACKAGE's name as a word at the beginning of a
 line."
@@ -1032,6 +1049,10 @@ them for PACKAGE."
      (name        'inputs-should-not-be-input)
      (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-sorted)
+     (description "Verify that inputs are in lexicographic order")
+     (check       check-inputs-should-be-sorted))
    (lint-checker
      (name        'patch-file-names)
      (description "Validate file names and availability of patches")
-- 
2.19.1



[Message part 3 (message/rfc822, inline)]
From: Arun Isaac <arunisaac <at> systemreboot.net>
To: 33575-done <at> debbugs.gnu.org
Subject: Re: [bug#33575] [PATCH] guix: lint: Add checker to check if inputs
 are sorted.
Date: Wed, 19 Dec 2018 02:06:51 +0530
I'm closing this bug report since I believe we have reached a consensus
that this patch is unnecessary. Thank you all for your thoughts!


This bug report was last modified 6 years and 155 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.