From patchwork Fri Jun 8 16:04:31 2018 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: 138060 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1056307lji; Fri, 8 Jun 2018 09:10:09 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI4m/HH/gIE3Vt/UB6lF4yd9PC+5V0pYbmDuWUx+PlIh0IBXdYcuXwOcB/qlVQcOvqys0Hr X-Received: by 2002:ac8:33f3:: with SMTP id d48-v6mr6397048qtb.317.1528474209750; Fri, 08 Jun 2018 09:10:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528474209; cv=none; d=google.com; s=arc-20160816; b=BBZ8lYDMxb4OFHvAryH4abwOm8RY/uyyBa2EHpg0E6bPn5sAFQ0ICrFNFNP6AjIhqX rNE4eOs0nDT+1w+ggLvX5Nyaz5JouSeg0vWYjO3q22ZnbMrLZQa/CtBzzWabVol803e5 X0wODruZWeQkMRK9bOFAzsBG7ZskQ/oEPX2nb1ezQ2iDFPOeReCrKH4lZ5se56P6wnRD O6cY7lXwuvcyCoBJ5iy8qPCCWGyzvQN7xlcT0PRGSzFdVoje0AXl56kkF3DlBMIHCfKc XXdf2I/gLngxKgKD6vhy3DZPPCBsNd92+h6rhIHgUj4nIy7BDQ0PGAEJ3R4Cww47oBFg PQZA== 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:arc-authentication-results; bh=cKWMs3nz6qhnG+8dxg8o1VTXwohj1ZlM932WlLkaXRw=; b=fB8QkfO91NNF1TwOKUY2quoBwHpKh9xGNLOxHbMtxgEIcJjkGq0zHgf2m8yva1YeU7 5xQy4wDGpy/bcFP4M+XTuIB8WhOCm6qlqsrWQJUR4WuL8pmFMxDmPpqlla0BOwwKO4FK fOIhNnuTKBPA7OGdeVpXEJTzY28RY5knsVhWKjLlMjtPvZwCx+8Wi62IoRbFFQ9A/oAk 9soWgrQcDEVXGP87bbTy8iW05MoxPYS0Vq6LseXApzx9lX26TvAo9EBQRTKseW2j7pQj NbFagKOl0kBtr7toYIdMnQ76qQSnXQ7dCoVjrT6w8GtjnHdvo+vfqZMJPOZVCpEmvYch oBVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hG9lfuFJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id f56-v6si114880qtk.355.2018.06.08.09.10.09 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 08 Jun 2018 09:10:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hG9lfuFJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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]:36886 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRJxp-0004Yv-5H for patch@linaro.org; Fri, 08 Jun 2018 12:10:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51387) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRJsV-0008FN-3c for qemu-devel@nongnu.org; Fri, 08 Jun 2018 12:04:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRJsS-0002ui-NQ for qemu-devel@nongnu.org; Fri, 08 Jun 2018 12:04:39 -0400 Received: from mail-wr0-x229.google.com ([2a00:1450:400c:c0c::229]:43056) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRJsS-0002sy-Hu for qemu-devel@nongnu.org; Fri, 08 Jun 2018 12:04:36 -0400 Received: by mail-wr0-x229.google.com with SMTP id d2-v6so13898758wrm.10 for ; Fri, 08 Jun 2018 09:04:36 -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=cKWMs3nz6qhnG+8dxg8o1VTXwohj1ZlM932WlLkaXRw=; b=hG9lfuFJnQUMugMWN2E+3KQn0z+yc6fhPZMlUb+gUtp5dC4ykj0sR9Gx8Yz6odMUbA QLEaprrnx6tsyvTxb2pKJizPOPiXcas+kB9xW3nUtnyTtkUSeD6x3Qphum9XmQHbJQyu qWW+OvljaxIWaLkWQtsLoeZDTSfXXuP08jG+U= 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=cKWMs3nz6qhnG+8dxg8o1VTXwohj1ZlM932WlLkaXRw=; b=tPsNimDpQ8YMeAoh7QOksuBd9lOJ3zMeyD9Ms1SovWlsxXQy5rBI6X9RCLtaz7UEf+ IHFjT3WfRFHviHkGFAposQohIHqtyCPR7k6EB+CeZ0whbX6CHp0s6uj6xs09Yg39Nu8R bc9s3DpZzjQ59//qHe+b4xMnMsXn9PrcN2Hi4znBPSTJEeifDN32cToLZD9ntCaxgX0p QzW9Ldwft+fHbLScnM1Id/nb3ZVk6d6hfYjyt8DIgJLmIruGaZu69bfFfo+I7xHaky4r h+qggtIZKlJYeYbZ7M0iOKaLfO+wprcXZd2W5g7zUnDl8YIZ1pG5dUm+Kuft1z4PqkF9 5p4Q== X-Gm-Message-State: APt69E31KBJGXaDbejeYGw2EW42tIfSEkOcvxkrcjWBLHNppna1lVCkc iJgKK5lPZNb/a0WoTcuPmdO9Pg== X-Received: by 2002:adf:a4cf:: with SMTP id h15-v6mr5769924wrb.130.1528473875439; Fri, 08 Jun 2018 09:04:35 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id j21-v6sm1253469wme.36.2018.06.08.09.04.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Jun 2018 09:04:33 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id BAD2D3E01CA; Fri, 8 Jun 2018 17:04:32 +0100 (BST) From: =?utf-8?q?Alex_Benn=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, pbonzini@redhat.com, stefanha@redhat.com, stefanb@linux.vnet.ibm.com, marcandre.lureau@redhat.com Date: Fri, 8 Jun 2018 17:04:31 +0100 Message-Id: <20180608160432.8734-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180608160432.8734-1-alex.bennee@linaro.org> References: <20180608160432.8734-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:400c:c0c::229 Subject: [Qemu-devel] [RFC PATCH 2/3] dcoker: 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_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée --- tests/docker/docker.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) -- 2.17.1 diff --git a/tests/docker/docker.py b/tests/docker/docker.py index 80efa641c5..c2763957c9 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -441,6 +441,28 @@ class CcCommand(SubCommand): return Docker().command("run", cmd, args.quiet) +class CheckCommand(SubCommand): + """Check if we need to re-build a docker image out of a dockerfile. Arguments: """ + name = "check" + def args(self, parser): + parser.add_argument("tag", + help="Image Tag") + parser.add_argument("dockerfile", + help="Dockerfile name") + + def run(self, args, argv): + dockerfile = open(args.dockerfile, "rb").read() + tag = args.tag + + dkr = 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 = argparse.ArgumentParser(description="A Docker helper", usage="%s ..." % os.path.basename(sys.argv[0]))