unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Lars-Dominik Braun <lars@6xq.net>
Cc: 58136-done@debbugs.gnu.org, zimoun <zimon.toutoune@gmail.com>
Subject: bug#58136: [PATCH] ui: Improve sort order when searching package names.
Date: Tue, 13 Dec 2022 14:28:58 +0100	[thread overview]
Message-ID: <87fsdjwhyd.fsf@gnu.org> (raw)
In-Reply-To: <Y5MgzLjZGb49LVa4@noor.fritz.box> (Lars-Dominik Braun's message of "Fri, 9 Dec 2022 12:49:32 +0100")

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

Hi,

Lars-Dominik Braun <lars@6xq.net> skribis:

> From e0092d786b29f4f1cdc35217212a86804f36cdb4 Mon Sep 17 00:00:00 2001
> From: Lars-Dominik Braun <lars@6xq.net>
> Date: Fri, 9 Dec 2022 11:46:37 +0100
> Subject: [PATCH v2 1/2] packages: Add 'package-upstream-name*'.
>
> * guix/packages.scm (package-upstream-name*): New procedure.
> * tests/packages.scm ("package-upstream-name*"): New test.

[...]

> From 5e0e8c0145a728d0ed49116596f06cc15e1e865d Mon Sep 17 00:00:00 2001
> From: Lars-Dominik Braun <lars@6xq.net>
> Date: Fri, 9 Dec 2022 12:01:31 +0100
> Subject: [PATCH v2 2/2] ui: Take package upstream name into account when
>  searching.
>
> * guix/ui.scm (%package-metrics): Add PACKAGE-UPSTREAM-NAME*.

Applied with the minor changes below, thank you!

Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 707 bytes --]

diff --git a/guix/packages.scm b/guix/packages.scm
index 5e8e3a4ff4..6e61e16aa4 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -718,11 +718,11 @@ (define (package-upstream-name* package)
     (or (assq-ref (package-properties package) 'upstream-name)
         (let loop ((prefixes namespaces))
           (match prefixes
-            ('() name)
+            (() name)
             ((prefix rest ...)
               (if (string-prefix? prefix name)
                 (substring name (string-length prefix))
-                (loop (cdr prefixes)))))))))
+                (loop rest))))))))
 
 (define (hidden-package p)
   "Return a \"hidden\" version of P--i.e., one that 'fold-packages' and thus,

[-- Attachment #3: Type: text/plain, Size: 7 bytes --]


and:


[-- Attachment #4: Type: text/x-patch, Size: 1144 bytes --]

diff --git a/tests/ui.scm b/tests/ui.scm
index 6a25a204ca..438acae525 100644
--- a/tests/ui.scm
+++ b/tests/ui.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013-2017, 2019-2020, 2022 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2022 Taiju HIGASHI <higashi@taiju.info>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -294,6 +294,15 @@ (define guile-2.0.9
          (>0 (package-relevance libb2
                                 (map rx '("crypto" "library")))))))
 
+(test-assert "package-relevance and upstream name"
+  ;; https://issues.guix.gnu.org/58136
+  (let ((ggplot2  (specification->package "r-ggplot2"))
+        (ggstance (specification->package "r-ggstance"))
+        (rx       (make-regexp "ggplot2" regexp/icase)))
+    (> (package-relevance ggplot2 (list rx))
+       (package-relevance ggstance (list rx))
+       0)))
+
 (define (make-empty-file directory file)
   ;; Create FILE in DIRECTORY.
   (close-port (open-output-file (in-vicinity directory file))))

  reply	other threads:[~2022-12-13 13:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28  9:27 [bug#58136] [PATCH] ui: Improve sort order when searching package names Lars-Dominik Braun
2022-09-28 14:26 ` zimoun
2022-09-28 20:23   ` Maxime Devos
2022-09-28 20:45     ` Maxime Devos
2022-09-28 21:40     ` zimoun
2022-09-28 21:43       ` Maxime Devos
2022-10-01 21:42   ` Ludovic Courtès
2022-10-02  8:26     ` zimoun
2022-10-12 11:24   ` Lars-Dominik Braun
2022-10-17  7:46     ` Ludovic Courtès
2022-10-17  8:19       ` zimoun
2022-12-09 11:49 ` Lars-Dominik Braun
2022-12-13 13:28   ` Ludovic Courtès [this message]
2022-12-13 14:53     ` Lars-Dominik Braun
2022-12-13 16:40       ` Ludovic Courtès

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=87fsdjwhyd.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=58136-done@debbugs.gnu.org \
    --cc=lars@6xq.net \
    --cc=zimon.toutoune@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).