mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-06 13:02:18 +00:00
Generate dockerfiles dynamically (#238)
This commit is contained in:
parent
c1c2fec6f5
commit
4d3025a108
26
.travis.yml
26
.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
|
||||
|
@ -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):
|
||||
|
||||
|
@ -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
|
7
contrib/ci/Dockerfile-arch.in
Normal file
7
contrib/ci/Dockerfile-arch.in
Normal file
@ -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
|
@ -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
|
@ -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
|
5
contrib/ci/Dockerfile-debian.in
Normal file
5
contrib/ci/Dockerfile-debian.in
Normal file
@ -0,0 +1,5 @@
|
||||
FROM debian:unstable
|
||||
%%%ARCH_SPECIFIC_COMMAND%%%
|
||||
%%%INSTALL_DEPENDENCIES_COMMAND%%%
|
||||
RUN mkdir /build
|
||||
WORKDIR /build
|
@ -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
|
8
contrib/ci/Dockerfile-fedora.in
Normal file
8
contrib/ci/Dockerfile-fedora.in
Normal file
@ -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
|
@ -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
|
@ -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
|
||||
|
75
contrib/ci/dependencies.txt
Normal file
75
contrib/ci/dependencies.txt
Normal file
@ -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, , , , ,
|
87
contrib/ci/generate_dockerfile.py
Executable file
87
contrib/ci/generate_dockerfile.py
Executable file
@ -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)
|
Loading…
Reference in New Issue
Block a user