describe: Work correctly on generation-less profiles.
authorLudovic Courtès <ludo@gnu.org>
Tue, 18 Sep 2018 20:49:41 +0000 (22:49 +0200)
committerLudovic Courtès <ludo@gnu.org>
Tue, 18 Sep 2018 21:23:44 +0000 (23:23 +0200)
Previously a command like:

  $(readlink -f ~/.config/guix/current)/bin/guix describe

would succeed without printing anything.

* guix/scripts/describe.scm (display-profile-info): Don't call
'generation-file-name' when NUMBER is zero.
* guix/scripts/pull.scm (display-profile-content): Likewise.

guix/scripts/describe.scm
guix/scripts/pull.scm

index fdff07d..c1a20fe 100644 (file)
@@ -134,8 +134,10 @@ in the format specified by FMT."
                     ;; Show most recently installed packages last.
                     (reverse
                      (manifest-entries
-                      (profile-manifest (generation-file-name profile
-                                                              number)))))))))
+                      (profile-manifest
+                       (if (zero? number)
+                           profile
+                           (generation-file-name profile number))))))))))
   (display-package-search-path fmt))
 
 \f
index 976e054..c0686f1 100644 (file)
@@ -233,7 +233,9 @@ way and displaying details about the channel's source code."
             ;; Show most recently installed packages last.
             (reverse
              (manifest-entries
-              (profile-manifest (generation-file-name profile number))))))
+              (profile-manifest (if (zero? number)
+                                    profile
+                                    (generation-file-name profile number)))))))
 
 (define (indented-string str indent)
   "Return STR with each newline preceded by IDENT spaces."