packages: Reintroduce 'find-newest-available-packages'.
This is a followup to e2a903c807
.
* gnu/packages.scm (find-newest-available-packages): New procedure.
This commit is contained in:
parent
e8cfce439a
commit
f2bf0407de
|
@ -32,6 +32,7 @@
|
||||||
mkdir-p))
|
mkdir-p))
|
||||||
#:autoload (guix profiles) (packages->manifest)
|
#:autoload (guix profiles) (packages->manifest)
|
||||||
#:use-module (guix describe)
|
#:use-module (guix describe)
|
||||||
|
#:use-module (guix deprecation)
|
||||||
#:use-module (ice-9 vlist)
|
#:use-module (ice-9 vlist)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:autoload (ice-9 binary-ports) (put-bytevector)
|
#:autoload (ice-9 binary-ports) (put-bytevector)
|
||||||
|
@ -55,6 +56,7 @@
|
||||||
fold-packages
|
fold-packages
|
||||||
fold-available-packages
|
fold-available-packages
|
||||||
|
|
||||||
|
find-newest-available-packages
|
||||||
find-packages-by-name
|
find-packages-by-name
|
||||||
find-package-locations
|
find-package-locations
|
||||||
find-best-packages-by-name
|
find-best-packages-by-name
|
||||||
|
@ -186,6 +188,29 @@ flags."
|
||||||
directory))
|
directory))
|
||||||
%load-path)))
|
%load-path)))
|
||||||
|
|
||||||
|
;; This procedure is used by Emacs-Guix up to 0.5.1.1, so keep it for now.
|
||||||
|
;; See <https://github.com/alezost/guix.el/issues/30>.
|
||||||
|
(define-deprecated find-newest-available-packages
|
||||||
|
find-packages-by-name
|
||||||
|
(mlambda ()
|
||||||
|
"Return a vhash keyed by package names, and with
|
||||||
|
associated values of the form
|
||||||
|
|
||||||
|
(newest-version newest-package ...)
|
||||||
|
|
||||||
|
where the preferred package is listed first."
|
||||||
|
(fold-packages (lambda (p r)
|
||||||
|
(let ((name (package-name p))
|
||||||
|
(version (package-version p)))
|
||||||
|
(match (vhash-assoc name r)
|
||||||
|
((_ newest-so-far . pkgs)
|
||||||
|
(case (version-compare version newest-so-far)
|
||||||
|
((>) (vhash-cons name `(,version ,p) r))
|
||||||
|
((=) (vhash-cons name `(,version ,p ,@pkgs) r))
|
||||||
|
((<) r)))
|
||||||
|
(#f (vhash-cons name `(,version ,p) r)))))
|
||||||
|
vlist-null)))
|
||||||
|
|
||||||
(define (fold-available-packages proc init)
|
(define (fold-available-packages proc init)
|
||||||
"Fold PROC over the list of available packages. For each available package,
|
"Fold PROC over the list of available packages. For each available package,
|
||||||
PROC is called along these lines:
|
PROC is called along these lines:
|
||||||
|
|
Loading…
Reference in New Issue