summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvkalintiris <vasilis@netdata.cloud>2023-12-18 12:39:39 +0200
committervkalintiris <vasilis@netdata.cloud>2024-01-16 17:06:36 +0200
commitec878a852b642ad127bbd9cefe73c52ddeab0c0e (patch)
tree59e62127d411ad1400e8dc5075d98c1ae6223326
parentd2463170f62e736fcb0cb1235fd28f46729a54aa (diff)
Dag
-rw-r--r--packaging/dag/README.md25
-rw-r--r--packaging/dag/cmake-aarch64.sha2561
-rw-r--r--packaging/dag/cmake-x86_64.sha2561
-rwxr-xr-xpackaging/dag/images.py1303
-rwxr-xr-xpackaging/dag/main.py237
-rw-r--r--packaging/dag/ol8-epel.repo6
-rw-r--r--packaging/dag/ol9-epel.repo6
7 files changed, 1579 insertions, 0 deletions
diff --git a/packaging/dag/README.md b/packaging/dag/README.md
new file mode 100644
index 0000000000..fb8d3ff0c6
--- /dev/null
+++ b/packaging/dag/README.md
@@ -0,0 +1,25 @@
+- Install Dagger CLI:
+ ```
+ cd /usr/local
+ curl -L https://dl.dagger.io/dagger/install.sh | sudo sh
+ ```
+- Install Python's Dagger SDK:
+ ```
+ pip install dagger-io
+ ```
+
+Now you can run something like this:
+
+```
+dagger run python packaging/dag/main.py -c -p linux/x86_64 -p linux/i386 -i debian10 -i debian11 -i debian12
+```
+
+This will build *concurrently* the agent for debian 10/11/12 on x86_64 and i386.
+The first run will be slow. However, subsequent runs will reuse cached artifacts
+and should be much faster.
+
+For more information, check the help message:
+
+```
+dagger run python packaging/dag/main.py --help
+```
diff --git a/packaging/dag/cmake-aarch64.sha256 b/packaging/dag/cmake-aarch64.sha256
new file mode 100644
index 0000000000..122b26e99f
--- /dev/null
+++ b/packaging/dag/cmake-aarch64.sha256
@@ -0,0 +1 @@
+a83e01ed1cdf44c2e33e0726513b9a35a8c09e3b5a126fd720b3c8a9d5552368 cmake-aarch64.sh
diff --git a/packaging/dag/cmake-x86_64.sha256 b/packaging/dag/cmake-x86_64.sha256
new file mode 100644
index 0000000000..d5adc8aa13
--- /dev/null
+++ b/packaging/dag/cmake-x86_64.sha256
@@ -0,0 +1 @@
+8c449dabb2b2563ec4e6d5e0fb0ae09e729680efab71527b59015131cea4a042 cmake-x86_64.sh
diff --git a/packaging/dag/images.py b/packaging/dag/images.py
new file mode 100755
index 0000000000..7f0f5ec2fe
--- /dev/null
+++ b/packaging/dag/images.py
@@ -0,0 +1,1303 @@
+import os
+from pathlib import Path
+
+import dagger
+
+
+_ALPINE_COMMON_PACKAGES = [
+ "alpine-sdk",
+ "autoconf",
+ "automake",
+ "bash",
+ "binutils",
+ "bison",
+ "cmake",
+ "curl",
+ "curl-static",
+ "elfutils-dev",
+ "flex",
+ "gcc",
+ "git",
+ "gnutls-dev",
+ "gzip",
+ "jq",
+ "libelf-static",
+ "libmnl-dev",
+ "libmnl-static",
+ "libtool",
+ "libuv-dev",
+ "libuv-static",
+ "lz4-dev",
+ "lz4-static",
+ "make",
+ "mongo-c-driver-dev",
+ "mongo-c-driver-static",
+ "musl-fts-dev",
+ "ncurses",
+ "ncurses-static",
+ "netcat-openbsd",
+ "ninja",
+ "openssh",
+ "pcre2-dev",
+ "pkgconfig",
+ "protobuf-dev",
+ "snappy-dev",
+ "snappy-static",
+ "util-linux-dev",
+ "wget",
+ "xz",
+ "yaml-dev",
+ "yaml-static",
+ "zlib-dev",
+ "zlib-static",
+ "zstd-dev",
+ "zstd-static",
+]
+
+
+def build_alpine_3_18(client, platform):
+ ctr = client.container(platform=platform).from_("alpine:3.18")
+
+ pkgs = [pkg for pkg in _ALPINE_COMMON_PACKAGES]
+
+ ctr = (
+ ctr.with_exec(["apk", "add", "--no-cache"] + pkgs)
+ )
+
+ return ctr
+
+
+def static_build_openssl(client: dagger.Client, ctr: dagger.Container):
+ tree = (
+ client.git(url="https://github.com/openssl/openssl", keep_git_dir=True)
+ .tag("openssl-3.1.4").tree()
+ )
+
+ #
+ # TODO: verify 32-bit builds
+ #
+ ctr = (
+ ctr.with_directory("/openssl", tree)
+ .with_workdir("/openssl")
+ .with_env_variable("CFLAGS", "-fno-lto -pipe")
+ .with_env_variable("LDFLAGS", "-static")
+ .with_env_variable("PKG_CONFIG", "pkg-config --static")
+ .with_exec(["sed", "-i", "s/disable('static', 'pic', 'threads');/disable('static', 'pic');/", "Configure"])
+ .with_exec(["./config", "-static", "threads", "no-tests", "--prefix=/openssl-static", "--openssldir=/opt/netdata/etc/ssl"])
+ .with_exec(["make", "V=1", "-j", str(os.cpu_count())])
+ .with_exec(["make", "V=1", "-j", str(os.cpu_count()), "install_sw"])
+ .with_exec(["ln", "-s", "/openssl-static/lib", "/openssl-static/lib64"])
+ .with_exec(["perl", "configdata.pm", "--dump"])
+ )
+
+ return ctr
+
+
+def static_build_bash(client: dagger.Client, ctr: dagger.Container):
+ tree = (
+ client.git(url="https://git.savannah.gnu.org/git/bash.git", keep_git_dir=True)
+ .tag("bash-5.1").tree()
+ )
+
+ ctr = (
+ ctr.with_directory("/bash", tree)
+ .with_workdir("/bash")
+ .with_env_variable("CFLAGS", "-pipe")
+ .with_env_variable("LDFLAGS", "")
+ .with_env_variable("PKG_CONFIG", "pkg-config --static")
+ .with_env_variable("PKG_CONFIG_PATH", "/openssl-static/lib64/pkgconfig")
+ .with_exec([
+ "./configure", "--prefix", "/opt/netdata",
+ "--without-bash-malloc",
+ "--enable-static-link",
+ "--enable-net-redirections",
+ "--enable-array-variables",
+ "--disable-progcomp",
+ "--disable-profiling",
+ "--disable-nls",
+ "--disable-dependency-tracking",
+ ])
+ .with_exec(["echo", "-e", "all:\nclean:\ninstall:\n", ">", "examples/loadables/Makefile"])
+ .with_exec(["make", "clean"])
+ # see: https://gitweb.gentoo.org/repo/gentoo.git/tree/app-shells/bash/files/bash-5.1-parallel_make.patch?id=4c2ebbf4b8bc660beb98cc2d845c73375d6e4f50
+ .with_exec(["make", "V=1", "-j", "2", "install"])
+ .with_exec(["strip", "/opt/netdata/bin/bash"])
+ )
+
+ return ctr
+
+def static_build_curl(client: dagger.Client, ctr: dagger.Container):
+ tree = (
+ client.git(url="https://github.com/curl/curl", keep_git_dir=True)
+ .tag("curl-8_4_0").tree()
+ )
+
+ ctr = (
+ ctr.with_directory("/curl", tree)
+ .with_workdir("/curl")
+ .with_env_variable("CFLAGS", "-I/openssl-static/include -pipe")
+ .with_env_variable("LDFLAGS", "-static -L/openssl-static/lib64")
+ .with_env_variable("PKG_CONFIG", "pkg-config --static")
+ .with_env_variable("PKG_CONFIG_PATH", "/openssl-static/lib64/pkgconfig")
+ .with_exec(["autoreconf", "-ifv"])
+ .with_exec([
+ "./configure", "--prefix=/curl-static",
+ "--enable-optimize",
+ "--disable-shared",
+ "--enable-static",
+ "--enable-http",
+ "--disable-ldap",
+ "--disable-ldaps",
+ "--enable-proxy",
+ "--disable-dict",
+ "--disable-telnet",
+ "--disable-tftp",
+ "--disable-pop3",
+ "--disable-imap",
+ "--disable-smb",
+ "--disable-smtp",
+ "--disable-gopher",
+ "--enable-ipv6",
+ "--enable-cookies",
+ "--with-ca-fallback",
+ "--with-openssl",
+ "--disable-dependency-tracking",
+ ])
+ .with_exec(["sed", "-i", "-e", "s/LDFLAGS =/LDFLAGS = -all-static/", "src/Makefile"])
+ .with_exec(["make", "clean"])
+ .with_exec(["make", "V=1", "-j", str(os.cpu_count()), "install"])
+ .with_exec(["cp", "/curl-static/bin/curl", "/opt/netdata/bin/curl"])
+ .with_exec(["strip", "/opt/netdata/bin/curl"])
+ )
+
+ return ctr
+
+
+def static_build_ioping(client: dagger.Client, ctr: dagger.Container):
+ tree = (
+ client.git(url="https://github.com/koct9i/ioping", keep_git_dir=True)
+ .tag("v1.3").tree()
+ )
+
+ ctr = (
+ ctr.with_directory("/ioping", tree)
+ .with_workdir("/ioping")
+ .with_env_variable("CFLAGS", "-static -pipe")
+ .with_exec(["mkdir", "-p", "/opt/netdata/usr/libexec/netdata/plugins.d"])
+ .with_exec(["make", "V=1"])
+ .with_exec(["install", "-o", "root", "-g", "root", "-m", "4750", "ioping", "/opt/netdata/usr/libexec/netdata/plugins.d"])
+ .with_exec(["strip", "/opt/netdata/usr/libexec/netdata/plugins.d/ioping"])
+ )
+
+ return ctr
+
+
+def static_build_libnetfilter_acct(client: dagger.Client, ctr: dagger.Container):
+ tree = (
+ client.git(url="git://git.netfilter.org/libnetfilter_acct", keep_git_dir=True)
+ .tag("libnetfilter_acct-1.0.3").tree()
+ )
+
+ ctr = (
+ ctr.with_directory("/libnetfilter_acct", tree)
+ .with_workdir("/libnetfilter_acct")
+ .with_env_variable("CFLAGS", "-static -I/usr/include/libmnl -pipe")
+ .with_env_variable("LDFLAGS", "-static -L/usr/lib -lmnl")
+ .with_env_variable("PKG_CONFIG", "pkg-config --static")
+ .with_env_variable("PKG_CONFIG_PATH", "/usr/lib/pkgconfig")
+ .with_exec(["autoreconf", "-ifv"])
+ .with_exec([
+ "./configure", "--prefix=/libnetfilter_acct-static",
+ "--exec-prefix=/libnetfilter_acct-static",
+ ])
+ .with_exec(["make", "clean"])
+ .with_exec(["make", "V=1", "-j", str(os.cpu_count()), "install"])
+ )
+
+ return ctr
+
+def static_build_netdata(client: dagger.Client, ctr: dagger.Container):
+ CFLAGS = [
+ "-ffunction-sections",
+ "-fdata-sections",
+ "-static",
+ "-O2",
+ "-funroll-loops",
+ "-I/openssl-static/include",
+ "-I/libnetfilter_acct-static/include/libnetfilter_acct",
+ "-I/curl-local/include/curl",
+ "-I/usr/include/libmnl",
+ "-pipe"
+ ]
+
+ LDFLAGS = [
+ "-Wl,--gc-sections",
+ "-static",
+ "-L/openssl-static/lib64",
+ "-L/libnetfilter_acct-static/lib",
+ "-lnetfilter_acct",
+ "-L/usr/lib",
+ "-lmnl",
+ "-L/usr/lib",
+ "-lzstd",
+ "-L/curl-local/lib",
+ ]
+
+ PKG_CONFIG = [
+ "pkg-config",
+ "--static",
+ ]
+
+ PKG_CONFIG_PATH = [
+ "/openssl-static/lib64/pkgconfig",
+ "/libnetfilter_acct-static/lib/pkgconfig",
+ "/usr/lib/pkgconfig",
+ "/curl-local/lib/pkgconfig",
+ ]
+
+ CMAKE_FLAGS=[
+ "-DOPENSSL_ROOT_DIR=/openssl-static",
+ "-DOPENSSL_LIBRARIES=/openssl-static/lib64",
+ "-DCMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE=/openssl-static",
+ "-DLWS_OPENSSL_INCLUDE_DIRS=/openssl-static/include",
+ "-DLWS_OPENSSL_LIBRARIES=/openssl-static/lib64/libssl.a;/openssl-static/lib64/libcrypto.a",
+ ]
+
+ NETDATA_INSTALLER_CMD = [
+ "./netdata-installer.sh", "--install-prefix", "/opt",
+ "--dont-wait",
+ "--dont-start-it",
+ "--disable-exporting-mongodb",
+ "--require-cloud",
+ "--use-system-protobuf",
+ "--dont-scrub-cflags-even-though-it-may-break-things",
+ "--one-time-build",
+ "--enable-lto",
+ ]
+
+ ctr = (
+ ctr.with_workdir("/netdata")
+ .with_env_variable("NETDATA_CMAKE_OPTIONS", "-DCMAKE_BUILD_TYPE=Debug")
+ .with_env_variable("CFLAGS", " ".join(CFLAGS))
+ .with_env_variable("LDFLAGS", " ".join(LDFLAGS))
+ .with_env_variable("PKG_CONFIG", " ".join(PKG_CONFIG))
+ .with_env_variable("PKG_CONFIG_PATH", ":".join(PKG_CONFIG_PATH))
+ .with_env_variable("CMAKE_FLAGS", " ".join(CMAKE_FLAGS))
+ .with_env_variable("EBPF_LIBC", "static")
+ .with_env_variable("IS_NETDATA_STATIC_BINARY", "yes")
+ .with_exec(NETDATA_INSTALLER_CMD)
+ )
+
+ return ctr
+
+
+def static_build(client, repo_path):
+ cmake_build_release_path = os.path.join(repo_path, "cmake-build-release")
+
+ ctr = build_alpine_3_18(client, dagger.Platform("linux/x86_64"))
+ ctr = static_build_openssl(client, ctr)
+ ctr = static_build_bash(client, ctr)
+ ctr = static_build_curl(client, ctr)
+ ctr = static_build_ioping(client, ctr)
+ ctr = static_build_libnetfilter_acct(client, ctr)
+
+ ctr = (
+ ctr.with_directory("/netdata", client.host().directory(repo_path), exclude=[
+ f"{cmake_build_release_path}/*",
+ "fluent-bit/build",
+ ])
+ )
+
+ # TODO: link bin/sbin
+
+ ctr = static_build_netdata(client, ctr)
+
+ build_dir = ctr.directory('/opt/netdata')
+ artifact_dir = os.path.join(Path.home(), f'ci/netdata-static')
+ output_task = build_dir.export(artifact_dir)
+ return output_task
+
+
+_CENTOS_COMMON_PACKAGES = [
+ "autoconf",
+ "autoconf-archive",
+ "autogen",
+ "automake",
+ "bison",
+ "bison-devel",
+ "cmake",
+ "cups-devel",
+ "curl",
+ "diffutils",
+ "elfutils-libelf-devel",
+ "findutils",
+ "flex",
+ "flex-devel",
+ "freeipmi-devel",
+ "gcc",
+ "gcc-c++",
+ "git-core",
+ "golang",
+ "json-c-devel",
+ "libyaml-devel",
+ "libatomic",
+ "libcurl-devel",
+ "libmnl-devel",
+ "libnetfilter_acct-devel",
+ "libtool",
+ "libuuid-devel",
+ "libuv-devel",
+ "libzstd-devel",
+ "lm_sensors",
+ "lz4-devel",
+ "make",
+ "ninja-build",
+ "openssl-devel",
+ "openssl-perl",
+ "patch",
+ "pcre2-devel",
+ "pkgconfig",
+ "pkgconfig(libmongoc-1.0)",
+ "procps",
+ "protobuf-c-devel",
+ "protobuf-compiler",
+ "protobuf-devel",
+ "rpm-build",
+ "rpm-devel",
+ "rpmdevtools",
+ "snappy-devel",
+ "systemd-devel",
+ "wget",
+ "zlib-devel",
+]
+
+def build_amazon_linux_2(client, platform):
+ ctr = client.container(platform=platform).from_("amazonlinux:2")
+
+ pkgs = [pkg for pkg in _CENTOS_COMMON_PACKAGES]
+
+ ctr = (
+ ctr.with_exec(["yum", "update", "-y"])
+ .with_exec(["yum", "install", "-y"] + pkgs)
+ .with_exec(["yum", "clean", "all"])
+ .with_exec(["c_rehash"])
+ .with_exec([
+ "mkdir", "-p",
+ "/root/rpmbuild/BUILD",
+ "/root/rpmbuild/RPMS",
+ "/root/rpmbuild/SOURCES",
+ "/root/rpmbuild/SPECS",
+ "/root/rpmbuild/SRPMS",
+ ])
+ )
+
+ if platform == "linux/x86_64":
+ machine = "x86_64"
+ elif platform == "linux/arm64":
+ machine = "aarch64"
+ else:
+ raise Exception("Amaxon Linux 2 supports only linux/amd64 and linux/arm64 platforms.")
+
+ repo_path = str(Path(__file__).parent.parent.parent)
+ this_path = os.path.join(repo_path, "packaging/dag")
+
+ ctr = (
+ ctr.with_file(f"cmake-{machine}.sha256", client.host().file(f"{this_path}/cmake-{machine}.sha256"))
+ .with_exec([
+ "curl", "--fail", "-sSL", "--connect-timeout", "20", "--retry", "3", "--output", f"cmake-{machine}.sh",
+ f"https://github.com/Kitware/CMake/releases/download/v3.27.6/cmake-3.27.6-linux-{machine}.sh",
+ ])
+ .with_exec(["sha256sum", "-c", f"cmake-{machine}.sha256"])
+ .with_exec(["chmod", "u+x", f"./cmake-{machine}.sh"])
+ .with_exec([f"./cmake-{machine}.sh", "--skip-license", "--prefix=/usr/local"])
+ )
+
+ return ctr
+
+
+def build_centos_7(client, platform):
+ ctr = client.container(platform=platform).from_("centos:7")
+
+ pkgs = [pkg for pkg in _CENTOS_COMMON_PACKAGES] + ["bash"]
+
+ ctr = (
+ ctr.with_exec(["yum", "install", "-y", "epel-release"])
+ .with_exec(["yum", "update", "-y"])
+ .with_exec(["yum", "install", "-y"] + pkgs)
+ .with_exec(["yum", "clean", "all"])
+ .with_exec(["c_rehash"])
+ .with_exec([
+ "mkdir", "-p",
+ "/root/rpmbuild/BUILD",
+ "/root/rpmbuild/RPMS",
+ "/root/rpmbuild/SOURCES",
+ "/root/rpmbuild/SPECS",
+ "/root/rpmbuild/SRPMS",
+ ])
+ )
+
+ if platform == "linux/x86_64":
+ machine = "x86_64"
+ elif platform == "linux/arm64":
+ machine = "aarch64"
+ else:
+ raise Exception("CentOS 7 supports only linux/amd64 and linux/arm64 platforms.")
+
+ repo_path = str(Path(__file__).parent.parent.parent)
+ this_path = os.path.join(repo_path, "packaging/dag")
+
+ ctr = (
+ ctr.with_file(f"cmake-{machine}.sha256", client.host().file(f"{this_path}/cmake-{machine}.sha256"))
+ .with_exec([
+ "curl", "--fail", "-sSL", "--connect-timeout", "20", "--retry", "3", "--output", f"cmake-{machine}.sh",
+ f"https://github.com/Kitware/CMake/releases/download/v3.27.6/cmake-3.27.6-linux-{machine}.sh",
+ ])
+ .with_exec(["sha256sum", "-c", f"cmake-{machine}.sha256"])
+ .with_exec(["chmod", "u+x", f"./cmake-{machine}.sh"])
+ .with_exec([f"./cmake-{machine}.sh", "--skip-license", "--prefix=/usr/local"])
+ )
+
+ return ctr
+
+
+_ROCKY_LINUX_COMMON_PACKAGES = [
+ "autoconf",
+ "autoconf-archive",
+ "automake",
+ "bash",
+ "bison",
+ "cmake",
+ "cups-devel",
+ "curl",
+ "libcurl-devel",
+ "diffutils",
+ "elfutils-libelf-devel",
+ "findutils",
+ "flex",
+ "freeipmi-devel",
+ "gcc",
+ "gcc-c++",
+ "git",
+ "golang",
+ "json-c-devel",
+ "libatomic",
+ "libmnl-devel",
+ "libtool",
+ "libuuid-devel",
+ "libuv-devel",
+ "libyaml-devel",
+ "libzstd-devel",
+ "lm_sensors",
+ "lz4-devel",
+ "make",
+ "ninja-build",
+ "nc",
+ "openssl-devel",
+ "openssl-perl",
+ "patch",
+ "pcre2-devel",
+ "pkgconfig",
+ "pkgconfig(libmongoc-1.0)",
+ "procps",
+ "protobuf-c-devel",
+ "protobuf-compiler",
+ "protobuf-devel",
+ "python3",
+ "python3-pyyaml",
+ "rpm-build",
+ "rpm-devel",
+ "rpmdevtools",
+ "snappy-devel",
+ "systemd-devel",
+ "wget",
+ "zlib-devel",
+]
+
+
+def build_rocky_linux_8(client, platform):
+ ctr = client.container(platform=platform).from_("rockylinux:8")
+
+ pkgs = [pkg for pkg in _ROCKY_LINUX_COMMON_PACKAGES] + ["autogen"]
+
+ ctr = (
+ ctr.with_exec(["dnf", "distro-sync", "-y", "--nodocs"])
+ .with_exec(["dnf", "install", "-y", "--nodocs", "dnf-command(config-manager)", "epel-release"])
+ .with_exec(["dnf", "config-manager", "--set-enabled", "powertools"])
+ .with_exec(["dnf", "clean", "packages"])
+ .with_exec([
+ "dnf", "install", "-y", "--nodocs", "--setopt=install_weak_deps=False", "--setopt=diskspacecheck=False",
+ ] + pkgs)
+ .with_exec(["rm", "-rf", "/var/cache/dnf"])
+ .with_exec(["c_rehash"])
+ .with_exec([
+ "mkdir", "-p",
+ "/root/rpmbuild/BUILD",
+ "/root/rpmbuild/RPMS",
+ "/root/rpmbuild/SOURCES",
+ "/root/rpmbuild/SPECS",
+ "/root/rpmbuild/SRPMS",
+ ])
+ )
+
+ return ctr
+
+
+def build_rocky_linux_9(client, platform):
+ ctr = client.container(platform=platform).from_("rockylinux:9")
+
+ pkgs = [pkg for pkg in _ROCKY_LINUX_COMMON_PACKAGES]
+
+ ctr = (
+ ctr.with_exec(["dnf", "distro-sync", "-y", "--nodocs"])
+ .with_exec(["dnf", "install", "-y", "--nodocs", "dnf-command(config-manager)", "epel-release"])
+ .with_exec(["dnf", "config-manager", "--set-enabled", "crb"])
+ .with_exec(["dnf", "clean", "packages"])
+ .with_exec([
+ "dnf", "install", "-y", "--allowerasing", "--nodocs", "--setopt=install_weak_deps=False", "--setopt=diskspacecheck=False",
+ ] + pkgs)
+ .with_exec(["rm", "-rf", "/var/cache/dnf"])
+ .with_exec(["c_rehash"])
+ .with_exec([
+ "mkdir", "-p",
+ "/root/rpmbuild/BUILD",
+ "/root/rpmbuild/RPMS",
+ "/root/rpmbuild/SOURCES",
+ "/root/rpmbuild/SPECS",
+ "/root/rpmbuild/SRPMS",
+ ])
+ )
+
+ return ctr
+
+
+_CENTOS_STREAM_COMMON_PACKAGES = [
+ "autoconf",
+ "autoconf-archive",
+ "automake",
+ "bash",
+ "bison",
+ "cmake",
+ "cups-devel",
+ "curl",
+ "libcurl-devel",
+ "libyaml-devel",
+ "diffutils",
+ "elfutils-libelf-devel",
+ "findutils",
+ "flex",
+ "freeipmi-devel",
+ "gcc",
+ "gcc-c++",
+ "git",
+ "golang",
+ "json-c-devel",
+ "libatomic",
+ "libmnl-devel",
+ "libtool",
+ "libuuid-devel",
+ "libuv-devel",
+ # "libzstd-devel",
+ "lm_sensors",
+ "lz4-devel",
+ "make",
+ "ninja-build",
+ "nc",
+ "openssl-devel",
+ "openssl-perl",
+ "patch",
+ "pcre2-devel",
+ "pkgconfig",
+ "pkgconfig(libmongoc-1.0)",
+ "procps",
+ "protobuf-c-devel",
+ "protobuf-compiler",
+ "protobuf-devel",
+ "python3",
+ "python3-pyyaml",
+ "rpm-build",
+ "rpm-devel",
+ "rpmdevtools",
+ "snappy-devel",
+ "systemd-devel",
+ "wget",
+ "zlib-devel",
+]
+
+
+def build_centos_stream_8(client, platform):
+ ctr = client.container(platform=platform).from_("quay.io/centos/centos:stream8")
+
+ pkgs = [pkg for pkg in _CENTOS_STREAM_COMMON_PACKAGES] + ["autogen"]
+
+ ctr = (
+ ctr.with_exec(["dnf", "distro-sync", "-y", "--nodocs"])
+ .with_exec(["dnf", "install", "-y", "--nodocs", "dnf-command(config-manager)", "epel-release"])
+ .with_exec(["dnf", "config-manager", "--set-enabled", "powertools"])
+ .with_exec(["dnf", "clean", "packages"])
+ .with_exec([
+ "dnf", "install", "-y", "--nodocs", "--setopt=install_weak_deps=False", "--setopt=diskspacecheck=False",
+ ] + pkgs)
+ .with_exec(["rm", "-rf", "/var/cache/dnf"])
+ .with_exec(["c_rehash"])
+ .with_exec([
+ "mkdir", "-p",
+ "/root/rpmbuild/BUILD",
+ "/root/rpmbuild/RPMS",
+ "/root/rpmbuild/SOURCES",
+ "/root/rpmbuild/SPECS",
+ "/root/rpmbuild/SRPMS",
+ ])
+ )
+
+ return ctr
+
+
+def build_centos_stream_9(client, platform):
+ ctr = client.container(platform=platform).from_("quay.io/centos/centos:stream9")
+
+ pkgs = [pkg for pkg in _CENTOS_STREAM_COMMON_PACKAGES]
+
+ ctr = (
+ ctr.with_exec(["dnf", "distro-sync", "-y", "--nodocs"])
+ .with_exec(["dnf", "install", "-y", "--nodocs", "dnf-command(config-manager)", "epel-release"])
+ .with_exec(["dnf", "config-manager", "--set-enabled", "crb"])
+ .with_exec(["dnf", "clean", "packages"])
+ .with_exec([
+ "dnf", "install", "-y", "--allowerasing", "--nodocs", "--setopt=install_weak_deps=False", "--setopt=diskspacecheck=False",
+ ] + pkgs)
+ .with_exec(["rm", "-rf", "/var/cache/dnf"])
+ .with_exec(["c_rehash"])
+ .with_exec([
+ "mkdir", "-p",
+ "/root/rpmbuild/BUILD",
+ "/root/rpmbuild/RPMS",
+ "/root/rpmbuild/SOURCES",
+ "/root/rpmbuild/SPECS",
+ "/root/rpmbuild/SRPMS",
+ ])
+ )
+
+ return ctr
+
+
+_ORACLE_LINUX_COMMON_PACKAGES = list(_ROCKY_LINUX_COMMON_PACKAGES)
+
+
+def build_oracle_linux_9(client, platform):
+ ctr = client.container(platform=platform).from_("oraclelinux:9")
+
+ pkgs = [pkg for pkg in _ORACLE_LINUX_COMMON_PACKAGES]
+
+ repo_path = str(Path(__file__).parent.parent.parent)
+ this_path = os.path.join(repo_path, "packaging/dag")
+
+ ctr = (
+ ctr.with_file("/etc/yum.repos.d/ol9-epel.repo", client.host().file(f"{this_path}/ol9-epel.repo"))
+ .with_exec(["dnf", "config-manager", "--set-enabled", "ol9_codeready_builder"])
+ .with_exec(["dnf", "config-manager", "--set-enabled", "ol9_developer_EPEL"])
+ .with_exec(["dnf", "distro-sync", "-y", "--nodocs"])
+ .with_exec(["dnf", "clean", "-y", "packages"])
+ .with_exec([
+ "dnf", "install", "-y", "--nodocs", "--setopt=install_weak_deps=False", "--setopt=diskspacecheck=False",
+ ] + pkgs)
+ .with_exec(["rm", "-rf", "/var/cache/dnf"])
+ .with_exec(["c_rehash"])
+ .with_exec([
+ "mkdir", "-p",
+ "/root/rpmbuild/BUILD",
+ "/root/rpmbuild/RPMS",
+ "/root/rpmbuild/SOURCES",
+ "/root/rpmbuild/SPECS",
+ "/root/rpmbuild/SRPMS",
+ ])
+ )
+
+ return ctr
+
+
+def build_oracle_linux_8(client, platform):
+ ctr = client.container(platform=platform).from_("oraclelinux:8")
+
+ pkgs = [pkg for pkg in _ORACLE_LINUX_COMMON_PACKAGES] + ["autogen"]
+
+ repo_path = str(Path(__file__).parent.parent.parent)
+ this_path = os.path.join(repo_path, "packaging/dag")
+
+ ctr = (
+ ctr.with_file("/etc/yum.repos.d/ol8-epel.repo", client.host().file(f"{this_path}/ol8-epel.repo"))
+ .with_exec(["dnf", "config-manager", "--set-enabled", "ol8_codeready_builder"])
+ .with_exec(["dnf", "distro-sync", "-y", "--nodocs"])
+ .with_exec(["dnf", "clean", "-y", "packages"])
+ .with_exec([
+ "dnf", "install", "-y", "--nodocs", "--setopt=install_weak_deps=False", "--setopt=diskspacecheck=False",
+ ] + pkgs)
+ .with_exec(["rm", "-rf", "/var/cache/dnf"])
+ .with_exec(["c_rehash"])
+ .with_exec([
+ "mkdir", "-p",
+ "/root/rpmbuild/BUILD",
+ "/root/rpmbuild/RPMS",
+ "/root/rpmbuild/SOURCES",
+ "/root/rpmbuild/SPECS",
+ "/root/rpmbuild/SRPMS",
+ ])
+ )
+
+ return ctr
+
+_OPENSUSE_COMMON_PACKAGES = [
+ "autoconf",
+ "autoconf-archive",
+ "autogen",
+ "automake",
+ "bison",
+ "cmake",
+ "cups",
+ "cups-devel",
+ "curl",
+ "diffutils",
+ "flex",
+ "freeipmi-devel",
+ "gcc",
+ "gcc-c++",
+ "git-core",
+ "go",
+ "json-glib-devel",
+ "judy-devel",
+ "libatomic1",
+ "libcurl-devel",
+ "libelf-devel",
+ "liblz4-devel",
+ "libjson-c-devel",
+ "libyaml-devel",
+ "libmnl0",
+ "libmnl-devel",
+ "libnetfilter_acct1",
+ "libnetfilter_acct-devel",
+ "libpcre2-8-0",
+ "libopenssl-devel",
+ "libtool",
+ "libuv-devel",
+ "libuuid-devel",
+ "libzstd-devel",
+ "make",
+ "ninja",
+ "patch",
+ "pkg-config",
+ "protobuf-devel",
+ "rpm-build",
+ "rpm-devel",
+ "rpmdevtools",
+ "snappy-devel",
+ "systemd-devel",
+ "tar",
+ "wget",
+ "xen-devel",
+]
+
+def build_opensuse_tumbleweed(client, platform):
+ ctr = client.container(platform=platform).from_("opensuse/tumbleweed:latest")
+
+ pkgs = [pkg for pkg in _OPENSUSE_COMMON_PACKAGES] + ["protobuf-c"]
+
+ ctr = (
+ ctr.with_exec(["zypper", "update", "-y"])
+ .with_exec([
+ "zypper", "install", "-y", "--allow-downgrade",
+ ] + pkgs)
+ .with_exec(["zypper", "clean"])
+ .with_exec(["rm", "-rf", "/var/cache/zypp/*/*"])
+ .with_exec(["c_rehash"])
+ .with_exec([
+ "mkdir", "-p",
+ "/usr/src/packages/BUILD",
+ "/usr/src/packages/RPMS",
+ "/usr/src/packages/SOURCES",
+ "/usr/src/packages/SPECS",
+ "/usr/src/packages/SRPMS",
+ ])
+ )
+
+ return ctr
+
+
+def build_opensuse_15_5(client, platform):
+ ctr = client.container(platform=platform).from_("opensuse/leap:15.5")
+
+ pkgs = [pkg for pkg in _OPENSUSE_COMMON_PACKAGES] + ["libprotobuf-c-devel"]
+
+ ctr = (
+ ctr.with_exec(["zypper", "update", "-y"])
+ .with_exec([
+ "zypper", "install", "-y", "--allow-downgrade",
+ ] + pkgs)
+ .with_exec(["zypper", "clean"])
+ .with_exec(["rm", "-rf", "/var/cache/zypp/*/*"])
+ .with_exec(["c_rehash"])
+ .with_exec([
+ "mkdir", "-p",
+ "/usr/src/packages/BUILD",
+ "/usr/src/packages/RPMS",
+ "/usr/src/packages/SOURCES",
+ "/usr/src/packages/SPECS",
+ "/usr/src/packages/SRPMS",
+ ])
+ )
+
+ return ctr
+
+
+def build_opensuse_15_4(client, platform):
+ crt = client.container(platform=platform).from_("opensuse/leap:15.4")
+
+ pkgs = [pkg for pkg in _OPENSUSE_COMMON_PACKAGES] + ["libprotobuf-c-devel"]
+
+ crt = (
+ crt.with_exec(["zypper", "update", "-y"])
+ .with_exec([
+ "zypper", "install", "-y", "--allow-downgrade",
+ ] + pkgs)
+ .with_exec(["zypper", "clean"])
+ .with_exec(["rm", "-rf", "/var/cache/zypp/*/*"])
+ .with_exec(["c_rehash"])
+ .with_exec([
+ "mkdir", "-p",
+ "/usr/src/packages/BUILD",
+ "/usr/src/packages/RPMS",
+ "/usr/src/packages/SOURCES",
+ "/usr/src/packages/SPECS",
+ "/usr/src/packages/SRPMS",
+ ])
+ )
+
+ return crt
+
+
+_FEDORA_COMMON_PACKAGES = [
+ "autoconf",
+ "autoconf-archive",
+ "autogen",
+ "automake",
+ "bash",
+ "bison",
+ "cmake",
+ "cups-devel",
+ "curl",
+ "diffutils",
+ "elfutils-libelf-devel",
+ "findutils",
+ "flex",
+ "freeipmi-devel",
+ "gcc",
+ "gcc-c++",
+ "git-core",
+ "golang",
+ "json-c-devel",
+ "libcurl-devel",
+ "libyaml-devel",
+ "Judy-devel",
+ "libatomic",
+ "libmnl-devel",
+ "libnetfilter_acct-devel",
+ "libtool",
+ "libuuid-devel",
+ "libuv-devel",
+ "libzstd-devel",
+ "lz4-devel",
+ "make",
+ "ninja-build",
+ "openssl-devel",
+ "openssl-perl",
+ "patch",
+ "pcre2-devel",
+ "pkgconfig",
+]
+
+
+def build_fedora_37(client, platform):
+ ctr = client.container(platform=platform).from_("fedora:37")
+
+ pkgs = [pkg for pkg in _FEDORA_COMMON_PACKAGES]
+
+ ctr = (
+ ctr.with_exec(["dnf", "distro-sync", "-y", "--nodocs"])
+ .with_exec(["dnf", "clean", "-y", "packages"])
+ .with_exec([
+ "dnf", "install", "-y", "--nodocs", "--setopt=install_weak_deps=False", "--setopt=diskspacecheck=False",
+ ] + pkgs)
+ .with_exec(["rm", "-rf", "/var/cache/dnf"])
+ .with_exec(["c_rehash"])
+ .with_exec([
+ "mkdir", "-p",
+ "/root/rpmbuild/BUILD",
+ "/root/rpmbuild/RPMS",
+ "/root/rpmbuild/SOURCES",
+ "/root/rpmbuild/SPECS",
+ "/root/rpmbuild/SRPMS",
+ ])
+ )
+
+ return ctr
+
+
+def build_fedora_38(client, platform):
+ ctr = client.container(platform=platform).from_("fedora:38")
+
+ pkgs = [pkg for pkg in _FEDORA_COMMON_PACKAGES]
+
+ ctr = (
+ ctr.with_exec(["dnf", "distro-sync", "-y", "--nodocs"])
+ .with_exec(["dnf", "clean", "-y", "packages"])
+ .with_exec([
+ "dnf",