]>
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.
18 from pathlib
import Path
20 if len(sys
.argv
) != 1:
21 print("syntax: %s" % sys
.argv
[0], file=sys
.stderr
)
24 self_dir
= Path(__file__
).parent
25 src_dir
= self_dir
.parent
.parent
26 dockerfiles_dir
= Path(src_dir
, "tests", "docker", "dockerfiles")
28 lcitool_path
= Path(self_dir
, "libvirt-ci", "lcitool")
30 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
:
44 def generate(filename
, cmd
, trailer
):
45 print("Generate %s" % filename
)
46 lcitool
= subprocess
.run(cmd
, capture_output
=True)
48 if lcitool
.returncode
!= 0:
49 raise Exception("Failed to generate %s: %s" % (filename
, lcitool
.stderr
))
51 content
= lcitool
.stdout
.decode("utf8")
52 if trailer
is not None:
54 atomic_write(filename
, content
)
57 def generate_dockerfile(host
, target
, cross
=None, trailer
=None):
58 filename
= Path(src_dir
, "tests", "docker", "dockerfiles", host
+ ".docker")
59 cmd
= lcitool_cmd
+ ["dockerfile"]
61 cmd
.extend(["--cross", cross
])
62 cmd
.extend([target
, "qemu"])
63 generate(filename
, cmd
, trailer
)
66 def generate_cirrus(target
, trailer
=None):
67 filename
= Path(src_dir
, ".gitlab-ci.d", "cirrus", target
+ ".vars")
68 cmd
= lcitool_cmd
+ ["variables", target
, "qemu"]
69 generate(filename
, cmd
, trailer
)
72 ubuntu2004_tsanhack
= [
73 "# Apply patch https://reviews.llvm.org/D75820\n",
74 "# This is required for TSan in clang-10 to compile with QEMU.\n",
75 "RUN sed -i 's/^const/static const/g' /usr/lib/llvm-10/lib/clang/10.0.0/include/sanitizer/tsan_interface.h\n"
79 def debian_cross_build(prefix
, targets
):
80 conf
= "ENV QEMU_CONFIGURE_OPTS --cross-prefix=%s\n" % (prefix
)
81 targets
= "ENV DEF_TARGET_LIST %s\n" % (targets
)
82 return "".join([conf
, targets
])
85 # Update all the various build configurations.
86 # Please keep each group sorted alphabetically for easy reading.
91 # Standard native builds
93 generate_dockerfile("alpine", "alpine-edge")
94 generate_dockerfile("centos8", "centos-stream-8")
95 generate_dockerfile("fedora", "fedora-35")
96 generate_dockerfile("opensuse-leap", "opensuse-leap-152")
97 generate_dockerfile("ubuntu2004", "ubuntu-2004",
98 trailer
="".join(ubuntu2004_tsanhack
))
101 # Cross compiling builds
103 generate_dockerfile("debian-arm64-cross", "debian-11",
105 trailer
=debian_cross_build("aarch64-linux-gnu-",
106 "aarch64-softmmu,aarch64-linux-user"))
108 generate_dockerfile("debian-armhf-cross", "debian-11",
110 trailer
=debian_cross_build("arm-linux-gnueabihf-",
111 "arm-softmmu,arm-linux-user"))
113 generate_dockerfile("debian-s390x-cross", "debian-11",
115 trailer
=debian_cross_build("s390x-linux-gnu-",
116 "s390x-softmmu,s390x-linux-user"))
119 # Cirrus packages lists for GitLab
121 generate_cirrus("freebsd-12")
122 generate_cirrus("freebsd-13")
123 generate_cirrus("macos-11")
126 except Exception as ex
:
127 print(str(ex
), file=sys
.stderr
)