diff options
-rw-r--r-- | .shippable.yml | 21 | ||||
-rw-r--r-- | MAINTAINERS | 2 | ||||
-rw-r--r-- | tests/docker/Makefile.include | 4 | ||||
-rwxr-xr-x | tests/docker/docker.py | 30 | ||||
-rw-r--r-- | tests/docker/dockerfiles/debian-arm64-cross.docker | 18 | ||||
-rw-r--r-- | tests/docker/dockerfiles/debian-armhf-cross.docker | 18 | ||||
-rw-r--r-- | tests/docker/dockerfiles/debian-mipsel-cross.docker | 29 | ||||
-rw-r--r-- | tests/docker/dockerfiles/debian-s390x-cross.docker | 10 | ||||
-rw-r--r-- | tests/docker/dockerfiles/debian.docker | 15 |
9 files changed, 123 insertions, 24 deletions
diff --git a/.shippable.yml b/.shippable.yml index 653bd750fe..5e0caa65c5 100644 --- a/.shippable.yml +++ b/.shippable.yml @@ -1,15 +1,22 @@ language: c +git: + submodules: false env: + global: + - LC_ALL=C matrix: - IMAGE=debian-armhf-cross - TARGET_LIST=arm-softmmu,arm-linux-user + TARGET_LIST=arm-softmmu,arm-linux-user,armeb-linux-user - IMAGE=debian-arm64-cross TARGET_LIST=aarch64-softmmu,aarch64-linux-user - IMAGE=debian-s390x-cross TARGET_LIST=s390x-softmmu,s390x-linux-user + # mips64el-softmmu disabled due to libfdt problem + - IMAGE=debian-mipsel-cross + TARGET_LIST=mipsel-softmmu,mipsel-linux-user,mips64el-linux-user build: pre_ci: - - make docker-image-${IMAGE} + - make docker-image-${IMAGE} V=1 pre_ci_boot: image_name: qemu image_tag: ${IMAGE} @@ -17,5 +24,13 @@ build: options: "-e HOME=/root" ci: - unset CC + # some targets require newer up to date packages, for example TARGET_LIST matching + # aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu|mips64el-softmmu) + # see the configure script: + # error_exit "DTC (libfdt) version >= 1.4.2 not present. Your options:" + # " (1) Preferred: Install the DTC (libfdt) devel package" + # " (2) Fetch the DTC submodule, using:" + # " git submodule update --init dtc" + - dpkg --compare-versions `dpkg-query --showformat='${Version}' --show libfdt-dev` ge 1.4.2 || git submodule update --init dtc - ./configure ${QEMU_CONFIGURE_OPTS} --target-list=${TARGET_LIST} - - make -j2 + - make -j$(($(getconf _NPROCESSORS_ONLN) + 1)) diff --git a/MAINTAINERS b/MAINTAINERS index 05e6e963ba..7b7543a54e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1857,12 +1857,14 @@ Build and test automation ------------------------- M: Alex Bennée <alex.bennee@linaro.org> M: Fam Zheng <famz@redhat.com> +R: Philippe Mathieu-Daudé <f4bug@amsat.org> L: qemu-devel@nongnu.org S: Maintained F: .travis.yml F: .shippable.yml F: tests/docker/ W: https://travis-ci.org/qemu/qemu +W: https://app.shippable.com/github/qemu/qemu W: http://patchew.org/QEMU/ Documentation diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include index 0ed8c3d323..037cb9e9e7 100644 --- a/tests/docker/Makefile.include +++ b/tests/docker/Makefile.include @@ -51,12 +51,14 @@ docker-image-%: $(DOCKER_FILES_DIR)/%.docker $(SRC_PATH)/tests/docker/docker.py build qemu:$* $< \ $(if $V,,--quiet) $(if $(NOCACHE),--no-cache) \ $(if $(NOUSER),,--add-current-user) \ + $(if $(EXTRA_FILES),--extra-files $(EXTRA_FILES))\ $(if $(EXECUTABLE),--include-executable=$(EXECUTABLE)),\ "BUILD","$*") # Enforce dependancies for composite images docker-image-debian-armhf-cross: docker-image-debian docker-image-debian-arm64-cross: docker-image-debian +docker-image-debian-mipsel-cross: docker-image-debian # Expand all the pre-requistes for each docker image and test combination $(foreach i,$(DOCKER_IMAGES), \ @@ -107,6 +109,8 @@ docker: @echo ' NOUSER Define to disable adding current user to containers passwd.' @echo ' NOCACHE=1 Ignore cache when build images.' @echo ' EXECUTABLE=<path> Include executable in image.' + @echo ' EXTRA_FILES="<path> [... <path>]"' + @echo ' Include extra files in image.' # This rule if for directly running against an arbitrary docker target. # It is called by the expanded docker targets (e.g. make diff --git a/tests/docker/docker.py b/tests/docker/docker.py index 8747f6a440..e707e5bcca 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -38,6 +38,9 @@ def _text_checksum(text): """Calculate a digest string unique to the text content""" return hashlib.sha1(text).hexdigest() +def _file_checksum(filename): + return _text_checksum(open(filename, 'rb').read()) + def _guess_docker_command(): """ Guess a working docker command or raise exception if not found""" commands = [["docker"], ["sudo", "-n", "docker"]] @@ -52,7 +55,7 @@ def _guess_docker_command(): raise Exception("Cannot find working docker command. Tried:\n%s" % \ commands_txt) -def _copy_with_mkdir(src, root_dir, sub_path): +def _copy_with_mkdir(src, root_dir, sub_path='.'): """Copy src into root_dir, creating sub_path as needed.""" dest_dir = os.path.normpath("%s/%s" % (root_dir, sub_path)) try: @@ -154,7 +157,7 @@ class Docker(object): return labels.get("com.qemu.dockerfile-checksum", "") def build_image(self, tag, docker_dir, dockerfile, - quiet=True, user=False, argv=None): + quiet=True, user=False, argv=None, extra_files_cksum=[]): if argv == None: argv = [] @@ -170,7 +173,8 @@ class Docker(object): tmp_df.write("\n") tmp_df.write("LABEL com.qemu.dockerfile-checksum=%s" % - _text_checksum(dockerfile)) + _text_checksum("\n".join([dockerfile] + + extra_files_cksum))) tmp_df.flush() self._do(["build", "-t", tag, "-f", tmp_df.name] + argv + \ @@ -237,6 +241,10 @@ class BuildCommand(SubCommand): help="""Specify a binary that will be copied to the container together with all its dependent libraries""") + parser.add_argument("--extra-files", "-f", nargs='*', + help="""Specify files that will be copied in the + Docker image, fulfilling the ADD directive from the + Dockerfile""") parser.add_argument("--add-current-user", "-u", dest="user", action="store_true", help="Add the current user to image's passwd") @@ -270,16 +278,24 @@ class BuildCommand(SubCommand): print "%s exited with code %d" % (docker_pre, rc) return 1 - # Do we include a extra binary? + # Copy any extra files into the Docker context. These can be + # included by the use of the ADD directive in the Dockerfile. + cksum = [] if args.include_executable: - _copy_binary_with_libs(args.include_executable, - docker_dir) + # FIXME: there is no checksum of this executable and the linked + # libraries, once the image built any change of this executable + # or any library won't trigger another build. + _copy_binary_with_libs(args.include_executable, docker_dir) + for filename in args.extra_files or []: + _copy_with_mkdir(filename, docker_dir) + cksum += [_file_checksum(filename)] argv += ["--build-arg=" + k.lower() + "=" + v for k, v in os.environ.iteritems() if k.lower() in FILTERED_ENV_NAMES] dkr.build_image(tag, docker_dir, dockerfile, - quiet=args.quiet, user=args.user, argv=argv) + quiet=args.quiet, user=args.user, argv=argv, + extra_files_cksum=cksum) rmtree(docker_dir) diff --git a/tests/docker/dockerfiles/debian-arm64-cross.docker b/tests/docker/dockerfiles/debian-arm64-cross.docker index 592b5d7055..45b891d57a 100644 --- a/tests/docker/dockerfiles/debian-arm64-cross.docker +++ b/tests/docker/dockerfiles/debian-arm64-cross.docker @@ -8,8 +8,22 @@ FROM qemu:debian # Add the foreign architecture we want and install dependencies RUN dpkg --add-architecture arm64 RUN apt update -RUN apt install -yy crossbuild-essential-arm64 -RUN apt-get build-dep -yy -a arm64 qemu +RUN DEBIAN_FRONTEND=noninteractive eatmydata \ + apt-get install -y --no-install-recommends \ + crossbuild-essential-arm64 +RUN DEBIAN_FRONTEND=noninteractive eatmydata \ + apt-get build-dep -yy -a arm64 qemu # Specify the cross prefix for this image (see tests/docker/common.rc) ENV QEMU_CONFIGURE_OPTS --cross-prefix=aarch64-linux-gnu- + +RUN DEBIAN_FRONTEND=noninteractive eatmydata \ + apt-get install -y --no-install-recommends \ + glusterfs-common:arm64 \ + libbz2-dev:arm64 \ + liblzo2-dev:arm64 \ + libncursesw5-dev:arm64 \ + libnfs-dev:arm64 \ + librdmacm-dev:arm64 \ + libsnappy-dev:arm64 \ + libxen-dev:arm64 diff --git a/tests/docker/dockerfiles/debian-armhf-cross.docker b/tests/docker/dockerfiles/debian-armhf-cross.docker index 668d60aeb3..e67dfdccc5 100644 --- a/tests/docker/dockerfiles/debian-armhf-cross.docker +++ b/tests/docker/dockerfiles/debian-armhf-cross.docker @@ -8,8 +8,22 @@ FROM qemu:debian # Add the foreign architecture we want and install dependencies RUN dpkg --add-architecture armhf RUN apt update -RUN apt install -yy crossbuild-essential-armhf -RUN apt-get build-dep -yy -a armhf qemu +RUN DEBIAN_FRONTEND=noninteractive eatmydata \ + apt-get install -y --no-install-recommends \ + crossbuild-essential-armhf +RUN DEBIAN_FRONTEND=noninteractive eatmydata \ + apt-get build-dep -yy -a armhf qemu # Specify the cross prefix for this image (see tests/docker/common.rc) ENV QEMU_CONFIGURE_OPTS --cross-prefix=arm-linux-gnueabihf- + +RUN DEBIAN_FRONTEND=noninteractive eatmydata \ + apt-get install -y --no-install-recommends \ + glusterfs-common:armhf \ + libbz2-dev:armhf \ + liblzo2-dev:armhf \ + libncursesw5-dev:armhf \ + libnfs-dev:armhf \ + librdmacm-dev:armhf \ + libsnappy-dev:armhf \ + libxen-dev:armhf diff --git a/tests/docker/dockerfiles/debian-mipsel-cross.docker b/tests/docker/dockerfiles/debian-mipsel-cross.docker new file mode 100644 index 0000000000..2156bdb28d --- /dev/null +++ b/tests/docker/dockerfiles/debian-mipsel-cross.docker @@ -0,0 +1,29 @@ +# +# Docker mipsel cross-compiler target +# +# This docker target builds on the base debian image. +# +FROM qemu:debian +MAINTAINER Philippe Mathieu-Daudé <f4bug@amsat.org> + +# Add the foreign architecture we want and install dependencies +RUN dpkg --add-architecture mipsel +RUN apt-get update +RUN DEBIAN_FRONTEND=noninteractive eatmydata \ + apt-get install -y --no-install-recommends \ + crossbuild-essential-mipsel + +# Specify the cross prefix for this image (see tests/docker/common.rc) +ENV QEMU_CONFIGURE_OPTS --cross-prefix=mipsel-linux-gnu- + +RUN DEBIAN_FRONTEND=noninteractive eatmydata \ + apt-get build-dep -yy -a mipsel qemu +RUN DEBIAN_FRONTEND=noninteractive eatmydata \ + apt-get install -y --no-install-recommends \ + glusterfs-common:mipsel \ + libbz2-dev:mipsel \ + liblzo2-dev:mipsel \ + libncursesw5-dev:mipsel \ + libnfs-dev:mipsel \ + librdmacm-dev:mipsel \ + libsnappy-dev:mipsel diff --git a/tests/docker/dockerfiles/debian-s390x-cross.docker b/tests/docker/dockerfiles/debian-s390x-cross.docker index 3a687feda0..cfc354ce5d 100644 --- a/tests/docker/dockerfiles/debian-s390x-cross.docker +++ b/tests/docker/dockerfiles/debian-s390x-cross.docker @@ -20,3 +20,13 @@ RUN apt install -yy gcc-multilib-s390x-linux-gnu binutils-multiarch # Specify the cross prefix for this image (see tests/docker/common.rc) ENV QEMU_CONFIGURE_OPTS --cross-prefix=s390x-linux-gnu- + +RUN DEBIAN_FRONTEND=noninteractive \ + apt-get install -y --no-install-recommends \ + glusterfs-common:s390x \ + libbz2-dev:s390x \ + liblzo2-dev:s390x \ + libncursesw5-dev:s390x \ + libnfs-dev:s390x \ + librdmacm-dev:s390x \ + libsnappy-dev:s390x diff --git a/tests/docker/dockerfiles/debian.docker b/tests/docker/dockerfiles/debian.docker index 52bd79938e..10953b2425 100644 --- a/tests/docker/dockerfiles/debian.docker +++ b/tests/docker/dockerfiles/debian.docker @@ -9,17 +9,12 @@ # FROM debian:stable-slim -# Setup some basic tools we need -RUN apt update -RUN apt install -yy curl aptitude - -# Setup Emdebian -RUN echo "deb http://emdebian.org/tools/debian/ jessie main" >> /etc/apt/sources.list -RUN curl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | apt-key add - - # Duplicate deb line as deb-src -RUN cat /etc/apt/sources.list | sed "s/deb/deb-src/" >> /etc/apt/sources.list +RUN cat /etc/apt/sources.list | sed "s/^deb\ /deb-src /" >> /etc/apt/sources.list # Install common build utilities RUN apt update -RUN apt install -yy build-essential clang +RUN DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata +RUN DEBIAN_FRONTEND=noninteractive eatmydata \ + apt install -y --no-install-recommends \ + ca-certificates build-essential clang git bison flex |