qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: qemu-devel@nongnu.org, riku.voipio@linaro.org
Subject: Re: [Qemu-devel] [PATCH v2 3/3] add debian-bootstrap.docker target (and pre script)
Date: Sun, 12 Jun 2016 15:05:00 +0800	[thread overview]
Message-ID: <20160612070500.GN27167@ad.usersys.redhat.com> (raw)
In-Reply-To: <1465403752-30348-4-git-send-email-alex.bennee@linaro.org>

On Wed, 06/08 17:35, Alex Bennée wrote:
> Together with the debian-bootstrap.pre script can now build an arbitrary
> architecture of Debian using debootstrap. The docker script will now
> search for an associated $dockerfile.pre script which gets run in the
> same build context as the dockerfile will be. This allows debootstrap to
> set up its first stage before the container is built.
> 
> To build a container you need a command line like:
> 
>   DEB_ARCH=armhf DEB_TYPE=testing \
>     ./tests/docker/docker.py build \
>     --include-executable=arm-linux-user/qemu-arm debian:armhf \
>     ./tests/docker/dockerfiles/debian-bootstrap.docker
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> 
> ---
> v2
>   - use .pre script instead of embedded HOST_CMD
>   - make default image include all QEMU build-deps
> ---
>  tests/docker/docker.py                           |  5 +++++

Could you split the docker.py into a separate patch?

>  tests/docker/dockerfiles/debian-bootstrap.docker | 21 +++++++++++++++++++++
>  tests/docker/dockerfiles/debian-bootstrap.pre    |  5 +++++
>  3 files changed, 31 insertions(+)
>  create mode 100644 tests/docker/dockerfiles/debian-bootstrap.docker
>  create mode 100755 tests/docker/dockerfiles/debian-bootstrap.pre
> 
> diff --git a/tests/docker/docker.py b/tests/docker/docker.py
> index ed6fa45..43041eb 100755
> --- a/tests/docker/docker.py
> +++ b/tests/docker/docker.py
> @@ -205,6 +205,11 @@ class BuildCommand(SubCommand):
>              # Create a docker context directory for the build
>              docker_dir = tempfile.mkdtemp(prefix="docker_build")
>  
> +            # Is there a .pre file to run in the build context?
> +            docker_pre = os.path.splitext(args.dockerfile)[0]+".pre"
> +            if os.path.exists(docker_pre):
> +                subprocess.call(os.path.realpath(docker_pre), cwd=docker_dir)

We should probably abort here if exit code is non-zero. Use
subprocess.check_call?

Fam

> +
>              # Do we include a extra binary?
>              if args.include_executable:
>                  _copy_binary_with_libs(args.include_executable,
> diff --git a/tests/docker/dockerfiles/debian-bootstrap.docker b/tests/docker/dockerfiles/debian-bootstrap.docker
> new file mode 100644
> index 0000000..3a9125e
> --- /dev/null
> +++ b/tests/docker/dockerfiles/debian-bootstrap.docker
> @@ -0,0 +1,21 @@
> +# Create Debian Bootstrap Image
> +#
> +# This is intended to be pre-poluated by:
> +#  - a first stage debootstrap (see debian-bootstrap.pre)
> +#  - a native qemu-$arch that binfmt_misc will run
> +FROM scratch
> +
> +# Add everything from the context into the container
> +ADD . /
> +
> +# Patch all mounts as docker already has stuff set up
> +RUN sed -i 's/in_target mount/echo not for docker in_target mount/g' /debootstrap/functions
> +
> +# Run stage 2
> +RUN /debootstrap/debootstrap --second-stage
> +
> +# At this point we can install additional packages if we want
> +# Duplicate deb line as deb-src
> +RUN cat /etc/apt/sources.list | sed "s/deb/deb-src/" >> /etc/apt/sources.list
> +RUN apt-get update
> +RUN apt-get -y build-dep qemu
> diff --git a/tests/docker/dockerfiles/debian-bootstrap.pre b/tests/docker/dockerfiles/debian-bootstrap.pre
> new file mode 100755
> index 0000000..6f42da6
> --- /dev/null
> +++ b/tests/docker/dockerfiles/debian-bootstrap.pre
> @@ -0,0 +1,5 @@
> +#!/bin/sh
> +#
> +# Simple wrapper for debootstrap, run in the docker build context
> +#
> +fakeroot debootstrap --variant=buildd --foreign --arch=$DEB_ARCH $DEB_TYPE . http://httpredir.debian.org/debian
> -- 
> 2.7.4
> 

  reply	other threads:[~2016-06-12  7:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-08 16:35 [Qemu-devel] [PATCH v2 0/3] Support building qemu-user powered docker test images Alex Bennée
2016-06-08 16:35 ` [Qemu-devel] [PATCH v2 1/3] tests/docker/docker.py: docker_dir outside build Alex Bennée
2016-06-12  6:39   ` Fam Zheng
2016-06-08 16:35 ` [Qemu-devel] [PATCH v2 2/3] tests/docker/docker.py: support --include-executable Alex Bennée
2016-06-12  6:47   ` Fam Zheng
2016-06-13  9:24     ` Alex Bennée
2016-06-13 12:24   ` Riku Voipio
2016-06-08 16:35 ` [Qemu-devel] [PATCH v2 3/3] add debian-bootstrap.docker target (and pre script) Alex Bennée
2016-06-12  7:05   ` Fam Zheng [this message]
2016-06-13  9:23     ` Alex Bennée
2016-06-12  8:16 ` [Qemu-devel] [PATCH v2 0/3] Support building qemu-user powered docker test images Fam Zheng
2016-06-13  9:22   ` Alex Bennée
2016-06-13 11:11     ` Fam Zheng
2016-06-13 11:38     ` Riku Voipio
2016-06-13 12:30       ` Alex Bennée
2016-06-13 12:39         ` Riku Voipio
2016-06-13 14:19           ` Alex Bennée

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160612070500.GN27167@ad.usersys.redhat.com \
    --to=famz@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).