GNU bug report logs - #34811
Make package name regexes case-insensitive

Previous Next

Package: guix-patches;

Reported by: Tobias Geerinckx-Rice <somebody <at> not-sent-or-endorsed-by.tobias.gr>

Date: Mon, 11 Mar 2019 10:59:01 UTC

Severity: normal

Done: Tobias Geerinckx-Rice <me <at> tobias.gr>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 34811 in the body.
You can then email your comments to 34811 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#34811; Package guix-patches. (Mon, 11 Mar 2019 10:59:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tobias Geerinckx-Rice <somebody <at> not-sent-or-endorsed-by.tobias.gr>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 11 Mar 2019 10:59:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tobias Geerinckx-Rice <somebody <at> not-sent-or-endorsed-by.tobias.gr>
To: guix-patches <at> gnu.org
Subject: Make package name regexes case-insensitive
Date: Mon, 11 Mar 2019 11:44:35 +0100
[Message part 1 (text/plain, inline)]
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

[0001-ui-Match-package-names-case-insensitively.patch (text/x-patch, inline)]
From 5876eb1fe6d412d7f2a556e0903cd2d87994ab9e Mon Sep 17 00:00:00 2001
From: Tobias Geerinckx-Rice <me <at> 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 <at> gnu.org>
 ;;; Copyright © 2016 Benz Schenk <benz.schenk <at> uzh.ch>
 ;;; Copyright © 2016 Chris Marusich <cmmarusich <at> gmail.com>
+;;; Copyright © 2019 Tobias Geerinckx-Rice <me <at> 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 <at> swecha.net>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado <at> elephly.net>
+;;; Copyright © 2019 Tobias Geerinckx-Rice <me <at> 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


Information forwarded to guix-patches <at> gnu.org:
bug#34811; Package guix-patches. (Fri, 15 Mar 2019 22:12:02 GMT) Full text and rfc822 format available.

Message #8 received at 34811 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Tobias Geerinckx-Rice <somebody <at> not-sent-or-endorsed-by.tobias.gr>
Cc: 34811 <at> debbugs.gnu.org
Subject: Re: [bug#34811] Make package name regexes case-insensitive
Date: Fri, 15 Mar 2019 23:11:11 +0100
Hello!

Tobias Geerinckx-Rice <somebody <at> not-sent-or-endorsed-by.tobias.gr>
skribis:

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

Indeed.

>>From 5876eb1fe6d412d7f2a556e0903cd2d87994ab9e Mon Sep 17 00:00:00 2001
> From: Tobias Geerinckx-Rice <me <at> 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.

[...]

> -                   (make-regexp* (or regexp "")))
> +                   (make-package-name-regexp (or regexp "")))

I don’t think the abstraction brings much here; I’d prefer
‘regexp/icase’ to be inlined.  WDYT?

Otherwise LGTM, thanks!

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#34811; Package guix-patches. (Tue, 21 May 2019 14:52:03 GMT) Full text and rfc822 format available.

Message #11 received at 34811 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Tobias Geerinckx-Rice <somebody <at> not-sent-or-endorsed-by.tobias.gr>
Cc: 34811 <at> debbugs.gnu.org
Subject: Re: [bug#34811] Make package name regexes case-insensitive
Date: Tue, 21 May 2019 16:51:48 +0200
Ping!

Ludovic Courtès <ludo <at> gnu.org> skribis:

> Hello!
>
> Tobias Geerinckx-Rice <somebody <at> not-sent-or-endorsed-by.tobias.gr>
> skribis:
>
>> 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.
>
> Indeed.
>
>>>>From 5876eb1fe6d412d7f2a556e0903cd2d87994ab9e Mon Sep 17 00:00:00 2001
>> From: Tobias Geerinckx-Rice <me <at> 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.
>
> [...]
>
>> -                   (make-regexp* (or regexp "")))
>> +                   (make-package-name-regexp (or regexp "")))
>
> I don’t think the abstraction brings much here; I’d prefer
> ‘regexp/icase’ to be inlined.  WDYT?
>
> Otherwise LGTM, thanks!
>
> Ludo’.




Reply sent to Tobias Geerinckx-Rice <me <at> tobias.gr>:
You have taken responsibility. (Mon, 30 Nov 2020 22:11:01 GMT) Full text and rfc822 format available.

Notification sent to Tobias Geerinckx-Rice <somebody <at> not-sent-or-endorsed-by.tobias.gr>:
bug acknowledged by developer. (Mon, 30 Nov 2020 22:11:02 GMT) Full text and rfc822 format available.

Message #16 received at 34811-done <at> debbugs.gnu.org (full text, mbox):

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: 34811-done <at> debbugs.gnu.org
Subject: Make package name regexes case-insensitive
Date: Mon, 30 Nov 2020 23:10:51 +0100
[Message part 1 (text/plain, inline)]
Done & forgotten as commit 
b56d160944ace6e06fcfe5a36310c98e6a213b87.

Closing now,

T G-R
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 29 Dec 2020 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 119 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.