From patchwork Sun Jan 3 18:32:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Maja_K=C4=85dzio=C5=82ka?= X-Patchwork-Id: 26190 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 0751527BC0A; Sun, 3 Jan 2021 18:33:29 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 88F2527BC09 for ; Sun, 3 Jan 2021 18:33:28 +0000 (GMT) Received: from localhost ([::1]:42866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kw8Bz-0005Fk-Kl for patchwork@mira.cbaines.net; Sun, 03 Jan 2021 13:33:27 -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?b?S8SFZHppb8WCa2E=?= 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?b?S8SFZHppb8WCa2E=?= 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 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * 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