[bug#58583,v2] scripts: package: Forbid installation of the guix package.
Commit Message
* guix/scripts/package.scm (package->manifest-entry*): Fail if the
package to be installed is guix from the default channel.
---
guix/scripts/package.scm | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
Comments
Hullo.
"( via Guix-patches" via 写道:
> * guix/scripts/package.scm (package->manifest-entry*): Fail if
> the
> package to be installed is guix from the default channel.
♥
As noted elsewhere, I've come to support this, er, straightforward
approach. It might offend some readers, so let's leave this open
for comment a bit longer.
I should like to merge it before 1.4, though.
> + (report-error (G_ "the 'guix' package should not be
> installed"))
> + (newline (current-error-port))
I would write (report-error "…~%") sans (newline). If you
intentionally didn't, let's explicitly discuss that.
Kind regards,
T G-R
Heya,
On Mon Oct 17, 2022 at 5:24 PM BST, Tobias Geerinckx-Rice wrote:
> > + (report-error (G_ "the 'guix' package should not be
> > installed"))
> > + (newline (current-error-port))
>
> I would write (report-error "…~%") sans (newline). If you
> intentionally didn't, let's explicitly discuss that.
Agh, silly me. I'll correct that in a moment.
-- (
@@ -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,15 @@ (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"))
+ (newline (current-error-port))
+ (display-hint (G_ "use 'guix pull' to fetch the latest Guix revision"))
+ (exit 1))
(manifest-entry-with-provenance
(package->manifest-entry package output)))