From 43578f3fbb7f184881ae4f1ca6b4cf3df8b67c11 Mon Sep 17 00:00:00 2001 From: Maxime Devos Date: Thu, 9 Sep 2021 18:59:41 +0200 Subject: [PATCH 04/10] store: Add compatibility fall-back for 'add-temp-root-and-valid-path?'. * guix/store.scm (add-temp-root-and-valid-path?): Rename to ... (add-temp-root-and-valid-path*?): ... this. (add-temp-root-and-valid-path?): New procedure. --- guix/store.scm | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/guix/store.scm b/guix/store.scm index c9f7b905b7..f2fb246fca 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2019, 2020 Mathieu Othacehe ;;; Copyright © 2020 Florian Pelz ;;; Copyright © 2020 Lars-Dominik Braun +;;; Copyright © 2021 Maxime Devos ;;; ;;; This file is part of GNU Guix. ;;; @@ -124,7 +125,7 @@ ensure-path find-roots add-temp-root - add-temp-root-and-valid-path? + (add-temp-root-and-valid-path*? . add-temp-root-and-valid-path?) add-indirect-root add-permanent-root remove-permanent-root @@ -1459,9 +1460,20 @@ Return #t." (define-operation (add-temp-root-and-valid-path? (store-path path)) "Make PATH a temporary root for the duration of the current session, -and test if PATH is a valid store path (see 'valid-path?')." +and test if PATH is a valid store path (see 'valid-path?'). This requires +a recent daemon version (#x164 or later); use 'add-temp-root-and-valid-path*?' +for compatibility." boolean) +(define (add-temp-root-and-valid-path*? store path) + "Make PATH a temporary root for the duration of the current session, +and test if PATH is a valid store path (see 'valid-path?')." + (if (>= (store-connection-minor-version store) #x64) + (add-temp-root-and-valid-path? store path) + (begin + (add-temp-root store path) + (valid-path? store path)))) + (define-operation (add-indirect-root (string file-name)) "Make the symlink FILE-NAME an indirect root for the garbage collector: whatever store item FILE-NAME points to will not be collected. Return #t on -- 2.33.0