unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Jakub Kądziołka" <kuba@kadziolka.net>
To: 45632@debbugs.gnu.org
Subject: [bug#45632] [PATCH] guix package: Warn if uses has 'guix' package in profile.
Date: Sun,  3 Jan 2021 19:32:02 +0100	[thread overview]
Message-ID: <20210103183202.11224-1-kuba@kadziolka.net> (raw)

* guix/scripts/package.scm (warn-about-guix-in-profile): New procedure.
(process-actions): Call WARN-ABOUT-GUIX-IN-PROFILE before executing
transaction.
---

Unresolved questions:
- Is this the right place to put warn-about-guix-in-profile?
- The warning message seems to be hard-wrapped. Is this the right
  line length?
- Do we want to make this configurable? Some other warnings are, but in
  those cases it is the threshold that gets configured. In this case,
  there is no threshold.

 guix/scripts/package.scm | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 6faf2adb7a..bc42bd7d84 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2021 Jakub Kądziołka <kuba@kadziolka.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -863,6 +864,15 @@ processed, #f otherwise."
     (switch-generation . ,switch-generation-action)
     (delete-generations . ,delete-generations-action)))
 
+(define (warn-about-guix-in-profile manifest)
+  "Emit a warning if MANIFEST contains a 'guix' package."
+  (when (manifest-installed? manifest
+          (manifest-pattern
+            (name "guix")))
+    (warning (G_ "Installing the 'guix' package in a user profile is not recommended,
+as it will conflict with the installation managed by 'guix pull'. Consider running
+'guix package -r guix'.\n"))))
+
 (define (process-actions store opts)
   "Process any install/remove/upgrade action from OPTS."
 
@@ -928,6 +938,7 @@ processed, #f otherwise."
                                (manifest-entries manifest)))))
 
       (warn-about-old-distro)
+      (warn-about-guix-in-profile new)
 
       (unless (manifest-transaction-null? trans)
         ;; When '--manifest' is used, display information about TRANS as if we
-- 
2.29.2





             reply	other threads:[~2021-01-03 18:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-03 18:32 Jakub Kądziołka [this message]
2021-01-07 16:39 ` [bug#45632] [PATCH] guix package: Warn if uses has 'guix' package in profile zimoun
2021-01-07 17:11   ` Jakub Kądziołka
2021-01-07 17:46     ` zimoun
2021-01-07 20:31       ` Ricardo Wurmus
2021-01-07 17:15 ` Tobias Geerinckx-Rice via Guix-patches via
2021-01-07 17:56   ` zimoun
2021-01-07 17:58     ` Jakub Kądziołka
2021-01-07 19:25       ` zimoun

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=20210103183202.11224-1-kuba@kadziolka.net \
    --to=kuba@kadziolka.net \
    --cc=45632@debbugs.gnu.org \
    /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).