]>
git.proxmox.com Git - mirror_qemu.git/blob - tests/lcitool/refresh
3 # Re-generate container recipes
5 # This script uses the "lcitool" available from
7 # https://gitlab.com/libvirt/libvirt-ci
9 # Copyright (c) 2020 Red Hat Inc.
11 # This work is licensed under the terms of the GNU GPL, version 2
12 # or (at your option) any later version. See the COPYING file in
13 # the top-level directory.
19 from pathlib
import Path
21 if len(sys
.argv
) != 1:
22 print("syntax: %s" % sys
.argv
[0], file=sys
.stderr
)
25 self_dir
= Path(__file__
).parent
26 src_dir
= self_dir
.parent
.parent
27 dockerfiles_dir
= Path(src_dir
, "tests", "docker", "dockerfiles")
29 lcitool_path
= Path(self_dir
, "libvirt-ci", "lcitool")
31 lcitool_cmd
= [lcitool_path
, "--data-dir", self_dir
]
33 def atomic_write(filename
, content
):
34 tmp
= filename
.with_suffix(filename
.suffix
+ ".tmp")
36 with tmp
.open("w") as fp
:
37 print(content
, file=fp
, end
="")
39 except Exception as ex
:
43 def generate(filename
, cmd
, trailer
):
44 print("Generate %s" % filename
)
45 lcitool
=subprocess
.run(cmd
, capture_output
=True)
47 if lcitool
.returncode
!= 0:
48 raise Exception("Failed to generate %s: %s" % (filename
, lcitool
.stderr
))
50 content
= lcitool
.stdout
.decode("utf8")
51 if trailer
is not None:
53 atomic_write(filename
, content
)
55 def generate_dockerfile(host
, target
, cross
=None, trailer
=None):
56 filename
= Path(src_dir
, "tests", "docker", "dockerfiles", host
+ ".docker")
57 cmd
= lcitool_cmd
+ ["dockerfile"]
59 cmd
.extend(["--cross", cross
])
60 cmd
.extend([target
, "qemu"])
61 generate(filename
, cmd
, trailer
)
63 def generate_cirrus(target
, trailer
=None):
64 filename
= Path(src_dir
, ".gitlab-ci.d", "cirrus", target
+ ".vars")
65 cmd
= [lcitool_path
, "variables", target
, "qemu"]
66 generate(filename
, cmd
, trailer
)
68 ubuntu1804_skipssh
= [
69 "# https://bugs.launchpad.net/qemu/+bug/1838763\n",
70 "ENV QEMU_CONFIGURE_OPTS --disable-libssh\n"
73 ubuntu2004_tsanhack
= [
74 "# Apply patch https://reviews.llvm.org/D75820\n",
75 "# This is required for TSan in clang-10 to compile with QEMU.\n",
76 "RUN sed -i 's/^const/static const/g' /usr/lib/llvm-10/lib/clang/10.0.0/include/sanitizer/tsan_interface.h\n"
80 generate_dockerfile("centos8", "centos-8")
81 generate_dockerfile("fedora", "fedora-35")
82 generate_dockerfile("ubuntu1804", "ubuntu-1804",
83 trailer
="".join(ubuntu1804_skipssh
))
84 generate_dockerfile("ubuntu2004", "ubuntu-2004",
85 trailer
="".join(ubuntu2004_tsanhack
))
86 generate_dockerfile("opensuse-leap", "opensuse-leap-152")
87 generate_dockerfile("alpine", "alpine-edge")
89 generate_cirrus("freebsd-12")
90 generate_cirrus("freebsd-13")
91 generate_cirrus("macos-11")
94 except Exception as ex
:
95 print(str(ex
), file=sys
.stderr
)