[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#52805] [PATCH] substitute: Add a ‘--clear-cache’ option.
From: |
Tobias Geerinckx-Rice |
Subject: |
[bug#52805] [PATCH] substitute: Add a ‘--clear-cache’ option. |
Date: |
Sun, 26 Dec 2021 17:21:26 +0100 |
Unlike ‘rm -rf ~/.cache/guix/substitute’ this respects XDG_CACHE_HOME.
Use the --OPTION form for consistency with the existing ‘guix substitute’
interface, where other guix subcommands would prefer an ACTION. This
subcommand really supports only one OPTION at a time, anyway.
* guix/scripts/substitute.scm (guix-substitute):
Add a new ‘--clear-cache’ option argument.
(show-help): Document it.
---
guix/scripts/substitute.scm | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index c044e1d47a..1e71b4848b 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2014 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2018 Kyle Meyer <kyle@kyleam.com>
;;; Copyright © 2020 Christopher Baines <mail@cbaines.net>
+;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -40,7 +41,7 @@ (define-module (guix scripts substitute)
#:use-module (guix cache)
#:use-module (gcrypt pk-crypto)
#:use-module (guix pki)
- #:use-module ((guix build utils) #:select (mkdir-p))
+ #:use-module ((guix build utils) #:select (delete-file-recursively mkdir-p))
#:use-module ((guix build download)
#:select (uri-abbreviation nar-uri-abbreviation
(open-connection-for-uri
@@ -239,6 +240,8 @@ (define-syntax with-networking
(define (show-help)
(display (G_ "Usage: guix substitute [OPTION]...
Internal tool to substitute a pre-built binary to a local build.\n"))
+ (display (G_ "
+ --clear-cache forget previously cached availability information"))
(display (G_ "
--query report on the availability of substitutes for the
store file names passed on the standard input"))
@@ -749,6 +752,10 @@ (define reply-port
(with-networking
(with-error-handling ; for signature errors
(match args
+ (("--clear-cache")
+ ;; This is meant to be a big hammer, so don't pussyfoot around with
+ ;; maybe-remove-expired-cache-entries.
+ (delete-file-recursively %narinfo-cache-directory))
(("--query")
(let ((acl (current-acl)))
(let loop ((command (read-line)))
--
2.34.0
- [bug#52805] [PATCH] substitute: Add a ‘--clear-cache’ option.,
Tobias Geerinckx-Rice <=