all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#52805] [PATCH] substitute: Add a ‘--clear-cache’ option.
@ 2021-12-26 16:21 Tobias Geerinckx-Rice via Guix-patches via
  2021-12-27 21:12 ` Mathieu Othacehe
  0 siblings, 1 reply; 9+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2021-12-26 16:21 UTC (permalink / raw)
  To: 52805

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





^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-01-12 21:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-26 16:21 [bug#52805] [PATCH] substitute: Add a ‘--clear-cache’ option Tobias Geerinckx-Rice via Guix-patches via
2021-12-27 21:12 ` Mathieu Othacehe
2021-12-27 21:20   ` Tobias Geerinckx-Rice via Guix-patches via
2021-12-29 16:49     ` zimoun
2022-01-05 20:59     ` Ludovic Courtès
2022-01-05 22:41       ` Tobias Geerinckx-Rice via Guix-patches via
2022-01-11 12:47         ` Ludovic Courtès
2022-01-11 18:00           ` Tobias Geerinckx-Rice via Guix-patches via
2022-01-12 21:04             ` Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.