AlmaLinux changes

This commit is contained in:
eabdullin 2022-10-17 14:10:04 +03:00
parent 972e7ab196
commit c9a3974db4
2 changed files with 148 additions and 1 deletions

View File

@ -0,0 +1,139 @@
diff -aruN osbuild-53/runners/org.osbuild.almalinux87 osbuild-53_alma/runners/org.osbuild.almalinux87
--- osbuild-53/runners/org.osbuild.almalinux87 1970-01-01 02:00:00.000000000 +0200
+++ osbuild-53_alma/runners/org.osbuild.almalinux87 2022-03-24 02:05:32.000000000 +0300
@@ -0,0 +1,83 @@
+#!/usr/libexec/platform-python
+
+import os
+import platform
+import subprocess
+import sys
+
+import osbuild.api
+
+
+def quirks():
+ # Platform specific quirks
+ env = os.environ.copy()
+
+ if platform.machine() == "aarch64":
+ # Work around a bug in qemu-img on aarch64 that can lead to qemu-img
+ # hangs when more then one coroutine is use (which is the default)
+ # See https://bugs.launchpad.net/qemu/+bug/1805256
+ env["OSBUILD_QEMU_IMG_COROUTINES"] = "1"
+
+ return env
+
+
+def ldconfig():
+ # ld.so.conf must exist, or `ldconfig` throws a warning
+ subprocess.run(["touch", "/etc/ld.so.conf"], check=True)
+ subprocess.run(["ldconfig"], check=True)
+
+
+def sysusers():
+ try:
+ subprocess.run(["systemd-sysusers"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True)
+ except subprocess.CalledProcessError as error:
+ sys.stderr.write(error.stdout)
+ sys.exit(1)
+
+
+def tmpfiles():
+ # Allow systemd-tmpfiles to return non-0. Some packages want to create
+ # directories owned by users that are not set up with systemd-sysusers.
+ subprocess.run(["systemd-tmpfiles", "--create"], check=False)
+
+
+def nsswitch():
+ # the default behavior is fine, but using nss-resolve does not
+ # necessarily work in a non-booted container, so make sure that
+ # is not configured.
+ try:
+ os.remove("/etc/nsswitch.conf")
+ except FileNotFoundError:
+ pass
+
+
+def python_alternatives():
+ """/usr/bin/python3 is a symlink to /etc/alternatives/python3, which points
+ to /usr/bin/python3.6 by default. Recreate the link in /etc, so that
+ shebang lines in stages and assemblers work.
+ """
+ os.makedirs("/etc/alternatives", exist_ok=True)
+ try:
+ os.symlink("/usr/bin/python3.6", "/etc/alternatives/python3")
+ except FileExistsError:
+ pass
+
+
+def main():
+ with osbuild.api.exception_handler():
+ ldconfig()
+ sysusers()
+ tmpfiles()
+ nsswitch()
+ python_alternatives()
+
+ env = quirks()
+
+ r = subprocess.run(sys.argv[1:],
+ env=env,
+ check=False)
+ sys.exit(r.returncode)
+
+
+if __name__ == "__main__":
+ main()
diff -aruN osbuild-53/runners/org.osbuild.almalinux91 osbuild-53_alma/runners/org.osbuild.almalinux91
--- osbuild-53/runners/org.osbuild.almalinux91 1970-01-01 02:00:00.000000000 +0200
+++ osbuild-53_alma/runners/org.osbuild.almalinux91 2022-03-24 02:05:32.000000000 +0300
@@ -0,0 +1,48 @@
+#!/usr/bin/python3
+
+import os
+import subprocess
+import sys
+
+import osbuild.api
+
+
+def ldconfig():
+ # ld.so.conf must exist, or `ldconfig` throws a warning
+ subprocess.run(["touch", "/etc/ld.so.conf"], check=True)
+ subprocess.run(["ldconfig"], check=True)
+
+
+def sysusers():
+ try:
+ subprocess.run(["systemd-sysusers"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True)
+ except subprocess.CalledProcessError as error:
+ sys.stderr.write(error.stdout)
+ sys.exit(1)
+
+
+def tmpfiles():
+ # Allow systemd-tmpfiles to return non-0. Some packages want to create
+ # directories owned by users that are not set up with systemd-sysusers.
+ subprocess.run(["systemd-tmpfiles", "--create"], check=False)
+
+
+def nsswitch():
+ # the default behavior is fine, but using nss-resolve does not
+ # necessarily work in a non-booted container, so make sure that
+ # is not configured.
+ try:
+ os.remove("/etc/nsswitch.conf")
+ except FileNotFoundError:
+ pass
+
+
+if __name__ == "__main__":
+ with osbuild.api.exception_handler():
+ ldconfig()
+ sysusers()
+ tmpfiles()
+ nsswitch()
+
+ r = subprocess.run(sys.argv[1:], check=False)
+ sys.exit(r.returncode)

View File

@ -9,7 +9,7 @@ Version: 65
%global pkgdir %{_prefix}/lib/%{pypi_name}
Name: %{pypi_name}
Release: 1%{?dist}
Release: 1%{?dist}.alma
License: ASL 2.0
URL: %{forgeurl}
@ -18,6 +18,9 @@ Source0: %{forgesource}
BuildArch: noarch
Summary: A build system for OS images
# AlmaLinux patch
Patch10000: almalinux_runners.patch
BuildRequires: make
BuildRequires: python3-devel
BuildRequires: python3-docutils
@ -120,6 +123,8 @@ manifests and osbuild.
%prep
%forgesetup
# AlmaLinux patch
%patch10000 -p1 -b .runners
%build
%py3_build
@ -248,6 +253,9 @@ fi
%changelog
* Mon Oct 17 2022 Eduard Abdullin <eabdullin@almalinux.org> - 65-1.alma
- Add AlmaLinux runners
* Fri Aug 26 2022 imagebuilder-bot <imagebuilder-bots+imagebuilder-bot@redhat.com> - 65-1
- New upstream release