-----BEGIN PGP SIGNATURE-----

Version: GnuPG v2
 
 iQEcBAABCAAGBQJX0kCLAAoJEMo1YkxqkXHGt2oH/j9t5iSsGzbjOAmhLKW7t/hS
 r1+B6gEvyRVzFBI2hCwcauHXKMM4v8qEMeZ9n0QeMk1BSjl1PGGg7BRrp2MnotC7
 7ELT/CqLbmXqILZp+x2rVEF+y1f5GcQdgA3bQCuQ6zM34b3Zuv1OnjuOoYVKHaeJ
 YnZopSCgIzaNq0noovG76l0TTYddUEa3Nbt97XtVhTmie+1z+Fyup9gdfHLF427z
 gUIhzGzfYLN8lL1eQX70+xUF7EpLwz/aySMsp63EaZU3DQ3m4EqrR9jH8xpbC/+k
 XwwFwH/C0284pxgZStkeHlvMRChzrIvKPYcAPg7wYnILMh61LKe84w5kRwMKRBU=
 =vq7v
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/famz/tags/docker-pull-request' into staging

# gpg: Signature made Fri 09 Sep 2016 05:54:35 BST
# gpg:                using RSA key 0xCA35624C6A9171C6
# gpg: Good signature from "Fam Zheng <famz@redhat.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 5003 7CB7 9706 0F76 F021  AD56 CA35 624C 6A91 71C6

* remotes/famz/tags/docker-pull-request:
  docker: silence debootstrap when --quiet is given
  docker: build debootstrap after cloning
  docker: make sure debootstrap is at least 1.0.67
  docker: print warning if EXECUTABLE is not set when building debootstrap image
  docker: debian-bootstrap.pre: print helpful message if DEB_ARCH/DEB_TYPE unset
  docker: debian-bootstrap.pre: print error messages to stderr
  docker: avoid dependency on 'realpath' package
  docker.py: don't hang on large docker output
  docker: Add a glib2-2.22 image

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2016-09-09 12:49:41 +01:00
commit c2a57aae9a
4 changed files with 48 additions and 9 deletions

View File

