summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-09-21 22:35:14 +0200
committerLudovic Courtès <ludo@gnu.org>2013-09-21 22:35:14 +0200
commit99882c613ca29d0020f507b76cc6da955dd70afa (patch)
treea3629e70093778cc4b02d27809b9d61a1c9ca40f
parent4d497632ce56287cc56cfb73abad7e562129b43e (diff)
downloadguix-99882c613ca29d0020f507b76cc6da955dd70afa.tar.gz
guix package: Sort the list of generation numbers in '--list-generations'.
* guix/scripts/package.scm (generation-numbers): Sort the result.
-rw-r--r--guix/scripts/package.scm11
1 files changed, 6 insertions, 5 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index dcc2bc74aa..c0cedcd4a8 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -97,7 +97,7 @@
                               "-([0-9]+)")))
 
 (define (generation-numbers profile)
-  "Return the list of generation numbers of PROFILE, or '(0) if no
+  "Return the sorted list of generation numbers of PROFILE, or '(0) if no
 former profiles were found."
   (define* (scandir name #:optional (select? (const #t))
                     (entry<? (@ (ice-9 i18n) string-locale<?)))
@@ -140,10 +140,11 @@ former profiles were found."
     (()                                         ; no profiles
      '(0))
     ((profiles ...)                             ; former profiles around
-     (map (compose string->number
-                   (cut match:substring <> 1)
-                   (cute regexp-exec (profile-regexp profile) <>))
-          profiles))))
+     (sort (map (compose string->number
+                         (cut match:substring <> 1)
+                         (cute regexp-exec (profile-regexp profile) <>))
+                profiles)
+           <))))
 
 (define (previous-generation-number profile number)
   "Return the number of the generation before generation NUMBER of