[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
06/09: profiles: Add 'generation-profile'.
From: |
guix-commits |
Subject: |
06/09: profiles: Add 'generation-profile'. |
Date: |
Wed, 10 Apr 2019 11:17:51 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit c872b952c527cb42766654d12059d5ea5224ca6c
Author: Ludovic Courtès <address@hidden>
Date: Sat Apr 6 23:05:27 2019 +0200
profiles: Add 'generation-profile'.
* 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 6564526..dfc9ba1 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."
- branch master updated (eff3a9b -> 3e4e74c), guix-commits, 2019/04/10
- 04/09: Add (guix store roots)., guix-commits, 2019/04/10
- 02/09: ui: Highlight diagnostic format string arguments., guix-commits, 2019/04/10
- 01/09: ui: Colorize hints., guix-commits, 2019/04/10
- 08/09: scripts: GC hint suggests 'guix gc -d 1m'., guix-commits, 2019/04/10
- 07/09: guix gc: Add '--delete-generations'., guix-commits, 2019/04/10
- 05/09: guix gc: Add '--list-roots'., guix-commits, 2019/04/10
- 03/09: pull: Remove duplicate '--dry-run' description., guix-commits, 2019/04/10
- 09/09: gnu: kodi: Allow connecting to HTTPS sources., guix-commits, 2019/04/10
- 06/09: profiles: Add 'generation-profile'.,
guix-commits <=