[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#39258] [PATCH v3 3/3] guix: Use package metadata cache for package
From: |
Ludovic Courtès |
Subject: |
[bug#39258] [PATCH v3 3/3] guix: Use package metadata cache for package search. |
Date: |
Fri, 24 Apr 2020 23:03:10 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Hello,
Arun Isaac <address@hidden> skribis:
> * guix/scripts/package.scm (process-query): Call search-packages and
> display-package-search-results instead of find-packages-by-description and
> display-search-results respectively.
> * guix/ui.scm (package-metadata->recutils): New function.
> (%package-metrics): Use package-metadata record field accessors.
> (package-relevance): Rename argument package to package-metadata.
> (display-package-search-results): New function.
[...]
> +(define* (package-metadata->recutils p port #:optional (width (%text-width))
> + #:key
> + (hyperlinks? (supports-hyperlinks?
> port))
> + (extra-fields '()))
> + "Write to PORT a `recutils' record of <package-metadata> object P,
> arranging
> +to fit within WIDTH columns. EXTRA-FIELDS is a list of symbol/value pairs to
> +emit. When HYPERLINKS? is true, emit hyperlink escape sequences when
> +appropriate."
I think we should avoid copy/paste of ‘package->recutils’.
How about factorizing by having a common procedure that takes the fields
as keyword arguments instead of taking a record?
> (define %package-metrics
> ;; Metrics used to compute the "relevance score" of a package against a set
> ;; of regexps.
> - `((,package-name . 4)
> + `((,package-metadata-name . 4)
Here we would also need to arrange so that this can apply to both a
<package> and <package-metadata> (or whatever), perhaps by defining the
two sets of metrics at once, or defining the second one by mapping over
the first one.
Thanks,
Ludo’.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug#39258] [PATCH v3 3/3] guix: Use package metadata cache for package search.,
Ludovic Courtès <=