Subject: [PATCH 2/2] gnu: bash-minimal: Don't support targets with no system.

From: Christopher Baines <[email-masked]>
Date: Tue, 16 Jul 2024 09:45:09 +0100

Since I believe bash-minimal will fail to build for these targets, this will
catch this early and display a clear message for both this package and
packages using it as an input.

* gnu/packages/base.scm (bash-minimal)[inputs]: Check the target if there is
one.

Change-Id: I3768c7fa05f5375a1227551e2b7ae66a741ef93d
---
 gnu/packages/bash.scm | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/bash.scm b/gnu/packages/bash.scm
index 9ecec0a484..c29400c1e4 100644
--- a/gnu/packages/bash.scm
+++ b/gnu/packages/bash.scm
@@ -41,6 +41,7 @@ (define-module (gnu packages bash)
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages less)
   #:use-module (guix packages)
+  #:use-module (guix platform)
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix utils)
@@ -57,6 +58,8 @@ (define-module (gnu packages bash)
 
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
+  #:use-module (srfi srfi-34)
+  #:use-module (srfi srfi-35)
   #:use-module (ice-9 format))
 
 (define (patch-url seqno)
@@ -226,7 +229,18 @@ (define-public bash-minimal
   ;; A stripped-down Bash for non-interactive use.
   (package (inherit bash)
     (name "bash-minimal")
-    (inputs '())                                ; no readline, no curses
+    (inputs
+     (begin
+       (let ((target (%current-target-system)))
+         (when target
+           (unless (platform-system (lookup-platform-by-target target))
+             (raise
+              (condition
+               (&package-unsupported-target-error
+                (package this-package)
+                (target target)))))))
+
+       '()))                            ; no readline, no curses
 
     ;; No "include" output because there's no support for loadable modules.
     (outputs (delete "include" (package-outputs bash)))
-- 
2.45.2