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.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJZSn4uAAoJEPvQ2wlanipE8+wH/jdr1A3AUrxvQh5PNivAxKr7
 FnDBNl41egWqmGSjE+pjJ5lZIVozg5cs8/WZnrOKcjnBk+eCitWI8cbE1nvJRMRL
 71MVdy4bYgNCX1iVSbl/OmZqMdunmIrQXb9YxdIkbOOjAIFAacd16xorRcgtOPS/
 /3H1zkBOnn16tHjGpQENBZQK3h0Rh5pKGQg8cG5d81i/38DTIlDO2vdgs0Hb7yHK
 WZwrlQctkb6MvPTp0vvNj17Z0KYeLqXBKxvKVNEmLoqSt4e1Tocz9kukWyPInocY
 u575XM3haUSuPqUD8EO1db4G52iWsOIz4M4S/1Rzr6/W4QWGXScvUauEJDZGvNA=
 =g+BN
 -----END PGP SIGNATURE-----

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>
This commit is contained in:
Peter Maydell 2017-06-22 14:33:41 +01:00
commit 469819a3e8
9 changed files with 123 additions and 24 deletions

View File

@ -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))

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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