[PATCH 0/2] Guard against producing derivations for platforms with no system

  • Open
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Christopher Baines
Owner
unassigned
Submitted by
Christopher Baines
Severity
normal
C
C
Christopher Baines wrote on 16 Jul 10:42 +0200
(address . guix-patches@gnu.org)
87ed7t7mog.fsf@cbaines.net
Christopher Baines (2):
gnu: coreutils-minimal: Don't support targets with no system.
gnu: bash-minimal: Don't support targets with no system.

gnu/packages/base.scm | 15 ++++++++++++++-
gnu/packages/bash.scm | 16 +++++++++++++++-
2 files changed, 29 insertions(+), 2 deletions(-)
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmaWMm9fFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9Xf+VxAAjD8N8uJmkKHJbHSgO/oL0DH0CIJcy8zo
JwkEiICyubpkAX2VnG1b88fdC9ejkrAZl7R4dVijvwbAqYLwHo8HSHDPgOFl7miz
VuqyzPETduX8lGmbSp+g3Byw6j/SpLlOtKbZQcJODFP1LJiLkNEruCna2U41zy2G
LlQ8U9ebq3NKWRgzQiaSs8cKRM21wvOT+gArAvvi1U9Y3GMNBKCBP6cwhB4a2n4x
0MYKs8vAqP1yreh6X0ooX/jjo0eYsWxRrowIfdHq6OgzdwA4KFm9Dd56AZcHOXmg
l3njcMtUwCvAGl4KoVPIxtigxguFzb0diiUbHgcF6LgInL+qtR6HU58Fnqc7uOjk
DXtINVoSWqvF1W71oGU2YMwoTJDAOdS4XI1fcZQ1cpnYBr9qqtn0X2fGakp7rbDe
lNCArvM+8rvssRNata9vXZR7aJ8/XXRPfe0yZV+UyNA5WaZuq5oOk6bdSUMXPHZ+
YKzOsQ1V0MgR+FG+Uqpkg1YcjLpjVAYftYIeIxUQV40sRAxDJI5E5aZ/OItAfjCv
fBqVkJ6UiatuZLWwkxKFj8AAUpJiMQBs1qq8/H/t0zoctCbUn0ACYUiLDCz4U+TV
12aTjhTte3jEnxefoJBGhMxd4nE08tpyhqXnUpGzMnht8iXNNwXx6p4vGepVtHvZ
1OjH5cgl9kw=
=TOdG
-----END PGP SIGNATURE-----

C
C
Christopher Baines wrote on 16 Jul 10:45 +0200
[PATCH 1/2] gnu: coreutils-minimal: Don't support targets with no system.
(address . 72136@debbugs.gnu.org)
7d092a3734bd2f988e03bfb28fb0ca6a0302cc86.1721119509.git.mail@cbaines.net
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(-)

Toggle diff (44 lines)
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
C
C
Christopher Baines wrote on 16 Jul 10:45 +0200
[PATCH 2/2] gnu: bash-minimal: Don't support targets with no system.
(address . 72136@debbugs.gnu.org)
db70845c54ab3d709ba99a42151db77d5bd32c46.1721119509.git.mail@cbaines.net
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(-)

Toggle diff (43 lines)
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
L
L
Ludovic Courtès wrote on 18 Jul 11:33 +0200
Re: [bug#72136] [PATCH 1/2] gnu: coreutils-minimal: Don't support targets with no system.
(name . Christopher Baines)(address . mail@cbaines.net)(address . 72136@debbugs.gnu.org)
87ikx3vybm.fsf@gnu.org
Hello,

Christopher Baines <mail@cbaines.net> skribis:

Toggle quote (9 lines)
> 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

[...]

Toggle quote (12 lines)
> + (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)))))))
> + '()))

I understand the rationale, but this raises a few issues IMO:

1. This is abusing the ‘native-inputs’ field.

2. It’s the kind of thing that should be purely declarative, much like
‘supported-systems’.

3. So far, we do not keep track of the supported cross-compilation
targets of each package, and I think it’s probably better that way:
the set of cross-compilation targets is pretty much open-ended and
we only check them on a best-effort basis, for select packages
(typically those listed in ‘packages-to-cross-build’ in (gnu ci)
and/or ‘etc/release-manifest.scm’). I think we’d rather not start
annotating packages for supported cross-compilation target.

That said, the initial problem remains: how can we ensure that the Data
Service does not attempt to compute cross-build derivations that don’t
make sense, such as Coreutils on bare-metal targets like ‘avr’?

My take is that we should bake knowledge about what makes sense to be
tested somewhere. It could be either arranging so (gnu ci) can be used
by the Data Service (it’s currently used by Cuirass), or
‘etc/release-manifest.scm’, or even just a hard-coded listed of
supported targets—we’re talking about a list of ten triplets or so,
that’s okay.

Or perhaps there’s room for something nicer in (guix platforms), but I
don’t see how we could determine whether a given package is eligible for
a bare-metal target.

Thoughts?

Ludo’.
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 72136@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 72136
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch