From bbcd06e56c06376e640a7ac81a7109e7135a20f2 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Fri, 9 Dec 2022 12:01:31 +0100 Subject: [PATCH] ui: Take package upstream name into account when searching. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- guix/ui.scm | 1 + tests/ui.scm | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/guix/ui.scm b/guix/ui.scm index 45eccb7335..3bca3b1e40 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -1668,6 +1668,7 @@ score, the more relevant OBJ is to REGEXPS." ;; Metrics used to compute the "relevance score" of a package against a set ;; of regexps. `((,package-name . 4) + (,package-upstream-name* . 2) ;; Match against uncommon outputs. (,(lambda (package) 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 +;;; Copyright © 2013-2017, 2019-2020, 2022 Ludovic Courtès ;;; Copyright © 2022 Taiju HIGASHI ;;; ;;; This file is part of GNU Guix. @@ -294,6 +294,15 @@ Second line" 24)) (>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))))