From b50e9d7f29ce8b69ad15e5773bac1170aa6b4a0a Mon Sep 17 00:00:00 2001 From: Filipe Brandenburger Date: Sep 26 2020 19:00:25 +0000 Subject: Create separate standalone packages for tmpfiles and sysusers These packages include binaries that link to a static version of libsystemd-shared, so they don't depend on the systemd-libs package at runtime. These packages are intended to expose systemd-tmpfiles and systemd-sysusers to non-systemd systems, such as container images. Note that static linking only pulls in the small subset of functions from libsystemd-shared that are actually used by the binaries, so the total size of a statically linked binary is much smaller than the sum of the shared binary with the shared library. The resulting binaries on an x86_64 build have 272KB (tmpfiles) and 180KB (sysusers). This commit relies on the -Dstandalone-binaries=true build configuration that was pushed upstream in PR 16061 and released in systemd v246. --- diff --git a/split-files.py b/split-files.py index 3b62a7f..f07b9da 100644 --- a/split-files.py +++ b/split-files.py @@ -21,9 +21,11 @@ o_pam = open('.file-list-pam', 'w') o_rpm_macros = open('.file-list-rpm-macros', 'w') o_devel = open('.file-list-devel', 'w') o_container = open('.file-list-container', 'w') +o_networkd = open('.file-list-networkd', 'w') o_remote = open('.file-list-remote', 'w') o_tests = open('.file-list-tests', 'w') -o_networkd = open('.file-list-networkd', 'w') +o_standalone_tmpfiles = open('.file-list-standalone-tmpfiles', 'w') +o_standalone_sysusers = open('.file-list-standalone-sysusers', 'w') o_rest = open('.file-list-rest', 'w') for file in files(buildroot): n = file.path[1:] @@ -112,6 +114,13 @@ for file in files(buildroot): /modprobe.d ''', n, re.X): o = o_udev + elif n.endswith('.standalone'): + if 'tmpfiles' in n: + o = o_standalone_tmpfiles + elif 'sysusers' in n: + o = o_standalone_sysusers + else: + assert False, 'Found .standalone not belonging to known packages' else: o = o_rest diff --git a/systemd.spec b/systemd.spec index cea243a..1ac69f5 100644 --- a/systemd.spec +++ b/systemd.spec @@ -334,6 +334,24 @@ License: LGPLv2+ "Installed tests" that are usually run as part of the build system. They can be useful to test systemd internals. +%package standalone-tmpfiles +Summary: Standalone tmpfiles binary for use in non-systemd systems +RemovePathPostfixes: .standalone + +%description standalone-tmpfiles +Standalone tmpfiles binary with no dependencies on the systemd-shared library +or other libraries from systemd-libs. This package conflicts with the main +systemd package and is meant for use in non-systemd systems. + +%package standalone-sysusers +Summary: Standalone sysusers binary for use in non-systemd systems +RemovePathPostfixes: .standalone + +%description standalone-sysusers +Standalone sysusers binary with no dependencies on the systemd-shared library +or other libraries from systemd-libs. This package conflicts with the main +systemd package and is meant for use in non-systemd systems. + %prep %autosetup -n %{?commit:%{name}%{?stable:-stable}-%{commit}}%{!?commit:%{name}%{?stable:-stable}-%{github_version}} -p1 @@ -388,6 +406,7 @@ CONFIGURE_OPTS=( -Dtpm=true -Dhwdb=true -Dsysusers=true + -Dstandalone-binaries=true -Ddefault-kill-user-processes=false -Dtests=unsafe -Dinstall-tests=true @@ -829,7 +848,15 @@ fi %files tests -f .file-list-tests +%files standalone-tmpfiles -f .file-list-standalone-tmpfiles + +%files standalone-sysusers -f .file-list-standalone-sysusers + %changelog +* Thu Sep 24 2020 Filipe Brandenburger - 246.6-2 +- Build a package with standalone binaries for non-systemd systems. + For now, only systemd-sysusers is included. + * Thu Sep 24 2020 Christian Glombek - 246.6-2 - Split out networkd sub-package and add to main package as recommended dependency