me
/
guix
Archived
1
0
Fork 0

channels: 'latest-channel-instances' doesn't leak internal state.

* guix/channels.scm (latest-channel-instances): Remove
'previous-channels' argument.  Introduce 'loop' and use it.
master
Ludovic Courtès 2020-05-20 15:55:37 +02:00
parent c098c11be8
commit 9b049de84e
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 33 additions and 34 deletions

View File

@ -231,10 +231,9 @@ result is unspecified."
#:select? (negate dot-git?)))) #:select? (negate dot-git?))))
(channel-instance channel commit checkout)))) (channel-instance channel commit checkout))))
(define* (latest-channel-instances store channels #:optional (previous-channels '())) (define* (latest-channel-instances store channels)
"Return a list of channel instances corresponding to the latest checkouts of "Return a list of channel instances corresponding to the latest checkouts of
CHANNELS and the channels on which they depend. PREVIOUS-CHANNELS is a list CHANNELS and the channels on which they depend."
of previously processed channels."
;; Only process channels that are unique, or that are more specific than a ;; Only process channels that are unique, or that are more specific than a
;; previous channel specification. ;; previous channel specification.
(define (ignore? channel others) (define (ignore? channel others)
@ -245,6 +244,8 @@ of previously processed channels."
(not (or (channel-commit a) (not (or (channel-commit a)
(channel-commit b)))))))) (channel-commit b))))))))
(let loop ((channels channels)
(previous-channels '()))
;; Accumulate a list of instances. A list of processed channels is also ;; Accumulate a list of instances. A list of processed channels is also
;; accumulated to decide on duplicate channel specifications. ;; accumulated to decide on duplicate channel specifications.
(define-values (resulting-channels instances) (define-values (resulting-channels instances)
@ -258,9 +259,7 @@ of previously processed channels."
(channel-url channel)) (channel-url channel))
(let ((instance (latest-channel-instance store channel))) (let ((instance (latest-channel-instance store channel)))
(let-values (((new-instances new-channels) (let-values (((new-instances new-channels)
(latest-channel-instances (loop (channel-instance-dependencies instance)
store
(channel-instance-dependencies instance)
previous-channels))) previous-channels)))
(values (append (cons channel new-channels) (values (append (cons channel new-channels)
previous-channels) previous-channels)
@ -276,7 +275,7 @@ of previously processed channels."
(values (delete-duplicates instances (values (delete-duplicates instances
(lambda (a b) (lambda (a b)
(eq? (instance-name a) (instance-name b)))) (eq? (instance-name a) (instance-name b))))
resulting-channels))) resulting-channels))))
(define* (checkout->channel-instance checkout (define* (checkout->channel-instance checkout
#:key commit #:key commit