[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#58576] [PATCH] system: image: Define correct docker image arch when
From: |
Mathieu Othacehe |
Subject: |
[bug#58576] [PATCH] system: image: Define correct docker image arch when cross building |
Date: |
Mon, 17 Oct 2022 09:54:51 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) |
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