From 7f105dc1bd24dbd58d5da2c60956c0242f2fe300 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Mon, 10 Jun 2024 14:17:10 +0100 Subject: [PATCH 1/2] mkosi: update to latest --- .github/workflows/mkosi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mkosi.yml b/.github/workflows/mkosi.yml index 71037f8fac..425d737b62 100644 --- a/.github/workflows/mkosi.yml +++ b/.github/workflows/mkosi.yml @@ -92,7 +92,7 @@ jobs: steps: - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 - - uses: systemd/mkosi@1cc81fb92ef0bb1ef7d51ac1e76327614d41ed74 + - uses: systemd/mkosi@0081ea66faf56a35353d6aeadfe42f9679c7d1cf # Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space # immediately, we remove the files in the background. However, we first move them to a different location From 3a46a00a26241978f451564d97dc06c687095f32 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Mon, 10 Jun 2024 04:06:39 +0100 Subject: [PATCH 2/2] mkosi: install dlopen optional dependencies for debian/ubuntu builds --- .../mkosi.conf.d/network.conf | 7 +++++ .../10-debian-ubuntu/mkosi.postinst | 29 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf.d/network.conf create mode 100755 mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.postinst diff --git a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf.d/network.conf b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf.d/network.conf new file mode 100644 index 0000000000..4fb4f46075 --- /dev/null +++ b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf.d/network.conf @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +[Match] +Environment=NO_BUILD=1 + +[Content] +WithNetwork=yes diff --git a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.postinst b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.postinst new file mode 100755 index 0000000000..314f235f5f --- /dev/null +++ b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.postinst @@ -0,0 +1,29 @@ +#!/bin/bash +# SPDX-License-Identifier: LGPL-2.1-or-later +set -e + +# By default Suggests are not installed (and often Recommends are disabled too), which means we will miss +# the dlopen optional dependencies, but the tests need them, so parse them from the package metadata and +# install them. This is not an issue when building locally, as the build and runtime images are the same, +# so they would get installed as build dependencies anyway. + +if [ "$1" = "build" ] || ! ((NO_BUILD)); then + exit 0 +fi + +# Query the Recommends and Suggests of all systemd packages, by matching on the version +systemd_version="$(dpkg-query --showformat '${Version}' --show systemd)" +mapfile -t systemd_packages < <( dpkg --list | grep '^ii' | grep "$systemd_version" | awk '{print $2}' | tr '\n' ' ' ) +extra_packages=() +# shellcheck disable=SC2068 +for package in ${systemd_packages[@]}; do + # We are looking for dlopens, so filter for libraries + mapfile -t -O "${#extra_packages[@]}" extra_packages < <(dpkg-query --showformat '${Suggests}' --show "$package" | sed -e "s/, /\n/g" -e "s/|.*//" | grep "lib") + mapfile -t -O "${#extra_packages[@]}" extra_packages < <(dpkg-query --showformat '${Recommends}' --show "$package" | sed -e "s/, /\n/g" -e "s/|.*//" | grep "lib") +done + +if [ "${#extra_packages[@]}" -eq 0 ]; then + exit 0 +fi + +apt install "${extra_packages[@]}"