From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id wHWbJPoN8l8qRQAA0tVLHw (envelope-from ) for ; Sun, 03 Jan 2021 18:33:30 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id CHVJIPoN8l+aEgAAbx9fmQ (envelope-from ) for ; Sun, 03 Jan 2021 18:33:30 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id EE5FC9404E5 for ; Sun, 3 Jan 2021 18:33:29 +0000 (UTC) Received: from localhost ([::1]:42866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kw8C0-0005Fk-Qw for larch@yhetil.org; Sun, 03 Jan 2021 13:33:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44674) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kw8Bc-0005Ai-NT for guix-patches@gnu.org; Sun, 03 Jan 2021 13:33:12 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:55304) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kw8Ba-0000d8-Kq for guix-patches@gnu.org; Sun, 03 Jan 2021 13:33:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kw8Ba-0000h4-Ib for guix-patches@gnu.org; Sun, 03 Jan 2021 13:33:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#45632] [PATCH] guix package: Warn if uses has 'guix' package in profile. Resent-From: Jakub =?UTF-8?Q?K=C4=85dzio=C5=82ka?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 03 Jan 2021 18:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 45632 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 45632@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16096987352599 (code B ref -1); Sun, 03 Jan 2021 18:33:02 +0000 Received: (at submit) by debbugs.gnu.org; 3 Jan 2021 18:32:15 +0000 Received: from localhost ([127.0.0.1]:38614 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kw8Ap-0000fp-B3 for submit@debbugs.gnu.org; Sun, 03 Jan 2021 13:32:15 -0500 Received: from lists.gnu.org ([209.51.188.17]:36278) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kw8An-0000fi-Gs for submit@debbugs.gnu.org; Sun, 03 Jan 2021 13:32:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kw8An-0004rA-57 for guix-patches@gnu.org; Sun, 03 Jan 2021 13:32:13 -0500 Received: from pat.zlotemysli.pl ([37.59.186.212]:51584) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kw8Ak-0000N8-M5 for guix-patches@gnu.org; Sun, 03 Jan 2021 13:32:12 -0500 Received: (qmail 22418 invoked by uid 1009); 3 Jan 2021 19:32:07 +0100 Received: from 188.123.215.55 (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl (envelope-from , uid 1002) with qmail-scanner-2.08st (clamdscan: 0.98.6/26036. spamassassin: 3.4.0. perlscan: 2.08st. Clear:RC:1(188.123.215.55):. Processed in 0.016152 secs); 03 Jan 2021 18:32:07 -0000 Received: from unknown (HELO localhost.localdomain) (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl with AES256-SHA encrypted SMTP; 3 Jan 2021 19:32:07 +0100 From: Jakub =?UTF-8?Q?K=C4=85dzio=C5=82ka?= Date: Sun, 3 Jan 2021 19:32:02 +0100 Message-Id: <20210103183202.11224-1-kuba@kadziolka.net> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: none client-ip=37.59.186.212; envelope-from=kuba@kadziolka.net; helo=pat.zlotemysli.pl X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -1.33 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: EE5FC9404E5 X-Spam-Score: -1.33 X-Migadu-Scanner: scn0.migadu.com X-TUID: VEDMWzX7crdr * 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 ;;; Copyright © 2020 Ricardo Wurmus ;;; Copyright © 2020 Simon Tournier +;;; Copyright © 2021 Jakub Kądziołka ;;; ;;; 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