From 4d3025a1089271a4b7a4e160e52f75eca167ce1a Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Mon, 11 Sep 2017 13:39:40 -0500 Subject: [PATCH] Generate dockerfiles dynamically (#238) --- .travis.yml | 26 ++++----- contrib/README.md | 11 ++-- contrib/ci/Dockerfile-arch | 34 ------------ contrib/ci/Dockerfile-arch.in | 7 +++ contrib/ci/Dockerfile-debian | 61 --------------------- contrib/ci/Dockerfile-debian-s390x | 43 --------------- contrib/ci/Dockerfile-debian.in | 5 ++ contrib/ci/Dockerfile-fedora | 62 --------------------- contrib/ci/Dockerfile-fedora.in | 8 +++ contrib/ci/Dockerfile-ubuntu | 60 --------------------- contrib/ci/README.md | 4 +- contrib/ci/dependencies.txt | 75 ++++++++++++++++++++++++++ contrib/ci/generate_dockerfile.py | 87 ++++++++++++++++++++++++++++++ 13 files changed, 201 insertions(+), 282 deletions(-) delete mode 100644 contrib/ci/Dockerfile-arch create mode 100644 contrib/ci/Dockerfile-arch.in delete mode 100644 contrib/ci/Dockerfile-debian delete mode 100644 contrib/ci/Dockerfile-debian-s390x create mode 100644 contrib/ci/Dockerfile-debian.in delete mode 100644 contrib/ci/Dockerfile-fedora create mode 100644 contrib/ci/Dockerfile-fedora.in delete mode 100644 contrib/ci/Dockerfile-ubuntu create mode 100644 contrib/ci/dependencies.txt create mode 100755 contrib/ci/generate_dockerfile.py diff --git a/.travis.yml b/.travis.yml index e85619b3c..3ed5f180e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,22 +6,18 @@ services: - docker env: - - OS=Fedora - - OS=Debian - - OS=Arch - - OS=Debian-clang - - OS=Debian-s390x + - OS=fedora + - OS=debian + - OS=arch + - OS=debian-clang + - OS=debian-s390x install: - - if [[ "$OS" == "Fedora" ]]; then docker build -t fwupd-fedora -f contrib/ci/Dockerfile-fedora .; fi - - if [[ "$OS" == "Debian" ]]; then docker build -t fwupd-debian -f contrib/ci/Dockerfile-debian .; fi - - if [[ "$OS" == "Arch" ]]; then docker build -t fwupd-arch -f contrib/ci/Dockerfile-arch .; fi - - if [[ "$OS" == "Debian-clang" ]]; then docker build -t fwupd-debian -f contrib/ci/Dockerfile-debian .; fi - - if [[ "$OS" == "Debian-s390x" ]]; then docker build -t fwupd-debian-s390x -f contrib/ci/Dockerfile-debian-s390x .; fi + - ./contrib/ci/generate_dockerfile.py; docker build -t fwupd-$OS -f contrib/ci/Dockerfile . script: - - if [[ "$OS" == "Fedora" ]]; then docker run -e CI=true -t -v `pwd`:/build fwupd-fedora ./contrib/ci/build_and_install_rpms.sh; fi - - if [[ "$OS" == "Debian" ]]; then docker run -e CI=true -t -v `pwd`:/build fwupd-debian ./contrib/ci/build_and_install_debs.sh; fi - - if [[ "$OS" == "Arch" ]]; then docker run -e CI=true -t -v `pwd`:/build fwupd-arch ./contrib/ci/build_and_install_pkgs.sh; fi - - if [[ "$OS" == "Debian-clang" ]]; then docker run -e CC=clang -e CI=true -t -v `pwd`:/build fwupd-debian ./contrib/ci/build_and_install_debs.sh; fi - - if [[ "$OS" == "Debian-s390x" ]]; then docker run -t -v `pwd`:/build fwupd-debian-s390x ./contrib/ci/build_debian_s390x.sh; fi + - if [[ "$OS" == "fedora" ]]; then docker run -e CI=true -t -v `pwd`:/build fwupd-$OS ./contrib/ci/build_and_install_rpms.sh; fi + - if [[ "$OS" == "debian" ]]; then docker run -e CI=true -t -v `pwd`:/build fwupd-$OS ./contrib/ci/build_and_install_debs.sh; fi + - if [[ "$OS" == "arch" ]]; then docker run -e CI=true -t -v `pwd`:/build fwupd-$OS ./contrib/ci/build_and_install_pkgs.sh; fi + - if [[ "$OS" == "debian-clang" ]]; then docker run -e CC=clang -e CI=true -t -v `pwd`:/build fwupd-$OS ./contrib/ci/build_and_install_debs.sh; fi + - if [[ "$OS" == "debian-s390x" ]]; then docker run -t -v `pwd`:/build fwupd-$OS ./contrib/ci/build_debian_s390x.sh; fi diff --git a/contrib/README.md b/contrib/README.md index 16eb42b1f..e14081fdf 100644 --- a/contrib/README.md +++ b/contrib/README.md @@ -6,9 +6,10 @@ It is used regularly for continuous integration using [Travis CI](http://travis- The build can be performed using Linux containers with [Docker](www.docker.com). ## RPM packages -A Dockerfile for Fedora 25 is available here in `contrib`. +A Dockerfile for Fedora can be generated in `contrib`. To prepare the Docker container run this command: +```OS=fedora ./generate_dockerfile.py; docker build -t fwupd-fedora -f contrib/ci/Dockerfile .``` `docker build -t fwupd-fedora -f contrib/ci/Dockerfile-fedora .` @@ -19,11 +20,11 @@ To build the RPMs run this command (from the root of your git checkout): RPMs will be made available in your working directory when complete. ## DEB packages -A Dockerfile is available for Debian unstable. +A Dockerfile for Debian or Ubuntu can be generated in `contrib`. To prepare the Docker container run this command: -`docker build -t fwupd-debian -f contrib/ci/Dockerfile-debian .` +```OS=debian ./generate_dockerfile.py; docker build -t fwupd-debian -f contrib/ci/Dockerfile .``` To build the DEBs run this command (from the root of your git checkout): @@ -32,11 +33,11 @@ To build the DEBs run this command (from the root of your git checkout): DEBs will be made available in your working directory when complete. ## PKG packages -A Dockerfile is available for Arch Linux. +A Dockerfile for Arch can be generated in `contrib`. To prepare the Docker container run this command: -`docker build -t fwupd-arch -f contrib/ci/Dockerfile-arch .` +```OS=arch ./generate_dockerfile.py; docker build -t fwupd-arch -f contrib/ci/Dockerfile .``` To build the PKGs run this command (from the root of your git checkout): diff --git a/contrib/ci/Dockerfile-arch b/contrib/ci/Dockerfile-arch deleted file mode 100644 index 097e0400f..000000000 --- a/contrib/ci/Dockerfile-arch +++ /dev/null @@ -1,34 +0,0 @@ -FROM archlinux/base -# set the locale -ENV LANG en_US.UTF-8 -ENV LC_ALL en_US.UTF-8 -# keep the package DB -RUN rm /usr/share/libalpm/hooks/package-cleanup.hook -# update the image, install devel packages -RUN pacman -Syu --noconfirm -RUN pacman -S --noconfirm base-devel -# runtime deps -RUN pacman -S --noconfirm \ - appstream-glib \ - colord \ - fwupdate -# buildtime deps -RUN pacman -S --noconfirm \ - adobe-source-han-sans-cn-fonts \ - docbook-utils \ - docbook-sgml \ - gobject-introspection \ - gtk-doc \ - meson \ - perl-sgmls \ - python-cairo \ - python-gobject \ - python-pillow \ - ttf-dejavu \ - umockdev \ - valgrind -# CI dep -RUN pacman -S --noconfirm git -# prepare the build environment -RUN mkdir /build -WORKDIR /build diff --git a/contrib/ci/Dockerfile-arch.in b/contrib/ci/Dockerfile-arch.in new file mode 100644 index 000000000..07478187a --- /dev/null +++ b/contrib/ci/Dockerfile-arch.in @@ -0,0 +1,7 @@ +FROM archlinux/base +ENV LANG en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 +RUN rm /usr/share/libalpm/hooks/package-cleanup.hook +%%%INSTALL_DEPENDENCIES_COMMAND%%% +RUN mkdir /build +WORKDIR /build diff --git a/contrib/ci/Dockerfile-debian b/contrib/ci/Dockerfile-debian deleted file mode 100644 index 23e0293cb..000000000 --- a/contrib/ci/Dockerfile-debian +++ /dev/null @@ -1,61 +0,0 @@ -FROM debian:unstable - -RUN apt-get update -qq -RUN apt-get install -yq --no-install-recommends \ - clang \ - debhelper \ - devscripts \ - fakeroot \ - docbook-utils \ - fontconfig \ - fontconfig-config \ - fonts-dejavu \ - git \ - gcab \ - gettext \ - gir1.2-appstreamglib-1.0 \ - gir1.2-pango-1.0 \ - gnutls-bin \ - gnutls-dev \ - gobject-introspection \ - gtk-doc-tools \ - texlive-fonts-recommended \ - locales \ - libappstream-glib-dev \ - libarchive-dev \ - libcairo-dev \ - libcairo-gobject2 \ - libcolord-dev \ - libcolorhug-dev \ - libefivar-dev \ - libelf-dev \ - libfreetype6-dev \ - libfwup-dev \ - libgcab-dev \ - libgirepository1.0-dev \ - libglib2.0-dev \ - libgpgme11-dev \ - libgudev-1.0-dev \ - libgusb-dev \ - libpolkit-gobject-1-dev \ - libsmbios-dev \ - libsoup2.4-dev \ - libsqlite3-dev \ - libtool-bin \ - libumockdev-dev \ - lintian \ - meson \ - pkg-config \ - policykit-1 \ - python3-gi-cairo \ - python3-pil \ - udev \ - umockdev \ - systemd \ - valgrind -#deps needed only for installed tests -RUN apt-get install -yq --no-install-recommends \ - gnome-desktop-testing dbus-x11 ca-certificates \ - python3-requests -RUN mkdir /build -WORKDIR /build diff --git a/contrib/ci/Dockerfile-debian-s390x b/contrib/ci/Dockerfile-debian-s390x deleted file mode 100644 index b5fff6514..000000000 --- a/contrib/ci/Dockerfile-debian-s390x +++ /dev/null @@ -1,43 +0,0 @@ -FROM debian:unstable - -RUN cat /etc/apt/sources.list | sed "s/deb/deb-src/" >> /etc/apt/sources.list -RUN dpkg --add-architecture s390x -RUN apt-get update -qq -RUN apt-get install -yq --no-install-recommends \ - binutils-multiarch \ - gcab \ - gcc-multilib-s390x-linux-gnu \ - gettext \ - git \ - gnutls-bin \ - libappstream-glib-dev:s390x \ - libarchive-dev:s390x \ - libcairo-dev:s390x \ - libcairo-gobject2:s390x \ - libcolord-dev:s390x \ - libcolorhug-dev:s390x \ - libelf-dev:s390x \ - libfreetype6-dev:s390x \ - libgcab-dev:s390x \ - libgirepository1.0-dev \ - libglib2.0-dev:s390x \ - libgnutls28-dev:s390x \ - libgpgme-dev:s390x \ - libgudev-1.0-dev:s390x \ - libgusb-dev:s390x \ - libicu-dev:s390x \ - libidn2-0-dev:s390x \ - libpolkit-gobject-1-dev:s390x \ - libsoup2.4-dev:s390x \ - libsqlite3-dev:s390x \ - libxml2-dev:s390x \ - locales \ - meson \ - policykit-1 \ - python3-gi-cairo \ - python3-pil \ - qemu-user \ - systemd \ - udev -RUN mkdir /build -WORKDIR /build diff --git a/contrib/ci/Dockerfile-debian.in b/contrib/ci/Dockerfile-debian.in new file mode 100644 index 000000000..233e0a09b --- /dev/null +++ b/contrib/ci/Dockerfile-debian.in @@ -0,0 +1,5 @@ +FROM debian:unstable +%%%ARCH_SPECIFIC_COMMAND%%% +%%%INSTALL_DEPENDENCIES_COMMAND%%% +RUN mkdir /build +WORKDIR /build diff --git a/contrib/ci/Dockerfile-fedora b/contrib/ci/Dockerfile-fedora deleted file mode 100644 index c1bf15297..000000000 --- a/contrib/ci/Dockerfile-fedora +++ /dev/null @@ -1,62 +0,0 @@ -FROM fedora:26 - -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US:en -ENV LC_ALL en_US.UTF-8 - -RUN dnf --enablerepo=updates-testing -y update -RUN dnf --enablerepo=updates-testing -y install \ - adobe-source-han-sans-cn-fonts \ - cairo-devel \ - cairo-gobject-devel \ - colord-devel \ - dejavu-sans-fonts \ - docbook-utils \ - elfutils-libelf-devel \ - freetype \ - fontconfig \ - fwupdate-devel \ - git \ - gcab \ - gettext \ - glib2-devel \ - gobject-introspection-devel \ - gpgme-devel \ - gnutls-devel \ - gnutls-utils \ - gtk-doc \ - jq \ - libappstream-glib-devel \ - libarchive-devel \ - libgudev1-devel \ - libgusb-devel \ - libsmbios-devel \ - libsoup-devel \ - meson \ - pango-devel \ - polkit-devel \ - python3 \ - python3-cairo \ - python3-gobject \ - python3-pillow \ - rpm-build \ - redhat-rpm-config \ - sqlite-devel \ - systemd \ - umockdev-devel \ - valgrind \ - valgrind-devel \ - xz -#deps needed only for installed tests -RUN dnf --enablerepo=updates-testing -y install \ - adobe-source-han-sans-cn-fonts \ - ca-certificates \ - dbus-x11 \ - dconf \ - gnome-desktop-testing \ - polkit \ - python3-gobject \ - python3-requests \ - gnupg2 -RUN mkdir /build -WORKDIR /build diff --git a/contrib/ci/Dockerfile-fedora.in b/contrib/ci/Dockerfile-fedora.in new file mode 100644 index 000000000..2d49ece69 --- /dev/null +++ b/contrib/ci/Dockerfile-fedora.in @@ -0,0 +1,8 @@ +FROM fedora:26 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 +RUN dnf --enablerepo=updates-testing -y update +%%%INSTALL_DEPENDENCIES_COMMAND%%% +RUN mkdir /build +WORKDIR /build diff --git a/contrib/ci/Dockerfile-ubuntu b/contrib/ci/Dockerfile-ubuntu deleted file mode 100644 index a0452dcb9..000000000 --- a/contrib/ci/Dockerfile-ubuntu +++ /dev/null @@ -1,60 +0,0 @@ -FROM ubuntu:devel - -RUN apt-get update -qq -RUN apt-get install -yq --no-install-recommends \ - debhelper \ - devscripts \ - fakeroot \ - docbook-utils \ - fontconfig \ - fontconfig-config \ - fonts-dejavu \ - git \ - gcab \ - gettext \ - gir1.2-appstreamglib-1.0 \ - gir1.2-pango-1.0 \ - gnutls-bin \ - gnutls-dev \ - gobject-introspection \ - gtk-doc-tools \ - texlive-fonts-recommended \ - locales \ - libappstream-glib-dev \ - libarchive-dev \ - libcairo-dev \ - libcairo-gobject2 \ - libcolord-dev \ - libcolorhug-dev \ - libefivar-dev \ - libelf-dev \ - libfreetype6-dev \ - libfwup-dev \ - libgcab-dev \ - libgirepository1.0-dev \ - libglib2.0-dev \ - libgpgme11-dev \ - libgudev-1.0-dev \ - libgusb-dev \ - libpolkit-gobject-1-dev \ - libsmbios-dev \ - libsoup2.4-dev \ - libsqlite3-dev \ - libtool-bin \ - libumockdev-dev \ - lintian \ - meson \ - pkg-config \ - policykit-1 \ - python3-gi-cairo \ - python3-pil \ - udev \ - umockdev \ - systemd \ - valgrind -#deps needed only for installed tests -RUN apt-get install -yq --no-install-recommends \ - gnome-desktop-testing dbus-x11 ca-certificates \ - python3-requests -RUN mkdir /build -WORKDIR /build diff --git a/contrib/ci/README.md b/contrib/ci/README.md index ab8117818..5478e4f58 100644 --- a/contrib/ci/README.md +++ b/contrib/ci/README.md @@ -3,7 +3,7 @@ Continuous Integration Continuous integration for fwupd is provided by [Travis CI](https://travis-ci.org/hughsie/fwupd). By using Travis CI, builds are exercised across a variety of environments attempting to maximize code coverage. -For every commit or pull request 4 builds are performed: +For every commit or pull request 5 builds are performed: Fedora ------ @@ -42,7 +42,7 @@ Debian unstable (cross compile s390x) * Not packaged * Compiled under gcc -* Tests without -Werror enabled +* Tests with -Werror enabled * Runs local test suite using qemu-user Arch Linux diff --git a/contrib/ci/dependencies.txt b/contrib/ci/dependencies.txt new file mode 100644 index 000000000..ee58d3a49 --- /dev/null +++ b/contrib/ci/dependencies.txt @@ -0,0 +1,75 @@ +fedora, arch, debian, debian-clang, debian-s390x, +, base-devel, , , , +adobe-source-han-sans-cn-fonts, adobe-source-han-sans-cn-fonts, , , , +, , , , binutils-multiarch +ca-certificates, , ca-certificates, ca-certificates, , +, , , clang, , +cairo-devel, , libcairo-dev, libcairo-dev, libcairo-dev:s390x, +cairo-gobject-devel, , libcairo-gobject2, libcairo-gobject2, libcairo-gobject2:s390x, +colord-devel, colord, libcolord-dev, libcolord-dev, libcolord-dev:s390x, +dejavu-sans-fonts, ttf-dejavu, fonts-dejavu, fonts-dejavu, , +, , devscripts, devscripts, , +, , debhelper, debhelper, , +dbus-x11, , dbus-x11, dbus-x11, , +dconf, , , , , +docbook-utils, docbook-utils, docbook-utils, docbook-utils, , +, docbook-sgml, , , , +elfutils-libelf-devel, , libelf-dev, libelf-dev, libelf-dev:s390x, +, , fakeroot, fakeroot, , +freetype, , libfreetype6-dev, libfreetype6-dev, libfreetype6-dev:s390x, +fontconfig, , fontconfig, fontconfig, , +fwupdate-devel, fwupdate, libfwup-dev, libfwup-dev, , +gcab, , gcab, gcab, gcab, +gettext, , gettext, gettext, gettext, +gnupg2, , , , , +, , gir1.2-appstreamglib-1.0, gir1.2-appstreamglib-1.0, , +, , , , gcc-multilib-s390x-linux-gnu, +git, git, git, git, git, +glib2-devel, , libglib2.0-dev, libglib2.0-dev, libglib2.0-dev:s390x, +gobject-introspection-devel, gobject-introspection, gobject-introspection, gobject-introspection, , +gpgme-devel, , libgpgme11-dev, libgpgme11-dev, libgpgme-dev:s390x, +gnome-desktop-testing, , gnome-desktop-testing, gnome-desktop-testing, , +gnutls-devel, , gnutls-dev, gnutls-dev, libgnutls28-dev:s390x, +, , gnutls-bin, gnutls-bin, gnutls-bin, +gnutls-utils, , , , , +gtk-doc, gtk-doc, gtk-doc-tools, gtk-doc-tools, , +jq, , , , , +libappstream-glib-devel, appstream-glib, libappstream-glib-dev, libappstream-glib-dev, libappstream-glib-dev:s390x, +libarchive-devel, , libarchive-dev, libarchive-dev, libarchive-dev:s390x,, +, , libcolorhug-dev, libcolorhug-dev, libcolorhug-dev:s390x, +, , libefivar-dev, libefivar-dev, , +, , libgcab-dev, libgcab-dev, libgcab-dev:s390x, +, , libgirepository1.0-dev, libgirepository1.0-dev, libgirepository1.0-dev, +libgudev1-devel, , libgudev-1.0-dev, libgudev-1.0-dev, libgudev-1.0-dev:s390x, +libgusb-devel, , libgusb-dev, libgusb-dev, libgusb-dev:s390x, +, , , , libicu-dev:s390x, +, , , , libidn2-0-dev:s390x, +libsmbios-devel, , libsmbios-dev, libsmbios-dev, , +libsoup-devel, , libsoup2.4-dev, libsoup2.4-dev, libsoup2.4-dev:s390x, +, , libtool-bin, libtool-bin, , +, , libumockdev-dev, libumockdev-dev, , +, , , , libxml2-dev:s390x, +, , lintian, lintian, , +, , locales, locales, locales, +meson, meson, meson, meson, meson, +pango-devel, , gir1.2-pango-1.0, gir1.2-pango-1.0, , +, perl-sgmls, , , , +, , pkg-config, pkg-config, , +polkit, , policykit-1, policykit-1, policykit-1, +polkit-devel, , libpolkit-gobject-1-dev, libpolkit-gobject-1-dev, libpolkit-gobject-1-dev:s390x, +python3, , , , , +python3-cairo, python-cairo, python3-gi-cairo, python3-gi-cairo, python3-gi-cairo, +python3-gobject, python-gobject, , , , +python3-pillow, python-pillow, python3-pil, python3-pil, python3-pil, +python3-requests, , python3-requests, python3-requests, , +, , , , qemu-user, +rpm-build, , , , , +redhat-rpm-config, , , , , +sqlite-devel, , libsqlite3-dev, libsqlite3-dev, libsqlite3-dev:s390x, +systemd, , systemd, systemd, systemd, +, , texlive-fonts-recommended, texlive-fonts-recommended, , +, , udev, udev, udev, +umockdev-devel, umockdev, umockdev, umockdev, , +valgrind, valgrind, valgrind, valgrind, , +valgrind-devel, , , , , +xz, , , , , diff --git a/contrib/ci/generate_dockerfile.py b/contrib/ci/generate_dockerfile.py new file mode 100755 index 000000000..be88f7b9a --- /dev/null +++ b/contrib/ci/generate_dockerfile.py @@ -0,0 +1,87 @@ +#!/usr/bin/python3 +# +# Copyright (C) 2017 Dell Inc. +# +# Licensed under the GNU General Public License Version 2 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +import os +import sys + +directory = os.path.dirname(sys.argv[0]) +TARGET=os.getenv('OS') + +if TARGET == '': + print("Missing OS environment variable") + sys.exit(1) + +deps = [] +with open (os.path.join(directory,"dependencies.txt"), 'r') as rfd: + header = rfd.readline().split(',') + pos = -1 + for i in range(0,len(header)): + if header[i].strip() == TARGET: + pos = i + break + if pos == -1: + print("Unknown OS: %s" % TARGET) + sys.exit(1) + for line in rfd.readlines(): + dep = line.split(',')[pos].strip() + if dep == '': + continue + deps.append(dep) + +OS = TARGET +SUBOS = '' +split = TARGET.split('-') +if len(split) >= 2: + OS = split[0] + SUBOS = split[1] + +input = os.path.join(directory, "Dockerfile-%s.in" % OS) +if not os.path.exists(input): + print("Missing input file %s for %s" % (input, OS)) + sys.exit(1) + +with open(input, 'r') as rfd: + lines = rfd.readlines() + +out = os.path.join(directory, "Dockerfile") + +with open(out, 'w') as wfd: + for line in lines: + if line == "%%%INSTALL_DEPENDENCIES_COMMAND%%%\n": + if OS == "fedora": + wfd.write("RUN dnf --enablerepo=updates-testing -y install \\\n") + elif OS == "debian" or OS == "ubuntu": + wfd.write("RUN apt update -qq && \\\n") + wfd.write("\tapt install -yq --no-install-recommends\\\n") + elif OS == "arch": + wfd.write("RUN pacman -Syu --noconfirm \\\n") + for i in range(0, len(deps)): + if i < len(deps)-1: + wfd.write("\t%s \\\n" % deps[i]) + else: + wfd.write("\t%s \n" % deps[i]) + elif line == "%%%ARCH_SPECIFIC_COMMAND%%%\n": + if OS == "debian" and SUBOS == "s390x": + #add sources + wfd.write('RUN cat /etc/apt/sources.list | sed "s/deb/deb-src/" >> /etc/apt/sources.list\n') + #add new architecture + wfd.write('RUN dpkg --add-architecture %s\n' % SUBOS) + else: + wfd.write(line)