summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRutherther <rutherther@ditigal.xyz>2025-10-14 17:02:31 +0200
committerLudovic Courtès <ludo@gnu.org>2025-10-23 19:35:08 +0200
commitbd2318ef0dc73f76cce942741255f5b566dd5f28 (patch)
tree0dfb974f999dd524316a7205b32cb22394e135c0
parent133910fd65363eb1fb26aeabb48fa07434ee83c5 (diff)
inferior: cached-channel-instances: Optimize caching for (partially) locked channels.
This makes it possible to skip the guix derivation calculation phase for channels.scm that aren't fully locked (specifically with missing channel dependencies). * guix/inferior.scm (cached-channel-instance): Return cached early after calculating latest-channel-instances. Change-Id: Ie77c1903c7a79b082e440046092fd697fd941afc Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r--guix/inferior.scm35
1 files changed, 19 insertions, 16 deletions
diff --git a/guix/inferior.scm b/guix/inferior.scm
index f23d35c9bab..89f017c6e86 100644
--- a/guix/inferior.scm
+++ b/guix/inferior.scm
@@ -975,23 +975,26 @@ X.509 host certificate; otherwise, warn about the problem and keep going."
validate-channels
#:verify-certificate?
verify-certificate?))
- (commits -> (map channel-instance-commit instances))
- (profile
- (channel-instances->derivation instances)))
- (mbegin %store-monad
- ;; It's up to the caller to install a build handler to report
- ;; what's going to be built.
- (built-derivations (list profile))
-
- ;; Cache if and only if AUTHENTICATE? is true.
- (if authenticate?
- (mbegin %store-monad
- (symlink* (derivation->output-path profile) (cached commits))
- (add-indirect-root* (cached commits))
- (return (cached commits)))
+ (commits -> (map channel-instance-commit instances)))
+ ;; Return early if cache is hit with filled channel dependencies.
+ (if (file-exists? (cached commits))
+ (return (cached commits))
+ (mlet* %store-monad ((profile
+ (channel-instances->derivation instances)))
(mbegin %store-monad
- (add-temp-root* (derivation->output-path profile))
- (return (derivation->output-path profile)))))))))
+ ;; It's up to the caller to install a build handler to report
+ ;; what's going to be built.
+ (built-derivations (list profile))
+
+ ;; Cache if and only if AUTHENTICATE? is true.
+ (if authenticate?
+ (mbegin %store-monad
+ (symlink* (derivation->output-path profile) (cached commits))
+ (add-indirect-root* (cached commits))
+ (return (cached commits)))
+ (mbegin %store-monad
+ (add-temp-root* (derivation->output-path profile))
+ (return (derivation->output-path profile)))))))))))
(define* (inferior-for-channels channels
#:key