summaryrefslogtreecommitdiff
path: root/guix/store
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2022-10-19 12:19:04 +0300
committerEfraim Flashner <efraim@flashner.co.il>2022-11-06 14:02:08 +0200
commit97d565c786ee1a1eb920ed66384f60aad20e5cc2 (patch)
treee75a0a70ad8644fa76b3efd162b4430fb7078735 /guix/store
parent2bf8146e311694ff8cdce9f0b1e638374682012a (diff)
guix gc: Add '--vacuum-database'.
* guix/scripts/gc.scm (show-help, %options): Add '--vacuum-database'. * guix/store/database.scm (vacuum-database): New procedure. * doc/guix.texi (Invoking guix gc): Document the option.
Diffstat (limited to 'guix/store')
-rw-r--r--guix/store/database.scm9
1 files changed, 8 insertions, 1 deletions
diff --git a/guix/store/database.scm b/guix/store/database.scm
index 8d08def833..e664015673 100644
--- a/guix/store/database.scm
+++ b/guix/store/database.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2017, 2019 Caleb Ristvedt <caleb.ristvedt@cune.org>
;;; Copyright © 2018, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2022 Efraim Flashner <efraim@flashner.co.il>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -45,7 +46,8 @@
sqlite-register
register-items
%epoch
- reset-timestamps))
+ reset-timestamps
+ vacuum-database))
;;; Code for working with the store database directly.
@@ -438,3 +440,8 @@ typically by adding them as temp-roots."
(register db item)
(report))
items)))))
+
+(define (vacuum-database)
+ (let ((db (sqlite-open (store-database-file))))
+ (sqlite-exec db "VACUUM;")
+ (sqlite-close db)))