GNU bug report logs - #58576
[PATCH] system: image: Define correct docker image arch when cross building

Previous Next

Package: guix-patches;

Reported by: Thiago Jung Bauermann <bauermann <at> kolabnow.com>

Date: Mon, 17 Oct 2022 01:30:02 UTC

Severity: normal

Tags: moreinfo, patch

Done: Mathieu Othacehe <othacehe <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 58576 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Thiago Jung Bauermann <bauermann <at> kolabnow.com>
Cc: Thiago Jung Bauermann <thiago.bauermann <at> linaro.org>, 58576 <at> debbugs.gnu.org
Subject: Re: bug#58576: [PATCH] system: image: Define correct docker image
 arch when cross building
Date: Mon, 17 Oct 2022 09:54:51 +0200
Hello Thiago,

Thanks for this patch!

> +         (image-target (or (%current-target-system)
> +                           (and=> (image-platform image) platform-target)
> +                           (nix-system->gnu-triplet)))

There's the following snippet in "system-image" that is trying to do the
right thing (and it is not easy) with the "target" value.

--8<---------------cut here---------------start------------->8---
  ;; The image platform definition may provide the appropriate "system"
  ;; architecture for the image.  If we are already running on this system,
  ;; the image can be built natively.  If we are running on a different
  ;; system, then we need to cross-compile, using the "target" provided by the
  ;; image definition.
  (define system (and=> platform platform-system))
  (define target (cond
                  ;; No defined platform, let's use the user defined
                  ;; system/target parameters.
                  ((not platform)
                   (%current-target-system))
                  ;; The current system is the same as the platform system, no
                  ;; need to cross-compile.
                  ((and system
                        (string=? system (%current-system)))
                   #f)
                  ;; If there is a user defined target let's override the
                  ;; platform target. Otherwise, we can cross-compile to the
                  ;; platform target.
                  (else
                   (or (%current-target-system)
                       (and=> platform platform-target)))))
--8<---------------cut here---------------end--------------->8---

The rationale is that the user supplied %current-target-system is always
overriding the image platform field. Then, %current-target-system is set
to the "target" value defined above.

It makes me think that you could use %current-target-system directly as
the "image-target" value. WDYT?

Mathieu




This bug report was last modified 2 years and 202 days ago.

Previous Next


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