environment: gracefully handle unsupported system.

OpenSubmitted by guy fleury iteriteka.
Details
2 participants
  • guy fleury iteriteka
  • Ludovic Courtès
Owner
unassigned
Severity
normal
G
G
guy fleury iteriteka wrote on 1 Jan 2021 11:53
(address . guix-patches@gnu.org)
87v9chx71n.fsf@disroot.org
hi guix,

if this patch looks good, feel free to change message diagnostic.
From d9b4727885744abda8afc179182a2cc975122487 Mon Sep 17 00:00:00 2001
From: guy fleury iteriteka <gfleury@disroot.org>
Date: Fri, 1 Jan 2021 11:01:49 +0200
Subject: [PATCH] environment: gracefully handle unsupported system.

* guix/scripts/environment.scm(guix-environment): Add a test
to ensure that the system is supported.
---
guix/scripts/environment.scm | 4 ++++
1 file changed, 4 insertions(+)

Toggle diff (17 lines)
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index e435bf0..40af012 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -719,6 +719,10 @@ message if any test fails."
            (mappings   (pick-all opts 'file-system-mapping))
            (white-list (pick-all opts 'inherit-regexp)))
 
+      (when (not (member system '("armhf-linux" "aarch64-linux"
+                                  "i686-linux" "x86_64-linux" "i586-gnu")))
+        (leave (G_ "guix does not support ~A system~%") system))
+
       (when container? (assert-container-features))
 
       (when (and (not container?) link-prof?)
-- 
2.20.1
L
L
Ludovic Courtès wrote on 13 Jan 2021 15:37
(name . guy fleury iteriteka)(address . gfleury@disroot.org)(address . 45591@debbugs.gnu.org)
87lfcwaon2.fsf@gnu.org
Hi,

guy fleury iteriteka <gfleury@disroot.org> skribis:

Toggle quote (12 lines)
> diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
> index e435bf0..40af012 100644
> --- a/guix/scripts/environment.scm
> +++ b/guix/scripts/environment.scm
> @@ -719,6 +719,10 @@ message if any test fails."
> (mappings (pick-all opts 'file-system-mapping))
> (white-list (pick-all opts 'inherit-regexp)))
>
> + (when (not (member system '("armhf-linux" "aarch64-linux"
> + "i686-linux" "x86_64-linux" "i586-gnu")))
> + (leave (G_ "guix does not support ~A system~%") system))

The system list should not be hardcoded (there’s already such a list in
(guix packages)).

Currently the error one gets is:

$ guix environment -s does-not-exist --ad-hoc coreutils
guix environment: error: could not find bootstrap binary 'tar' for system 'does-not-exist'

I suppose that’s what you intended to improve, right?

Ludo’.
L
L
Ludovic Courtès wrote on 22 Mar 2021 18:22
control message for bug #45591
(address . control@debbugs.gnu.org)
8735wnw1b2.fsf@gnu.org
tags 45591 + moreinfo
quit
?