unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: "(" <paren@disroot.org>
Cc: 58583@debbugs.gnu.org
Subject: [bug#58583] [PATCH 0/1] scripts: package: Forbid installation of the guix package.
Date: Thu, 27 Oct 2022 16:11:11 -0400	[thread overview]
Message-ID: <87eduthvs0.fsf_-_@gmail.com> (raw)
In-Reply-To: <20221017165057.15648-1-paren@disroot.org> (paren@disroot.org's message of "Mon, 17 Oct 2022 17:50:57 +0100")

Hello,

"(" <paren@disroot.org> writes:

> * guix/scripts/package.scm (package->manifest-entry*): Fail if the
>   package to be installed is guix from the default channel.
> ---
>  guix/scripts/package.scm | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
> index 7ba2661bbb..9f023ea7b5 100644
> --- a/guix/scripts/package.scm
> +++ b/guix/scripts/package.scm
> @@ -12,6 +12,7 @@
>  ;;; Copyright © 2018 Steve Sprang <scs@stevesprang.com>
>  ;;; Copyright © 2022 Josselin Poiret <dev@jpoiret.xyz>
>  ;;; Copyright © 2022 Antero Mejr <antero@mailbox.org>
> +;;; Copyright © 2022 ( <paren@disroot.org>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -699,7 +700,14 @@ (define (store-item->manifest-entry item)
>  
>  (define (package->manifest-entry* package output)
>    "Like 'package->manifest-entry', but attach PACKAGE provenance meta-data to
> -the resulting manifest entry."
> +the resulting manifest entry, and report an error if PACKAGE is the 'guix'
> +package from the default channel."
> +  (when (and (string=? (package-name package) "guix")
> +             (string-prefix? "gnu/" (location-file
> +                                     (package-location package))))
> +    (report-error (G_ "the 'guix' package should not be installed~%"))
> +    (display-hint (G_ "use 'guix pull' to fetch the latest Guix revision"))
> +    (exit 1))
>    (manifest-entry-with-provenance
>     (package->manifest-entry package output)))

Instead of exiting directly here, would it make sense to use
raise-exception with a compounded message and &fix-hint condition?  When
working with the Guix API, I prefer to encounter exceptions rather than
errors + exit.  For a recent example I used, see:
https://issues.guix.gnu.org/58812#5-lineno360.

-- 
Thanks,
Maxim




      parent reply	other threads:[~2022-10-27 20:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-17 12:16 [bug#58583] [PATCH 0/1] scripts: package: Forbid installation of the guix package ( via Guix-patches via
2022-10-17 12:18 ` [bug#58583] [PATCH 1/1] " ( via Guix-patches via
2022-10-17 12:22 ` [bug#58583] [PATCH v2] " ( via Guix-patches via
2022-10-17 16:24   ` Tobias Geerinckx-Rice via Guix-patches via
2022-10-17 16:43     ` ( via Guix-patches via
2022-10-17 16:50 ` [bug#58583] [PATCH v3] " ( via Guix-patches via
2022-10-17 18:14   ` zimoun
2022-10-27 20:04     ` [bug#58583] [PATCH 0/1] " Maxim Cournoyer
2022-10-28  7:44       ` zimoun
2022-10-28 14:31         ` ( via Guix-patches via
2022-10-28 15:47         ` Maxim Cournoyer
2022-10-28 16:20         ` Tobias Geerinckx-Rice via Guix-patches via
2022-10-28 17:01           ` Tobias Geerinckx-Rice via Guix-patches via
2022-11-02 11:47         ` zimoun
2022-11-02 13:19           ` Tobias Geerinckx-Rice via Guix-patches via
2022-11-02 15:48             ` zimoun
2022-11-03 15:03               ` Maxim Cournoyer
2022-11-03 18:32                 ` zimoun
2022-10-27 20:11   ` Maxim Cournoyer [this message]

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=87eduthvs0.fsf_-_@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=58583@debbugs.gnu.org \
    --cc=paren@disroot.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).