civodul pushed a commit to branch master
in repository guix-artwork.
commit 422b0d70e0d96953f0dbe8c04d7d3129e7a45763
Author: Ludovic Courtès <[email protected]>
Date: Wed Dec 6 14:19:07 2017 +0100
website: packages: 'all-packages' memoizes its result.
* website/apps/packages/data.scm (%package-list): New variable.
(all-packages): Use it.
---
website/apps/packages/data.scm | 34 +++++++++++++++++++---------------
1 file changed, 19 insertions(+), 15 deletions(-)
diff --git a/website/apps/packages/data.scm b/website/apps/packages/data.scm
index 424701a..148ec3d 100644
--- a/website/apps/packages/data.scm
+++ b/website/apps/packages/data.scm
@@ -34,23 +34,27 @@
"N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z"))
+(define %package-list
+ (delay
+ ;; Note: Dismiss packages found in $GUIX_PACKAGE_PATH.
+ (let ((packages
+ (sort (parameterize ((%package-module-path (last-pair
+
(%package-module-path))))
+ (fold-packages (lambda (package lst)
+ (cons (or (package-replacement package)
+ package)
+ lst))
+ '()))
+ (lambda (p1 p2)
+ (string<? (package-name p1)
+ (package-name p2))))))
+ (cond ((null? packages) '())
+ ((getenv "GUIX_WEB_SITE_LOCAL") (list-head packages 300))
+ (else packages)))))
+
(define (all-packages)
"Return the list of all Guix package objects, sorted by name.
If GUIX_WEB_SITE_LOCAL=yes, return only 300 packages for
testing the website."
- ;; Note: Dismiss packages found in $GUIX_PACKAGE_PATH.
- (let ((packages
- (sort (parameterize ((%package-module-path (last-pair
- (%package-module-path))))
- (fold-packages (lambda (package lst)
- (cons (or (package-replacement package)
- package)
- lst))
- '()))
- (lambda (p1 p2)
- (string<? (package-name p1)
- (package-name p2))))))
- (cond ((null? packages) '())
- ((getenv "GUIX_WEB_SITE_LOCAL") (list-head packages 300))
- (else packages))))
+ (force %package-list))