diff options
author | zimoun <zimon.toutoune@gmail.com> | 2020-05-03 17:01:53 +0200 |
---|---|---|
committer | Guix Patches Tester <> | 2020-05-03 16:06:10 +0100 |
commit | b333c77da7fb4dae4059d0acdddd5938128d0c2e (patch) | |
tree | c4135e0cf7acdba80e2dc8f723daabab43339776 /gnu/packages.scm | |
parent | 2f56e3e67d7f2744c5eca39cb87adb9c77271110 (diff) | |
download | guix-patches-b333c77da7fb4dae4059d0acdddd5938128d0c2e.tar guix-patches-b333c77da7fb4dae4059d0acdddd5938128d0c2e.tar.gz |
DRAFT packages: Add new procedure 'fold-packages*'.
Diffstat (limited to 'gnu/packages.scm')
-rw-r--r-- | gnu/packages.scm | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/gnu/packages.scm b/gnu/packages.scm index fa18f81487..a0c5835b8b 100644 --- a/gnu/packages.scm +++ b/gnu/packages.scm @@ -55,6 +55,7 @@ fold-packages fold-available-packages + fold-packages* find-newest-available-packages find-packages-by-name @@ -253,6 +254,52 @@ is guaranteed to never traverse the same package twice." init modules)) +(define (fold-packages* proc init) + "Fold (PROC PACKAGE RESULT) over the list of available packages. When a +package cache is available, this procedure does not actually load any package +module. Moreover when package cache is available, this procedure +re-constructs a new package skipping some package record field. The usage of +this procedure is User Interface (ui) only." + (define cache + (load-package-cache (current-profile))) + + (define license (@@ (guix licenses) license)) + + (if (and cache (cache-is-authoritative?)) + (vhash-fold (lambda (name vector result) + (match vector + (#(name version module symbol outputs + supported? deprecated? + file line column + synopsis description home-page + build-system-name build-system-description + supported-systems direct-inputs + license-name license-uri license-comment) + (proc (package + (name name) + (version version) + (source #f) ;TODO: ? + (build-system + (build-system + (name (string->symbol build-system-name)) + (description build-system-description) + (lower #f))) ; never used by ui + (inputs ; list of "full-name@version" + (list 'cache direct-inputs)) + (outputs outputs) + (synopsis synopsis) + (description description) + (license (license + license-name license-uri license-comment)) + (home-page home-page) + (supported-systems (list 'cache supported-systems)) + (location (location + file line column))) + result)))) + init + cache) + (fold-packages proc init))) + (define %package-cache-file ;; Location of the package cache. "/lib/guix/package.cache") |