[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#39258] [PATCH v3 2/3] guix: Search package metadata cache.
From: |
Ludovic Courtès |
Subject: |
[bug#39258] [PATCH v3 2/3] guix: Search package metadata cache. |
Date: |
Fri, 24 Apr 2020 22:58:30 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Arun Isaac <address@hidden> skribis:
> * gnu/packages.scm (search-packages): New function.
> * guix/packages.scm (<package-metadata>): New record type.
[...]
> +(define (search-packages profile regexps)
> + "Return a list of pairs: <package-metadata> objects corresponding to
> +packages whose name, synopsis, description, or output matches at least one of
> +REGEXPS sorted by relevance, and its non-zero relevance score."
> + (define cache-file
> + (string-append profile %package-metadata-cache-file))
Here we’re missing something that checks if the cache is authoritative
and falls back to the old method if it’s not, akin to what
‘fold-available-packages’ does.
> + (define cache
> + (catch 'system-error
> + (lambda ()
> + (map (match-lambda
> + (#(name version dependencies outputs systems
> + synopsis description home-page (file line column))
> + (make-package-metadata
> + name version dependencies outputs systems
> + synopsis description home-page
> + (location file line column))))
> + (load-compiled cache-file)))
I realize the other cache also has that problem, but it would be nice to
add a version tag to the cache. Basically emit something like:
(package-metadata-cache (version 0) VECTOR …)
instead of just:
(VECTOR …)
> +(define-record-type* <package-metadata>
> + package-metadata make-package-metadata
> + package-metadata?
> + this-package-metadata
> + (name package-metadata-name)
> + (version package-metadata-version)
> + (dependencies package-metadata-dependencies)
> + (outputs package-metadata-outputs)
> + (supported-systems package-metadata-supported-systems)
> + (synopsis package-metadata-synopsis)
> + (description package-metadata-description)
> + ;; TODO: Add license
> + ;; (license package-metadata-license)
> + (home-page package-metadata-home-page)
> + (location package-metadata-location))
I’m not comfortable with this data structure duplication, especially
right in (guix packages, but I’m not sure it’s avoidable.
‘fold-available-packages’ avoids it by passing all the fields as
arguments to the fold procedure, I’m not sure if it’s applicable here.
Thanks,
Ludo’.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug#39258] [PATCH v3 2/3] guix: Search package metadata cache.,
Ludovic Courtès <=