summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-02-12 22:51:23 +0100
committerLudovic Courtès <ludo@gnu.org>2019-02-12 23:30:16 +0100
commit201253674bca6a1bf5d45e2af46fbb5c34f060bf (patch)
treeb2419a01f33065ac6b9a20235e31ff01d053f093 /guix
parentcf0eacceb46492515431fec6bcf25b750b7d402d (diff)
pull: Speed up the new/upgraded package computation.
* guix/scripts/pull.scm (new/upgraded-packages): OLD no longer stores all the versions of each package. Remove 'vhash-fold*' call and reduce the number of 'version>?' calls when computing UPGRADED.
Diffstat (limited to 'guix')
-rw-r--r--guix/scripts/pull.scm17
1 files changed, 11 insertions, 6 deletions
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 408ff91978..730b6a0bf2 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -353,7 +353,13 @@ pairs, and return two values: the list of packages new in ALIST2, and the list
of packages upgraded in ALIST2."
(let* ((old (fold (match-lambda*
(((name . version) table)
- (vhash-cons name version table)))
+ (match (vhash-assoc name table)
+ (#f
+ (vhash-cons name version table))
+ ((_ . previous-version)
+ (if (version>? version previous-version)
+ (vhash-cons name version table)
+ table)))))
vlist-null
alist1))
(new (remove (match-lambda
@@ -362,11 +368,10 @@ of packages upgraded in ALIST2."
alist2))
(upgraded (filter-map (match-lambda
((name . new-version)
- (match (vhash-fold* cons '() name old)
- (() #f)
- ((= (cut sort <> version>?) old-versions)
- (and (version>? new-version
- (first old-versions))
+ (match (vhash-assoc name old)
+ (#f #f)
+ ((_ . old-version)
+ (and (version>? new-version old-version)
(string-append name "@"
new-version))))))
alist2)))