unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Tobias Geerinckx-Rice via Guix-patches via <guix-patches@gnu.org>
To: 52805@debbugs.gnu.org
Subject: [bug#52805] [PATCH] substitute: Add a ‘--clear-cache’ option.
Date: Sun, 26 Dec 2021 17:21:26 +0100	[thread overview]
Message-ID: <20211226162126.23749-1-me@tobias.gr> (raw)

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





             reply	other threads:[~2021-12-26 16:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-26 16:21 Tobias Geerinckx-Rice via Guix-patches via [this message]
2021-12-27 21:12 ` [bug#52805] [PATCH] substitute: Add a ‘--clear-cache’ option 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211226162126.23749-1-me@tobias.gr \
    --to=guix-patches@gnu.org \
    --cc=52805@debbugs.gnu.org \
    --cc=me@tobias.gr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).