From patchwork Fri Jan 25 14:00:09 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: 156581 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp396236jaa; Fri, 25 Jan 2019 06:04:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN55ZEyvGD+Eouiad4+Rqjit8UtUF1ZU/Ify+44m8+PMLjXBfQlyXdfCGJh1WpKDMm+/S9zS X-Received: by 2002:adf:b6a1:: with SMTP id j33mr11630754wre.55.1548425072623; Fri, 25 Jan 2019 06:04:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548425072; cv=none; d=google.com; s=arc-20160816; b=OMLTVOYrKOu2akNwgdt2YdbrzbPXvUq1rWuz1cd6m4k+c0cPUjvBubAg1LLnVhlH/A W05hUPvZPHU45IdKMM+4wm/0p2VZiEoa1P8TOUUSM+Fr7h1n1cZnoqCvgtqq7ueSeDGZ /NqjoUIndtDubS3hvY+5XHZKqcmNNVZ1lXq5HWAuAWYR6lxscdB0XExcXsNrE/3O30BG W4WFdf8oTfcdezJSENKhow4VFELanMsBiVFu8Xhi/zmW5p9sUT1T6ZJK51+6sOQZMkwh /NsmicNI1v3KKJO/oWY4fL1ftWhzPWIhSnx8bNgJNYxrRlRkOWCSX4tQHk5YTeqil9I5 Ldlg== 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=wsBjSZZmNHXCqkh57UmQuWi2mMRlT52ALUyhq1If/0w=; b=YiVFSNMEsWYFUYYZ/PRCN+d8qRyW3TXw/Mc0yxSeP3nYxcM4ZKeJ3afSKE4MM2zwyv wagHzt4IzlC0UCX1i87KmhvKVhim/mrkemRnMiL1BfXKrUHCbq2PcwVy1+1rXA2UAxyV hdxHCFoGdDw63UJ30ycW9bLA0TeWjmLLTSMejeaBjnCK7LTyPsYfOFPJ17FUUXAo3ngK +DHc6t5Ay68FSl8GAtd0LyAKkBm/u/J6WO7cV91ohdrIdCAo88U7jXZprEtpLmUS6f3z OXV2t5Xoap7l3+KoxMNv2DcLdEFmbizyg8LVFqe0uwd5eszTDVBne3p3v9aIb+3p5lf9 Y4EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=B8DBtZJT; 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 v6si72624239wru.229.2019.01.25.06.04.32 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 25 Jan 2019 06:04:32 -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=B8DBtZJT; 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]:45184 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gn25v-0006EC-Ii for patch@linaro.org; Fri, 25 Jan 2019 09:04:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52197) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gn22A-0003c9-6u for qemu-devel@nongnu.org; Fri, 25 Jan 2019 09:00:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gn222-0000gs-4Q for qemu-devel@nongnu.org; Fri, 25 Jan 2019 09:00:37 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:51178) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gn221-0000Zm-PM for qemu-devel@nongnu.org; Fri, 25 Jan 2019 09:00:29 -0500 Received: by mail-wm1-x333.google.com with SMTP id n190so6893197wmd.0 for ; Fri, 25 Jan 2019 06:00:24 -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=wsBjSZZmNHXCqkh57UmQuWi2mMRlT52ALUyhq1If/0w=; b=B8DBtZJT/5oXNAH0AqU9SCuoFMDXaJ4JOnmNQciQRA0mE5rcmJT2nsg+JzFokQstFg bnirXsqV6UZSzjjF4CLq9lkOc3VMQDEMZ/lVF2eHWnH9p/JyKQOb9GKJeb2J7e9uIySu dLHgij/K7BaoTjqjMN2CQ2lq7XebA6S9D9DLk= 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=wsBjSZZmNHXCqkh57UmQuWi2mMRlT52ALUyhq1If/0w=; b=qji/PPp+d0TsdmAWYC6V+gjTdju1LlmrAc8rTNKqaBaItC/sTn3HgSCaKgw1MKzwNt kA3fwclN64r7lIJ5/Ug2e+vh73i8hKtCLx7u92bizOGuoyPAGady8atRiqUlW9w6AenL wcRyczQL93seuS/Ded8xgmWKWxBB4ZvunucE0MR9UJ0+2mdbFy9Jip/nOSo975H6PV5T D9haalroQhlGYMcFmRStVcS/xxTwRTTvWxM12dM2YCsP4epCkQLxlwFavoR9T3a9j2Se mGl2GylMvPRJXv56vQFWcHJOijIT/V6D3bMbVDKLsbeFfjSfk8OhWcUqiWEMSf+Gnxc/ 64nw== X-Gm-Message-State: AJcUukeOBSn49cwDKiIM2LyTnH3e2Os493gffKsmwK+XoI31ZmSG95OD fobOE+e7y2tO0pnFDNHDuFkX0Q== X-Received: by 2002:a1c:384:: with SMTP id 126mr6948241wmd.26.1548424822969; Fri, 25 Jan 2019 06:00:22 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id o64sm58552780wmo.47.2019.01.25.06.00.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Jan 2019 06:00:19 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 1921B3E0670; Fri, 25 Jan 2019 14:00:18 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Fri, 25 Jan 2019 14:00:09 +0000 Message-Id: <20190125140017.6092-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190125140017.6092-1-alex.bennee@linaro.org> References: <20190125140017.6092-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::333 Subject: [Qemu-devel] [PATCH v1 06/14] 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: Fam Zheng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?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.17.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