]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mkosi: Streamline running the integration tests without building systemd
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 11 Jul 2024 14:09:47 +0000 (16:09 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 18 Jul 2024 09:39:07 +0000 (11:39 +0200)
Let's document in detail how to build the integration test image and run
the integration tests without building systemd. To streamline the process,
we stop automatically using binaries from build/ when invoking mkosi directly
and don't automatically use a tools tree anymore if systemd on the host is too
old. Instead, we document these options in HACKING.md and change the mkosi meson
target to automatically use the current build directory as an extra binary search
path for mkosi.

docs/HACKING.md
meson.build
mkosi.conf.d/10-extra-search-paths.conf [deleted file]
mkosi.conf.d/10-tools.conf [deleted file]
test/README.testsuite

index 670cbb9deaae0fbbb7cf4fdc74287a2ea8264309..2e964f41789f6e617e05c9d1d2db9379e016ffd8 100644 (file)
@@ -44,6 +44,24 @@ or:
 $ mkosi qemu
 ```
 
+By default, the tools from your host system are used to build the image. To have
+`mkosi` use the systemd tools from the `build/` directory, add the following to
+`mkosi.local.conf`:
+
+```conf
+[Host]
+ExtraSearchPaths=build/
+```
+
+And if you want `mkosi` to build a tools image and use the tools from there
+instead of looking for tools on the host, add the following to
+`mkosi.local.conf`:
+
+```conf
+[Host]
+ToolsTree=default
+```
+
 Every time you rerun the `mkosi` command a fresh image is built, incorporating
 all current changes you made to the project tree. To avoid having to build a new
 image all the time when iterating on a patch, add the following to
index 69dc53cde2ab016f5d1d030a66ee8a20bf89d235..3893a9fabefe76b436a01d8a1562e9b717e2a121 100644 (file)
@@ -2673,6 +2673,7 @@ if mkosi.found()
                         '--output-dir', meson.current_build_dir() / 'mkosi.output',
                         '--cache-dir', meson.current_build_dir() / 'mkosi.cache',
                         '--build-dir', meson.current_build_dir() / 'mkosi.builddir',
+                        '--extra-search-path', meson.current_build_dir(),
                         '--force',
                         'build',
                 ],
diff --git a/mkosi.conf.d/10-extra-search-paths.conf b/mkosi.conf.d/10-extra-search-paths.conf
deleted file mode 100644 (file)
index bd3cdb1..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: LGPL-2.1-or-later
-
-[Match]
-PathExists=build/
-
-[Host]
-ExtraSearchPaths=build/
diff --git a/mkosi.conf.d/10-tools.conf b/mkosi.conf.d/10-tools.conf
deleted file mode 100644 (file)
index 9d276d4..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-# SPDX-License-Identifier: LGPL-2.1-or-later
-
-[Match]
-PathExists=!build/
-SystemdVersion=<254
-
-[Host]
-@ToolsTree=default
index 0aa6cf576ea3f472ddf050831b30533a28f037b2..22da1cd1a117a9b49ae12704a3dbd1f9967d4b1c 100644 (file)
@@ -14,12 +14,41 @@ We also need to make sure the required meson options are enabled:
 $ meson setup --reconfigure build -Dremote=enabled
 ```
 
-Next, we can build the integration test image:
+To make sure `mkosi` doesn't try to build systemd from source during the image build
+process, you can add the following to `mkosi.local.conf`:
+
+```
+[Content]
+Environment=NO_BUILD=1
+```
+
+You might also want to use the `PackageDirectories=` or `Repositories=` option to provide
+mkosi with a directory or repository containing the systemd packages that should be installed
+instead. If the repository containing the systemd packages is not a builtin repository known
+by mkosi, you can use the `PackageManagerTrees=` option to write an extra repository definition
+to /etc which is used when building the image instead.
+
+Next, we can build the integration test image with meson:
 
 ```shell
 $ meson compile -C build mkosi
 ```
 
+By default, the `mkosi` meson target which builds the integration test image depends on
+other meson targets to build various systemd tools that are used to build the image to make
+sure they are up-to-date. If you instead want the already installed systemd tools on the
+host to be used, you can run `mkosi` manually to build the image. To build the integration test
+image without meson, run the following:
+
+```shell
+$ mkosi -f
+```
+
+Note that by default we assume that `build/` is used as the meson build directory that will be used to run
+the integration tests. If you want to use another directory as the meson build directory, you will have to
+configure the mkosi build directory (`BuildDirectory=`), cache directory (`CacheDirectory=`) and output
+directory (`OutputDirectory=`) to point to the other directory using `mkosi.local.conf`.
+
 After the image has been built, the integration tests can be run with:
 
 ```shell