GNU bug report logs - #70985
[PATCH 0/4] Use specific errors for unsupported targets

Previous Next

Package: guix-patches;

Reported by: Christopher Baines <mail <at> cbaines.net>

Date: Thu, 16 May 2024 15:01:02 UTC

Severity: normal

Tags: patch

Done: Christopher Baines <mail <at> cbaines.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Christopher Baines <mail <at> cbaines.net>
To: 70985 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>
Subject: [bug#70985] [PATCH 3/4] gnu: cross-libc*: Raise conditions rather than returning #f.
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





This bug report was last modified 338 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.