[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 12/23] tests/docker: add script for automating container refresh
From: |
Daniel P . Berrangé |
Subject: |
[PATCH 12/23] tests/docker: add script for automating container refresh |
Date: |
Tue, 1 Dec 2020 17:18:14 +0000 |
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
tests/docker/dockerfiles/refresh | 53 ++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
create mode 100755 tests/docker/dockerfiles/refresh
diff --git a/tests/docker/dockerfiles/refresh b/tests/docker/dockerfiles/refresh
new file mode 100755
index 0000000000..b1d99963e9
--- /dev/null
+++ b/tests/docker/dockerfiles/refresh
@@ -0,0 +1,53 @@
+#!/usr/bin/python3
+#
+# Re-generate container recipes
+#
+# This script uses the "lcitool" available from
+#
+# https://gitlab.com/libvirt/libvirt-ci
+#
+# Copyright (c) 2020 Red Hat Inc.
+#
+# This work is licensed under the terms of the GNU GPL, version 2
+# or (at your option) any later version. See the COPYING file in
+# the top-level directory.
+
+import sys
+import os
+import subprocess
+
+if len(sys.argv) != 2:
+ print("syntax: %s PATH-TO-LCITOOL" % sys.argv[0], file=sys.stderr)
+ sys.exit(1)
+
+lcitool_path=sys.argv[1]
+
+def atomic_write(filename, content):
+ try:
+ with open(filename + ".tmp", "w") as fp:
+ print(content, file=fp, end="")
+ os.replace(filename + ".tmp", filename)
+ except Exception as ex:
+ os.unlink(filename + ".tmp")
+ raise
+
+def generate_image(filename, host, cross=None, trailer=None):
+ print("Generate %s" % filename)
+ args = [lcitool_path, "dockerfile"]
+ if cross is not None:
+ args.extend(["--cross", cross])
+ args.extend([host, "qemu"])
+ lcitool=subprocess.run(args, capture_output=True)
+
+ if lcitool.returncode != 0:
+ raise Exception("Failed to generate %s: %s" % (filename, lcitool.stderr))
+
+ content = lcitool.stdout.decode("utf8")
+ if trailer is not None:
+ content += trailer
+ atomic_write(filename, content)
+
+try:
+ pass
+except Exception as ex:
+ print(str(ex), file=sys.stderr)
--
2.28.0
- Re: [PATCH 07/23] tests/docker: fix sorting in package lists, (continued)
- [PATCH 08/23] tests/docker: fix mistakes in centos package lists, Daniel P . Berrangé, 2020/12/01
- [PATCH 09/23] tests/docker: fix mistakes in fedora package list, Daniel P . Berrangé, 2020/12/01
- [PATCH 10/23] tests/docker: fix mistakes in ubuntu package lists, Daniel P . Berrangé, 2020/12/01
- [PATCH 13/23] tests/docker: expand centos7 package list, Daniel P . Berrangé, 2020/12/01
- [PATCH 11/23] tests/docker: remove mingw packages from Fedora, Daniel P . Berrangé, 2020/12/01
- [PATCH 14/23] tests/docker: expand centos8 package list, Daniel P . Berrangé, 2020/12/01
- [PATCH 15/23] tests/docker: expand fedora package list, Daniel P . Berrangé, 2020/12/01
- [PATCH 17/23] tests/docker: expand ubuntu2004 package list, Daniel P . Berrangé, 2020/12/01
- [PATCH 12/23] tests/docker: add script for automating container refresh,
Daniel P . Berrangé <=
- [PATCH 16/23] tests/docker: expand ubuntu1804 package list, Daniel P . Berrangé, 2020/12/01
- [PATCH 18/23] tests/docker: auto-generate centos7 with lcitool, Daniel P . Berrangé, 2020/12/01
- [PATCH 19/23] tests/docker: auto-generate centos8 with lcitool, Daniel P . Berrangé, 2020/12/01
- [PATCH 20/23] tests/docker: auto-generate fedora with lcitool, Daniel P . Berrangé, 2020/12/01
- [PATCH 21/23] tests/docker: auto-generate ubuntu1804 with lcitool, Daniel P . Berrangé, 2020/12/01
- [PATCH 22/23] tests/docker: auto-generate ubuntu2004 with lcitool, Daniel P . Berrangé, 2020/12/01
- [PATCH 23/23] tests/docker: remove ubuntu container, Daniel P . Berrangé, 2020/12/01
- Re: [PATCH 00/23] tests/docker: start using libvirt-ci's "lcitool" for dockerfiles, Kashyap Chamarthy, 2020/12/01