@ -44,6 +44,9 @@ docker-image: ${DOCKER_TARGETS}
# General rule for building docker images
docker-image-%: $(DOCKER_FILES_DIR)/%.docker
@if test "$@" = docker-image-debian-bootstrap -a -z "$(EXECUTABLE)"; then \
echo WARNING: EXECUTABLE is not set, debootstrap may fail. 2>&1 ; \
fi
$(call quiet-command,\
$(SRC_PATH)/tests/docker/docker.py build qemu:$* $< \
$(if $V,,--quiet) $(if $(NOCACHE),--no-cache) \
@ -116,7 +119,7 @@ docker-run-%: docker-qemu-src
-e EXTRA_CONFIGURE_OPTS=$(EXTRA_CONFIGURE_OPTS) \
-e V=$V -e J=$J -e DEBUG=$(DEBUG)\
-e CCACHE_DIR=/var/tmp/ccache \
-v $$(realpath $(DOCKER_SRC_COPY)):/var/tmp/qemu:z$(COMMA)ro \
-v $$(readlink -e $(DOCKER_SRC_COPY)):/var/tmp/qemu:z$(COMMA)ro \
-v $(DOCKER_CCACHE_DIR):/var/tmp/ccache:z \
qemu:$(IMAGE) \
/var/tmp/qemu/run \

View File

@ -25,6 +25,10 @@
from StringIO import StringIO
from shutil import copy, rmtree
DEVNULL = open(os.devnull, 'wb')
def _text_checksum(text):
"""Calculate a digest string unique to the text content"""
return hashlib.sha1(text).hexdigest()
@ -34,8 +38,7 @@ def _guess_docker_command():
commands = [["docker"], ["sudo", "-n", "docker"]]
for cmd in commands:
if subprocess.call(cmd + ["images"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE) == 0:
stdout=DEVNULL, stderr=DEVNULL) == 0:
return cmd
commands_txt = "\n".join([" " + " ".join(x) for x in commands])
raise Exception("Cannot find working docker command. Tried:\n%s" % \
@ -98,7 +101,7 @@ def __init__(self):
def _do(self, cmd, quiet=True, infile=None, **kwargs):
if quiet:
kwargs["stdout"] = subprocess.PIPE
kwargs["stdout"] = DEVNULL
if infile:
kwargs["stdin"] = infile
return subprocess.call(self._command + cmd, **kwargs)
@ -236,8 +239,9 @@ def run(self, args, argv):
# 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):
stdout = DEVNULL if args.quiet else None
rc = subprocess.call(os.path.realpath(docker_pre),
cwd=docker_dir)
cwd=docker_dir, stdout=stdout)
if rc == 3:
print "Skip"
return 0

View File

@ -3,6 +3,8 @@
# Simple wrapper for debootstrap, run in the docker build context
#
FAKEROOT=`which fakeroot 2> /dev/null`
# debootstrap < 1.0.67 generates empty sources.list, see Debian#732255
MIN_DEBOOTSTRAP_VERSION=1.0.67
exit_and_skip()
{
@ -13,8 +15,21 @@ exit_and_skip()
# fakeroot is needed to run the bootstrap stage
#
if [ -z $FAKEROOT ]; then
echo "Please install fakeroot to enable bootstraping"
echo "Please install fakeroot to enable bootstraping" >&2
exit_and_skip
fi
if [ -z "${DEB_ARCH}" ]; then
echo "Please set DEB_ARCH to choose an architecture (e.g. armhf)" >&2
exit_and_skip
fi
if [ -z "${DEB_TYPE}" ]; then
echo "Please set DEB_TYPE to a Debian archive name (e.g. testing)" >&2
exit_and_skip
fi
# We check in order for
@ -27,18 +42,27 @@ fi
#
if [ -z $DEBOOTSTRAP_DIR ]; then
NEED_DEBOOTSTRAP=false
DEBOOTSTRAP=`which debootstrap 2> /dev/null`
if [ -z $DEBOOTSTRAP ]; then
echo "No debootstrap installed, attempting to install from SCM"
NEED_DEBOOTSTRAP=true
elif ! (echo "${MIN_DEBOOTSTRAP_VERSION}" ; "${DEBOOTSTRAP}" --version \
| cut -d ' ' -f 2) | sort -t . -n -k 1,1 -k 2,2 -k 3,3 -c &>/dev/null; then
echo "debootstrap too old, attempting to install from SCM"
NEED_DEBOOTSTRAP=true
fi
if $NEED_DEBOOTSTRAP; then
DEBOOTSTRAP_SOURCE=https://anonscm.debian.org/git/d-i/debootstrap.git
git clone ${DEBOOTSTRAP_SOURCE} ./debootstrap.git
export DEBOOTSTRAP_DIR=./debootstrap.git
DEBOOTSTRAP=./debootstrap.git/debootstrap
(cd "${DEBOOTSTRAP_DIR}" && "${FAKEROOT}" make )
fi
else
DEBOOTSTRAP=${DEBOOTSTRAP_DIR}/debootstrap
if [ ! -f $DEBOOTSTRAP ]; then
echo "Couldn't find script at ${DEBOOTSTRAP}"
echo "Couldn't find script at ${DEBOOTSTRAP}" >&2
exit_and_skip
fi
fi
@ -48,7 +72,7 @@ fi
#
BINFMT_DIR=/proc/sys/fs/binfmt_misc
if [ ! -e $BINFMT_DIR ]; then
echo "binfmt_misc needs enabling for a QEMU bootstrap to work"
echo "binfmt_misc needs enabling for a QEMU bootstrap to work" >&2
exit_and_skip
else
# DEB_ARCH and QEMU arch names are not totally aligned
@ -76,7 +100,7 @@ else
;;
esac
if [ ! -e "${BINFMT_DIR}/$QEMU" ]; then
echo "No binfmt_misc rule to run $QEMU, can't bootstrap"
echo "No binfmt_misc rule to run $QEMU, can't bootstrap" >&2
exit_and_skip
fi
fi

View File

@ -0,0 +1,8 @@
FROM centos:6
RUN yum install -y \
tar git make gcc g++ \
zlib-devel SDL-devel pixman-devel \
epel-release
RUN yum install -y libfdt-devel ccache
RUN yum downgrade -y http://vault.centos.org/6.0/os/x86_64/Packages/glib2-2.22.5-5.el6.x86_64.rpm
RUN yum install -y http://vault.centos.org/6.0/os/x86_64/Packages/glib2-devel-2.22.5-5.el6.x86_64.rpm