Hi,
Greg Hogan <[email protected]> skribis:
> From my x86_64 machine I am executing offload builds targeting an
> aarch64 machine:
>
> $ guix build --system=aarch64-linux --manifest=manifest.scm
>
> Several packages do not build for aarch64 and need to be filtered out.
> %current-target-system is #f as these are offload builds not cross
> compilation, and %current-system is reported as "x86_64-linux". How
> can I access the current "build system"?
Not via ‘%current-system’ because at the time the manifest is evaluated,
it can be bound to anything, as you saw.
What you could do is wrap packages in ‘let-system’, which lets you check
the “current system” as the time the object is “lowered” (untested):
(define (package-or-emptiness p)
(let-system system
(if (supported-package? p system)
p
(plain-file "emptyness" "Nothing to see here."))))
(manifest
(map (lambda (p)
(manifest-entry
(inherit (package->manifest-entry p))
(item (package-or-emptiness p))))
the-packages))
Obviously that’s not great because you still end up with entries for
non-existing packages. It’s good enough for ‘guix build -m’ though.
HTH!
Ludo’.