From nobody Fri Apr 26 20:59:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565612940; cv=none; d=zoho.com; s=zohoarc; b=Z38juArzTXgD9QEnjYetv9Gkn+ddhfsXsPxbC7W+5o620K7mkyz8RTp/S0WvFWZjX1A4hADiq+p0ZbVWRz8B/gIrQ7AOvuOgqDdyC6HIZWbm1EwUfGItBBwqzVI8lYU7h1E52jEbiKCFO5oegUs+jaL1WFx5arUCcaEF+cXJfCA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565612940; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Ip57lmIlBhsnoTllGq8mm9kWozOP9tY3wstotsGqjck=; b=Wtml7cY+BpjW7JqSmHOuEvn6v3bxN555TTkvGo9Tf7lM0913kRldgizluGFfGmhm8z3g3PSxnP5BiNiNAhTHMubYX72CrkJn0gwirwxSw5WcWuNQoCQHV8kGA4obwiqOiuhHMT7IL1swXTAKZ4Y3XicmtPxgiJ/higza+FgdTkU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1565612940266652.2297035277958; Mon, 12 Aug 2019 05:29:00 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EAFF6315C02D; Mon, 12 Aug 2019 12:28:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C8BCA7CD84; Mon, 12 Aug 2019 12:28:58 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 908D12551F; Mon, 12 Aug 2019 12:28:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7CCSj3w018726 for ; Mon, 12 Aug 2019 08:28:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 81F297CD9B; Mon, 12 Aug 2019 12:28:45 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0D11B7CD9A for ; Mon, 12 Aug 2019 12:28:44 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Mon, 12 Aug 2019 14:28:37 +0200 Message-Id: <20190812122839.29331-2-abologna@redhat.com> In-Reply-To: <20190812122839.29331-1-abologna@redhat.com> References: <20190812122839.29331-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [dockerfiles PATCH 1/3] refresh: Generate archived Dockerfiles X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 12 Aug 2019 12:28:59 +0000 (UTC) Content-Type: text/plain; charset="utf-8" We need this so that we can perform Quay builds without going through a build trigger. Once we start generating Dockerfiles this way, each refresh will result in a bunch of binary files being modified, which is not very nice to humans following along at home. Thankfully, there is a way the issue can be mitigated: just configure git with # ~/.config/git/attributes buildenv-*.zip diff=3Ddockerfilezip # ~/.config/git/config [diff "dockerfilezip"] binary =3D true textconv =3D unzip -q -c -a after which 'git diff' and friends will automatically show the contents of the archive. Note that the configuration above only works correctly if there is a single file in the archive, but for us that's the case by definition so it's not really a problem. Signed-off-by: Andrea Bolognani --- .gitignore | 1 + refresh | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9414382 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +Dockerfile diff --git a/refresh b/refresh index 6cefd79..73b4f9e 100755 --- a/refresh +++ b/refresh @@ -29,7 +29,7 @@ class Dockerfile: =20 PREFIX =3D "buildenv-" CROSS =3D "-cross-" - SUFFIX =3D ".Dockerfile" + SUFFIX =3D ".zip" =20 # PROJECTS is a dictionary of dictionaries. # The key is the project name, as present in the Dockerfile name and @@ -106,6 +106,8 @@ class Dockerfile: =20 def refresh(self, lcitool): =20 + dockerfile =3D pathlib.Path("./Dockerfile") + args =3D [ lcitool, "dockerfile", @@ -128,9 +130,24 @@ class Dockerfile: if rc.returncode !=3D 0: raise Exception("lcitool failed: {}".format(rc.stderr.decode()= )) =20 - with self.path.open('w') as f: + with dockerfile.open('w') as f: print(rc.stdout.decode().strip(), file=3Df) =20 + self.path.unlink() + + args =3D [ + "zip", + self.path, + dockerfile, + ] + + rc =3D subprocess.run(args, capture_output=3DTrue) + + if rc.returncode !=3D 0: + raise Exception("zip failed: {}".format(rc.stderr.decode())) + + dockerfile.unlink() + =20 class Application: =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list