From d9e6217f4e978777d1e6f7b82a1e096740cc419a Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 6 Jul 2019 15:54:45 +0200 Subject: 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'. --- guix/channels.scm | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-) (limited to 'guix/channels.scm') diff --git a/guix/channels.scm b/guix/channels.scm index e7278c6060..fcf9fed829 100644 --- a/guix/channels.scm +++ b/guix/channels.scm @@ -429,32 +429,27 @@ derivation." (define (channel-instances->manifest instances) "Return a profile manifest with entries for all of INSTANCES, a list of channel instances." - (define instance->entry - (match-lambda - ((instance drv) - (let ((commit (channel-instance-commit instance)) - (channel (channel-instance-channel instance))) - (with-monad %store-monad - (return (manifest-entry - (name (symbol->string (channel-name channel))) - (version (string-take commit 7)) - (item (if (guix-channel? channel) - (if (old-style-guix? drv) - (whole-package-for-legacy - (string-append name "-" version) - drv) - drv) - drv)) - (properties - `((source (repository - (version 0) - (url ,(channel-url channel)) - (branch ,(channel-branch channel)) - (commit ,commit)))))))))))) + (define (instance->entry instance drv) + (let ((commit (channel-instance-commit instance)) + (channel (channel-instance-channel instance))) + (manifest-entry + (name (symbol->string (channel-name channel))) + (version (string-take commit 7)) + (item (if (guix-channel? channel) + (if (old-style-guix? drv) + (whole-package-for-legacy (string-append name "-" version) + drv) + drv) + drv)) + (properties + `((source (repository + (version 0) + (url ,(channel-url channel)) + (branch ,(channel-branch channel)) + (commit ,commit)))))))) (mlet* %store-monad ((derivations (channel-instance-derivations instances)) - (entries (mapm %store-monad instance->entry - (zip instances derivations)))) + (entries -> (map instance->entry instances derivations))) (return (manifest entries)))) (define (package-cache-file manifest) -- cgit v1.2.3 From cdf689471a7f360efc798eb6e4dcdc4297d64043 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 8 Jul 2019 10:53:41 +0200 Subject: channels: Key cached channel derivations by system. Previously, the channel instance to derivation mapping would be independent of the system. Thus, building the same channel instance for several different systems would always return the derivation that was first computed. This is a followup to c3ab921eed2a471022e9863a94ea521508782e53. * guix/channels.scm (channel-instance-derivations)[instance->derivation]: Pass the current system as a third argument to 'mcached'. --- guix/channels.scm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'guix/channels.scm') diff --git a/guix/channels.scm b/guix/channels.scm index fcf9fed829..e6bb9b891b 100644 --- a/guix/channels.scm +++ b/guix/channels.scm @@ -349,13 +349,15 @@ INSTANCES." (resolve-dependencies instances)) (define (instance->derivation instance) - (mcached (if (eq? instance core-instance) - (build-channel-instance instance) - (mlet %store-monad ((core (instance->derivation core-instance)) - (deps (mapm %store-monad instance->derivation - (edges instance)))) - (build-channel-instance instance core deps))) - instance)) + (mlet %store-monad ((system (current-system))) + (mcached (if (eq? instance core-instance) + (build-channel-instance instance) + (mlet %store-monad ((core (instance->derivation core-instance)) + (deps (mapm %store-monad instance->derivation + (edges instance)))) + (build-channel-instance instance core deps))) + instance + system))) (unless core-instance (let ((loc (and=> (any (compose channel-location channel-instance-channel) -- cgit v1.2.3