summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2022-12-09 12:01:31 +0100
committerLudovic Courtès <ludo@gnu.org>2022-12-13 17:46:39 +0100
commitbbcd06e56c06376e640a7ac81a7109e7135a20f2 (patch)
treeec53b144f9a8f1a8f12b496065e62036efa271f4
parent052faadde70c44043d0db73bd254f664e1905ceb (diff)
ui: Take package upstream name into account when searching.
* guix/ui.scm (%package-metrics): Add PACKAGE-UPSTREAM-NAME*. * tests/ui.scm ("package-relevance and upstream name"): New test. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r--guix/ui.scm1
-rw-r--r--tests/ui.scm11
2 files changed, 11 insertions, 1 deletions
diff --git a/guix/ui.scm b/guix/ui.scm
index 45eccb73355..3bca3b1e401 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1668,6 +1668,7 @@ score, the more relevant OBJ is to REGEXPS."
1668 ;; Metrics used to compute the "relevance score" of a package against a set 1668 ;; Metrics used to compute the "relevance score" of a package against a set
1669 ;; of regexps. 1669 ;; of regexps.
1670 `((,package-name . 4) 1670 `((,package-name . 4)
1671 (,package-upstream-name* . 2)
1671 1672
1672 ;; Match against uncommon outputs. 1673 ;; Match against uncommon outputs.
1673 (,(lambda (package) 1674 (,(lambda (package)
diff --git a/tests/ui.scm b/tests/ui.scm
index 6a25a204ca8..438acae5252 100644
--- a/tests/ui.scm
+++ b/tests/ui.scm
@@ -1,5 +1,5 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2019, 2020 Ludovic Courtès <ludo@gnu.org> 2;;; Copyright © 2013-2017, 2019-2020, 2022 Ludovic Courtès <ludo@gnu.org>
3;;; Copyright © 2022 Taiju HIGASHI <higashi@taiju.info> 3;;; Copyright © 2022 Taiju HIGASHI <higashi@taiju.info>
4;;; 4;;;
5;;; This file is part of GNU Guix. 5;;; This file is part of GNU Guix.
@@ -294,6 +294,15 @@ Second line" 24))
294 (>0 (package-relevance libb2 294 (>0 (package-relevance libb2
295 (map rx '("crypto" "library"))))))) 295 (map rx '("crypto" "library")))))))
296 296
297(test-assert "package-relevance and upstream name"
298 ;; https://issues.guix.gnu.org/58136
299 (let ((ggplot2 (specification->package "r-ggplot2"))
300 (ggstance (specification->package "r-ggstance"))
301 (rx (make-regexp "ggplot2" regexp/icase)))
302 (> (package-relevance ggplot2 (list rx))
303 (package-relevance ggstance (list rx))
304 0)))
305
297(define (make-empty-file directory file) 306(define (make-empty-file directory file)
298 ;; Create FILE in DIRECTORY. 307 ;; Create FILE in DIRECTORY.
299 (close-port (open-output-file (in-vicinity directory file)))) 308 (close-port (open-output-file (in-vicinity directory file))))