all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#34811] Make package name regexes case-insensitive
@ 2019-03-11 10:44 Tobias Geerinckx-Rice
  2019-03-15 22:11 ` Ludovic Courtès
  2020-11-30 22:10 ` bug#34811: " Tobias Geerinckx-Rice via Guix-patches via
  0 siblings, 2 replies; 4+ messages in thread
From: Tobias Geerinckx-Rice @ 2019-03-11 10:44 UTC (permalink / raw)
  To: 34811

[-- 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-30 22:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-11 10:44 [bug#34811] Make package name regexes case-insensitive Tobias Geerinckx-Rice
2019-03-15 22:11 ` 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

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.