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

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

Since I believe coreutils-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 (coreutils-minimal)[native-inputs]: Check the target
if there is one.

Change-Id: Id37cf6ac0b63226261a85a00699dfd06188c1475
---
 gnu/packages/base.scm | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 66c5b7d237..05c3278e2e 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -67,6 +67,7 @@ (define-module (gnu packages base)
   #:use-module (guix utils)
   #:use-module (guix gexp)
   #:use-module (guix packages)
+  #:use-module (guix platform)
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
@@ -76,6 +77,8 @@ (define-module (gnu packages base)
   #:use-module (ice-9 optargs)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
+  #:use-module (srfi srfi-34)
+  #:use-module (srfi srfi-35)
   #:export (glibc
             libc-for-target
             libc-locales-for-target
@@ -537,7 +540,17 @@ (define-public coreutils-minimal
     (inherit coreutils)
     (name "coreutils-minimal")
     (outputs '("out"))
-    (native-inputs '())
+    (native-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)))))))
+       '()))
     (inputs '())))
 
 (define-public coreutils-8.30

base-commit: bf6ab0e0f5066d999e027a7eb8ecf05db71123ce
-- 
2.45.2