Skip to contentSkip to conversation

updates for Docker

PATCH In review Alex Bennée 2 participants 10 messages Jun 4, 2018 – Jun 5, 2018 Kbuild

lore
Share & tools
lore
#0 lore raw

cover updates for Docker

Hi,

I was prompted on IRC so I've gathered together some of the outstanding docker related patches from the list. It also includes a few of the docker related tweaks from my mega TCG testing series whcih should hopefully bring the delta down. I plan to send the pull request in tomorrow if nothing comes up.

Alex.

Alex Bennée (2):
docker: add "probe" command for configure
configure: add test for docker availability

Fam Zheng (3):
Makefile: Rename TARGET_DIRS to TARGET_LIST
docker: Add fedora-i386-cross image
docker: Update fedora image to 28

Paolo Bonzini (1):
docker: test-mingw: use SDL2 and GTK+3

Philippe Mathieu-Daudé (1):
docker: add debian/tricore image

 Makefile                                      | 20 ++++++++--------
 configure                                     | 19 ++++++++++++++-
 scripts/create_config                         |  2 +-
 tests/Makefile.include                        |  2 +-
 tests/docker/Makefile.include                 |  3 +++
 tests/docker/docker.py                        | 18 +++++++++++++++
 .../dockerfiles/debian-tricore-cross.docker   | 23 +++++++++++++++++++
 .../dockerfiles/fedora-i386-cross.docker      | 14 +++++++++++
 tests/docker/dockerfiles/fedora.docker        | 10 ++++----
 tests/docker/test-mingw                       |  4 ++--
 10 files changed, 95 insertions(+), 20 deletions(-)
 create mode 100644 tests/docker/dockerfiles/debian-tricore-cross.docker
 create mode 100644 tests/docker/dockerfiles/fedora-i386-cross.docker
Signature · 1 line
2.17.0
#1 lore raw

PATCH 1/7 docker: add "probe" command for configure

This is a helper function for the configure script. It replies yes, sudo or no to inform the user if non-interactive docker support is available. We trap the Exception to fail gracefully.

---
 tests/docker/docker.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
tests/docker/docker.py +18 -0
index 1246ba9578..f8267586eb 100755
@@ -390,6 +390,24 @@ class ImagesCommand(SubCommand):
     def run(self, args, argv):
         return Docker().command("images", argv, args.quiet)
 
+
+class ProbeCommand(SubCommand):
+    """Probe if we can run docker automatically"""
+    name = "probe"
+
+    def run(self, args, argv):
+        try:
+            docker = Docker()
+            if docker._command[0] == "docker":
+                print "yes"
+            elif docker._command[0] == "sudo":
+                print "sudo"
+        except Exception:
+            print "no"
+
+        return
+
+
 def main():
     parser = argparse.ArgumentParser(description="A Docker helper",
             usage="%s <subcommand> ..." % os.path.basename(sys.argv[0]))
Signature · 1 line
2.17.0
#2 lore raw

PATCH 2/7 configure: add test for docker availability

In reply to Alex Bennée

This tests for a working docker installation without sudo and sets up config-host.mak accordingly. This will be useful from cross compiling things in the future.

---
 configure | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
configure +17 -0
index a8498ab393..2e10956cfc 100755
@@ -456,6 +456,7 @@ jemalloc="no"
 replication="yes"
 vxhs=""
 libxml2=""
+docker="no"
 
 supported_cpu="no"
 supported_os="no"
@@ -5444,6 +5445,17 @@ EOF
   fi
 fi
 
+##########################################
+# Docker and cross-compiler support
+#
+# This is specifically for building test
+# cases for foreign architectures, not
+# cross-compiling QEMU itself.
+
+if has "docker"; then
+    docker=$($python $source_path/tests/docker/docker.py probe)
+fi
+
 ##########################################
 # End of CC checks
 # After here, no more $cc or $ld runs
@@ -5907,6 +5919,7 @@ echo "avx2 optimization $avx2_opt"
 echo "replication support $replication"
 echo "VxHS block device $vxhs"
 echo "capstone          $capstone"
+echo "docker            $docker"
 
 if test "$sdl_too_old" = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -6731,6 +6744,10 @@ if test "$gcov" = "yes" ; then
   echo "GCOV=$gcov_tool" >> $config_host_mak
 fi
 
+if test "$docker" != "no"; then
+    echo "HAVE_USER_DOCKER=y" >> $config_host_mak
+fi
+
 # use included Linux headers
 if test "$linux" = "yes" ; then
   mkdir -p linux-headers
