From patchwork Mon Oct 17 01:28:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thiago Jung Bauermann X-Patchwork-Id: 43455 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 50E5927BBEA; Mon, 17 Oct 2022 02:30:12 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id CE7A527BBE9 for ; Mon, 17 Oct 2022 02:30:11 +0100 (BST) Received: from localhost ([::1]:56448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okExG-0005MD-SH for patchwork@mira.cbaines.net; Sun, 16 Oct 2022 21:30:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52632) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okEx8-0005Lu-JF for guix-patches@gnu.org; Sun, 16 Oct 2022 21:30:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:47533) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1okEx8-0000fu-Ap for guix-patches@gnu.org; Sun, 16 Oct 2022 21:30:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1okEx8-0004za-5F for guix-patches@gnu.org; Sun, 16 Oct 2022 21:30:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58576] [PATCH] system: image: Define correct docker image arch when cross building Resent-From: Thiago Jung Bauermann Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 17 Oct 2022 01:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58576 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 58576@debbugs.gnu.org Cc: Thiago Jung Bauermann X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.166597015219082 (code B ref -1); Mon, 17 Oct 2022 01:30:02 +0000 Received: (at submit) by debbugs.gnu.org; 17 Oct 2022 01:29:12 +0000 Received: from localhost ([127.0.0.1]:46611 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okEwJ-0004xh-SM for submit@debbugs.gnu.org; Sun, 16 Oct 2022 21:29:12 -0400 Received: from lists.gnu.org ([209.51.188.17]:47230) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okEwH-0004xa-PI for submit@debbugs.gnu.org; Sun, 16 Oct 2022 21:29:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okEwD-0004kA-0p for guix-patches@gnu.org; Sun, 16 Oct 2022 21:29:06 -0400 Received: from mx.kolabnow.com ([212.103.80.155]:53664) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okEw9-0000ZN-V3 for guix-patches@gnu.org; Sun, 16 Oct 2022 21:29:03 -0400 Received: from localhost (unknown [127.0.0.1]) by mx.kolabnow.com (Postfix) with ESMTP id E7A70B13A; Mon, 17 Oct 2022 03:28:59 +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:date:date:subject:subject:from:from:received :received:received; s=dkim20160331; t=1665970139; x=1667784540; bh=DRuz0sx+C6jH1OHEuX9jvZZIBVCA7I+S54Ry9KNWb/Q=; b=fd1FZmWlnvan EMPQ2qcymC2L7HwxqTBtRzeVZzpFop0kSp3R7nof+YFHJQsZFGTvcRH/guNwjiDf vJDrsC+2TZrFhAC8oH72iMLRZiq5+yTV+BEs5OiuahXH4AgP/ZgJH4/Rqood2PDQ 4U9L9BapfBkTrCZ8f+kj3RXzpPXs58hFiw6/LLDjUeJ0PK4yWLo/Sh3Cbbf5CsZi x9wCfuhP1ffJ9Iu+GbUqiZvyAWiCWmi0fRPLCIdMe2BuGuTi+dJh/oMzwnQM3xzM fr0Fbx260KjKDeBf4dIHKbfnMHt+58sVq6BOwFN+6lO7ywFBiyRC85sLKJ7WN+9C NqulE34ePfDl7UPp4aEw3zOG3YxwXrHj0U9egzlVQCsSXstEbUVAHwO/8JbF6LKd OSzo/za9tWXUaeUQ2dnC13yVHr1u8h/uaq05NNKph0T0JTDJfKMViEv/WSxIbRiH jOsyIJMx2IfwYj/lyOE1tY47p9ez0Zeyg0Ctb3BQOWksDRWoR9drz6ebGsPTUv03 36aJCzuS6oER01H1S16E+1j4jqL+ROzacZ9og955iJO4zwLveigtS+ktHQtYyG/O +Ae/NEE2EieV/joyh+cXMNRY18zpDz3zW7yR5duAQ/cUOp4Sn3y0sv/vVONZS9Eu T3S77zZSLM5KmkBR7wXoz9LgfU7OZSc= X-Virus-Scanned: amavisd-new at mykolab.com 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 eOYeDU7qBxeM; Mon, 17 Oct 2022 03:28:59 +0200 (CEST) Received: from int-mx002.mykolab.com (unknown [10.9.13.2]) by mx.kolabnow.com (Postfix) with ESMTPS id 81998B137; Mon, 17 Oct 2022 03:28:58 +0200 (CEST) Received: from ext-subm002.mykolab.com (unknown [10.9.6.2]) by int-mx002.mykolab.com (Postfix) with ESMTPS id 40AD42367; Mon, 17 Oct 2022 03:28:58 +0200 (CEST) Date: Sun, 16 Oct 2022 22:28:43 -0300 Message-Id: <20221017012843.29975-1-bauermann@kolabnow.com> MIME-Version: 1.0 Received-SPF: pass client-ip=212.103.80.155; envelope-from=bauermann@kolabnow.com; helo=mx.kolabnow.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: Thiago Jung Bauermann X-ACL-Warn: , Thiago Jung Bauermann via Guix-patches X-Patchwork-Original-From: Thiago Jung Bauermann via Guix-patches via From: Thiago Jung Bauermann X-getmail-retrieved-from-mailbox: Patches From: Thiago Jung Bauermann Cross-building a docker image with: $ guix system image --image-type=docker --target=aarch64-linux-gnu os.scm results in an image where the architecture declared in its config.json is the host architecture rather than the target one. The binaries are correctly cross-compiled, so the image can be loaded and used despite the warning message shown by docker: $ docker load -i vcal7bvsqcijchifhqdvprpd1niqh8sk-docker-image.tar.gz Loaded image: guix:latest $ docker create guix:latest WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested 40f06aa869ed690489c4a3824a7f7721bd4bf453b85f25ac7199266939fe2fba $ echo $? 0 This is fixed by passing the correct triplet to the build-docker-image function. * gnu/system/image.scm (system-docker-image) Add ‘image-target’ variable. [builder]: Pass ‘#:system’ argument to ‘build-docker-image’. --- gnu/system/image.scm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gnu/system/image.scm b/gnu/system/image.scm index 5fc0d55d9a14..c6d7d13f6daf 100644 --- a/gnu/system/image.scm +++ b/gnu/system/image.scm @@ -652,6 +652,9 @@ (define shared-network? shared-network?) (list boot-program))) (substitutable? (image-substitutable? image)) + (image-target (or (%current-target-system) + (and=> (image-platform image) platform-target) + (nix-system->gnu-triplet))) (register-closures? (has-guix-service-type? os)) (schema (and register-closures? (local-file (search-path %load-path @@ -705,6 +708,7 @@ (define builder #:entry-point '(#$boot-program #$os) #:compressor '(#+(file-append gzip "/bin/gzip") "-9n") #:creation-time (make-time time-utc 0 1) + #:system #$image-target #:transformations `((,image-root -> "")))))))) (computed-file name builder