summaryrefslogtreecommitdiff
path: root/guix/scripts/gc.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2019-07-12 01:03:53 +0200
committerMarius Bakke <mbakke@fastmail.com>2019-07-12 01:03:53 +0200
commitfb9a23a3f3ad3d7b5b7f03b2007baf27684d6bbd (patch)
treeafbd3f4f33771c61254b0c3d977092542fbe8009 /guix/scripts/gc.scm
parent1c4b72cb34640638e40c5190676e5c8c352d292d (diff)
parent5a836ce38c9c29e9c2bd306007347486b90c5064 (diff)
downloadpatches-fb9a23a3f3ad3d7b5b7f03b2007baf27684d6bbd.tar
patches-fb9a23a3f3ad3d7b5b7f03b2007baf27684d6bbd.tar.gz
Merge branch 'master' into core-updates
Conflicts: gnu/local.mk gnu/packages/python-xyz.scm gnu/packages/xml.scm guix/gexp.scm po/guix/POTFILES.in
Diffstat (limited to 'guix/scripts/gc.scm')
-rw-r--r--guix/scripts/gc.scm18
1 files changed, 10 insertions, 8 deletions
diff --git a/guix/scripts/gc.scm b/guix/scripts/gc.scm
index 9a57e5fd1e..31657326b6 100644
--- a/guix/scripts/gc.scm
+++ b/guix/scripts/gc.scm
@@ -104,11 +104,14 @@ Invoke the garbage collector.\n"))
'()))))
(define (delete-old-generations store profile pattern)
- "Remove the generations of PROFILE that match PATTERN, a duration pattern.
-Do nothing if none matches."
+ "Remove the generations of PROFILE that match PATTERN, a duration pattern;
+do nothing if none matches. If PATTERN is #f, delete all generations but the
+current one."
(let* ((current (generation-number profile))
- (numbers (matching-generations pattern profile
- #:duration-relation >)))
+ (numbers (if (not pattern)
+ (profile-generations profile)
+ (matching-generations pattern profile
+ #:duration-relation >))))
;; Make sure we don't inadvertently remove the current generation.
(delete-generations store profile (delv current numbers))))
@@ -155,8 +158,7 @@ is deprecated; use '-D'~%"))
(when (and arg (not (string->duration arg)))
(leave (G_ "~s does not denote a duration~%")
arg))
- (alist-cons 'delete-generations (or arg "")
- result)))))
+ (alist-cons 'delete-generations arg result)))))
(option '("optimize") #f #f
(lambda (opt name arg result)
(alist-cons 'action 'optimize
@@ -287,9 +289,9 @@ is deprecated; use '-D'~%"))
(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)
+ (match (assq 'delete-generations opts)
(#f #t)
- ((? string? pattern)
+ ((_ . pattern)
(delete-generations store pattern)))
(cond
(free-space