From patchwork Mon Apr 19 14:54:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 423999 Delivered-To: patch@linaro.org Received: by 2002:a02:6a6f:0:0:0:0:0 with SMTP id m47csp2791323jaf; Mon, 19 Apr 2021 07:56:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbuK0WHQYUCYqs17GslB6Q+CKVRQAg0m8lu+dGql99tWx9yUZcPWDY40QPPxC4RIgjDzXq X-Received: by 2002:a05:6e02:1bc3:: with SMTP id x3mr1325998ilv.47.1618844170436; Mon, 19 Apr 2021 07:56:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618844170; cv=none; d=google.com; s=arc-20160816; b=Qb5SW6c4jyIOWY5vaPu3kRVTKp/BLLHa9G86ZV7K0LMggm7UiFRipqfkcyjGnXo2kK Cv26vozIxk63pX4Mv2j1FmLk57lJNpDDvgHKpUompsCyUOAktb03zDoFqnu5HdMs/ToU DjCtSTD9yhY1lkFngLgMf1Z+D+Nv4VsZmEL2heXVpikTSOhujuJNpriEXzUabTt/JsO4 0iCoRPQxsJRJcSy5JELSncRq0Iq5ys+2+KSSXET3H1tUSmjy2S+Lmop3snPDvNB26Tbg 2Hhp2mXZiZP/Tem5T12ot6zyZTsoZ+aJDqIR8VlIMYYPkHIWILAeIiDp4guly5H93b4g oTmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=+RapX0rJktJJYzf8Ecx4whGcyCHUxIuWWJtgYesJZUs=; b=wBE0qGx0L1z2if+knM1bWoEXIxQBSCQhKZVnbOacbO6/LiNA4fIYZgN0eoz5jNolmy kAs9tf5+q1GOgaJ34Qk2gVsD0TSlzf71R1ssGdPfFz208B39rYzMFKShrIKNQhdL7uis OqgljlA9a7Fdk/z/EhYNabH3/ZyYbtsr29IGilw7Dni5DXJy013or0wwmmc/9e1NpQOR 7ALnHHNx77Nwgcyye5J+X9P156Eo/vb3GZVuarHcxN0011Nz/2NMuwHkMo/58oxxTJME svjtHAuwwBa+GpdfjgoD4JH7RETSkAoMBh2xuVs5mNtvs09Y0axF4mX+SVmFbL2LyuV2 F0og== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Hy8rdEtJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w25si12311430jal.57.2021.04.19.07.56.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Apr 2021 07:56:10 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Hy8rdEtJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49282 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lYVJp-00035l-Pl for patch@linaro.org; Mon, 19 Apr 2021 10:56:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44532) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYVIR-00031y-PR for qemu-devel@nongnu.org; Mon, 19 Apr 2021 10:54:43 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:41831) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lYVIQ-0006u8-23 for qemu-devel@nongnu.org; Mon, 19 Apr 2021 10:54:43 -0400 Received: by mail-wr1-x42c.google.com with SMTP id k26so17947001wrc.8 for ; Mon, 19 Apr 2021 07:54:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+RapX0rJktJJYzf8Ecx4whGcyCHUxIuWWJtgYesJZUs=; b=Hy8rdEtJxP3XroBgcZV2gMf6fJHKnaRo2ms18KU9mCANVRP2qVgEcpAAPtcdOSHg5E 3aJTEqiTd5u42VI88BXEy+O0VAWMCeW4KmP2DCyRRpOLm4Be5TVge+p9XqqTMQvtnJ+D ZYZCcUGeJY5AE8BOwO5K6j5uG+Js0OC0e9AwojLsEJ/chWY21LvjKDW7gDv7czkZVMbM 6PfpEHCLpciGcs7QI9GDVem2a/QsKjzjedQwHI6UwOfPrSRhXUjlm70AhiABf2TCe7nC o/W0Z1zl9vnbta8z6194QQIF//UAI4yrSgAzgmR31H3fJuAPlIbA+GkDT2b2/XPnQHqY ncIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+RapX0rJktJJYzf8Ecx4whGcyCHUxIuWWJtgYesJZUs=; b=F2/wCz9m6gh1sNplvbJ+YkRyXLfqy41M+TnSc8KR815YyneAtyKPTQ/SBQ8hf/Qr2D vOoGTIOA7CDq2Dgsx5YqEL7s9M32+FCv85HijBIoXhHbMJFki7iQx/1sm21K6WjCeapq Kjl4sbDp8twd8DJuBUNRbSWLmAHqURgOh0Yfb20PRvb+jM9lS9CNGFknnAkvQIt8doqZ mVExUT5Ta2sMM3+n+q0mkafuVhai69xkX15GHtYXVDdRGJ+Uklz7q9E0H+IucxurV/0H sFYgXglCyrsqK+9BbECk96dEd0deHGjYN6P91PNGKwTPNJigT+7q6Poy/neJe02XEh9U kdYQ== X-Gm-Message-State: AOAM532wNBAahlhIjhKcY3ScQeL5IhZW8Tn+HQI+nIW6M+ksqAbPO2/n WUIPjQgmM/tbn/CPCXO7xIJBxA== X-Received: by 2002:adf:f0cc:: with SMTP id x12mr15297419wro.16.1618844080688; Mon, 19 Apr 2021 07:54:40 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id l4sm23482169wrx.24.2021.04.19.07.54.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 07:54:37 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id DCC141FF8F; Mon, 19 Apr 2021 15:54:35 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 03/25] tests/docker: make executable an optional argument to "update" Date: Mon, 19 Apr 2021 15:54:13 +0100 Message-Id: <20210419145435.14083-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210419145435.14083-1-alex.bennee@linaro.org> References: <20210419145435.14083-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, Thomas Huth , berrange@redhat.com, f4bug@amsat.org, Wainer dos Santos Moschetta , Willian Rampazzo , stefanha@redhat.com, crosa@redhat.com, pbonzini@redhat.com, =?utf-8?q?Alex_Benn=C3=A9e?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We're going to extend the abilities of the command shortly. Signed-off-by: Alex Bennée --- v2 - fix indention issue --- tests/docker/Makefile.include | 2 +- tests/docker/docker.py | 56 ++++++++++++++++++----------------- 2 files changed, 30 insertions(+), 28 deletions(-) -- 2.20.1 Reviewed-by: Willian Rampazzo diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include index 9f464cb92c..820423d718 100644 --- a/tests/docker/Makefile.include +++ b/tests/docker/Makefile.include @@ -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 \ diff --git a/tests/docker/docker.py b/tests/docker/docker.py index 0435a55d10..9b3425fec2 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -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,35 +532,37 @@ def run(self, args, argv): tmp = tempfile.NamedTemporaryFile(suffix="dckr.tar.gz") tmp_tar = TarFile(fileobj=tmp, mode='w') - # 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 - ff, enabled = _check_binfmt_misc(args.executable) - - if not enabled: - print("binfmt_misc not enabled, update disabled") - return 1 - - if ff: - tmp_tar.add(args.executable, arcname=ff) - - # Add any associated libraries - libs = _get_so_libs(args.executable) - if libs: - for l in libs: - so_path = os.path.dirname(l) - name = os.path.basename(l) - real_l = os.path.realpath(l) - try: - tmp_tar.add(real_l, arcname="%s/%s" % (so_path, name)) - except FileNotFoundError: - 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") + + 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 + ff, enabled = _check_binfmt_misc(args.executable) + + if not enabled: + print("binfmt_misc not enabled, update disabled") + return 1 + + if ff: + tmp_tar.add(args.executable, arcname=ff) + + # Add any associated libraries + libs = _get_so_libs(args.executable) + if libs: + for l in libs: + so_path = os.path.dirname(l) + name = os.path.basename(l) + real_l = os.path.realpath(l) + try: + tmp_tar.add(real_l, arcname="%s/%s" % (so_path, name)) + except FileNotFoundError: + print("Couldn't add %s/%s to archive" % (so_path, name)) + pass + + df.write(u"ADD . /\n") df_bytes = BytesIO(bytes(df.getvalue(), "UTF-8"))