Signature · 1 line
2.17.0
#3 lore raw

PATCH 3/7 Makefile: Rename TARGET_DIRS to TARGET_LIST

In reply to Alex Bennée

From: Fam Zheng <[email protected]>

To be more accurate on its purpose and make code that looks for a certain target out of this variable more readable.

---
 Makefile               | 20 ++++++++++----------
 configure              |  2 +-
 scripts/create_config  |  2 +-
 tests/Makefile.include |  2 +-
 4 files changed, 13 insertions(+), 13 deletions(-)
Makefile +10 -10
index 6d588d1f71..023b3437ec 100644
@@ -62,8 +62,8 @@ seems to have been used for an in-tree build. You can fix this by running \
 endif
 endif
 
-CONFIG_SOFTMMU := $(if $(filter %-softmmu,$(TARGET_DIRS)),y)
-CONFIG_USER_ONLY := $(if $(filter %-user,$(TARGET_DIRS)),y)
+CONFIG_SOFTMMU := $(if $(filter %-softmmu,$(TARGET_LIST)),y)
+CONFIG_USER_ONLY := $(if $(filter %-user,$(TARGET_LIST)),y)
 CONFIG_XEN := $(CONFIG_XEN_BACKEND)
 CONFIG_ALL=y
 -include config-all-devices.mak
@@ -366,8 +366,8 @@ DOCS=
 endif
 
 SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet) BUILD_DIR=$(BUILD_DIR)
-SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
-SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_DIRS))
+SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_LIST))
+SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_LIST))
 
 ifeq ($(SUBDIR_DEVICES_MAK),)
 config-all-devices.mak:
@@ -470,7 +470,7 @@ config-host.h-timestamp: config-host.mak
 qemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"GEN","$@")
 
-SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
+SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_LIST))
 SOFTMMU_SUBDIR_RULES=$(filter %-softmmu,$(SUBDIR_RULES))
 
 $(SOFTMMU_SUBDIR_RULES): $(block-obj-y)
@@ -514,7 +514,7 @@ ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
 romsubdir-%:
 	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/" CFLAGS="$(filter -O% -g%,$(CFLAGS))",)
 
-ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS))
+ALL_SUBDIRS=$(TARGET_LIST) $(patsubst %,pc-bios/%, $(ROMS))
 
 recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
 
@@ -772,7 +772,7 @@ distclean: clean
 	rm -f docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
 	rm -f docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html
 	rm -f docs/qemu-block-drivers.7
-	for d in $(TARGET_DIRS); do \
+	for d in $(TARGET_LIST); do \
 	rm -rf $$d || exit 1 ; \
         done
 	rm -Rf .sdk
@@ -873,7 +873,7 @@ endif
 		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
 	done
 	$(INSTALL_DATA) $(BUILD_DIR)/trace-events-all "$(DESTDIR)$(qemu_datadir)/trace-events-all"
-	for d in $(TARGET_DIRS); do \
+	for d in $(TARGET_LIST); do \
 	$(MAKE) $(SUBDIR_MAKEFLAGS) TARGET_DIR=$$d/ -C $$d $@ || exit 1 ; \
         done
 
@@ -1071,9 +1071,9 @@ endif
 	@echo  '  ctags/TAGS      - Generate tags file for editors'
 	@echo  '  cscope          - Generate cscope index'
 	@echo  ''
-	@$(if $(TARGET_DIRS), \
+	@$(if $(TARGET_LIST), \
 		echo 'Architecture specific targets:'; \
-		$(foreach t, $(TARGET_DIRS), \
+		$(foreach t, $(TARGET_LIST), \
 		printf "  %-30s - Build for %s\\n" $(patsubst %,subdir-%,$(t)) $(t);) \
 		echo '')
 	@echo  'Cleaning targets:'
configure +1 -1
index 2e10956cfc..a08544dd6e 100755
@@ -6122,7 +6122,7 @@ qemu_version=$(head $source_path/VERSION)
 echo "VERSION=$qemu_version" >>$config_host_mak
 echo "PKGVERSION=$pkgversion" >>$config_host_mak
 echo "SRC_PATH=$source_path" >> $config_host_mak
-echo "TARGET_DIRS=$target_list" >> $config_host_mak
+echo "TARGET_LIST=$target_list" >> $config_host_mak
 if [ "$docs" = "yes" ] ; then
   echo "BUILD_DOCS=yes" >> $config_host_mak
 fi
scripts/create_config +1 -1
index d727e5e36e..58948a67a4 100755
@@ -107,7 +107,7 @@ case $line in
     target_name=${line#*=}
     echo "#define TARGET_NAME \"$target_name\""
     ;;
- TARGET_DIRS=*)
+ TARGET_LIST=*)
     # do nothing
     ;;
  TARGET_*=y) # configuration
