It's nicer to use, and consistent with how we're building the native
part of the Dockerfile.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
guests/lcitool | 33 +++++++++++++++++++--------------
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/guests/lcitool b/guests/lcitool
index fb0219b..117e1a5 100755
--- a/guests/lcitool
+++ b/guests/lcitool
@@ -868,25 +868,30 @@ class Application:
sys.stdout.write(script.format(**varmap))
if cross_arch:
+ cross_commands = []
+
# Intentionally a separate RUN command from the above
# so that the common packages of all cross-built images
# share a Docker image layer.
if package_format == "deb":
- sys.stdout.write(textwrap.dedent("""
- RUN export DEBIAN_FRONTEND=noninteractive && \\
- dpkg --add-architecture {cross_arch} && \\
- {package_manager} update && \\
- {package_manager} dist-upgrade -y && \\
- {package_manager} install --no-install-recommends -y dpkg-dev
&& \\
- {package_manager} install --no-install-recommends -y {cross_pkgs}
&& \\
- {package_manager} autoremove -y && \\
- {package_manager} autoclean -y
- """).format(**varmap))
+ cross_commands.extend([
+ "export DEBIAN_FRONTEND=noninteractive",
+ "dpkg --add-architecture {cross_arch}",
+ "{package_manager} update",
+ "{package_manager} dist-upgrade -y",
+ "{package_manager} install --no-install-recommends -y
dpkg-dev",
+ "{package_manager} install --no-install-recommends -y
{cross_pkgs}",
+ "{package_manager} autoremove -y",
+ "{package_manager} autoclean -y",
+ ])
elif package_format == "rpm":
- sys.stdout.write(textwrap.dedent("""
- RUN {package_manager} install -y {cross_pkgs} && \\
- {package_manager} clean all -y
- """).format(**varmap))
+ cross_commands.extend([
+ "{package_manager} install -y {cross_pkgs}",
+ "{package_manager} clean all -y",
+ ])
+
+ cross_script = "\nRUN " + (" && \\\n
".join(cross_commands)) + "\n"
+ sys.stdout.write(cross_script.format(**varmap))
if "pip_pkgs" in varmap:
sys.stdout.write(textwrap.dedent("""
--
2.25.1