From unknown Fri Sep 19 16:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#35176] [PATCH 0/5] 'guix gc --delete-generations' and '--list-roots' Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 06 Apr 2019 21:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 35176 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 35176@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.155458603619560 (code B ref -1); Sat, 06 Apr 2019 21:28:02 +0000 Received: (at submit) by debbugs.gnu.org; 6 Apr 2019 21:27:16 +0000 Received: from localhost ([127.0.0.1]:47512 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hCsqK-00055Q-B4 for submit@debbugs.gnu.org; Sat, 06 Apr 2019 17:27:16 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50001) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hCsqJ-00055F-BG for submit@debbugs.gnu.org; Sat, 06 Apr 2019 17:27:15 -0400 Received: from lists.gnu.org ([209.51.188.17]:41271) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hCsqE-0001LO-6u for submit@debbugs.gnu.org; Sat, 06 Apr 2019 17:27:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hCsqA-0005LO-CQ for guix-patches@gnu.org; Sat, 06 Apr 2019 17:27:10 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46294) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hCsqA-0001HX-7S; Sat, 06 Apr 2019 17:27:06 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=50418 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hCsq9-0000Z1-J7; Sat, 06 Apr 2019 17:27:06 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Sat, 6 Apr 2019 23:26:56 +0200 Message-Id: <20190406212656.27025-1-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello Guix! This patch series is mostly about making it easier to free space: ‘guix gc --delete-generations’ deletes old generations of all the user’s profiles prior to collecting garbage. For consistency, ‘--delete-generations’ is aliased with ‘-d’, so ‘-d’ is repurposed (until now it was an alias for ‘--delete’). Thoughts? Ludo’. Ludovic Courtès (5): Add (guix store roots). guix gc: Add '--list-roots'. profiles: Add 'generation-profile'. guix gc: Add '--delete-generations'. scripts: GC hint suggests 'guix gc -d 1m'. Makefile.am | 6 ++- doc/guix.texi | 22 +++++++- guix/profiles.scm | 15 ++++++ guix/scripts.scm | 10 ++-- guix/scripts/gc.scm | 66 +++++++++++++++++++++-- guix/store/roots.scm | 120 ++++++++++++++++++++++++++++++++++++++++++ tests/guix-gc.sh | 6 ++- tests/store-roots.scm | 53 +++++++++++++++++++ 8 files changed, 282 insertions(+), 16 deletions(-) create mode 100644 guix/store/roots.scm create mode 100644 tests/store-roots.scm -- 2.21.0 From unknown Fri Sep 19 16:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#35176] [PATCH 1/5] Add (guix store roots). References: <20190406212656.27025-1-ludo@gnu.org> In-Reply-To: <20190406212656.27025-1-ludo@gnu.org> Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 06 Apr 2019 21:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35176 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 35176@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 35176-submit@debbugs.gnu.org id=B35176.155458629720031 (code B ref 35176); Sat, 06 Apr 2019 21:32:01 +0000 Received: (at 35176) by debbugs.gnu.org; 6 Apr 2019 21:31:37 +0000 Received: from localhost ([127.0.0.1]:47518 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hCsuW-0005D0-Tx for submit@debbugs.gnu.org; Sat, 06 Apr 2019 17:31:37 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51015) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hCsuV-0005Cf-FA for 35176@debbugs.gnu.org; Sat, 06 Apr 2019 17:31:35 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46368) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hCsuQ-0004No-7f; Sat, 06 Apr 2019 17:31:30 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=50434 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hCsuP-0002OK-LR; Sat, 06 Apr 2019 17:31:30 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Sat, 6 Apr 2019 23:31:19 +0200 Message-Id: <20190406213123.27164-1-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * guix/store/roots.scm, tests/store-roots.scm: New files. * Makefile.am (STORE_MODULES): Add guix/store/roots.scm. (SCM_TESTS): Add tests/store-roots.scm. --- Makefile.am | 6 ++- guix/store/roots.scm | 120 ++++++++++++++++++++++++++++++++++++++++++ tests/store-roots.scm | 53 +++++++++++++++++++ 3 files changed, 177 insertions(+), 2 deletions(-) create mode 100644 guix/store/roots.scm create mode 100644 tests/store-roots.scm diff --git a/Makefile.am b/Makefile.am index c331da7267..18889bf89e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -276,7 +276,8 @@ endif BUILD_DAEMON_OFFLOAD # Scheme implementation of the build daemon and related functionality. STORE_MODULES = \ guix/store/database.scm \ - guix/store/deduplication.scm + guix/store/deduplication.scm \ + guix/store/roots.scm MODULES += $(STORE_MODULES) @@ -407,7 +408,8 @@ SCM_TESTS = \ tests/pypi.scm \ tests/import-utils.scm \ tests/store-database.scm \ - tests/store-deduplication.scm + tests/store-deduplication.scm \ + tests/store-roots.scm SH_TESTS = \ tests/guix-build.sh \ diff --git a/guix/store/roots.scm b/guix/store/roots.scm new file mode 100644 index 0000000000..4f23ae34e8 --- /dev/null +++ b/guix/store/roots.scm @@ -0,0 +1,120 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2019 Ludovic Courtès +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix store roots) + #:use-module (guix config) + #:use-module ((guix store) #:select (store-path? %gc-roots-directory)) + #:use-module (guix sets) + #:use-module (guix build syscalls) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-11) + #:use-module (srfi srfi-26) + #:use-module (ice-9 match) + #:use-module (ice-9 regex) + #:re-export (%gc-roots-directory) + #:export (gc-roots + user-owned?)) + +;;; Commentary: +;;; +;;; This module provides tools to list and access garbage collector roots ("GC +;;; roots"). +;;; +;;; Code: + +(define %profile-directory + ;; Directory where user profiles are stored. + ;; XXX: This is redundant with the definition in (guix profiles) and not + ;; entirely needed since in practice /var/guix/gcroots/profiles links to + ;; it. + (string-append %state-directory "/profiles")) + +(define (gc-roots) + "Return the list of garbage collector roots (\"GC roots\"). This includes +\"regular\" roots fount in %GC-ROOTS-DIRECTORY as well as indirect roots that +are user-controlled symlinks stored anywhere on the file system." + (define (regular? file) + (match file + (((or "." "..") . _) #f) + (_ #t))) + + (define (file-type=? type) + (match-lambda + ((file . properties) + (match (assq-ref properties 'type) + ('unknown + (let ((stat (lstat file))) + (eq? type (stat:type stat)))) + (actual-type + (eq? type actual-type)))))) + + (define directory? + (file-type=? 'directory)) + + (define symlink? + (file-type=? 'symlink)) + + (define canonical-root + (match-lambda + ((file . properties) + (let ((target (readlink file))) + (cond ((store-path? target) + ;; Regular root: FILE points to the store. + file) + + ;; Indirect root: FILE points to a user-controlled file outside + ;; the store. + ((string-prefix? "/" target) + target) + (else + (string-append (dirname file) "/" target))))))) + + (let loop ((directories (list %gc-roots-directory + %profile-directory)) + (roots '()) + (visited (set))) + (match directories + (() + roots) + ((directory . rest) + (if (set-contains? visited directory) + (loop rest roots visited) + (let*-values (((scope) + (cut string-append directory "/" <>)) + ((sub-directories files) + (partition directory? + (map (match-lambda + ((file . properties) + (cons (scope file) properties))) + (scandir* directory regular?))))) + (loop (append rest (map first sub-directories)) + (append (map canonical-root (filter symlink? files)) + roots) + (set-insert directory visited)))))))) + +(define* (user-owned? root #:optional (uid (getuid))) + "Return true if ROOT exists and is owned by UID, false otherwise." + ;; If ROOT is an indirect root, then perhaps it no longer exists. Thus, + ;; catch 'system-error' exceptions. + (catch 'system-error + (lambda () + (define stat + (lstat root)) + + (= (stat:uid stat) uid)) + (const #f))) diff --git a/tests/store-roots.scm b/tests/store-roots.scm new file mode 100644 index 0000000000..5bcf1bc87e --- /dev/null +++ b/tests/store-roots.scm @@ -0,0 +1,53 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2019 Ludovic Courtès +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (test-store-deduplication) + #:use-module (guix tests) + #:use-module (guix store) + #:use-module (guix store roots) + #:use-module ((guix utils) #:select (call-with-temporary-directory)) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-64)) + +(define %store + (open-connection)) + +(test-begin "store-roots") + +(test-assert "gc-roots, regular root" + (let* ((item (add-text-to-store %store "something" + (random-text))) + (root (string-append %gc-roots-directory "/test-gc-root"))) + (symlink item root) + (let ((result (member root (gc-roots)))) + (delete-file root) + result))) + +(test-assert "gc-roots, indirect root" + (call-with-temporary-directory + (lambda (directory) + (let* ((item (add-text-to-store %store "something" + (random-text))) + (root (string-append directory "/gc-root"))) + (symlink item root) + (add-indirect-root %store root) + (let ((result (member root (gc-roots)))) + (delete-file root) + result))))) + +(test-end "store-roots") -- 2.21.0 From unknown Fri Sep 19 16:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#35176] [PATCH 2/5] guix gc: Add '--list-roots'. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 06 Apr 2019 21:32:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35176 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 35176@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 35176-submit@debbugs.gnu.org id=B35176.155458630120058 (code B ref 35176); Sat, 06 Apr 2019 21:32:03 +0000 Received: (at 35176) by debbugs.gnu.org; 6 Apr 2019 21:31:41 +0000 Received: from localhost ([127.0.0.1]:47523 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hCsua-0005DP-Eu for submit@debbugs.gnu.org; Sat, 06 Apr 2019 17:31:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51018) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hCsuW-0005Ch-BE for 35176@debbugs.gnu.org; Sat, 06 Apr 2019 17:31:36 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46369) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hCsuR-0004O9-3p; Sat, 06 Apr 2019 17:31:31 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=50434 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hCsuQ-0002OK-Kz; Sat, 06 Apr 2019 17:31:30 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Sat, 6 Apr 2019 23:31:20 +0200 Message-Id: <20190406213123.27164-2-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190406213123.27164-1-ludo@gnu.org> References: <20190406213123.27164-1-ludo@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * guix/scripts/gc.scm (show-help, %options): Add '--list-roots'. (guix-gc)[list-roots]: New procedure. Handle '--list-roots'. * tests/guix-gc.sh: Test it. * doc/guix.texi (Invoking guix gc): Document it. --- doc/guix.texi | 6 +++++- guix/scripts/gc.scm | 21 ++++++++++++++++++++- tests/guix-gc.sh | 6 ++++-- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 1c82579afc..75ab2fe4f5 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3385,7 +3385,7 @@ deleted. The set of garbage collector roots (``GC roots'' for short) includes default user profiles; by default, the symlinks under @file{/var/guix/gcroots} represent these GC roots. New GC roots can be added with @command{guix build --root}, for example (@pxref{Invoking -guix build}). +guix build}). The @command{guix gc --list-roots} command lists them. Prior to running @code{guix gc --collect-garbage} to make space, it is often useful to remove old generations from user profiles; that way, old @@ -3451,6 +3451,10 @@ This prints nothing unless the daemon was started with @option{--cache-failures} (@pxref{Invoking guix-daemon, @option{--cache-failures}}). +@item --list-roots +List the GC roots owned by the user; when run as root, list @emph{all} the GC +roots. + @item --clear-failures Remove the specified store items from the failed-build cache. diff --git a/guix/scripts/gc.scm b/guix/scripts/gc.scm index 6f37b767ff..2606e20deb 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 Ludovic Courtès +;;; Copyright © 2012, 2013, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -20,6 +20,7 @@ #:use-module (guix ui) #:use-module (guix scripts) #:use-module (guix store) + #:use-module (guix store roots) #:autoload (guix build syscalls) (free-disk-space) #:use-module (ice-9 match) #:use-module (ice-9 regex) @@ -48,6 +49,8 @@ Invoke the garbage collector.\n")) -F, --free-space=FREE attempt to reach FREE available space in the store")) (display (G_ " -d, --delete attempt to delete PATHS")) + (display (G_ " + --list-roots list the user's garbage collector roots")) (display (G_ " --optimize optimize the store by deduplicating identical files")) (display (G_ " @@ -135,6 +138,10 @@ Invoke the garbage collector.\n")) (alist-cons 'verify-options options (alist-delete 'action result)))))) + (option '("list-roots") #f #f + (lambda (opt name arg result) + (alist-cons 'action 'list-roots + (alist-delete 'action result)))) (option '("list-dead") #f #f (lambda (opt name arg result) (alist-cons 'action 'list-dead @@ -205,6 +212,15 @@ Invoke the garbage collector.\n")) (info (G_ "freeing ~h MiBs~%") (/ to-free 1024. 1024.)) (collect-garbage store to-free))))) + (define (list-roots) + ;; List all the user-owned GC roots. + (let ((roots (filter (if (zero? (getuid)) (const #t) user-owned?) + (gc-roots)))) + (for-each (lambda (root) + (display root) + (newline)) + roots))) + (with-error-handling (let* ((opts (parse-options)) (store (open-connection)) @@ -238,6 +254,9 @@ Invoke the garbage collector.\n")) (else (let-values (((paths freed) (collect-garbage store))) (info (G_ "freed ~h MiBs~%") (/ freed 1024. 1024.))))))) + ((list-roots) + (assert-no-extra-arguments) + (list-roots)) ((delete) (delete-paths store (map direct-store-path paths))) ((list-references) diff --git a/tests/guix-gc.sh b/tests/guix-gc.sh index ef2d9543b7..8284287730 100644 --- a/tests/guix-gc.sh +++ b/tests/guix-gc.sh @@ -1,5 +1,5 @@ # GNU Guix --- Functional package management for GNU -# Copyright © 2013, 2015, 2017, 2018 Ludovic Courtès +# Copyright © 2013, 2015, 2017, 2018, 2019 Ludovic Courtès # # This file is part of GNU Guix. # @@ -34,7 +34,7 @@ unset drv unset out # For some operations, passing extra arguments is an error. -for option in "" "-C 500M" "--verify" "--optimize" +for option in "" "-C 500M" "--verify" "--optimize" "--list-roots" do if guix gc $option whatever; then false; else true; fi done @@ -69,6 +69,8 @@ guix gc --delete "$drv" drv="`guix build --root=guix-gc-root lsh -d`" test -f "$drv" && test -L guix-gc-root +guix gc --list-roots | grep "$PWD/guix-gc-root" + guix gc --list-live | grep "$drv" if guix gc --delete "$drv"; then false; else true; fi -- 2.21.0 From unknown Fri Sep 19 16:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#35176] [PATCH 3/5] profiles: Add 'generation-profile'. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 06 Apr 2019 21:32:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35176 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 35176@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 35176-submit@debbugs.gnu.org id=B35176.155458630220066 (code B ref 35176); Sat, 06 Apr 2019 21:32:03 +0000 Received: (at 35176) by debbugs.gnu.org; 6 Apr 2019 21:31:42 +0000 Received: from localhost ([127.0.0.1]:47525 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hCsub-0005DT-Mp for submit@debbugs.gnu.org; Sat, 06 Apr 2019 17:31:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51022) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hCsuX-0005Cj-6r for 35176@debbugs.gnu.org; Sat, 06 Apr 2019 17:31:37 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46370) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hCsuR-0004OV-WA; Sat, 06 Apr 2019 17:31:32 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=50434 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hCsuR-0002OK-H2; Sat, 06 Apr 2019 17:31:31 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Sat, 6 Apr 2019 23:31:21 +0200 Message-Id: <20190406213123.27164-3-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190406213123.27164-1-ludo@gnu.org> References: <20190406213123.27164-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * guix/profiles.scm (%profile-generation-rx): New variable. (generation-profile): New procedure. --- guix/profiles.scm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/guix/profiles.scm b/guix/profiles.scm index 6564526aee..dfc9ba1ca0 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -118,6 +118,7 @@ profile-search-paths generation-number + generation-profile generation-numbers profile-generations relative-generation-spec->number @@ -1552,6 +1553,20 @@ already effective." (compose string->number (cut match:substring <> 1))) 0)) +(define %profile-generation-rx + ;; Regexp that matches profile generation. + (make-regexp "(.*)-([0-9]+)-link$")) + +(define (generation-profile file) + "If FILE is a profile generation GC root such as \"guix-profile-42-link\", +return its corresponding profile---e.g., \"guix-profile\". Otherwise return +#f." + (match (regexp-exec %profile-generation-rx file) + (#f #f) + (m (let ((profile (match:substring m 1))) + (and (file-exists? (string-append profile "/manifest")) + profile))))) + (define (generation-numbers profile) "Return the sorted list of generation numbers of PROFILE, or '(0) if no former profiles were found." -- 2.21.0 From unknown Fri Sep 19 16:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#35176] [PATCH 4/5] guix gc: Add '--delete-generations'. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 06 Apr 2019 21:32:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35176 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 35176@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 35176-submit@debbugs.gnu.org id=B35176.155458630220073 (code B ref 35176); Sat, 06 Apr 2019 21:32:03 +0000 Received: (at 35176) by debbugs.gnu.org; 6 Apr 2019 21:31:42 +0000 Received: from localhost ([127.0.0.1]:47527 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hCsuc-0005Db-1A for submit@debbugs.gnu.org; Sat, 06 Apr 2019 17:31:42 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51027) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hCsuY-0005Cl-2L for 35176@debbugs.gnu.org; Sat, 06 Apr 2019 17:31:38 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46371) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hCsuS-0004P0-SX; Sat, 06 Apr 2019 17:31:32 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=50434 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hCsuS-0002OK-DC; Sat, 06 Apr 2019 17:31:32 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Sat, 6 Apr 2019 23:31:22 +0200 Message-Id: <20190406213123.27164-4-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190406213123.27164-1-ludo@gnu.org> References: <20190406213123.27164-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * guix/scripts/gc.scm (show-help, %options): Add '--delete-generations'. Change '--delete' shorthand to '-d'. (delete-old-generations): New procedure. (guix-gc)[delete-generations]: New procedure. Call it when ACTION is 'collect-garbage' and OPTS contains 'delete-generations. * doc/guix.texi (Invoking guix gc): Document it. --- doc/guix.texi | 16 +++++++++++++++- guix/scripts/gc.scm | 45 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 75ab2fe4f5..e1b30f0ab1 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3438,8 +3438,22 @@ as @code{500MiB}, as described above. When @var{free} or more is already available in @file{/gnu/store}, do 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 +applies to all the profiles @emph{of all the users}. + +For example, this command deletes all the generations of all your profiles +that are older than 2 months (except generations that are current), and then +proceeds to free space until at least 10 GiB are available: + +@example +guix gc -d 2m -F 10G +@end example + @item --delete -@itemx -d +@itemx -D Attempt to delete all the store files and directories specified as arguments. This fails if some of the files are not in the store, or if they are still live. diff --git a/guix/scripts/gc.scm b/guix/scripts/gc.scm index 2606e20deb..635a031645 100644 --- a/guix/scripts/gc.scm +++ b/guix/scripts/gc.scm @@ -22,6 +22,8 @@ #:use-module (guix store) #:use-module (guix store roots) #:autoload (guix build syscalls) (free-disk-space) + #:autoload (guix profiles) (generation-profile) + #:autoload (guix scripts package) (delete-generations) #:use-module (ice-9 match) #:use-module (ice-9 regex) #:use-module (srfi srfi-1) @@ -48,7 +50,10 @@ Invoke the garbage collector.\n")) (display (G_ " -F, --free-space=FREE attempt to reach FREE available space in the store")) (display (G_ " - -d, --delete attempt to delete PATHS")) + -d, --delete-generations[=PATTERN] + delete profile generations matching PATTERN")) + (display (G_ " + -D, --delete attempt to delete PATHS")) (display (G_ " --list-roots list the user's garbage collector roots")) (display (G_ " @@ -98,6 +103,16 @@ Invoke the garbage collector.\n")) lst) '())))) +(define (delete-old-generations store profile pattern) + "Remove the generations of PROFILE that match PATTERN, a duration pattern. +Do nothing if none matches." + (let* ((current (generation-number profile)) + (numbers (matching-generations pattern profile + #:duration-relation >))) + + ;; Make sure we don't inadvertently remove the current generation. + (delete-generations store profile (delv current numbers)))) + (define %options ;; Specification of the command-line options. (list (option '(#\h "help") #f #f @@ -123,10 +138,24 @@ Invoke the garbage collector.\n")) (option '(#\F "free-space") #t #f (lambda (opt name arg result) (alist-cons 'free-space (size->number arg) result))) - (option '(#\d "delete") #f #f + (option '(#\D "delete") #f #f ;used to be '-d' (lower case) (lambda (opt name arg result) (alist-cons 'action 'delete (alist-delete 'action result)))) + (option '(#\d "delete-generations") #f #t + (lambda (opt name arg result) + (if (and arg (store-path? arg)) + (begin + (warning (G_ "'-d' as an alias for '--delete' \ +is deprecated; use '-D'~%")) + (alist-cons 'action 'delete + (alist-delete 'action result))) + (begin + (when (and arg (not (string->duration arg))) + (leave (G_ "~s does not denote a duration~%") + arg)) + (alist-cons 'delete-generations (or arg "") + result))))) (option '("optimize") #f #f (lambda (opt name arg result) (alist-cons 'action 'optimize @@ -212,6 +241,14 @@ Invoke the garbage collector.\n")) (info (G_ "freeing ~h MiBs~%") (/ to-free 1024. 1024.)) (collect-garbage store to-free))))) + (define (delete-generations store pattern) + ;; Delete the generations matching PATTERN of all the user's profiles. + (let ((profiles (delete-duplicates + (filter-map generation-profile (gc-roots))))) + (for-each (lambda (profile) + (delete-old-generations store profile pattern)) + profiles))) + (define (list-roots) ;; List all the user-owned GC roots. (let ((roots (filter (if (zero? (getuid)) (const #t) user-owned?) @@ -245,6 +282,10 @@ Invoke the garbage collector.\n")) (assert-no-extra-arguments) (let ((min-freed (assoc-ref opts 'min-freed)) (free-space (assoc-ref opts 'free-space))) + (match (assoc-ref opts 'delete-generations) + (#f #t) + ((? string? pattern) + (delete-generations store pattern))) (cond (free-space (ensure-free-space store free-space)) -- 2.21.0 From unknown Fri Sep 19 16:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#35176] [PATCH 5/5] scripts: GC hint suggests 'guix gc -d 1m'. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 06 Apr 2019 21:32:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35176 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 35176@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 35176-submit@debbugs.gnu.org id=B35176.155458630220079 (code B ref 35176); Sat, 06 Apr 2019 21:32:04 +0000 Received: (at 35176) by debbugs.gnu.org; 6 Apr 2019 21:31:42 +0000 Received: from localhost ([127.0.0.1]:47529 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hCsuc-0005Dj-Ff for submit@debbugs.gnu.org; Sat, 06 Apr 2019 17:31:42 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51031) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hCsuZ-0005Cn-41 for 35176@debbugs.gnu.org; Sat, 06 Apr 2019 17:31:39 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46372) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hCsuT-0004PY-Sc; Sat, 06 Apr 2019 17:31:34 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=50434 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hCsuT-0002OK-9a; Sat, 06 Apr 2019 17:31:33 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Sat, 6 Apr 2019 23:31:23 +0200 Message-Id: <20190406213123.27164-5-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190406213123.27164-1-ludo@gnu.org> References: <20190406213123.27164-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * guix/scripts.scm (warn-about-disk-space): Suggest 'guix gc -d'. --- guix/scripts.scm | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/guix/scripts.scm b/guix/scripts.scm index e4b11d295d..77cbf12350 100644 --- a/guix/scripts.scm +++ b/guix/scripts.scm @@ -201,16 +201,12 @@ available." (when (< ratio threshold) (warning (G_ "only ~,1f% of free space available on ~a~%") (* ratio 100) (%store-prefix)) - (if profile - (display-hint (format #f (G_ "Consider deleting old profile + (display-hint (format #f (G_ "Consider deleting old profile generations and collecting garbage, along these lines: @example -guix package -p ~s --delete-generations=1m -guix gc +guix gc --delete-generations=1m @end example\n") - profile)) - (display-hint (G_ "Consider running @command{guix gc} to free -space.")))))) + profile))))) ;;; scripts.scm ends here -- 2.21.0 From unknown Fri Sep 19 16:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#35176] [PATCH 0/5] 'guix gc --delete-generations' and '--list-roots' Resent-From: =?UTF-8?Q?Bj=C3=B6rn_?= =?UTF-8?Q?H=C3=B6fling?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 09 Apr 2019 19:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35176 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 35176@debbugs.gnu.org Received: via spool by 35176-submit@debbugs.gnu.org id=B35176.15548364756767 (code B ref 35176); Tue, 09 Apr 2019 19:02:02 +0000 Received: (at 35176) by debbugs.gnu.org; 9 Apr 2019 19:01:15 +0000 Received: from localhost ([127.0.0.1]:51984 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDvzf-0001l5-AK for submit@debbugs.gnu.org; Tue, 09 Apr 2019 15:01:15 -0400 Received: from m4s11.vlinux.de ([83.151.27.109]:55884 helo=bjoernhoefling.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDvzb-0001ku-0Q for 35176@debbugs.gnu.org; Tue, 09 Apr 2019 15:01:11 -0400 Received: from alma-ubu (unknown [37.49.7.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bjoernhoefling.de (Postfix) with ESMTPSA id B29573F8B0; Tue, 9 Apr 2019 21:01:09 +0200 (CEST) Date: Tue, 9 Apr 2019 21:01:09 +0200 From: =?UTF-8?Q?Bj=C3=B6rn_?= =?UTF-8?Q?H=C3=B6fling?= Message-ID: <20190409210109.42ba3cee@alma-ubu> In-Reply-To: <20190406212656.27025-1-ludo@gnu.org> References: <20190406212656.27025-1-ludo@gnu.org> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/TLQx/WNnZXf6qXuc81L5SFA"; protocol="application/pgp-signature" X-Spam-Score: 0.1 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.9 (/) --Sig_/TLQx/WNnZXf6qXuc81L5SFA Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sat, 6 Apr 2019 23:26:56 +0200 Ludovic Court=C3=A8s wrote: > Hello Guix! >=20 > This patch series is mostly about making it easier to free space: > =E2=80=98guix gc --delete-generations=E2=80=99 deletes old generations of= all the > user=E2=80=99s profiles prior to collecting garbage. >=20 > For consistency, =E2=80=98--delete-generations=E2=80=99 is aliased with = =E2=80=98-d=E2=80=99, so > =E2=80=98-d=E2=80=99 is repurposed (until now it was an alias for =E2=80= =98--delete=E2=80=99). I'm using regularly `guix gc -d /gnu/store/...` and I'm a bit concerned about re/abusing this existing parameter. First I like the simple '-d' to delete a store path. Second, how big is the chance I could accidentally delete (all) older generations of my profiles? I really like to keep them for a long time, until my disk is near-full, and it looks like gc-roots are no longer a safe way to keep them? Bj=C3=B6rn --Sig_/TLQx/WNnZXf6qXuc81L5SFA Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQQiGUP0np8nb5SZM4K/KGy2WT5f/QUCXKzr9QAKCRC/KGy2WT5f /RmzAJ9PbZtoOUOjT/jRow4wYA7ytffP9ACfb/CrzkoR5IdUlAIvrdBO0FwtqfQ= =JYgD -----END PGP SIGNATURE----- --Sig_/TLQx/WNnZXf6qXuc81L5SFA-- From unknown Fri Sep 19 16:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#35176] [PATCH 0/5] 'guix gc --delete-generations' and '--list-roots' Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 09 Apr 2019 20:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35176 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: =?UTF-8?Q?Bj=C3=B6rn_?= =?UTF-8?Q?H=C3=B6fling?= Cc: 35176@debbugs.gnu.org Received: via spool by 35176-submit@debbugs.gnu.org id=B35176.155484014013200 (code B ref 35176); Tue, 09 Apr 2019 20:03:02 +0000 Received: (at 35176) by debbugs.gnu.org; 9 Apr 2019 20:02:20 +0000 Received: from localhost ([127.0.0.1]:52003 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDwwl-0003Qp-IT for submit@debbugs.gnu.org; Tue, 09 Apr 2019 16:02:19 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60112) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDwwj-0003Qb-Au for 35176@debbugs.gnu.org; Tue, 09 Apr 2019 16:02:18 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46439) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDwwc-0001Qh-T0; Tue, 09 Apr 2019 16:02:11 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=53274 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hDwwc-00044s-00; Tue, 09 Apr 2019 16:02:10 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20190406212656.27025-1-ludo@gnu.org> <20190409210109.42ba3cee@alma-ubu> Date: Tue, 09 Apr 2019 22:02:07 +0200 In-Reply-To: <20190409210109.42ba3cee@alma-ubu> ("=?UTF-8?Q?Bj=C3=B6rn_?= =?UTF-8?Q?H=C3=B6fling?="'s message of "Tue, 9 Apr 2019 21:01:09 +0200") Message-ID: <87ftqrdk1s.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Bj=C3=B6rn, Bj=C3=B6rn H=C3=B6fling skribis: > On Sat, 6 Apr 2019 23:26:56 +0200 > Ludovic Court=C3=A8s wrote: > >> Hello Guix! >>=20 >> This patch series is mostly about making it easier to free space: >> =E2=80=98guix gc --delete-generations=E2=80=99 deletes old generations o= f all the >> user=E2=80=99s profiles prior to collecting garbage. >>=20 >> For consistency, =E2=80=98--delete-generations=E2=80=99 is aliased with = =E2=80=98-d=E2=80=99, so >> =E2=80=98-d=E2=80=99 is repurposed (until now it was an alias for =E2=80= =98--delete=E2=80=99). > > I'm using regularly `guix gc -d /gnu/store/...` and I'm a bit concerned > about re/abusing this existing parameter. First I like the simple '-d' > to delete a store path. It still works actually, it just prints a warning stating that it=E2=80=99s deprecated. (I=E2=80=99m used to =E2=80=98-d=E2=80=99 as well but I=E2=80= =99m confident my muscle memory will get used to =E2=80=98-D=E2=80=99. :-)) > Second, how big is the chance I could accidentally delete (all) older > generations of my profiles? It=E2=80=99s unlikely because if you do =E2=80=9Cguix gc -d /gnu/store/=E2= =80=A6=E2=80=9D, it still behaves like before. Does it address your concern? > I really like to keep them for a long time, until my disk is > near-full, and it looks like gc-roots are no longer a safe way to keep > them? It=E2=80=99s still safe, I do the same as you! The intent is just to provi= de a simple way to =E2=80=9Cremove old stuff=E2=80=9D (currently you have to kno= w that you have at least two profiles, and then run =E2=80=98guix package -p =E2=80=A6= -d=E2=80=99, which isn=E2=80=99t very convenient when all you want is to free some space.) Thanks for your feedback! Ludo=E2=80=99. From unknown Fri Sep 19 16:07:03 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#35176] [PATCH 0/5] 'guix gc --delete-generations' and '--list-roots' Resent-From: =?UTF-8?Q?Bj=C3=B6rn_?= =?UTF-8?Q?H=C3=B6fling?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 09 Apr 2019 20:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35176 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 35176@debbugs.gnu.org Received: via spool by 35176-submit@debbugs.gnu.org id=B35176.155484353326494 (code B ref 35176); Tue, 09 Apr 2019 20:59:02 +0000 Received: (at 35176) by debbugs.gnu.org; 9 Apr 2019 20:58:53 +0000 Received: from localhost ([127.0.0.1]:52055 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDxpU-0006tG-Vo for submit@debbugs.gnu.org; Tue, 09 Apr 2019 16:58:53 -0400 Received: from m4s11.vlinux.de ([83.151.27.109]:55896 helo=bjoernhoefling.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDxpS-0006t5-8W for 35176@debbugs.gnu.org; Tue, 09 Apr 2019 16:58:51 -0400 Received: from alma-ubu (unknown [37.49.7.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bjoernhoefling.de (Postfix) with ESMTPSA id B78C73F8B0; Tue, 9 Apr 2019 22:58:48 +0200 (CEST) Date: Tue, 9 Apr 2019 22:58:47 +0200 From: =?UTF-8?Q?Bj=C3=B6rn_?= =?UTF-8?Q?H=C3=B6fling?= Message-ID: <20190409225847.20265f8f@alma-ubu> In-Reply-To: <87ftqrdk1s.fsf@gnu.org> References: <20190406212656.27025-1-ludo@gnu.org> <20190409210109.42ba3cee@alma-ubu> <87ftqrdk1s.fsf@gnu.org> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/v.k0/Jw=tV7dKbtbjeGco+X"; protocol="application/pgp-signature" X-Spam-Score: 0.1 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.9 (/) --Sig_/v.k0/Jw=tV7dKbtbjeGco+X Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, 09 Apr 2019 22:02:07 +0200 Ludovic Court=C3=A8s wrote: > Hi Bj=C3=B6rn, >=20 > > Second, how big is the chance I could accidentally delete (all) > > older generations of my profiles? =20 >=20 > It=E2=80=99s unlikely because if you do =E2=80=9Cguix gc -d /gnu/store/= =E2=80=A6=E2=80=9D, it still > behaves like before. >=20 > Does it address your concern? OK, convinced. Thanks for clarifying. Bj=C3=B6rn --Sig_/v.k0/Jw=tV7dKbtbjeGco+X Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQQiGUP0np8nb5SZM4K/KGy2WT5f/QUCXK0HhwAKCRC/KGy2WT5f /UAzAJ9w3zrS1OMWH7MgvZLGNgeCzJLbzgCgtGM4PH5b/+IHltD1VWV8oYXx5x0= =WegH -----END PGP SIGNATURE----- --Sig_/v.k0/Jw=tV7dKbtbjeGco+X-- From unknown Fri Sep 19 16:07:03 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#35176: closed (Re: [bug#35176] [PATCH 0/5] 'guix gc --delete-generations' and '--list-roots') Message-ID: References: <87mukxc2h7.fsf@gnu.org> <20190406212656.27025-1-ludo@gnu.org> X-Gnu-PR-Message: they-closed 35176 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 35176@debbugs.gnu.org Date: Wed, 10 Apr 2019 15:20:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1554909602-10916-1" This is a multi-part message in MIME format... ------------=_1554909602-10916-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #35176: [PATCH 0/5] 'guix gc --delete-generations' and '--list-roots' which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 35176@debbugs.gnu.org. --=20 35176: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D35176 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1554909602-10916-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 35176-done) by debbugs.gnu.org; 10 Apr 2019 15:19:27 +0000 Received: from localhost ([127.0.0.1]:53455 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hEF0Z-0002pC-86 for submit@debbugs.gnu.org; Wed, 10 Apr 2019 11:19:27 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43246) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hEF0X-0002oz-3x for 35176-done@debbugs.gnu.org; Wed, 10 Apr 2019 11:19:25 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36018) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEF0R-0000f2-9w; Wed, 10 Apr 2019 11:19:19 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=54876 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hEF0Q-0006Gs-DT; Wed, 10 Apr 2019 11:19:18 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: =?utf-8?Q?Bj=C3=B6rn_H=C3=B6fling?= Subject: Re: [bug#35176] [PATCH 0/5] 'guix gc --delete-generations' and '--list-roots' References: <20190406212656.27025-1-ludo@gnu.org> <20190409210109.42ba3cee@alma-ubu> <87ftqrdk1s.fsf@gnu.org> <20190409225847.20265f8f@alma-ubu> Date: Wed, 10 Apr 2019 17:19:16 +0200 In-Reply-To: <20190409225847.20265f8f@alma-ubu> (=?utf-8?Q?=22Bj=C3=B6rn?= =?utf-8?Q?_H=C3=B6fling=22's?= message of "Tue, 9 Apr 2019 22:58:47 +0200") Message-ID: <87mukxc2h7.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 35176-done Cc: 35176-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hello, Bj=C3=B6rn H=C3=B6fling skribis: > On Tue, 09 Apr 2019 22:02:07 +0200 > Ludovic Court=C3=A8s wrote: > >> Hi Bj=C3=B6rn, >>=20 >> > Second, how big is the chance I could accidentally delete (all) >> > older generations of my profiles?=20=20 >>=20 >> It=E2=80=99s unlikely because if you do =E2=80=9Cguix gc -d /gnu/store/= =E2=80=A6=E2=80=9D, it still >> behaves like before. >>=20 >> Does it address your concern? > > OK, convinced. Thanks for clarifying. Cool, I=E2=80=99ve just pushed the patch series. I noticed that the compatibility trick for =E2=80=98-d=E2=80=99 would ignor= e its argument (thus it wouldn=E2=80=99t delete anything at all), so I=E2=80=99ve= fixed that. Thank you! Ludo=E2=80=99. ------------=_1554909602-10916-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 6 Apr 2019 21:27:16 +0000 Received: from localhost ([127.0.0.1]:47512 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hCsqK-00055Q-B4 for submit@debbugs.gnu.org; Sat, 06 Apr 2019 17:27:16 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50001) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hCsqJ-00055F-BG for submit@debbugs.gnu.org; Sat, 06 Apr 2019 17:27:15 -0400 Received: from lists.gnu.org ([209.51.188.17]:41271) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hCsqE-0001LO-6u for submit@debbugs.gnu.org; Sat, 06 Apr 2019 17:27:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hCsqA-0005LO-CQ for guix-patches@gnu.org; Sat, 06 Apr 2019 17:27:10 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46294) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hCsqA-0001HX-7S; Sat, 06 Apr 2019 17:27:06 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=50418 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hCsq9-0000Z1-J7; Sat, 06 Apr 2019 17:27:06 -0400 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: guix-patches@gnu.org Subject: [PATCH 0/5] 'guix gc --delete-generations' and '--list-roots' Date: Sat, 6 Apr 2019 23:26:56 +0200 Message-Id: <20190406212656.27025-1-ludo@gnu.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: submit Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello Guix! This patch series is mostly about making it easier to free space: ‘guix gc --delete-generations’ deletes old generations of all the user’s profiles prior to collecting garbage. For consistency, ‘--delete-generations’ is aliased with ‘-d’, so ‘-d’ is repurposed (until now it was an alias for ‘--delete’). Thoughts? Ludo’. Ludovic Courtès (5): Add (guix store roots). guix gc: Add '--list-roots'. profiles: Add 'generation-profile'. guix gc: Add '--delete-generations'. scripts: GC hint suggests 'guix gc -d 1m'. Makefile.am | 6 ++- doc/guix.texi | 22 +++++++- guix/profiles.scm | 15 ++++++ guix/scripts.scm | 10 ++-- guix/scripts/gc.scm | 66 +++++++++++++++++++++-- guix/store/roots.scm | 120 ++++++++++++++++++++++++++++++++++++++++++ tests/guix-gc.sh | 6 ++- tests/store-roots.scm | 53 +++++++++++++++++++ 8 files changed, 282 insertions(+), 16 deletions(-) create mode 100644 guix/store/roots.scm create mode 100644 tests/store-roots.scm -- 2.21.0 ------------=_1554909602-10916-1--