From nobody Tue Feb 10 03:40:02 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1663709067; cv=none; d=zohomail.com; s=zohoarc; b=Oym5rwh+bv7sgn/vGFgByNCZPf4DGzi/J6wsZh/GHf4yssLnjDJS3LtcjIv8BNgY2BF7hFTGnfajFV0Yk2MZTlukWraR6s+jCQtEZ91xuxRb4r5VQjeAakBvKIFy1gPn3sM8AVos/JKyC/RmGNaDgFhYRTiEjWr0ng+WTMhinAw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663709067; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AnscUj/WsXzqq3s+vV4bQPFCFx5NHk6AZxIJISHW2ag=; b=h+I7LhmXniIRrF+LEdnY9eQQ+QXNkagKHywyZ4jSRTjsRbywLZJdoTDl9N/x0Amlteepu5EKSASls4fSVxPHODPEI8tV0bNbJvNqgbRnjKOwVnUJYURPkTBX2YLRUqx8XFeY5+vhS7lQwQWoIoiIEDan39MEhUT+bnvroVdwHgk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1663709067689267.0034421039064; Tue, 20 Sep 2022 14:24:27 -0700 (PDT) Received: from localhost ([::1]:37526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oakjB-0007uR-Gk for importer@patchew.org; Tue, 20 Sep 2022 17:24:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51380) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oagzb-00060c-Qh for qemu-devel@nongnu.org; Tue, 20 Sep 2022 13:25:07 -0400 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]:43971) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oagzZ-0001wd-HK for qemu-devel@nongnu.org; Tue, 20 Sep 2022 13:25:07 -0400 Received: by mail-ej1-x62f.google.com with SMTP id lh5so7812963ejb.10 for ; Tue, 20 Sep 2022 10:25:05 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id rl24-20020a170907217800b0073d7e58b1bcsm138266ejb.157.2022.09.20.10.24.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 10:24:57 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id CCC121FFD4; Tue, 20 Sep 2022 18:15:36 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=AnscUj/WsXzqq3s+vV4bQPFCFx5NHk6AZxIJISHW2ag=; b=Zd7ovdZXxz7IYhYYL7OsBAkGRlplC65dwk6Bwyz8raFopu2w4aK1xukAXtQjWQ9m7Z kb3LZJeKxagg3HK9L22koxtaMC2KHrCvZ6jXV9lhnUCeT7/RVrI9z3JRqWn0ua9vbrJW QQuzsKyc9es/R2HOSCP3zIgKzMUqBhUSCe3AVnfEhb+y85YWio44iqEJvnzLb8WbUToN vatA04IqDSUYd03h/gw6CBamnlbvgnL9Xm3f7FnJ3aVXE03mLjU1pFBpBRi6Co86jpDE Q/7jHRqjrckhZTh5I6ajRXbM5tlmjQYbhUMmilBrTkAM7ye2d++ehAhMKG8OErVqm1PI fxNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=AnscUj/WsXzqq3s+vV4bQPFCFx5NHk6AZxIJISHW2ag=; b=xT/I2NHMZuKfsEwuYEUXVXM8M7dJEmbZq/tkmSb5F1nUG+yaKzpLCb5RyWqEbQ6csX fPHM5YkBdlRu9j+rvZv7RDr14186nGaq6cO+V2xOVw8SrTdWAaRmSB1wVVZb0hMp2JD3 xAqyuR76XlaxoNqfu8MCGDNXUbijdUh8kvYry6QZtSfHBbxT6ssBs8AGVpm47ojEGXlU 1yQFL02phgwsm+JOF5SsxfnQWLCLOcCVIp64m9occaQE+OXOvZKL80Y/8PDqw5YXH4hG xDDLrFGeZ3qzFKCAABm6DEhUAdhXpc0af6nY1+/jVKQKBACENYsgI6PQn6NLtrvx1+sZ DCcw== X-Gm-Message-State: ACrzQf03YnhM2qPtOKOC/U8F+w+V9vgeJcTOuVMLC8b5VMLwpANFyThz L1si21ZF48MQgPsbHEA+06TigA== X-Google-Smtp-Source: AMsMyM4oFKAhb0a2HcP/gHJZFMLPq9DPpJ/DnLW2bErnZvjm8pPPplMBryR/dg/62UefHTg3+VTxTQ== X-Received: by 2002:a17:906:8473:b0:77b:efa8:50e4 with SMTP id hx19-20020a170906847300b0077befa850e4mr17611222ejc.250.1663694703141; Tue, 20 Sep 2022 10:25:03 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beraldo Leal Subject: [PULL 29/30] tests/docker: remove FROM qemu/ support from docker.py Date: Tue, 20 Sep 2022 18:15:32 +0100 Message-Id: <20220920171533.1098094-30-alex.bennee@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220920171533.1098094-1-alex.bennee@linaro.org> References: <20220920171533.1098094-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62f.google.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1663709068213100001 We want to migrate from docker.py to building our images directly with docker/podman. Before we get there we need to make sure we don't re-introduce our layered builds so bug out if we see FROM qemu/ in a Dockerfile. Signed-off-by: Alex Benn=C3=A9e Acked-by: Thomas Huth Reviewed-by: Richard Henderson Message-Id: <20220914155950.804707-30-alex.bennee@linaro.org> diff --git a/tests/docker/docker.py b/tests/docker/docker.py index d0af2861b8..3a1ed7cb18 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -205,22 +205,17 @@ def _read_qemu_dockerfile(img_name): return _read_dockerfile(df) =20 =20 -def _dockerfile_preprocess(df): - out =3D "" +def _dockerfile_verify_flat(df): + "Verify we do not include other qemu/ layers" for l in df.splitlines(): if len(l.strip()) =3D=3D 0 or l.startswith("#"): continue from_pref =3D "FROM qemu/" if l.startswith(from_pref): - # TODO: Alternatively we could replace this line with "FROM $I= D" - # where $ID is the image's hex id obtained with - # $ docker images $IMAGE --format=3D"{{.Id}}" - # but unfortunately that's not supported by RHEL 7. - inlining =3D _read_qemu_dockerfile(l[len(from_pref):]) - out +=3D _dockerfile_preprocess(inlining) - continue - out +=3D l + "\n" - return out + print("We no longer support multiple QEMU layers.") + print("Dockerfiles should be flat, ideally created by lcitool") + return False + return True =20 =20 class Docker(object): @@ -309,23 +304,10 @@ def build_image(self, tag, docker_dir, dockerfile, if argv is None: argv =3D [] =20 - # pre-calculate the docker checksum before any - # substitutions we make for caching - checksum =3D _text_checksum(_dockerfile_preprocess(dockerfile)) + if not _dockerfile_verify_flat(dockerfile): + return -1 =20 - if registry is not None: - sources =3D re.findall("FROM qemu\/(.*)", dockerfile) - # Fetch any cache layers we can, may fail - for s in sources: - pull_args =3D ["pull", "%s/qemu/%s" % (registry, s)] - if self._do(pull_args, quiet=3Dquiet) !=3D 0: - registry =3D None - break - # Make substitutions - if registry is not None: - dockerfile =3D dockerfile.replace("FROM qemu/", - "FROM %s/qemu/" % - (registry)) + checksum =3D _text_checksum(dockerfile) =20 tmp_df =3D tempfile.NamedTemporaryFile(mode=3D"w+t", encoding=3D'utf-8', @@ -371,7 +353,7 @@ def image_matches_dockerfile(self, tag, dockerfile): checksum =3D self.get_image_dockerfile_checksum(tag) except Exception: return False - return checksum =3D=3D _text_checksum(_dockerfile_preprocess(docke= rfile)) + return checksum =3D=3D _text_checksum(dockerfile) =20 def run(self, cmd, keep, quiet, as_user=3DFalse): label =3D uuid.uuid4().hex --=20 2.34.1