From patchwork Mon Mar 11 10:44:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Geerinckx-Rice X-Patchwork-Id: 1366 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 E72DB16D82; Mon, 11 Mar 2019 11:04:41 +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=-1.9 required=5.0 tests=BAYES_00,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 8368D16D79 for ; Mon, 11 Mar 2019 11:04:41 +0000 (GMT) Received: from localhost ([127.0.0.1]:59681 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3IjY-0002V7-Su for patchwork@mira.cbaines.net; Mon, 11 Mar 2019 07:04:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43293) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3Ie8-0006Xy-B6 for guix-patches@gnu.org; Mon, 11 Mar 2019 06:59:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3Ie6-0005Nc-8l for guix-patches@gnu.org; Mon, 11 Mar 2019 06:59:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:53349) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h3Ie5-0005NE-Vt for guix-patches@gnu.org; Mon, 11 Mar 2019 06:59:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h3Ie5-0002yS-PG for guix-patches@gnu.org; Mon, 11 Mar 2019 06:59:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#34811] Make package name regexes case-insensitive Resent-From: Tobias Geerinckx-Rice Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 11 Mar 2019 10:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 34811 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 34811@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.155230190311377 (code B ref -1); Mon, 11 Mar 2019 10:59:01 +0000 Received: (at submit) by debbugs.gnu.org; 11 Mar 2019 10:58:23 +0000 Received: from localhost ([127.0.0.1]:38660 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h3IdP-0002xN-UD for submit@debbugs.gnu.org; Mon, 11 Mar 2019 06:58:23 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56148) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h3IdM-0002x7-Gl for submit@debbugs.gnu.org; Mon, 11 Mar 2019 06:58:18 -0400 Received: from lists.gnu.org ([209.51.188.17]:33443) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h3IdH-0004ab-4o for submit@debbugs.gnu.org; Mon, 11 Mar 2019 06:58:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42277) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3IdF-0005pD-FB for guix-patches@gnu.org; Mon, 11 Mar 2019 06:58:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3IQD-00036o-Pz for guix-patches@gnu.org; Mon, 11 Mar 2019 06:44:42 -0400 Received: from tobias.gr ([2001:470:7405::1]:51244) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h3IQD-00034c-AI for guix-patches@gnu.org; Mon, 11 Mar 2019 06:44:41 -0400 Received: by tobias.gr (OpenSMTPD) with ESMTP id 6e900e7a for ; Mon, 11 Mar 2019 10:44:37 +0000 (UTC) Received: by submission.tobias.gr (OpenSMTPD) with ESMTPSA id 45bf3316 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Mon, 11 Mar 2019 10:44:37 +0000 (UTC) From: Tobias Geerinckx-Rice Date: Mon, 11 Mar 2019 11:44:35 +0100 Message-ID: <87ftrther0.fsf@nckx> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. 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: 209.51.188.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, I think they should. All of our package names are lower case, and it doesn't add value that $ guix package -A ExifTool matches zero, zip, zilch, nada, nothing, while $ guix package -A exiftool perl-image-exiftool 11.11 out gnu/packages/photo.scm:208:2 does. Kind regards, T G-R From 5876eb1fe6d412d7f2a556e0903cd2d87994ab9e Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Mon, 11 Mar 2019 11:37:11 +0100 Subject: [PATCH] ui: Match package names case-insensitively. * guix/ui.scm (make-package-name-regexp): New variable. * guix/scripts/package.scm (options->upgrade-predicate, process-query): Use it. --- guix/scripts/package.scm | 9 +++++---- guix/ui.scm | 6 ++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index efff511299..563615938b 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2016 Roel Janssen ;;; Copyright © 2016 Benz Schenk ;;; Copyright © 2016 Chris Marusich +;;; Copyright © 2019 Tobias Geerinckx-Rice ;;; ;;; This file is part of GNU Guix. ;;; @@ -526,14 +527,14 @@ upgrading, #f otherwise." (define upgrade-regexps (filter-map (match-lambda (('upgrade . regexp) - (make-regexp* (or regexp ""))) + (make-package-name-regexp (or regexp ""))) (_ #f)) opts)) (define do-not-upgrade-regexps (filter-map (match-lambda (('do-not-upgrade . regexp) - (make-regexp* regexp)) + (make-package-name-regexp regexp)) (_ #f)) opts)) @@ -686,7 +687,7 @@ processed, #f otherwise." #t) (('list-installed regexp) - (let* ((regexp (and regexp (make-regexp* regexp))) + (let* ((regexp (and regexp (make-package-name-regexp regexp))) (manifest (profile-manifest profile)) (installed (manifest-entries manifest))) (leave-on-EPIPE @@ -702,7 +703,7 @@ processed, #f otherwise." #t)) (('list-available regexp) - (let* ((regexp (and regexp (make-regexp* regexp))) + (let* ((regexp (and regexp (make-package-name-regexp regexp))) (available (fold-available-packages (lambda* (name version result #:key outputs location diff --git a/guix/ui.scm b/guix/ui.scm index 2fc001d2eb..eb4ea28d52 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -13,6 +13,7 @@ ;;; Copyright © 2013, 2014 Free Software Foundation, Inc. ;;; Copyright © 2018 Sahithi Yarlagadda ;;; Copyright © 2018 Ricardo Wurmus +;;; Copyright © 2019 Tobias Geerinckx-Rice ;;; ;;; This file is part of GNU Guix. ;;; @@ -79,6 +80,7 @@ show-version-and-exit show-bug-report-information make-regexp* + make-package-name-regexp string->number* size->number show-derivation-outputs @@ -548,6 +550,10 @@ nicely." (leave (G_ "'~a' is not a valid regular expression: ~a~%") regexp message)))) +(define (make-package-name-regexp regexp) + "Like 'make-regexp*' but specifically for package names (i.e. ignore case)" + (make-regexp* regexp regexp/icase)) + (define (string->number* str) "Like `string->number', but error out with an error message on failure." (or (string->number str) -- 2.20.1