tests/Makefile.include +1 -1
index 3b9a5e31a2..3d2f0458ab 100644
@@ -854,7 +854,7 @@ endif
 
 # QTest rules
 
-TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_DIRS)))
+TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_LIST)))
 ifeq ($(CONFIG_POSIX),y)
 QTEST_TARGETS = $(TARGETS)
 check-qtest-y=$(foreach TARGET,$(TARGETS), $(check-qtest-$(TARGET)-y))
Signature · 1 line
2.17.0
#4 lore raw

PATCH 4/7 docker: Add fedora-i386-cross image

In reply to Alex Bennée

From: Fam Zheng <[email protected]>

It has some basic *-devel.i686 packages to be used with "gcc -m32" as a 32 bit cross build environment.

---
 tests/docker/dockerfiles/fedora-i386-cross.docker | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 tests/docker/dockerfiles/fedora-i386-cross.docker
tests/docker/dockerfiles/fedora-i386-cross.docker new file +14 -0
new file mode 100644
index 0000000000..8fbef2fa53
@@ -0,0 +1,14 @@
+FROM fedora:latest
+ENV PACKAGES \
+    gcc \
+    glibc-static.i686 \
+    glibc-devel.i686 \
+    glib2-devel.i686 \
+    zlib-devel.i686 \
+    glib2-devel.i686 \
+    nettle-devel.i686 \
+    pixman-devel.i686 \
+    gnutls-devel.i686
+
+RUN dnf install -y $PACKAGES
+RUN rpm -q $PACKAGES | sort > /packages.txt
Signature · 1 line
2.17.0
#5 lore raw

PATCH 5/7 docker: Update fedora image to 28

In reply to Alex Bennée

From: Fam Zheng <[email protected]>

---
 tests/docker/dockerfiles/fedora.docker | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/docker/dockerfiles/fedora.docker +1 -1
index b706f42405..65d7761cf5 100644
@@ -1,4 +1,4 @@
-FROM fedora:27
+FROM fedora:28
 ENV PACKAGES \
     ccache gettext git tar PyYAML sparse flex bison python3 bzip2 hostname \
     gcc gcc-c++ llvm clang make perl which bc findutils glib2-devel \
Signature · 1 line
2.17.0
#6 lore raw

Re: [Qemu-devel] [PATCH v1 5/7] docker: Update fedora image to 28

Quoted 21 lines · Alex Bennée

From: Fam Zheng <[email protected]>

---
 tests/docker/dockerfiles/fedora.docker | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/docker/dockerfiles/fedora.docker +1 -1
index b706f42405..65d7761cf5 100644
@@ -1,4 +1,4 @@
-FROM fedora:27
+FROM fedora:28
 ENV PACKAGES \
     ccache gettext git tar PyYAML sparse flex bison python3 bzip2 hostname \
     gcc gcc-c++ llvm clang make perl which bc findutils glib2-devel \
Signature · 1 line
2.17.0

This one is in master now.

Fam

#7 lore raw

Re: [Qemu-devel] [PATCH v1 5/7] docker: Update fedora image to 28

Quoted 9 lines · Fam Zheng
Quoted 8 lines · Alex Bennée

From: Fam Zheng <[email protected]>

---
 tests/docker/dockerfiles/fedora.docker | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines
Quoted 11 lines
tests/docker/dockerfiles/fedora.docker +1 -2
index b706f42405..65d7761cf5 100644
@@ -1,4 +1,4 @@
-FROM fedora:27
+FROM fedora:28
 ENV PACKAGES \
     ccache gettext git tar PyYAML sparse flex bison python3 bzip2 hostname \
     gcc gcc-c++ llvm clang make perl which bc findutils glib2-devel \
--
Quoted 2 lines

2.17.0

This one is in master now.

Cool, rolling the pull-req for the rest now.

Quoted 2 lines

Fam

--
Alex Bennée

#8 lore raw

PATCH 6/7 docker: test-mingw: use SDL2 and GTK+3

In reply to Alex Bennée

From: Paolo Bonzini <[email protected]>

Do not test the deprecated API versions. debian-win32-cross and debian-win64-cross are already using SDL2 (they do not cover GTK+ at all).

