Subject: [bug#70985] [PATCH 3/4] gnu: cross-libc*: Raise conditions rather than returning #f.

From: Christopher Baines <[email-masked]>
Date: Thu, 16 May 2024 16:06:05 +0100

As this means that the error will be clearer for targets which are
unsupported.

* gnu/packages/cross-base.scm (cross-libc*): Raise conditions rather than
returning #f.

Change-Id: I820780ad738d85a98950de5608f3019e961ff7c8
---
 gnu/packages/cross-base.scm | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 2cc5f52e47..0488e397ef 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -46,6 +46,8 @@ (define-module (gnu packages cross-base)
   #:use-module (guix gexp)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
+  #:use-module (srfi srfi-34)
+  #:use-module (srfi srfi-35)
   #:use-module (ice-9 match)
   #:use-module (ice-9 regex)
   #:export (cross-binutils
@@ -671,8 +673,8 @@ (define* (cross-libc* target
                       (xbinutils (cross-binutils target))
                       (xheaders (cross-kernel-headers target)))
   "Return LIBC cross-built for TARGET, a GNU triplet. Use XGCC and XBINUTILS
-and the cross tool chain.  If TARGET doesn't have a standard C library #f is
-returned."
+and the cross tool chain.  If TARGET doesn't have a standard C library an
+exception is raised."
   (match target
    ((? target-mingw?)
     (let ((machine (substring target 0 (string-index target #\-))))
@@ -745,7 +747,11 @@ (define* (cross-libc* target
    ((? target-avr?)
     (make-avr-libc #:xbinutils xbinutils
                    #:xgcc xgcc))
-   (else #f)))
+   (else
+    (raise (condition
+            (&package-unsupported-target-error
+             (package libc)
+             (target target)))))))
 
 (define* (cross-gcc-toolchain/implementation target
                                              #:key
-- 
2.41.0