help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: %current-system and --system


From: Ludovic Courtès
Subject: Re: %current-system and --system
Date: Tue, 07 Mar 2023 17:09:21 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Hi,

Greg Hogan <code@greghogan.com> 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’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]