From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 26 20:02:51 2022 Received: (at 58576) by debbugs.gnu.org; 27 Oct 2022 00:02:51 +0000 Received: from localhost ([127.0.0.1]:55552 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1onqMF-0004RP-Cg for submit@debbugs.gnu.org; Wed, 26 Oct 2022 20:02:51 -0400 Received: from mx.kolabnow.com ([212.103.80.154]:49348) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1onqMC-0004RB-QS for 58576@debbugs.gnu.org; Wed, 26 Oct 2022 20:02:50 -0400 Received: from localhost (unknown [127.0.0.1]) by mx.kolabnow.com (Postfix) with ESMTP id 1746619EB; Thu, 27 Oct 2022 02:02:43 +0200 (CEST) Authentication-Results: ext-mx-out001.mykolab.com (amavisd-new); dkim=pass (4096-bit key) reason="pass (just generated, assumed good)" header.d=kolabnow.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h= content-transfer-encoding:content-type:content-type:mime-version :message-id:in-reply-to:date:date:subject:subject:from:from :references:received:received:received; s=dkim20160331; t= 1666828962; x=1668643363; bh=IpZbI58Qs1VPpEjFQJZm6INeclhhKaft+QF nbqn6jTY=; b=xUkaWuB4iSVn7KckK5G0zn3rtijScJel6XUH1c93Yb3jTWtn1aA qGS2QVRXpWESCXdW7YBJq8B8gpQAUvM50k+xxJcfW6Is0UfzfSEGGjP0hV/ZmvGH rkm61wvXuFxXmpmIUEFiFxZA0WYvpewuDgkGojf75ytZhi98upanO/dz2iT0xEZG u2iEkp0B4UC6LG2YjlX/6UoADz6GBwN+g9gysyecfm4bSDKU9Gny+AsCp5H0yWVU 1AN5phGYyx9a5+ERkGzbiH4p3POop4MyWKO3zJBLLn7SSv3nYY0AWOKW1vJE5lNz SvwotVxD04IM25ZaK2LrvpyHdc3FxwoBR/IpCvO2jardn2gIai+cX7GRX24qVyQ/ h1bQrmoScNZWem8FPGsjB06SSHrEb9Lk6PUCOQgCGVytV8J1RXh29uqDX2+e1tE/ MUrslyzA13OiUHA6wwPNPGz26nnPf5P0Wkt/QoP4yP6BpRjVERo3fKDHiuFE0Mrs 7h22QzJ0NlokDgfZ/bawcLAvLxQpRsH8ju9RbFMxWFg7pZl7O7RwmRO0W2pu7Qwb OyzNp4s9chVNIXwwdMJmkGdxX0GGS8yaJkmlDyuXQ4vJxJ3HX4WZrgnq/91IReLX FXQWgEB9AJS1ThedTJL5oflmCCQU+bPHj1CiE15uTC44PTHZYDsMoLPs= X-Virus-Scanned: amavisd-new at mykolab.com X-Spam-Flag: NO X-Spam-Score: -1.899 X-Spam-Level: X-Spam-Status: No, score=-1.899 tagged_above=-10 required=4 tests=[BAYES_00=-1.9, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out001.mykolab.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NxiBQCwDGg-4; Thu, 27 Oct 2022 02:02:42 +0200 (CEST) Received: from int-mx001.mykolab.com (unknown [10.9.13.1]) by mx.kolabnow.com (Postfix) with ESMTPS id AF30414FA; Thu, 27 Oct 2022 02:02:41 +0200 (CEST) Received: from ext-subm003.mykolab.com (unknown [10.9.6.3]) by int-mx001.mykolab.com (Postfix) with ESMTPS id 54D3981F; Thu, 27 Oct 2022 02:02:41 +0200 (CEST) References: <20221017012843.29975-1-bauermann@kolabnow.com> <87pmeqnaus.fsf@gnu.org> From: Thiago Jung Bauermann To: Mathieu Othacehe Subject: Re: bug#58576: [PATCH] system: image: Define correct docker image arch when cross building Date: Wed, 26 Oct 2022 20:47:15 -0300 In-reply-to: <87pmeqnaus.fsf@gnu.org> Message-ID: <87tu3qgmlg.fsf@kolabnow.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 58576 Cc: Thiago Jung Bauermann , 58576@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello Mathieu, Thank you for reviewing my patch! Sorry for the delay, I've been traveling. Mathieu Othacehe writes: > Hello Thiago, > > Thanks for this patch! > >> + (image-target (or (%current-target-system) >> + (and=3D> (image-platform image) platform-tar= get) >> + (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. > > ;; The image platform definition may provide the appropriate "system" > ;; architecture for the image. If we are already running on this syste= m, > ;; the image can be built natively. If we are running on a different > ;; system, then we need to cross-compile, using the "target" provided b= y the > ;; image definition. > (define system (and=3D> 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 syste= m, no > ;; need to cross-compile. > ((and system > (string=3D? 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=3D> platform platform-target))))) > > 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? I don't think =E2=80=9C%current-target-system=E2=80=9D can be used directly= as the =E2=80=9Cimage-target=E2=80=9D value because for native builds it will be #= f and my understanding is that =E2=80=9Cbuild-docker-image=E2=80=9D would throw an e= rror when receiving #f for the =E2=80=9C#:system=E2=80=9D argument. So I still need the or expression above, but I can drop the middle expression that calls =E2=80=9Cplatform-target=E2=80=9D because it's redund= ant with the snippet you posted above. Thank you for pointing it out. I'll send a v2 with the change. --=20 Thanks Thiago