mirror of https://github.com/xemu-project/xemu.git
tests/docker: fix update command due to python3 str/bytes distinction
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>
This commit is contained in:
parent
2667e069e7
commit
e336cec3a5
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue