From: "Ludovic Courtès" <ludo@gnu.org>
To: 56618@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#56618] [PATCH 2/2] guix gc: '--delete-generations' now deletes old Home generations.
Date: Sun, 17 Jul 2022 17:21:17 +0200 [thread overview]
Message-ID: <20220717152117.23452-2-ludo@gnu.org> (raw)
In-Reply-To: <20220717152117.23452-1-ludo@gnu.org>
Previously, 'guix gc -d4m' would ignore Home generations. With this
change, they are treated like profiles and generations that match the
pattern are deleted.
* guix/scripts/gc.scm (guix-gc)[delete-generations]: Add call to
'home-generation-base'.
* doc/guix.texi (Invoking guix gc): Document the change.
---
doc/guix.texi | 3 ++-
guix/scripts/gc.scm | 6 ++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 8fc8f53d0e..f3f3189f64 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4362,7 +4362,8 @@ nothing and exit immediately.
@item --delete-generations[=@var{duration}]
@itemx -d [@var{duration}]
Before starting the garbage collection process, delete all the generations
-older than @var{duration}, for all the user profiles; when run as root, this
+older than @var{duration}, for all the user profiles and home environment
+generations; when run as root, this
applies to all the profiles @emph{of all the users}.
For example, this command deletes all the generations of all your profiles
diff --git a/guix/scripts/gc.scm b/guix/scripts/gc.scm
index 043273f491..65cd4bdf8b 100644
--- a/guix/scripts/gc.scm
+++ b/guix/scripts/gc.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012-2013, 2015-2020, 2022 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -26,6 +26,7 @@ (define-module (guix scripts gc)
profile-generations
generation-number)
#:autoload (guix scripts package) (delete-generations)
+ #:autoload (gnu home) (home-generation-base)
#:use-module (ice-9 match)
#:use-module (ice-9 regex)
#:use-module (srfi srfi-1)
@@ -260,7 +261,8 @@ (define (delete-generations store pattern)
(filter-map (lambda (root)
(and (or (zero? (getuid))
(user-owned? root))
- (generation-profile root)))
+ (or (generation-profile root)
+ (home-generation-base root))))
(gc-roots)))))
(for-each (lambda (profile)
(delete-old-generations store profile pattern))
--
2.36.1
next prev parent reply other threads:[~2022-07-17 15:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-17 15:19 [bug#56618] [PATCH 0/2] Let 'guix gc -d' delete old Home generations Ludovic Courtès
2022-07-17 15:21 ` [bug#56618] [PATCH 1/2] home: Add 'home-generation-base' Ludovic Courtès
2022-07-17 15:21 ` Ludovic Courtès [this message]
2022-07-18 12:51 ` Andrew Tropin
2022-07-19 8:01 ` Ludovic Courtès
2022-07-18 12:59 ` [bug#56618] [PATCH 0/2] Let 'guix gc -d' delete old Home generations Andrew Tropin
2022-07-19 8:28 ` Ludovic Courtès
2022-07-19 9:46 ` Andrew Tropin
2022-07-21 9:07 ` Ludovic Courtès
2022-07-21 20:10 ` Maxim Cournoyer
2022-07-22 12:20 ` Ludovic Courtès
2022-07-25 2:04 ` Maxim Cournoyer
2022-08-01 12:39 ` Ludovic Courtès
2022-07-22 22:42 ` bug#56618: " 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220717152117.23452-2-ludo@gnu.org \
--to=ludo@gnu.org \
--cc=56618@debbugs.gnu.org \
/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 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.