all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tobias Geerinckx-Rice <somebody@not-sent-or-endorsed-by.tobias.gr>
To: 34811@debbugs.gnu.org
Subject: [bug#34811] Make package name regexes case-insensitive
Date: Mon, 11 Mar 2019 11:44:35 +0100	[thread overview]
Message-ID: <87ftrther0.fsf@nckx> (raw)

[-- Attachment #1: Type: text/plain, Size: 303 bytes --]

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


[-- Attachment #2: 0001-ui-Match-package-names-case-insensitively.patch --]
[-- Type: text/x-patch, Size: 3481 bytes --]

From 5876eb1fe6d412d7f2a556e0903cd2d87994ab9e Mon Sep 17 00:00:00 2001
From: Tobias Geerinckx-Rice <me@tobias.gr>
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 <roel@gnu.org>
 ;;; Copyright © 2016 Benz Schenk <benz.schenk@uzh.ch>
 ;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com>
+;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;;
 ;;; 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 <sahi@swecha.net>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;;
 ;;; 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


             reply	other threads:[~2019-03-11 10:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-11 10:44 Tobias Geerinckx-Rice [this message]
2019-03-15 22:11 ` [bug#34811] Make package name regexes case-insensitive Ludovic Courtès
2019-05-21 14:51   ` Ludovic Courtès
2020-11-30 22:10 ` bug#34811: " Tobias Geerinckx-Rice via Guix-patches via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ftrther0.fsf@nckx \
    --to=somebody@not-sent-or-endorsed-by.tobias.gr \
    --cc=34811@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.