From patchwork Sun Dec 2 07:42:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arun Isaac X-Patchwork-Id: 366 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 060A716788; Sun, 2 Dec 2018 07:43:15 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB,T_DKIM_INVALID,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) by mira.cbaines.net (Postfix) with ESMTPS id 723511676F for ; Sun, 2 Dec 2018 07:43:14 +0000 (GMT) Received: from localhost ([::1]:43721 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTMPJ-00089n-EZ for patchwork@mira.cbaines.net; Sun, 02 Dec 2018 02:43:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44745) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTMPG-00089W-CU for guix-patches@gnu.org; Sun, 02 Dec 2018 02:43:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTMP8-0005k1-Q6 for guix-patches@gnu.org; Sun, 02 Dec 2018 02:43:09 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:53261) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gTMP8-0005jL-Md for guix-patches@gnu.org; Sun, 02 Dec 2018 02:43:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gTMP8-000113-Jc for guix-patches@gnu.org; Sun, 02 Dec 2018 02:43:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#33575] [PATCH] guix: lint: Add checker to check if inputs are sorted. Resent-From: Arun Isaac Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 02 Dec 2018 07:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 33575 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 33575@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15437365793895 (code B ref -1); Sun, 02 Dec 2018 07:43:02 +0000 Received: (at submit) by debbugs.gnu.org; 2 Dec 2018 07:42:59 +0000 Received: from localhost ([127.0.0.1]:57519 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gTMP5-00010k-A7 for submit@debbugs.gnu.org; Sun, 02 Dec 2018 02:42:59 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35058) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gTMP3-00010V-6t for submit@debbugs.gnu.org; Sun, 02 Dec 2018 02:42:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTMOx-0005Yc-0M for submit@debbugs.gnu.org; Sun, 02 Dec 2018 02:42:51 -0500 Received: from lists.gnu.org ([2001:4830:134:3::11]:36441) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gTMOw-0005YW-Tl for submit@debbugs.gnu.org; Sun, 02 Dec 2018 02:42:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44663) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTMOw-0007gj-22 for guix-patches@gnu.org; Sun, 02 Dec 2018 02:42:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTMOr-0005Vv-31 for guix-patches@gnu.org; Sun, 02 Dec 2018 02:42:49 -0500 Received: from vultr.systemreboot.net ([45.77.148.100]:41124) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gTMOq-0005P0-N9 for guix-patches@gnu.org; Sun, 02 Dec 2018 02:42:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=systemreboot.net; s=default; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=apyJcGGF8INHSwazKRwMU7eCFa2XA8z9mL0O+JcBdtY=; b=jy36/dfWi907rjqqF9Je2qV+xS 8Ia6zi8MxmY9cmyC5cZez7AOTPNAWZCTmrVKNWC4ByGsjQ83f5HD+Qsoiai7Quw4++Pb+qjowH6cZ hvtz6nWptXgsIz4zUOunVTHmCwvhzatbFWrwSN04AaLuyhCwtP0NL7nd9DZ4EZHMRFi8=; Received: from [103.5.134.173] (helo=localhost.localdomain) by systemreboot.net with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91) (envelope-from ) id 1gTMOl-0003wK-1Z; Sun, 02 Dec 2018 13:12:40 +0530 From: Arun Isaac Date: Sun, 2 Dec 2018 13:12:10 +0530 Message-Id: <20181202074210.31361-1-arunisaac@systemreboot.net> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * 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 ;;; Copyright © 2017 Tobias Geerinckx-Rice ;;; Copyright © 2017 Efraim Flashner +;;; Copyright © 2018 Arun Isaac ;;; ;;; 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