From 94c9855a1823be6b0a2342ba5a8b57353fa32ea3 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 29 Mar 2023 10:42:23 +0200 Subject: [PATCH] mkosi: Update to latest - Drop Netdev= as it was removed in mkosi - Always install python-psutil in the final image (required for networkd tests) - Always Install python-pytest in the final image (required for ukify tests) - Use the narrow glob for all centos python packages - Drop the networkd mkosi config files (the default image can be used instead) - Use ".conf" as the mkosi config file suffix everywhere - Copy src/ to /root/src in the final image and set gdb substitute path in .gdbinit to make gdb work properly --- .github/workflows/mkosi.yml | 6 +- .gitignore | 3 +- docs/HACKING.md | 2 +- docs/TESTING_WITH_SANITIZERS.md | 2 +- mkosi.conf.d/10-systemd.conf | 2 +- mkosi.conf.d/arch/10-arch.conf | 5 +- mkosi.conf.d/centos/10-centos.conf | 17 +++--- mkosi.conf.d/debian/10-debian.conf | 5 +- mkosi.conf.d/fedora/10-fedora.conf | 7 ++- mkosi.conf.d/opensuse/10-opensuse.conf | 5 +- mkosi.conf.d/ubuntu/10-ubuntu.conf | 5 +- mkosi.extra/root/.gdbinit | 1 + test/mkosi.build.networkd-test | 25 -------- test/mkosi.default.networkd-test | 82 -------------------------- test/mkosi.nspawn.networkd-test | 4 -- 15 files changed, 33 insertions(+), 138 deletions(-) delete mode 100755 test/mkosi.build.networkd-test delete mode 100644 test/mkosi.default.networkd-test delete mode 100644 test/mkosi.nspawn.networkd-test diff --git a/.github/workflows/mkosi.yml b/.github/workflows/mkosi.yml index 90c3d07828..cec8a432d2 100644 --- a/.github/workflows/mkosi.yml +++ b/.github/workflows/mkosi.yml @@ -1,7 +1,7 @@ --- # vi: ts=2 sw=2 et: # SPDX-License-Identifier: LGPL-2.1-or-later -# Simple boot tests that build and boot the mkosi images generated by the mkosi config files in mkosi.default.d/. +# Simple boot tests that build and boot the mkosi images generated by the mkosi config files in mkosi.conf.d/. name: mkosi on: @@ -73,11 +73,11 @@ jobs: steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c - - uses: systemd/mkosi@36638fb37e0ccbb97bbaa573d158dcea3a5f9bde + - uses: systemd/mkosi@af1fe54805c84bb09e80bb585399121946fec701 - name: Configure run: | - tee mkosi.default <<- EOF + tee mkosi.conf <<- EOF [Distribution] Distribution=${{ matrix.distro }} Release=${{ matrix.release }} diff --git a/.gitignore b/.gitignore index 844d67f0a1..1ad0675c4e 100644 --- a/.gitignore +++ b/.gitignore @@ -31,11 +31,10 @@ __pycache__/ /.mkosi-* /mkosi.builddir/ /mkosi.output/ -/mkosi.default /mkosi.installdir/ /mkosi.secure-boot.* # Ignore any mkosi config files with "local" in the name -/mkosi.default.d/**/*local*.conf +/mkosi.conf.d/**/*local*.conf /tags .dir-locals-2.el .vscode/ diff --git a/docs/HACKING.md b/docs/HACKING.md index 265f17e0d5..d5c5373430 100644 --- a/docs/HACKING.md +++ b/docs/HACKING.md @@ -340,7 +340,7 @@ To debug systemd-boot in an IDE such as VSCode we can use a launch configuration If you're hacking on the kernel in tandem with systemd, you can clone a kernel repository in mkosi.kernel/ in the systemd repository, and mkosi will automatically build that kernel and install it into the final image. To prevent the distribution's kernel from being installed (which isn't necessary since we're building our -own kernel), you can add the following snippets to mkosi.default.d/20-local.conf: +own kernel), you can add the following snippets to mkosi.conf.d/20-local.conf: (This snippet is for Fedora, the list of packages will need to be changed for other distributions) diff --git a/docs/TESTING_WITH_SANITIZERS.md b/docs/TESTING_WITH_SANITIZERS.md index ef98cf0121..67b6be46c2 100644 --- a/docs/TESTING_WITH_SANITIZERS.md +++ b/docs/TESTING_WITH_SANITIZERS.md @@ -15,7 +15,7 @@ compiler you want to use and which part of the test suite you want to run. ## mkosi -To build with sanitizers in mkosi, create a file 20-local.conf in mkosi.default.d/ and add the following +To build with sanitizers in mkosi, create a file 20-local.conf in mkosi.conf.d/ and add the following contents: ``` diff --git a/mkosi.conf.d/10-systemd.conf b/mkosi.conf.d/10-systemd.conf index 0b364f49f2..bbb3544f1f 100644 --- a/mkosi.conf.d/10-systemd.conf +++ b/mkosi.conf.d/10-systemd.conf @@ -13,6 +13,7 @@ OutputDirectory=mkosi.output [Content] BuildDirectory=mkosi.builddir Cache=mkosi.cache +ExtraTrees=src:/root/src Packages= acl bash-completion @@ -66,7 +67,6 @@ BuildPackages= [Host] Acl=yes -Netdev=yes QemuMem=2G ExtraSearchPaths=build/ KernelCommandLineExtra=systemd.crash_shell diff --git a/mkosi.conf.d/arch/10-arch.conf b/mkosi.conf.d/arch/10-arch.conf index e1c75b3996..30333cff3a 100644 --- a/mkosi.conf.d/arch/10-arch.conf +++ b/mkosi.conf.d/arch/10-arch.conf @@ -3,7 +3,7 @@ # Copyright © 2016 Zeal Jagannatha # This is a settings file for OS image generation using mkosi (https://github.com/systemd/mkosi). -# Symlink this file to mkosi.default in the project root directory and invoke "mkosi" to build an OS image. +# Symlink this file to mkosi.conf in the project root directory and invoke "mkosi" to build an OS image. [Distribution] Distribution=arch @@ -31,6 +31,8 @@ Packages= polkit popt python-pefile + python-psutil + python-pytest quota-tools shadow tpm2-tss @@ -47,4 +49,3 @@ BuildPackages= python-jinja python-lxml python-pyelftools - python-pytest diff --git a/mkosi.conf.d/centos/10-centos.conf b/mkosi.conf.d/centos/10-centos.conf index 2532b35f51..ff26e3611f 100644 --- a/mkosi.conf.d/centos/10-centos.conf +++ b/mkosi.conf.d/centos/10-centos.conf @@ -1,11 +1,11 @@ # SPDX-License-Identifier: LGPL-2.1-or-later # This is a settings file for OS image generation using mkosi (https://github.com/systemd/mkosi). -# Symlink this file to mkosi.default in the project root directory and invoke "mkosi" to build an OS image. +# Symlink this file to mkosi.conf in the project root directory and invoke "mkosi" to build an OS image. -# We use python3*dist() throughout this file because we need to make sure the python3.9dis() packages are -# installed on CentOS Stream 8. mkosi doesn't support release specific configuration yet so we use the globs -# to get the necessary packages on both CentOS Stream 8 and CentOS Stream 9. +# We use python3[.][9]dist() throughout this file because we need to make sure the python3.9dis() packages +# are installed on CentOS Stream 8. mkosi doesn't support release specific configuration yet so we use the +# globs to get the necessary packages on both CentOS Stream 8 and CentOS Stream 9. [Distribution] Distribution=centos @@ -47,6 +47,7 @@ Packages= procps-ng python3[.][9]dist(pefile) python3[.][9]dist(pluggy) # python39-pluggy is a pytest dependency that's not installed for some reason. + python3[.][9]dist(psutil) python3[.][9]dist(pytest) python39 quota @@ -101,7 +102,7 @@ BuildPackages= pkgconfig(tss2-rc) pkgconfig(valgrind) pkgconfig(xkbcommon) - python3*dist(docutils) - python3*dist(jinja2) - python3*dist(lxml) - python3*dist(pyelftools) + python3-docutils + python3[.][9]dist(jinja2) + python3[.][9]dist(lxml) + python3[.][9]dist(pyelftools) diff --git a/mkosi.conf.d/debian/10-debian.conf b/mkosi.conf.d/debian/10-debian.conf index e9b5775a37..c3e582b8ec 100644 --- a/mkosi.conf.d/debian/10-debian.conf +++ b/mkosi.conf.d/debian/10-debian.conf @@ -1,7 +1,7 @@ # SPDX-License-Identifier: LGPL-2.1-or-later # This is a settings file for OS image generation using mkosi (https://github.com/systemd/mkosi). -# Symlink this file to mkosi.default in the project root directory and invoke "mkosi" to build an OS image. +# Symlink this file to mkosi.conf in the project root directory and invoke "mkosi" to build an OS image. [Distribution] Distribution=debian @@ -40,6 +40,8 @@ Packages= policykit-1 procps python3-pefile + python3-psutil + python3-pytest quota xxd @@ -92,5 +94,4 @@ BuildPackages= python3-jinja2 python3-lxml python3-pyelftools - python3-pytest xsltproc diff --git a/mkosi.conf.d/fedora/10-fedora.conf b/mkosi.conf.d/fedora/10-fedora.conf index b4c641cd67..b263cce673 100644 --- a/mkosi.conf.d/fedora/10-fedora.conf +++ b/mkosi.conf.d/fedora/10-fedora.conf @@ -1,7 +1,7 @@ # SPDX-License-Identifier: LGPL-2.1-or-later # This is a settings file for OS image generation using mkosi (https://github.com/systemd/mkosi). -# Symlink this file to mkosi.default in the project root directory and invoke "mkosi" to build an OS image. +# Symlink this file to mkosi.conf in the project root directory and invoke "mkosi" to build an OS image. [Distribution] Distribution=fedora @@ -41,6 +41,8 @@ Packages= popt procps-ng python3dist(pefile) + python3dist(psutil) + python3dist(pytest) quota tpm2-tss vim-common @@ -90,8 +92,7 @@ BuildPackages= pkgconfig(valgrind) pkgconfig(xencontrol) pkgconfig(xkbcommon) - python3dist(docutils) + python3-docutils python3dist(jinja2) python3dist(lxml) python3dist(pyelftools) - python3dist(pytest) diff --git a/mkosi.conf.d/opensuse/10-opensuse.conf b/mkosi.conf.d/opensuse/10-opensuse.conf index ae0486850c..1e03c79cff 100644 --- a/mkosi.conf.d/opensuse/10-opensuse.conf +++ b/mkosi.conf.d/opensuse/10-opensuse.conf @@ -1,7 +1,7 @@ # SPDX-License-Identifier: LGPL-2.1-or-later # This is a settings file for OS image generation using mkosi (https://github.com/systemd/mkosi). -# Symlink this file to mkosi.default in the project root directory and invoke "mkosi" to build an OS image. +# Symlink this file to mkosi.conf in the project root directory and invoke "mkosi" to build an OS image. [Distribution] Distribution=opensuse @@ -39,6 +39,8 @@ Packages= libxkbcommon0 pam python3-pefile + python3-psutil + python3-pytest shadow tpm2-0-tss vim @@ -95,7 +97,6 @@ BuildPackages= python3-Jinja2 python3-lxml python3-pyelftools - python3-pytest qrencode-devel shadow system-group-obsolete diff --git a/mkosi.conf.d/ubuntu/10-ubuntu.conf b/mkosi.conf.d/ubuntu/10-ubuntu.conf index ffc1d54456..51898475b0 100644 --- a/mkosi.conf.d/ubuntu/10-ubuntu.conf +++ b/mkosi.conf.d/ubuntu/10-ubuntu.conf @@ -1,7 +1,7 @@ # SPDX-License-Identifier: LGPL-2.1-or-later # This is a settings file for OS image generation using mkosi (https://github.com/systemd/mkosi). -# Symlink this file to mkosi.default in the project root directory and invoke "mkosi" to build an OS image. +# Symlink this file to mkosi.conf in the project root directory and invoke "mkosi" to build an OS image. [Distribution] Distribution=ubuntu @@ -42,6 +42,8 @@ Packages= policykit-1 procps python3-pefile + python3-psutil + python3-pytest quota xxd @@ -93,5 +95,4 @@ BuildPackages= python3-jinja2 python3-lxml python3-pyelftools - python3-pytest xsltproc diff --git a/mkosi.extra/root/.gdbinit b/mkosi.extra/root/.gdbinit index 522e1fecb6..1a2163e3a5 100644 --- a/mkosi.extra/root/.gdbinit +++ b/mkosi.extra/root/.gdbinit @@ -1,2 +1,3 @@ set debuginfod enabled off set build-id-verbose 0 +set substitute-path ../src /root/src diff --git a/test/mkosi.build.networkd-test b/test/mkosi.build.networkd-test deleted file mode 100755 index 25c935ed61..0000000000 --- a/test/mkosi.build.networkd-test +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: LGPL-2.1-or-later -set -ex - -# First, source in the main build script -. "$SRCDIR"/mkosi.build - -mkdir -p "$DESTDIR"/usr/local/bin -cp "$SRCDIR"/test/networkd-test.py "$DESTDIR"/usr/local/bin/networkd-test.py - -mkdir -p "$DESTDIR"/etc/systemd/system -cat >"$DESTDIR"/etc/systemd/system/networkd-test.service <