diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2016-09-09 12:49:41 +0100 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2016-09-09 12:49:41 +0100 |
| commit | c2a57aae9a1c3dd7de77daf5478df10379aeeebf (patch) | |
| tree | 558d7d0bd70a945a4d5c050fcc3a807a9f32c6dc /tests/docker/docker.py | |
| parent | 5f31bbf1015abd3fc27c7f87b8db65aba2c8164d (diff) | |
| parent | f8042deafa724924d03c44c7bd21e269ccb5190b (diff) | |
| download | focaccia-qemu-c2a57aae9a1c3dd7de77daf5478df10379aeeebf.tar.gz focaccia-qemu-c2a57aae9a1c3dd7de77daf5478df10379aeeebf.zip | |
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>
Diffstat (limited to 'tests/docker/docker.py')
| -rwxr-xr-x | tests/docker/docker.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/docker/docker.py b/tests/docker/docker.py index 222a1053fe..b85c165130 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -25,6 +25,10 @@ from tarfile import TarFile, TarInfo 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 @@ class Docker(object): 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 @@ class BuildCommand(SubCommand): # 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 |