1# syntax=docker/dockerfile:1.0.0-experimental
2#
3# Docker setup for running the "Coverity Scan" tools over the source
4# tree and uploading them to the website, as per
5# https://scan.coverity.com/projects/qemu/builds/new
6# We do this on a fixed config (currently Fedora 30 with a known
7# set of dependencies and a configure command that enables a specific
8# set of options) so that random changes don't result in our accidentally
9# dropping some files from the scan.
10#
11# We don't build on top of the fedora.docker file because we don't
12# want to accidentally change or break the scan config when that
13# is updated.
14
15# The work of actually doing the build is handled by the
16# run-coverity-scan script.
17
18FROM registry.fedoraproject.org/fedora:37
19
20RUN dnf install -y nosync && \
21    echo -e '#!/bin/sh\n\
22if test -d /usr/lib64\n\
23then\n\
24    export LD_PRELOAD=/usr/lib64/nosync/nosync.so\n\
25else\n\
26    export LD_PRELOAD=/usr/lib/nosync/nosync.so\n\
27fi\n\
28exec "$@"' > /usr/bin/nosync && \
29    chmod +x /usr/bin/nosync && \
30    nosync dnf update -y && \
31    nosync dnf install -y \
32               SDL2-devel \
33               SDL2_image-devel \
34               alsa-lib-devel \
35               bash \
36               bc \
37               bison \
38               brlapi-devel \
39               bzip2 \
40               bzip2-devel \
41               ca-certificates \
42               capstone-devel \
43               ccache \
44               clang \
45               ctags \
46               cyrus-sasl-devel \
47               daxctl-devel \
48               dbus-daemon \
49               device-mapper-multipath-devel \
50               diffutils \
51               findutils \
52               flex \
53               fuse3-devel \
54               gcc \
55               gcc-c++ \
56               gcovr \
57               genisoimage \
58               gettext \
59               git \
60               glib2-devel \
61               glib2-static \
62               glibc-langpack-en \
63               glibc-static \
64               glusterfs-api-devel \
65               gnutls-devel \
66               gtk3-devel \
67               hostname \
68               jemalloc-devel \
69               json-c-devel \
70               libaio-devel \
71               libasan \
72               libattr-devel \
73               libbpf-devel \
74               libcacard-devel \
75               libcap-ng-devel \
76               libcmocka-devel \
77               libcurl-devel \
78               libdrm-devel \
79               libepoxy-devel \
80               libfdt-devel \
81               libffi-devel \
82               libgcrypt-devel \
83               libiscsi-devel \
84               libjpeg-devel \
85               libnfs-devel \
86               libpmem-devel \
87               libpng-devel \
88               librbd-devel \
89               libseccomp-devel \
90               libselinux-devel \
91               libslirp-devel \
92               libssh-devel \
93               libtasn1-devel \
94               libubsan \
95               liburing-devel \
96               libusbx-devel \
97               libzstd-devel \
98               llvm \
99               lttng-ust-devel \
100               lzo-devel \
101               make \
102               mesa-libgbm-devel \
103               meson \
104               ncurses-devel \
105               nettle-devel \
106               ninja-build \
107               nmap-ncat \
108               numactl-devel \
109               openssh-clients \
110               pam-devel \
111               pcre-static \
112               pixman-devel \
113               pkgconfig \
114               pulseaudio-libs-devel \
115               python3 \
116               python3-PyYAML \
117               python3-numpy \
118               python3-opencv \
119               python3-pillow \
120               python3-pip \
121               python3-sphinx \
122               python3-sphinx_rtd_theme \
123               rdma-core-devel \
124               rpm \
125               sed \
126               snappy-devel \
127               socat \
128               sparse \
129               spice-protocol \
130               spice-server-devel \
131               systemd-devel \
132               systemtap-sdt-devel \
133               tar \
134               tesseract \
135               tesseract-langpack-eng \
136               usbredir-devel \
137               util-linux \
138               virglrenderer-devel \
139               vte291-devel \
140               which \
141               xen-devel \
142               xfsprogs-devel \
143               zlib-devel \
144               zlib-static \
145               zstd && \
146    nosync dnf autoremove -y && \
147    nosync dnf clean all -y && \
148    rpm -qa | sort > /packages.txt && \
149    mkdir -p /usr/libexec/ccache-wrappers && \
150    ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/c++ && \
151    ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \
152    ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/clang && \
153    ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/g++ && \
154    ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc
155
156ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
157ENV LANG "en_US.UTF-8"
158ENV MAKE "/usr/bin/make"
159ENV NINJA "/usr/bin/ninja"
160ENV PYTHON "/usr/bin/python3"
161ENV QEMU_CONFIGURE_OPTS --meson=internal
162
163RUN dnf install -y curl wget
164ENV COVERITY_TOOL_BASE=/coverity-tools
165COPY coverity_tool.tgz coverity_tool.tgz
166RUN mkdir -p /coverity-tools/coverity_tool && cd /coverity-tools/coverity_tool && tar xf /coverity_tool.tgz
167COPY run-coverity-scan run-coverity-scan
168