channels: Simplify 'channel-instances->manifest'.

* guix/channels.scm (channel-instances->manifest)[instance->entry]:
Change to take two arguments instead of a tuple.  Turn into a
non-monadic procedure.
Call it via 'map' instead of 'mapm'.
This commit is contained in:
Ludovic Courtès 2019-07-06 15:54:45 +02:00
parent 403f2189aa
commit d9e6217f4e
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 19 additions and 24 deletions

View File

@ -429,19 +429,15 @@ derivation."
(define (channel-instances->manifest instances) (define (channel-instances->manifest instances)
"Return a profile manifest with entries for all of INSTANCES, a list of "Return a profile manifest with entries for all of INSTANCES, a list of
channel instances." channel instances."
(define instance->entry (define (instance->entry instance drv)
(match-lambda
((instance drv)
(let ((commit (channel-instance-commit instance)) (let ((commit (channel-instance-commit instance))
(channel (channel-instance-channel instance))) (channel (channel-instance-channel instance)))
(with-monad %store-monad (manifest-entry
(return (manifest-entry
(name (symbol->string (channel-name channel))) (name (symbol->string (channel-name channel)))
(version (string-take commit 7)) (version (string-take commit 7))
(item (if (guix-channel? channel) (item (if (guix-channel? channel)
(if (old-style-guix? drv) (if (old-style-guix? drv)
(whole-package-for-legacy (whole-package-for-legacy (string-append name "-" version)
(string-append name "-" version)
drv) drv)
drv) drv)
drv)) drv))
@ -450,11 +446,10 @@ channel instances."
(version 0) (version 0)
(url ,(channel-url channel)) (url ,(channel-url channel))
(branch ,(channel-branch channel)) (branch ,(channel-branch channel))
(commit ,commit)))))))))))) (commit ,commit))))))))
(mlet* %store-monad ((derivations (channel-instance-derivations instances)) (mlet* %store-monad ((derivations (channel-instance-derivations instances))
(entries (mapm %store-monad instance->entry (entries -> (map instance->entry instances derivations)))
(zip instances derivations))))
(return (manifest entries)))) (return (manifest entries))))
(define (package-cache-file manifest) (define (package-cache-file manifest)