From nobody Tue Feb 10 20:48:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529095555624592.6182772215891; Fri, 15 Jun 2018 13:45:55 -0700 (PDT) Received: from localhost ([::1]:49323 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fTvbW-0005mI-VT for importer@patchew.org; Fri, 15 Jun 2018 16:45:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fTuyP-0000iY-HC for qemu-devel@nongnu.org; Fri, 15 Jun 2018 16:05:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fTuyO-0007uf-IW for qemu-devel@nongnu.org; Fri, 15 Jun 2018 16:05:29 -0400 Received: from mail-wr0-x236.google.com ([2a00:1450:400c:c0c::236]:44063) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fTuyO-0007uJ-BI for qemu-devel@nongnu.org; Fri, 15 Jun 2018 16:05:28 -0400 Received: by mail-wr0-x236.google.com with SMTP id x4-v6so10997473wro.11 for ; Fri, 15 Jun 2018 13:05:28 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id c11-v6sm8866037wri.49.2018.06.15.13.05.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Jun 2018 13:05:22 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id C65C33E1048; Fri, 15 Jun 2018 20:47:09 +0100 (BST) 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=SswNevRDqaQtg8Xuy/6vM3Ltl/4QCI68l1uxu1pc9cM=; b=cWTseViEc5/VKPTWfAwRhC+0uAm247ssBzOtWbXJzbIx1N7/iBPoCc+jqV3rjCu5hB kaJHnLoDtss0g53e4WbmZQ4QLlpbxuRjhdhjrAHjWDXJZf7rvYUqygq9elpyI/PEKqBa nVCm/TLCzsItAwFCsJ+mHF9F1CDCMm4y7OyRs= 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=SswNevRDqaQtg8Xuy/6vM3Ltl/4QCI68l1uxu1pc9cM=; b=kfZsEW2zc3/JA7HtAJM2Lg6gO2UKbjEnBX9uGnF0uhHdh4ae5JCQucY/5/2+O1tyFX rlcxrpRFaukR87tbJqcgCkFgrG8iTvCElyhH8HgSf4SyQW8WGFbxB01BinjhXOlJ9MP0 0F3YlzNkPOGiptEZcNL9C5A7l93861RGyiaYkyvsgE/JOBElQb1xz2Yr7+DqbanhZ4kN WLbeJIFWsb+A8G5Fe+KZsqvhom2vZZd4lS8OCAP9Lsp8BTSzr1T768hTuyXE0lbJzRO1 o5Vqc8yKxRwzGrTv4bUalgVQuqtua1gTO/h7+Tpkuc9qG9roHjiy1SRvIBZSEWCgRzkw bOsg== X-Gm-Message-State: APt69E1gxZ0JGr5lkt4+2+zqu1mKl24IdOx5UxQfAbR/+HmMl4gf1q9o 5EVKm0j8kGdWwHRane2UrYU0Nw== X-Google-Smtp-Source: ADUXVKIW1+Zy/NpyTi80MSVRwKYzX7BkQGFxRlnadTfSTbnzSxO8S0Ij5r4Ry6pFpqG1z+JKU2MQfg== X-Received: by 2002:a5d:49d1:: with SMTP id t17-v6mr2605773wrs.242.1529093127223; Fri, 15 Jun 2018 13:05:27 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: cota@braap.org, famz@redhat.com, berrange@redhat.com, f4bug@amsat.org, richard.henderson@linaro.org, balrogg@gmail.com, aurelien@aurel32.net, agraf@suse.de, peter.maydell@linaro.org Date: Fri, 15 Jun 2018 20:47:01 +0100 Message-Id: <20180615194705.28019-51-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180615194705.28019-1-alex.bennee@linaro.org> References: <20180615194705.28019-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::236 Subject: [Qemu-devel] [PATCH v7 50/54] docker: docker.py add check sub-command 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=20Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 This command allows you to check if we need to re-build a docker image. If the image isn't in the repository or the checksums don't match then we return false and some text (for processing in makefiles). Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- - fix prints to be "modern" - PEP8 fixes --- tests/docker/docker.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/docker/docker.py b/tests/docker/docker.py index 2593a12d04..3666197a16 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -442,6 +442,31 @@ class CcCommand(SubCommand): return Docker().command("run", cmd, args.quiet) =20 =20 +class CheckCommand(SubCommand): + """Check if we need to re-build a docker image out of a dockerfile. + Arguments: """ + name =3D "check" + + def args(self, parser): + parser.add_argument("tag", + help=3D"Image Tag") + parser.add_argument("dockerfile", + help=3D"Dockerfile name") + + def run(self, args, argv): + dockerfile =3D open(args.dockerfile, "rb").read() + tag =3D args.tag + + dkr =3D Docker() + if dkr.image_matches_dockerfile(tag, dockerfile): + if not args.quiet: + print("Image is up to date.") + return 0 + else: + print("Image needs updating") + return 1 + + def main(): parser =3D argparse.ArgumentParser(description=3D"A Docker helper", usage=3D"%s ..." % os.path.basename(sys.argv[0])) --=20 2.17.1