From patchwork Thu Feb 7 18:37:36 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: 157768 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1026482jaa; Thu, 7 Feb 2019 10:58:39 -0800 (PST) X-Google-Smtp-Source: AHgI3IbXrqShXAURROpKtu0DwzZRz1WdvJL26eAWnhToJk+jCCfxlYLNpcRM/sA+hWwbbxT8esx8 X-Received: by 2002:a81:5683:: with SMTP id k125mr13579948ywb.436.1549565919213; Thu, 07 Feb 2019 10:58:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549565919; cv=none; d=google.com; s=arc-20160816; b=Z22DbBt2atAgWlH+g/UA5TdObueSLMFYW9GSttLXf5fbRwqoEIiwSnS2aFbZKoWCHi jPe2Tu0M5Akfo/C+u/yb0ertDO/yvPEpcO4Qe+OQ8gS65tgDwhrJM6ZaQNbRJlYMlcHR Ecf4yRLDln4bHoUnohVoRgPSyIuAUZgJ4sLqPFaZ6a3G8ZfWFlQ3KbvWEERExf5fWtPy +x43rbJH7KzEmQ8BNcJfuGgEWUqU6j4lYWWcnLb+c2Jtuih/EztGmwjs2lSE1Jfhp2wD bGcnCXKIzb/KrWe6Bn3RaCIXE3bWwWSgMHhDbbKQg5NI3Wcp4wQrKtGa4Y7ErZex7lrq +M2A== 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=S0Y0SJaJ+3uJySRmld2klURjfuxOZh/cv8KZYQZ3LY4=; b=NGZwIDDuFaxcKS156EFswh3bwsdIL6krb/dflbWrdW0jddrdRIjnhp7tUJluscdx+o BdPvq2hUakgT1cF6npQfapemUxI7KiDMt/1sXQPdUg/z8yPg8YV+29sKKXLCRnsZLDl8 XUlRaePFLIgwgZNVc0nz00OrLvzvCRzj97wR9EEJmiwDiN/M3QF2gk9wxp55WcmVaLQk BvE6s+/TAdjHUpsfc3rWLrw7BHNRSf2xHYfgJx4XHV58xFyERNabP4p7e2kGWUqKn8Nq rpdg24REr0WjNQi7FxK+k5Wnp+TURr9q2iYRMY1xPPUENF1VOn1/14K1l4Izm94pSe4k 8tng== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=TDxNaFUl; 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 e11si1324228ywb.169.2019.02.07.10.58.39 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 07 Feb 2019 10:58:39 -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=TDxNaFUl; 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]:45381 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1grosg-0007Yj-Lg for patch@linaro.org; Thu, 07 Feb 2019 13:58:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1groYj-0000Ie-VI for qemu-devel@nongnu.org; Thu, 07 Feb 2019 13:38:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1groYe-0007Sz-P7 for qemu-devel@nongnu.org; Thu, 07 Feb 2019 13:38:00 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:34112) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1groYe-0007Ll-9n for qemu-devel@nongnu.org; Thu, 07 Feb 2019 13:37:56 -0500 Received: by mail-wr1-x42d.google.com with SMTP id z15so991437wrn.1 for ; Thu, 07 Feb 2019 10:37:53 -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=S0Y0SJaJ+3uJySRmld2klURjfuxOZh/cv8KZYQZ3LY4=; b=TDxNaFUlOQB7IKeUJHn3Jh52UKCZ3CnSlPNwN7PueVV2pJC305dcPYAv7wN3KroXw8 Z2C/Zz67kaS7hEmkQ39s27RsduyQcYG4hf4nVJUvc+Pkl7hGDWLB24GdsjakbZe1i+Mn 8ncqkm9iUvNXktUP7gX3h7qlytV4F9uAOwt43mR0zQAcIuhxVCokV6wwq5cgmEXQUvRe T5+8wgIFetb4Pg0ryUyhkn2bVx7Pvl6UvOA1JKoNJpQStu8UkyvQ9Br3NfvNErt2q/PK z88sT6tPgOqMrXfjpD1EtNdyKcu2OSLar7tvhn6JIeACThzNoDRMxxWrP/pTemvDrvM+ CEWQ== 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=S0Y0SJaJ+3uJySRmld2klURjfuxOZh/cv8KZYQZ3LY4=; b=PlDnGK+29TG/ENuDA5bAOtLYEoTf1kQUd9tBJ24lK8jUDMG5q9RmEKL1iFKhoEv7Qj vBaM+mp0xXCvfJnx2cC2t1ogVzUT6KD4eQ1kJslEdNwGqmCKbCjjacSbUkh3tFmp6WUc 74JyClUoEQ60SGq0FQ3/unTwgI3EaDm4fvnFm/t708A6tSmv3WSh+PGfykDg5e3UXHrH Cy2gj4cf4T9SsTZQw3fJtalOXQ7bj4z4u4FhTgLYTC0VCNvtqLQuV3xfCrRKUfQkMaOb RDTgd0ShEh7ylNws9ek7At0oNXCQowKOm2L0wN+OcQ+pJqWyiN+gqKOjvzACLG+lfDfn oFZA== X-Gm-Message-State: AHQUAua9bAdPTATVEu9j50IDSId1PqTMq68++AFo6O9Nh8ld/3IuExVw /TtUN8WMKa4c/lZGPmAPpJv7nw== X-Received: by 2002:adf:9067:: with SMTP id h94mr10600283wrh.129.1549564672250; Thu, 07 Feb 2019 10:37:52 -0800 (PST) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id g123sm144421wmd.1.2019.02.07.10.37.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Feb 2019 10:37:48 -0800 (PST) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id F23FD1FF88; Thu, 7 Feb 2019 18:37:44 +0000 (UTC) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Thu, 7 Feb 2019 18:37:36 +0000 Message-Id: <20190207183744.5054-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190207183744.5054-1-alex.bennee@linaro.org> References: <20190207183744.5054-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::42d Subject: [Qemu-devel] [PATCH v2 08/16] 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: qemu-arm@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= 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 --- tests/docker/docker.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) -- 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