Subject: bug#34811: closed (Make package name regexes case-insensitive)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 30 Nov 2020 22:11:02 +0000

Your bug report

#34811: Make package name regexes case-insensitive

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
34811: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=34811
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Make package name regexes case-insensitive
From: Tobias Geerinckx-Rice <[email-masked]>
To: [email-masked]
Date: Mon, 30 Nov 2020 23:10:51 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Done & forgotten as commit 
b56d160944ace6e06fcfe5a36310c98e6a213b87.

Closing now,

T G-R

Subject: Make package name regexes case-insensitive
From: Tobias Geerinckx-Rice <[email-masked]>
To: [email-masked]
Date: Mon, 11 Mar 2019 11:44:35 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

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 <[email-masked]>
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 <[email-masked]>
 ;;; Copyright © 2016 Benz Schenk <[email-masked]>
 ;;; Copyright © 2016 Chris Marusich <[email-masked]>
+;;; Copyright © 2019 Tobias Geerinckx-Rice <[email-masked]>
 ;;;
 ;;; 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 <[email-masked]>
 ;;; Copyright © 2018 Ricardo Wurmus <[email-masked]>
+;;; Copyright © 2019 Tobias Geerinckx-Rice <[email-masked]>
 ;;;
 ;;; 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