unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Xinglu Chen <public@yoctocell.xyz>
To: 50982@debbugs.gnu.org
Cc: Maxime Devos <maximedevos@telenet.be>
Subject: [bug#50982] [PATCH] scripts: home/system: Don’t throw an error if no generations exist.
Date: Sat, 02 Oct 2021 23:05:48 +0200	[thread overview]
Message-ID: <8c1286034c3a48353d13515f04883dbede289e0c.1633208618.git.public@yoctocell.xyz> (raw)

Previously, When running ‘guix home describe’ or ‘guix system describe’ prior
to having any generations, a backtrace would produced.  Since not having any
existing generations is not an error, a warning would be enough.

  $ guix system describe
  guix system: warning: no system generation, nothing to describe

* guix/scripts/home.scm (process-command): Produce a warning instead of an
error if no generations exist.
* guix/scripts/system.scm (process-command): Likewise.

Fixes: <https://issues.guix.gnu.org/50978>
Reported-by: Maxime Devos <maximedevos@telenet.be>
---
 guix/scripts/home.scm   | 2 +-
 guix/scripts/system.scm | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/guix/scripts/home.scm b/guix/scripts/home.scm
index 75df6d707d..70860564eb 100644
--- a/guix/scripts/home.scm
+++ b/guix/scripts/home.scm
@@ -260,7 +260,7 @@ (define-syntax-rule (with-store* store exp ...)
     ((describe)
      (match (generation-number %guix-home)
        (0
-        (error (G_ "no home environment generation, nothing to describe~%")))
+        (warning (G_ "no home environment generation, nothing to describe~%")))
        (generation
         (display-home-environment-generation generation))))
     ((list-generations)
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 65eb98e4b2..d77d3ea289 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -1307,7 +1307,7 @@ (define-syntax-rule (with-store* store exp ...)
     ((describe)
      (match (generation-number %system-profile)
        (0
-        (error (G_ "no system generation, nothing to describe~%")))
+        (warning (G_ "no system generation, nothing to describe~%")))
        (generation
         (display-system-generation generation))))
     ((search)

base-commit: f1a3c11407b52004e523ec5de20d326c5661681f
-- 
2.33.0







             reply	other threads:[~2021-10-02 21:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-02 21:05 Xinglu Chen [this message]
2021-10-03  8:53 ` [bug#50982] [PATCH] scripts: home/system: Don’t throw an error if no generations exist Maxime Devos
2021-10-19 13:59   ` Ludovic Courtès
2021-10-30 11:18   ` Xinglu Chen
2021-10-30 14:24     ` Ludovic Courtès
2022-01-06 10:28   ` bug#50982: " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8c1286034c3a48353d13515f04883dbede289e0c.1633208618.git.public@yoctocell.xyz \
    --to=public@yoctocell.xyz \
    --cc=50982@debbugs.gnu.org \
    --cc=maximedevos@telenet.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).