diff mbox series

bug#58136: [PATCH] ui: Improve sort order when searching package names.

Message ID 87fsdjwhyd.fsf@gnu.org
State New
Headers show
Series bug#58136: [PATCH] ui: Improve sort order when searching package names. | expand

Commit Message

Ludovic Courtès Dec. 13, 2022, 1:28 p.m. UTC
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’.
and:

Comments

Lars-Dominik Braun Dec. 13, 2022, 2:53 p.m. UTC | #1
Hi Ludo,

> Applied with the minor changes below, thank you!
thank you!

> +(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)))
I was hesitant to add a system test, which depends on real package
descriptions (not synthetic ones), because at some point it *will* break.

Cheers,
Lars
Ludovic Courtès Dec. 13, 2022, 4:40 p.m. UTC | #2
Hi,

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

>> Applied with the minor changes below, thank you!
> thank you!
>
>> +(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)))
> I was hesitant to add a system test, which depends on real package
> descriptions (not synthetic ones), because at some point it *will* break.

Yes, that’s a tradeoff.  For now, I would think the test is a plus as it
will allow us to see if future tweaks break this use case but yeah, on
the day it breaks, we’ll have to rewrite it or to drop it.

Ludo’.
diff mbox series

Patch

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