Patchwork [3/5] system: Optionally limit the entries returned by profile-grub-entries.

login
register
mail settings
Submitter Chris Marusich
Date Nov. 2, 2016, 5:48 a.m.
Message ID <20161102054815.11253-4-cmmarusich@gmail.com>
Download mbox | patch
Permalink /patch/17090/
State New
Headers show

Comments

Chris Marusich - Nov. 2, 2016, 5:48 a.m.
From: Chris Marusich <cmmarusich@gmail.com>

* guix/scripts/system.scm (profile-grub-entries): Add an optional parameter
which allows the caller to limit the number of returned grub entries.
---
 guix/scripts/system.scm | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
Ludovic Court├Ęs - Nov. 6, 2016, 4:57 p.m.
cmmarusich@gmail.com skribis:

> From: Chris Marusich <cmmarusich@gmail.com>
>
> * guix/scripts/system.scm (profile-grub-entries): Add an optional parameter
> which allows the caller to limit the number of returned grub entries.

Applied!

Patch

diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index eee4422..5bc40ed 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -366,8 +366,10 @@  it atomically, and then run OS's activation script."
     (date->string (time-utc->date time)
                   "~Y-~m-~d ~H:~M")))
 
-(define* (profile-grub-entries #:optional (profile %system-profile))
-  "Return a list of 'menu-entry' for the generations of PROFILE."
+(define* (profile-grub-entries #:optional (profile %system-profile)
+                                  (numbers (generation-numbers profile)))
+  "Return a list of 'menu-entry' for the generations of PROFILE specified by
+NUMBERS, which is a list of generation numbers."
   (define (system->grub-entry system number time)
     (unless-file-not-found
      (let* ((file             (string-append system "/parameters"))
@@ -395,8 +397,7 @@  it atomically, and then run OS's activation script."
                 kernel-arguments))
         (initrd initrd)))))
 
-  (let* ((numbers (generation-numbers profile))
-         (systems (map (cut generation-file-name profile <>)
+  (let* ((systems (map (cut generation-file-name profile <>)
                        numbers))
          (times   (map (lambda (system)
                          (unless-file-not-found