From 7df3ab0f0d21e6414a22b113c832dc18475f34a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 21 Jan 2021 16:06:10 +0100 Subject: store: Add 'find-roots' RPC. * guix/serialization.scm (read-string-pairs): New procedure. * guix/store.scm (read-arg): Add support for 'string-pairs'. (find-roots): New procedure. * tests/store.scm ("add-indirect-root and find-roots"): New test. --- guix/store.scm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'guix/store.scm') diff --git a/guix/store.scm b/guix/store.scm index 4da39971b5..e0b15abce3 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès +;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès ;;; Copyright © 2018 Jan Nieuwenhuizen ;;; Copyright © 2019, 2020 Mathieu Othacehe ;;; Copyright © 2020 Florian Pelz @@ -114,6 +114,7 @@ query-failed-paths clear-failed-paths ensure-path + find-roots add-temp-root add-indirect-root add-permanent-root @@ -340,7 +341,8 @@ (write-string (bytevector->base16-string arg) p)))) (define-syntax read-arg - (syntax-rules (integer boolean string store-path store-path-list string-list + (syntax-rules (integer boolean string store-path + store-path-list string-list string-pairs substitutable-path-list path-info base16) ((_ integer p) (read-int p)) @@ -354,6 +356,8 @@ (read-store-path-list p)) ((_ string-list p) (read-string-list p)) + ((_ string-pairs p) + (read-string-pairs p)) ((_ substitutable-path-list p) (read-substitutable-path-list p)) ((_ path-info p) @@ -1404,6 +1408,15 @@ running a substitute. As a GC root is not created by the daemon, you may want to call ADD-TEMP-ROOT on that store path." boolean) +(define-operation (find-roots) + "Return a list of root/target pairs: for each pair, the first element is the +GC root file name and the second element is its target in the store. + +When talking to a local daemon, this operation is equivalent to the 'gc-roots' +procedure in (guix store roots), except that the 'find-roots' excludes +potential roots that do not point to store items." + string-pairs) + (define-operation (add-temp-root (store-path path)) "Make PATH a temporary root for the duration of the current session. Return #t." -- cgit v1.2.3