From: "Lucas Mateus Castro(alqotel)" <lucas.araujo@eldorado.org.br>
To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Cc: "Lucas Mateus Castro(alqotel)" <lucas.araujo@eldorado.org.br>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Thomas Huth" <thuth@redhat.com>,
"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
"Willian Rampazzo" <willianr@redhat.com>
Subject: [RFC PATCH 8/8] tests/docker: Selective line reading by python script
Date: Wed, 27 Jul 2022 13:36:32 -0300 [thread overview]
Message-ID: <20220727163632.59806-9-lucas.araujo@eldorado.org.br> (raw)
In-Reply-To: <20220727163632.59806-1-lucas.araujo@eldorado.org.br>
Building some images failed on ppc64le because the dockerfile tried to
install some packages that are only available in x86 and arm64, to solve
this while still having those packages be available in those architectures
a comment was put before the installation command to instruct the python
script into ignoring those lines for some architectures (in this case
ppc64le)
Overall I'm not a big fan of the way I solved this problem, so I'd like
to know if anyone has a better way to make these dockerfilse work in
PPC64LE.
For context the base images used here are available in PPC64LE but some
of the packages installed are not (in alpine's case it's XEN, which is
only available to x86 and ARM), so this patch create a ignore_list which
is set on a per-architecture basis, and any packages in a dockerfile in
this ignore_list will not be copied to the temporary dockerfile used in
the docker command.
Signed-off-by: Lucas Mateus Castro(alqotel) <lucas.araujo@eldorado.org.br>
---
tests/docker/docker.py | 15 ++++++++++++---
tests/docker/dockerfiles/alpine.docker | 2 ++
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index d0af2861b8..9b962d1c78 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -14,6 +14,7 @@
import os
import sys
import subprocess
+import platform
import json
import hashlib
import atexit
@@ -207,8 +208,15 @@ def _read_qemu_dockerfile(img_name):
def _dockerfile_preprocess(df):
out = ""
+ ignore_list = []
for l in df.splitlines():
- if len(l.strip()) == 0 or l.startswith("#"):
+ if len(l.strip()) == 0:
+ continue
+ if l.startswith("#"):
+ if len(l.split()) >= 3:
+ if l.split()[1] == "ignore":
+ if platform.processor() in l.split()[2].split(','):
+ ignore_list += l.split()[3].split(',')
continue
from_pref = "FROM qemu/"
if l.startswith(from_pref):
@@ -219,7 +227,8 @@ def _dockerfile_preprocess(df):
inlining = _read_qemu_dockerfile(l[len(from_pref):])
out += _dockerfile_preprocess(inlining)
continue
- out += l + "\n"
+ if not any(x in l.split() for x in ignore_list):
+ out += l + "\n"
return out
@@ -330,7 +339,7 @@ def build_image(self, tag, docker_dir, dockerfile,
tmp_df = tempfile.NamedTemporaryFile(mode="w+t",
encoding='utf-8',
dir=docker_dir, suffix=".docker")
- tmp_df.write(dockerfile)
+ tmp_df.write(_dockerfile_preprocess(dockerfile))
if user:
uid = os.getuid()
diff --git a/tests/docker/dockerfiles/alpine.docker b/tests/docker/dockerfiles/alpine.docker
index 2943a99730..5cec46d8f2 100644
--- a/tests/docker/dockerfiles/alpine.docker
+++ b/tests/docker/dockerfiles/alpine.docker
@@ -6,6 +6,8 @@
FROM docker.io/library/alpine:edge
+# Lines to by ignored when this file is read by the python script
+# ignore ppc64le,ppc64 xen-dev
RUN apk update && \
apk upgrade && \
apk add \
--
2.25.1
next prev parent reply other threads:[~2022-07-27 17:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-27 16:36 [PATCH 0/8] Patch series to set up a ppc64le CI Lucas Mateus Castro(alqotel)
2022-07-27 16:36 ` [PATCH 1/8] tests/docker: Fix alpine dockerfile Lucas Mateus Castro(alqotel)
2022-07-27 17:09 ` Daniel P. Berrangé
2022-07-27 17:23 ` Lucas Mateus Martins Araujo e Castro
2022-07-28 6:52 ` Thomas Huth
2022-07-28 7:06 ` Thomas Huth
2022-07-27 16:36 ` [PATCH 2/8] scripts/ci/setup: ninja missing from build-environment Lucas Mateus Castro(alqotel)
2022-07-27 16:36 ` [PATCH 3/8] scripts/ci/setup: Fix libxen requirements Lucas Mateus Castro(alqotel)
2022-09-07 17:24 ` Alex Bennée
2022-07-27 16:36 ` [PATCH 4/8] scripts/ci/setup: spice-server only on x86 aarch64 Lucas Mateus Castro(alqotel)
2022-07-27 16:36 ` [PATCH 5/8] scripts/ci/setup: Add ppc64le to vars.yml template Lucas Mateus Castro(alqotel)
2022-07-27 16:36 ` [PATCH 6/8] scripts/ci/setup: Add Fedora to build-environment.yml Lucas Mateus Castro(alqotel)
2022-07-27 16:36 ` [PATCH 7/8] scripts/ci/setup: Added debian " Lucas Mateus Castro(alqotel)
2022-07-27 16:36 ` Lucas Mateus Castro(alqotel) [this message]
2022-07-27 21:20 ` [RFC PATCH 8/8] tests/docker: Selective line reading by python script Philippe Mathieu-Daudé via
2022-07-28 8:43 ` Daniel P. Berrangé
2022-09-06 19:52 ` [PATCH 0/8] Patch series to set up a ppc64le CI Daniel Henrique Barboza
2022-09-12 12:16 ` Lucas Mateus Martins Araujo e Castro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220727163632.59806-9-lucas.araujo@eldorado.org.br \
--to=lucas.araujo@eldorado.org.br \
--cc=alex.bennee@linaro.org \
--cc=f4bug@amsat.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=thuth@redhat.com \
--cc=wainersm@redhat.com \
--cc=willianr@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.