From ce68d4349e0db866181c51a9a5d8a9432fa6d51a Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Tue, 1 Apr 2025 14:57:22 +0200 Subject: [PATCH] mkosi: Stop passing package environment variables to tools image The tools image is not guaranteed to be the same distribution as the target distribution and so might have different package environment variables than the main image yet we currently unconditionally use the same package environment variables for both of them. Let's fix this by not passing the package environment variables to the tools image and subimages anymore, and instead having the main, tools and build images separately include a config file with the required environment variables. --- .packit.yml | 2 +- mkosi.conf | 5 ----- mkosi.conf.d/arch/mkosi.conf | 7 ------- mkosi.conf.d/arch/mkosi.conf.d/pkgenv.conf | 11 +++++++++++ mkosi.conf.d/centos-fedora/mkosi.conf | 7 ------- mkosi.conf.d/centos-fedora/mkosi.conf.d/pkgenv.conf | 12 ++++++++++++ mkosi.conf.d/debian-ubuntu/mkosi.conf | 8 -------- mkosi.conf.d/debian-ubuntu/mkosi.conf.d/pkgenv.conf | 13 +++++++++++++ mkosi.conf.d/opensuse/mkosi.conf | 6 ------ mkosi.conf.d/opensuse/mkosi.conf.d/pkgenv.conf | 12 ++++++++++++ mkosi.images/build/mkosi.conf.d/arch/mkosi.conf | 3 +++ .../build/mkosi.conf.d/centos-fedora/mkosi.conf | 3 +++ .../build/mkosi.conf.d/debian-ubuntu/mkosi.conf | 3 +++ mkosi.images/build/mkosi.conf.d/opensuse/mkosi.conf | 3 +++ mkosi.tools.conf/mkosi.conf.d/arch.conf | 3 +++ mkosi.tools.conf/mkosi.conf.d/centos-fedora.conf | 3 +++ mkosi.tools.conf/mkosi.conf.d/debian-ubuntu.conf | 3 +++ mkosi.tools.conf/mkosi.conf.d/opensuse.conf | 3 +++ tools/fetch-distro.py | 2 +- 19 files changed, 74 insertions(+), 35 deletions(-) create mode 100644 mkosi.conf.d/arch/mkosi.conf.d/pkgenv.conf create mode 100644 mkosi.conf.d/centos-fedora/mkosi.conf.d/pkgenv.conf create mode 100644 mkosi.conf.d/debian-ubuntu/mkosi.conf.d/pkgenv.conf create mode 100644 mkosi.conf.d/opensuse/mkosi.conf.d/pkgenv.conf diff --git a/.packit.yml b/.packit.yml index 5a0be6131f0..19fbce9cdd5 100644 --- a/.packit.yml +++ b/.packit.yml @@ -19,7 +19,7 @@ actions: post-upstream-clone: # Use the Fedora Rawhide specfile - git clone https://src.fedoraproject.org/rpms/systemd .packit_rpm - - bash -c 'git -C .packit_rpm checkout "$(grep GIT_COMMIT= mkosi.conf.d/centos-fedora/mkosi.conf | cut -d= -f2)"' + - bash -c 'git -C .packit_rpm checkout "$(grep GIT_COMMIT= mkosi.conf.d/centos-fedora/mkosi.conf.d/pkgenv.conf | cut -d= -f2)"' - bash -c 'echo "%bcond upstream 1" > .packit_rpm/systemd.spec.new' - bash -c 'echo "%define meson_extra_configure_options --werror" >> .packit_rpm/systemd.spec.new' - bash -c 'cat .packit_rpm/systemd.spec >> .packit_rpm/systemd.spec.new' diff --git a/mkosi.conf b/mkosi.conf index 033b92d5915..8c3695bef24 100644 --- a/mkosi.conf +++ b/mkosi.conf @@ -23,11 +23,6 @@ PassEnvironment= ASAN_OPTIONS COVERAGE VCS_TAG - GIT_URL - GIT_SUBDIR - GIT_BRANCH - GIT_COMMIT - PKG_SUBDIR [Output] RepartDirectories=mkosi.repart diff --git a/mkosi.conf.d/arch/mkosi.conf b/mkosi.conf.d/arch/mkosi.conf index 79c189bf034..f897d7d31c1 100644 --- a/mkosi.conf.d/arch/mkosi.conf +++ b/mkosi.conf.d/arch/mkosi.conf @@ -3,13 +3,6 @@ [Match] Distribution=arch -[Build] -Environment= - GIT_URL=https://gitlab.archlinux.org/archlinux/packaging/packages/systemd.git - GIT_BRANCH=main - GIT_COMMIT=1b4994657df1c7495607f0c2f20db73550b94f34 - PKG_SUBDIR=arch - [Content] VolatilePackages= systemd diff --git a/mkosi.conf.d/arch/mkosi.conf.d/pkgenv.conf b/mkosi.conf.d/arch/mkosi.conf.d/pkgenv.conf new file mode 100644 index 00000000000..66244583313 --- /dev/null +++ b/mkosi.conf.d/arch/mkosi.conf.d/pkgenv.conf @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +[Match] +Distribution=arch + +[Build] +Environment= + GIT_URL=https://gitlab.archlinux.org/archlinux/packaging/packages/systemd.git + GIT_BRANCH=main + GIT_COMMIT=1b4994657df1c7495607f0c2f20db73550b94f34 + PKG_SUBDIR=arch diff --git a/mkosi.conf.d/centos-fedora/mkosi.conf b/mkosi.conf.d/centos-fedora/mkosi.conf index 6f996fd578a..7c941046f77 100644 --- a/mkosi.conf.d/centos-fedora/mkosi.conf +++ b/mkosi.conf.d/centos-fedora/mkosi.conf @@ -4,13 +4,6 @@ Distribution=|centos Distribution=|fedora -[Build] -Environment= - GIT_URL=https://src.fedoraproject.org/rpms/systemd.git - GIT_BRANCH=rawhide - GIT_COMMIT=617952132de4ed882b9b00ceeed077f843130f91 - PKG_SUBDIR=fedora - [Content] VolatilePackages= systemd diff --git a/mkosi.conf.d/centos-fedora/mkosi.conf.d/pkgenv.conf b/mkosi.conf.d/centos-fedora/mkosi.conf.d/pkgenv.conf new file mode 100644 index 00000000000..63caaede597 --- /dev/null +++ b/mkosi.conf.d/centos-fedora/mkosi.conf.d/pkgenv.conf @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +[Match] +Distribution=|centos +Distribution=|fedora + +[Build] +Environment= + GIT_URL=https://src.fedoraproject.org/rpms/systemd.git + GIT_BRANCH=rawhide + GIT_COMMIT=617952132de4ed882b9b00ceeed077f843130f91 + PKG_SUBDIR=fedora diff --git a/mkosi.conf.d/debian-ubuntu/mkosi.conf b/mkosi.conf.d/debian-ubuntu/mkosi.conf index 3b85be300be..30138c00fbc 100644 --- a/mkosi.conf.d/debian-ubuntu/mkosi.conf +++ b/mkosi.conf.d/debian-ubuntu/mkosi.conf @@ -4,14 +4,6 @@ Distribution=|debian Distribution=|ubuntu -[Build] -Environment= - GIT_URL=https://salsa.debian.org/systemd-team/systemd.git - GIT_SUBDIR=debian - GIT_BRANCH=debian/master - GIT_COMMIT=d8c7f8f7f461b1edc3bf5040509e697ea574c990 - PKG_SUBDIR=debian - [Content] VolatilePackages= libnss-myhostname diff --git a/mkosi.conf.d/debian-ubuntu/mkosi.conf.d/pkgenv.conf b/mkosi.conf.d/debian-ubuntu/mkosi.conf.d/pkgenv.conf new file mode 100644 index 00000000000..1f8fe976f42 --- /dev/null +++ b/mkosi.conf.d/debian-ubuntu/mkosi.conf.d/pkgenv.conf @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +[Match] +Distribution=|debian +Distribution=|ubuntu + +[Build] +Environment= + GIT_URL=https://salsa.debian.org/systemd-team/systemd.git + GIT_SUBDIR=debian + GIT_BRANCH=debian/master + GIT_COMMIT=d8c7f8f7f461b1edc3bf5040509e697ea574c990 + PKG_SUBDIR=debian diff --git a/mkosi.conf.d/opensuse/mkosi.conf b/mkosi.conf.d/opensuse/mkosi.conf index 6509ea4f168..32ff446fec5 100644 --- a/mkosi.conf.d/opensuse/mkosi.conf +++ b/mkosi.conf.d/opensuse/mkosi.conf @@ -9,12 +9,6 @@ Repositories=non-oss [Build] SandboxTrees=macros.db_backend:/etc/rpm/macros.db_backend -Environment= - GIT_URL=https://github.com/bmwiedemann/openSUSE - GIT_SUBDIR=packages/s/systemd - GIT_BRANCH=master - GIT_COMMIT=9002a773f0ab185908dc8fb6c831c1cd9fdf11f0 - PKG_SUBDIR=opensuse [Content] VolatilePackages= diff --git a/mkosi.conf.d/opensuse/mkosi.conf.d/pkgenv.conf b/mkosi.conf.d/opensuse/mkosi.conf.d/pkgenv.conf new file mode 100644 index 00000000000..ac1ddf5e929 --- /dev/null +++ b/mkosi.conf.d/opensuse/mkosi.conf.d/pkgenv.conf @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +[Match] +Distribution=opensuse + +[Build] +Environment= + GIT_URL=https://github.com/bmwiedemann/openSUSE + GIT_SUBDIR=packages/s/systemd + GIT_BRANCH=master + GIT_COMMIT=9002a773f0ab185908dc8fb6c831c1cd9fdf11f0 + PKG_SUBDIR=opensuse diff --git a/mkosi.images/build/mkosi.conf.d/arch/mkosi.conf b/mkosi.images/build/mkosi.conf.d/arch/mkosi.conf index d7a79d11c10..2e54455354c 100644 --- a/mkosi.images/build/mkosi.conf.d/arch/mkosi.conf +++ b/mkosi.images/build/mkosi.conf.d/arch/mkosi.conf @@ -3,6 +3,9 @@ [Match] Distribution=arch +[Include] +Include=%D/mkosi.conf.d/arch/mkosi.conf.d/pkgenv.conf + [Content] Packages= base diff --git a/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.conf b/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.conf index 4d0ca8917d8..89fdfc4b20a 100644 --- a/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.conf +++ b/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.conf @@ -4,6 +4,9 @@ Distribution=|centos Distribution=|fedora +[Include] +Include=%D/mkosi.conf.d/centos-fedora/mkosi.conf.d/pkgenv.conf + [Content] Packages= clang-devel diff --git a/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.conf b/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.conf index 81c79a2c219..7fac74772b9 100644 --- a/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.conf +++ b/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.conf @@ -4,6 +4,9 @@ Distribution=|debian Distribution=|ubuntu +[Include] +Include=%D/mkosi.conf.d/debian-ubuntu/mkosi.conf.d/pkgenv.conf + [Content] Packages= apt diff --git a/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.conf b/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.conf index 70a1b31b641..00a45fce5b7 100644 --- a/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.conf +++ b/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.conf @@ -3,6 +3,9 @@ [Match] Distribution=opensuse +[Include] +Include=%D/mkosi.conf.d/opensuse/mkosi.conf.d/pkgenv.conf + [Content] Packages= clang diff --git a/mkosi.tools.conf/mkosi.conf.d/arch.conf b/mkosi.tools.conf/mkosi.conf.d/arch.conf index 2ccbf7c192e..75570ffe0c6 100644 --- a/mkosi.tools.conf/mkosi.conf.d/arch.conf +++ b/mkosi.tools.conf/mkosi.conf.d/arch.conf @@ -3,6 +3,9 @@ [Match] Distribution=arch +[Include] +Include=%D/mkosi.conf.d/arch/mkosi.conf.d/pkgenv.conf + [Content] PrepareScripts=%D/mkosi.images/build/mkosi.conf.d/arch/mkosi.prepare Packages= diff --git a/mkosi.tools.conf/mkosi.conf.d/centos-fedora.conf b/mkosi.tools.conf/mkosi.conf.d/centos-fedora.conf index b360b1d55b9..8f5f07addf5 100644 --- a/mkosi.tools.conf/mkosi.conf.d/centos-fedora.conf +++ b/mkosi.tools.conf/mkosi.conf.d/centos-fedora.conf @@ -4,6 +4,9 @@ Distribution=|fedora Distribution=|centos +[Include] +Include=%D/mkosi.conf.d/centos-fedora/mkosi.conf.d/pkgenv.conf + [Content] PrepareScripts=%D/mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.prepare Packages= diff --git a/mkosi.tools.conf/mkosi.conf.d/debian-ubuntu.conf b/mkosi.tools.conf/mkosi.conf.d/debian-ubuntu.conf index 2b962da2ea7..0a34b867c9b 100644 --- a/mkosi.tools.conf/mkosi.conf.d/debian-ubuntu.conf +++ b/mkosi.tools.conf/mkosi.conf.d/debian-ubuntu.conf @@ -4,6 +4,9 @@ Distribution=|debian Distribution=|ubuntu +[Include] +Include=%D/mkosi.conf.d/debian-ubuntu/mkosi.conf.d/pkgenv.conf + [Content] PrepareScripts=%D/mkosi.images/build/mkosi.conf.d/debian-ubuntu/mkosi.prepare Packages= diff --git a/mkosi.tools.conf/mkosi.conf.d/opensuse.conf b/mkosi.tools.conf/mkosi.conf.d/opensuse.conf index 9e016bcfb27..6fd1c746d60 100644 --- a/mkosi.tools.conf/mkosi.conf.d/opensuse.conf +++ b/mkosi.tools.conf/mkosi.conf.d/opensuse.conf @@ -3,6 +3,9 @@ [Match] Distribution=opensuse +[Include] +Include=%D/mkosi.conf.d/opensuse/mkosi.conf.d/pkgenv.conf + [Content] PrepareScripts=%D/mkosi.images/build/mkosi.conf.d/opensuse/mkosi.prepare Packages= diff --git a/tools/fetch-distro.py b/tools/fetch-distro.py index 77c46d45a20..c7d30f18c13 100755 --- a/tools/fetch-distro.py +++ b/tools/fetch-distro.py @@ -127,7 +127,7 @@ def update_distro(args, distro: str, config: dict): changes = subprocess.check_output(cmd, text=True).strip() conf_dir = Path('mkosi.conf.d') - files = conf_dir.glob('*/*.conf') + files = conf_dir.glob('**/pkgenv.conf') for file in files: s = file.read_text() if old_commit in s: -- 2.47.3