From: "Ludovic Courtès" <ludo@gnu.org>
To: Greg Hogan <code@greghogan.com>
Cc: Guix Help <help-guix@gnu.org>
Subject: Re: %current-system and --system
Date: Tue, 07 Mar 2023 17:09:21 +0100 [thread overview]
Message-ID: <87fsagbl1q.fsf@gnu.org> (raw)
In-Reply-To: <CA+3U0ZmGS8==Kk7=QNLFQz_y6MsNCxDkNGvFhO7PtOajcTdzow@mail.gmail.com> (Greg Hogan's message of "Fri, 3 Mar 2023 10:37:44 -0500")
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’.
prev parent reply other threads:[~2023-03-07 16:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-03 15:37 %current-system and --system Greg Hogan
2023-03-07 12:08 ` Efraim Flashner
2023-03-07 16:09 ` Ludovic Courtès [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fsagbl1q.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=code@greghogan.com \
--cc=help-guix@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).