[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/16] tests/docker: fix update command due to python3 str/bytes d
From: |
Alex Bennée |
Subject: |
[PULL 09/16] tests/docker: fix update command due to python3 str/bytes distinction |
Date: |
Mon, 27 Jul 2020 13:23:50 +0100 |
Does this seem convoluted to you? It feels a little complicated to me.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20200724064509.331-10-alex.bennee@linaro.org>
diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index c9f20d8d093..356d7618f1a 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -24,7 +24,7 @@ import tempfile
import re
import signal
from tarfile import TarFile, TarInfo
-from io import StringIO
+from io import StringIO, BytesIO
from shutil import copy, rmtree
from pwd import getpwuid
from datetime import datetime, timedelta
@@ -541,13 +541,14 @@ class UpdateCommand(SubCommand):
# Create a Docker buildfile
df = StringIO()
- df.write("FROM %s\n" % args.tag)
- df.write("ADD . /\n")
- df.seek(0)
+ df.write(u"FROM %s\n" % args.tag)
+ df.write(u"ADD . /\n")
+
+ df_bytes = BytesIO(bytes(df.getvalue(), "UTF-8"))
df_tar = TarInfo(name="Dockerfile")
- df_tar.size = len(df.buf)
- tmp_tar.addfile(df_tar, fileobj=df)
+ df_tar.size = df_bytes.getbuffer().nbytes
+ tmp_tar.addfile(df_tar, fileobj=df_bytes)
tmp_tar.close()
--
2.20.1
- [PULL 00/16] various fixes for rc2 (semihosting, tcg, docker, tests/vm), Alex Bennée, 2020/07/27
- [PULL 01/16] shippable: add one more qemu to registry url, Alex Bennée, 2020/07/27
- [PULL 02/16] semihosting: defer connect_chardevs a little more to use serialx, Alex Bennée, 2020/07/27
- [PULL 03/16] semihosting: don't send the trailing '\0', Alex Bennée, 2020/07/27
- [PULL 04/16] util: add qemu_get_host_physmem utility function, Alex Bennée, 2020/07/27
- [PULL 05/16] util/oslib-win32: add qemu_get_host_physmem implementation, Alex Bennée, 2020/07/27
- [PULL 06/16] accel/tcg: better handle memory constrained systems, Alex Bennée, 2020/07/27
- [PULL 08/16] linux-user: don't use MAP_FIXED in pgd_find_hole_fallback, Alex Bennée, 2020/07/27
- [PULL 07/16] target/i386: floatx80: avoid compound literals in static initializers, Alex Bennée, 2020/07/27
- [PULL 12/16] linux-user: fix clock_nanosleep(), Alex Bennée, 2020/07/27
- [PULL 09/16] tests/docker: fix update command due to python3 str/bytes distinction,
Alex Bennée <=
- [PULL 10/16] tests/docker: fix binfmt_misc image building, Alex Bennée, 2020/07/27
- [PULL 14/16] python/qemu: Cleanup changes to ConsoleSocket, Alex Bennée, 2020/07/27
- [PULL 11/16] tests/docker: add support for DEB_KEYRING, Alex Bennée, 2020/07/27
- [PULL 13/16] linux-user, ppc: fix clock_nanosleep() for linux-user-ppc, Alex Bennée, 2020/07/27
- [PULL 15/16] python/qemu: Change ConsoleSocket to optionally drain socket., Alex Bennée, 2020/07/27
- [PULL 16/16] tests/vm: add shutdown timeout in basevm.py, Alex Bennée, 2020/07/27
- Re: [PULL 00/16] various fixes for rc2 (semihosting, tcg, docker, tests/vm), Peter Maydell, 2020/07/27