---
 tests/docker/dockerfiles/fedora.docker | 8 ++++----
 tests/docker/test-mingw                | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)
tests/docker/dockerfiles/fedora.docker +4 -4
index 65d7761cf5..7d1d008002 100644
@@ -11,12 +11,12 @@ ENV PACKAGES \
     numactl-devel SDL2-devel snappy-devel spice-server-devel \
     systemtap-sdt-devel usbredir-devel virglrenderer-devel vte3-devel \
     xen-devel \
-    mingw32-pixman mingw32-glib2 mingw32-gmp mingw32-SDL mingw32-pkg-config \
-    mingw32-gtk2 mingw32-gtk3 mingw32-gnutls mingw32-nettle mingw32-libtasn1 \
+    mingw32-pixman mingw32-glib2 mingw32-gmp mingw32-SDL2 mingw32-pkg-config \
+    mingw32-gtk3 mingw32-gnutls mingw32-nettle mingw32-libtasn1 \
     mingw32-libjpeg-turbo mingw32-libpng mingw32-curl mingw32-libssh2 \
     mingw32-bzip2 \
-    mingw64-pixman mingw64-glib2 mingw64-gmp mingw64-SDL mingw64-pkg-config \
-    mingw64-gtk2 mingw64-gtk3 mingw64-gnutls mingw64-nettle mingw64-libtasn1 \
+    mingw64-pixman mingw64-glib2 mingw64-gmp mingw64-SDL2 mingw64-pkg-config \
+    mingw64-gtk3 mingw64-gnutls mingw64-nettle mingw64-libtasn1 \
     mingw64-libjpeg-turbo mingw64-libpng mingw64-curl mingw64-libssh2 \
     mingw64-bzip2
 ENV QEMU_CONFIGURE_OPTS --python=/usr/bin/python3
tests/docker/test-mingw +2 -2
index 503a6bc6f7..7cca7e16a6 100755
@@ -28,8 +28,8 @@ for prefix in x86_64-w64-mingw32- i686-w64-mingw32-; do
         --enable-vnc \
         --enable-bzip2 \
         --enable-guest-agent \
-        --with-sdlabi=1.2 \
-        --with-gtkabi=2.0
+        --with-sdlabi=2.0 \
+        --with-gtkabi=3.0
     install_qemu
     make clean
 
Signature · 1 line
2.17.0
#9 lore raw

PATCH 7/7 docker: add debian/tricore image

In reply to Alex Bennée

From: Philippe Mathieu-Daudé <[email protected]>

TriCore binutils is built from Bastian Koppelmann repository.

Note: There is no TriCore compiler in this image (only assembler/linker).

[AJB: base of Debian9, add to Makefile.include]
---
 tests/docker/Makefile.include                 |  3 +++
 .../dockerfiles/debian-tricore-cross.docker   | 23 +++++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 tests/docker/dockerfiles/debian-tricore-cross.docker
tests/docker/Makefile.include +3 -0
index ef1a3e62eb..f0aeb76a58 100644
@@ -62,6 +62,9 @@ docker-image-debian-win32-cross: docker-image-debian8-mxe
 docker-image-debian-win64-cross: docker-image-debian8-mxe
 docker-image-travis: NOUSER=1
 
+# Specialist build images, sometimes very limited tools
+docker-image-tricore-cross: docker-image-debian9
+
 # Expand all the pre-requistes for each docker image and test combination
 $(foreach i,$(DOCKER_IMAGES), \
 	$(foreach t,$(DOCKER_TESTS) $(DOCKER_TOOLS), \
tests/docker/dockerfiles/debian-tricore-cross.docker new file +23 -0
new file mode 100644
index 0000000000..898b8dd511
@@ -0,0 +1,23 @@
+#
+# Docker TriCore cross-compiler target
+#
+# This docker target builds on the debian Stretch base image.
+#
+# Copyright (c) 2018 Philippe Mathieu-Daudé
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+FROM debian:9
+
+MAINTAINER Philippe Mathieu-Daudé <[email protected]>
+
+RUN git clone --single-branch \
+        https://github.com/bkoppelmann/tricore-binutils.git \
+        /usr/src/binutils && \
+    cd /usr/src/binutils && chmod +x missing && \
+    CFLAGS=-w ./configure --prefix=/usr --disable-nls --target=tricore && \
+    make && make install && \
+    rm -rf /usr/src/binutils
+
+# Specify the cross prefix for this image (see tests/docker/common.rc)
+ENV QEMU_CONFIGURE_OPTS --cross-prefix=tricore-
Signature · 1 line
2.17.0