tests/docker: make executable an optional argument to "update"

We're going to extend the abilities of the command shortly.

Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Message-Id: <20210512102051.12134-4-alex.bennee@linaro.org>
This commit is contained in:
Alex Bennée 2021-05-12 11:20:23 +01:00
parent 3218d829e3
commit 8d628d075d
2 changed files with 30 additions and 28 deletions

View file

@ -248,7 +248,7 @@ docker-run: docker-qemu-src
$(if $(EXECUTABLE), \
$(call quiet-command, \
$(DOCKER_SCRIPT) update \
$(IMAGE) $(EXECUTABLE), \
$(IMAGE) --executable $(EXECUTABLE), \
" COPYING $(EXECUTABLE) to $(IMAGE)"))
$(call quiet-command, \
$(DOCKER_SCRIPT) run \

View file

@ -523,7 +523,7 @@ class UpdateCommand(SubCommand):
def args(self, parser):
parser.add_argument("tag",
help="Image Tag")
parser.add_argument("executable",
parser.add_argument("--executable",
help="Executable to copy")
def run(self, args, argv):
@ -532,6 +532,11 @@ class UpdateCommand(SubCommand):
tmp = tempfile.NamedTemporaryFile(suffix="dckr.tar.gz")
tmp_tar = TarFile(fileobj=tmp, mode='w')
# Create a Docker buildfile
df = StringIO()
df.write(u"FROM %s\n" % args.tag)
if args.executable:
# Add the executable to the tarball, using the current
# configured binfmt_misc path. If we don't get a path then we
# only need the support libraries copied
@ -557,9 +562,6 @@ class UpdateCommand(SubCommand):
print("Couldn't add %s/%s to archive" % (so_path, name))
pass
# Create a Docker buildfile
df = StringIO()
df.write(u"FROM %s\n" % args.tag)
df.write(u"ADD . /\n")
df_bytes = BytesIO(bytes(df.getvalue(), "UTF-8"))