From patchwork Mon Feb 11 13:04:57 2019 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: 157994 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2582432jaa; Mon, 11 Feb 2019 05:12:16 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ0kS2sMgDQQ/jNPwAEH12zYJqXtj/ZFf9mERqUCUULfCJqwsBJYON79f6S5TciVSaxjVCc X-Received: by 2002:a1c:c90b:: with SMTP id f11mr9043103wmb.33.1549890736004; Mon, 11 Feb 2019 05:12:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549890735; cv=none; d=google.com; s=arc-20160816; b=oH2Q4Ss0U7Clfm1huQLT4BfUtLFwisHqdwAVLAVp2LLITs/WDG3c+qXD4MhpQaSRdq YYr35Dcw648qlDs48DwhQ3cpdeOLLoHt8Rkz/V+F+bIcZr2jZf5Os2+U0N2U61+rrjRG QzD9OETZgLfu69walOqGCia4mP/O9ZnU0ciypsfAlw8Dm4m/lku1EhSianX6qCZSfodx F9+FE1YUkIgM1gMu01dhxJcXG89fsshGh6Uj7qELlZC7Q1tKrLdgAuy2OT1sVlnQUTvV SMeAgdcUjlLdNrQYM30F3p/fbjo/KNvrE1KAT6NkDWlsn3Td8XAwILcXJUo8BLRuewdR d6cg== 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:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=cfYXt3jdwi09OihZ7AqVPIs1Vt0TXY0xmP8ZqbXxKOw=; b=jOHqs+rnzUIcmgT95kLWbmxdKaC6MRcYvpDDBzRZpZBHa6HlIbW5//skjYeWEe7Tar SgUJAffoaDoKhK7gMFr+OVUDYfnL8wcLGfHkecAh7LelBqeY3Yjefm+wfAgIwubo/MgO RNH6JzO7SaNcOKEaiLPQqnAjOQA+iMs7W3/800WyYHlSYBO7aJ2fFTuxMhg4ClGvCBNv Kn3MEUQPFv72DQutd7r0jvo/BgJKZL6rNkwbDU8YhfJ26OV74IGMY03s7F7gLX1r8OXK xmxExHzbN4OvjPF5YfMARMVkmPpZH9Koyzbz/ykzX5jdkici2d77ig+7WzX4RkDD1Hjc WHdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="F/4tcMYS"; 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 c13si8987569wmb.4.2019.02.11.05.12.15 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 11 Feb 2019 05:12:15 -0800 (PST) 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="F/4tcMYS"; 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 ([127.0.0.1]:50009 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtBNe-0002mH-Sc for patch@linaro.org; Mon, 11 Feb 2019 08:12:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtBHZ-0007S5-1n for qemu-devel@nongnu.org; Mon, 11 Feb 2019 08:05:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtBHR-00048s-IL for qemu-devel@nongnu.org; Mon, 11 Feb 2019 08:05:53 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:33483) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gtBHO-0003pJ-1U for qemu-devel@nongnu.org; Mon, 11 Feb 2019 08:05:47 -0500 Received: by mail-wm1-x329.google.com with SMTP id h22so14534856wmb.0 for ; Mon, 11 Feb 2019 05:05:18 -0800 (PST) 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=cfYXt3jdwi09OihZ7AqVPIs1Vt0TXY0xmP8ZqbXxKOw=; b=F/4tcMYSiphmkMEqwEnfQ4/UFxDmfkTRQP/9fDqhoJg64Y/NbpFmLTuVmS7LOCODeE 0jo16hafEz5NkgwmNDgwFUHv55Wb3Nx6wHq9XhvRYm9K9rCV4+80y7f0sW2YzbOiJG4G dy0U3yjkv256TUi/Gd7JMViY2FhgG8+JhnNYGkDhtzilGlhXL1gvHYWzq7FukDcC3aVl niIxFVyVzVTIoOLc3j837MHMxOF0ySMzJv4BCCqBzaRGnxlyjlUHuCz89nHi6O+vlIu0 oaHvZNSPz3DnxACmA04jfDBv/+mYQXwnm9afpWjnqkPCfzIkbVhfq7nzyWag7PBAF3H0 Mjgw== 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=cfYXt3jdwi09OihZ7AqVPIs1Vt0TXY0xmP8ZqbXxKOw=; b=VrZ0JH6NuYX9VI8Y0STv3B6/1CrX0ayVaUQX9Umg5H2PyBe92ihre1p771QbAmaavx hHYdBMy9Q9ZLMAe3unaMcNYSquZiUnuk/6gKPY3ioleJuLSHSy5ndj8QMTTosMnwaIWz oIVEHlAAybxTtRhm7ZcSFXti6lalcXJovtlW857yF2TjTEEc58wUpfh8a6eeNOOIuV92 R6U1J+L3XDDk5w5z3irYjw2/eXS+PQmqBc1NDgfxsrXcESGLJMX2uliUzAF1wamJBJNo aoP/noiTJgxpGvi+Lw+lQ6LWOHPlT79R7ZjKYnDJz0vuLzguxRBGG7ZJUAb4n7/Y5Bo1 fmwA== X-Gm-Message-State: AHQUAuY4fmY8PKLug8rIa+PWEOSWuSAtHwrZ1jRaXu1kQ6o13zuR6zuK ErAs1GJAe61xWcsXyHSkzdny1Q== X-Received: by 2002:a1c:7312:: with SMTP id d18mr8339954wmb.24.1549890317624; Mon, 11 Feb 2019 05:05:17 -0800 (PST) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 2sm28872221wrj.27.2019.02.11.05.05.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Feb 2019 05:05:12 -0800 (PST) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 6B5631FF88; Mon, 11 Feb 2019 13:05:07 +0000 (UTC) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Mon, 11 Feb 2019 13:04:57 +0000 Message-Id: <20190211130507.8710-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211130507.8710-1-alex.bennee@linaro.org> References: <20190211130507.8710-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::329 Subject: [Qemu-devel] [PULL 08/18] tests: make docker.py update use configured binfmt path X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" When copying a QEMU binary into a linux-user docker image we should check what the current configured binfmt_misc path is rather than just assuming "/usr/bin/qemu-bin". Obviously if the user changes the configuration afterwards they will break their images again. Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/tests/docker/docker.py b/tests/docker/docker.py index 02d8a83847..30f463af9f 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -123,17 +123,17 @@ def _check_binfmt_misc(executable): if not os.path.exists(binfmt_entry): print ("No binfmt_misc entry for %s" % (binary)) - return False + return None with open(binfmt_entry) as x: entry = x.read() - qpath = "/usr/bin/%s" % (binary) - if not re.search("interpreter %s\n" % (qpath), entry): - print ("binfmt_misc for %s does not point to %s" % (binary, qpath)) - return False - - return True + m = re.search("interpreter (\S+)\n", entry) + interp = m.group(1) + if interp and interp != executable: + print("binfmt_misc for %s does not point to %s, using %s" % + (binary, executable, interp)) + return interp def _read_qemu_dockerfile(img_name): # special case for Debian linux-user images @@ -394,9 +394,14 @@ class UpdateCommand(SubCommand): tmp = tempfile.NamedTemporaryFile(suffix="dckr.tar.gz") tmp_tar = TarFile(fileobj=tmp, mode='w') - # Add the executable to the tarball - bn = os.path.basename(args.executable) - ff = "/usr/bin/%s" % bn + # Add the executable to the tarball, using the current + # configured binfmt_misc path. + ff = _check_binfmt_misc(args.executable) + if not ff: + bn = os.path.basename(args.executable) + ff = "/usr/bin/%s" % bn + print ("No binfmt_misc configured: copied to %s" % (ff)) + tmp_tar.add(args.executable, arcname=ff) # Add any associated libraries