diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2017-06-22 14:33:41 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2017-06-22 14:33:42 +0100 |
commit | 469819a3e8e3ce4c8ec352fe23ad2509d0653d5c (patch) | |
tree | a546aa123079b1e8a94a89518f0291be96bdbcc4 /tests | |
parent | 22a9e1fd63ebd7254c6618f144357def75a993cb (diff) | |
parent | 32b9ca986855a5d56daf47fdb516743008788b71 (diff) |
Merge remote-tracking branch 'remotes/stsquad/tags/pull-ci-updates-210617-2' into staging
This is mostly Philippe's updates
We add the following cross-compile targets:
- mipsel-softmmu,mipsel-linux-user,mips64el-linux-user
- armeb-linux-user
While I was rolling I discovered we could also back out a bunch of the
emdebian hacks as the newly released stretch handles cross compilers
as first class citizens. Unfortunately this also meant I had to drop
the powerpc support as that is no longer in Debian stable.
# gpg: Signature made Wed 21 Jun 2017 15:09:50 BST
# gpg: using RSA key 0xFBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>"
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8 DF35 FBD0 DB09 5A9E 2A44
* remotes/stsquad/tags/pull-ci-updates-210617-2: (21 commits)
MAINTAINERS: self-appoint me as reviewer in build/test automation
MAINTAINERS: add Shippable automation platform URL
shippable: add mipsel target
shippable: add armeb-linux-user target
shippable: be verbose while building docker images
shippable: do not initialize submodules automatically
shippable: build using all available cpus
shippable: use C locale to simplify console output
docker: add mipsel build target
docker: add extra libs to s390x target to extend codebase coverage
docker: add extra libs to arm64 target to extend codebase coverage
docker: add extra libs to armhf target to extend codebase coverage
docker: use eatmydata in debian arm64 image
docker: use eatmydata in debian armhf image
docker: use eatmydata, install common build packages in base image
docker: use better regex to generate deb-src entries
docker: install ca-certificates package in base image
docker: rebuild image if 'extra files' checksum does not match
docker: add --include-files argument to 'build' command
docker: let _copy_with_mkdir() sub_path argument be optional
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-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 |
7 files changed, 103 insertions, 21 deletions
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 |