guix gc: '--delete-generations' now deletes old Home generations.

This reverts commit 24c0518dd4,
thereby reinstating ba22560627, with an
additional fix in (guix self).

Fixes <https://issues.guix.gnu.org/56722>.
Reported by "(" <paren@disroot.org>.

* guix/scripts/gc.scm (guix-gc)[delete-generations]: Add call to
'home-generation-base'.
* guix/self.scm (compiled-guix)[*core-cli-modules*]: Remove (guix
scripts gc).
* doc/guix.texi (Invoking guix gc): Document the change.
This commit is contained in:
Ludovic Courtès 2022-07-31 23:03:36 +02:00
parent 61db74a687
commit 4de445f3da
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
3 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -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 @@
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 @@ is deprecated; use '-D'~%"))
(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))

View File

@ -929,6 +929,7 @@ itself."
(('guix 'scripts 'deploy) #t)
(('guix 'scripts 'home . _) #t)
(('guix 'scripts 'import . _) #t)
(('guix 'scripts 'gc) #t) ;autoloads (gnu home)
(('guix 'pack) #t)
(_ #f))
(scheme-modules* source "guix/scripts"))