]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
manager: configurable Meson directory docs-develop-mana-oa16bs/deployments/4217
authorOto Šťáva <oto.stava@nic.cz>
Thu, 16 May 2024 12:17:12 +0000 (14:17 +0200)
committerOto Šťáva <oto.stava@nic.cz>
Wed, 29 May 2024 14:50:08 +0000 (16:50 +0200)
This commit makes it more convenient to change the configuration of the
build directory of `kresd` when using Knot Resolver Manager. It adds a
new `./poe configure` command, which optionally takes the same arguments
as the standard `meson configure` command.

The `./poe run` command now requires running `./poe configure` at least
once to set up the build directory. If the directory has been configured
before this commit (i.e. `./poe run` has been executed at least once),
no extra action is required, as the directory structure remains the
same.

The commit also removes the `manager` configuration option from Meson as
we were not using it and it was broken and potentially confusing to
newcomers.

doc/dev/build.rst
manager/README.md
manager/pyproject.toml
manager/scripts/_env.sh
manager/scripts/meson-configure [new file with mode: 0755]
meson.build
meson_options.txt

index b6bfd9f43cb07ecfdbfa2206a72eef42a4d9d6e4..8a08ed4ff61c2d2f92883b90f87117cd5295080c 100644 (file)
@@ -168,7 +168,7 @@ You can also configure some :ref:`build-options`, in this case enable ``manager`
 
 .. code-block:: bash
 
-   $ meson build_dir --prefix=/tmp/kr --default-library=static -Dmanager=enabled
+   $ meson build_dir --prefix=/tmp/kr
 
 After that it is possible to build and install Knot Resolver.
 
@@ -275,7 +275,6 @@ Recommended build options for packagers:
 * ``-Dsystemd_files=enabled`` for systemd unit files
 * ``-Ddoc=enabled`` for offline documentation (see :ref:`build-html-doc`)
 * ``-Dinstall_kresd_conf=enabled`` to install default config file
-* ``-Dmanager=enabled`` to force build of the manager and its features
 * ``-Dunit_tests=enabled`` to force build of unit tests
 
 Systemd
index 805a563e3f24ca4f78dbe085487edca27200438d..7f3233374751c5639d5b3802cdde819aa152ad56 100644 (file)
@@ -32,9 +32,10 @@ Please note that Python's development files are also required, since the Manager
 
 ### Common tasks and interactions with the project
 
-After setting up the environment, you should be able to interract with the project by using `./poe` script. Common actions are:
+After setting up the environment, you should be able to interact with the project by using the `./poe` script. Common actions are:
 
-* `poe run` - runs the manager from the source
+* `poe configure` - configures Knot Resolver daemon for use with the manager
+* `poe run` - runs the manager from the source (requires the daemon to be configured)
 * `poe docs` - creates HTML documentation
 * `poe test` - unit tests
 * `poe tox` - unit tests in all supported Python versions (must not be run outside of virtualenv, otherwise it fails to find multiple versions of Python)
index 3b63350f53fbc840745ce6a1de923c2856ae03f2..1da53a489e4b20b0e5e0e68af3a3a4e9d5cdee3d 100644 (file)
@@ -58,6 +58,7 @@ kresctl = 'knot_resolver_manager.cli.main:main'
 knot-resolver = 'knot_resolver_manager.__main__:run'
 
 [tool.poe.tasks]
+configure = { cmd = "scripts/meson-configure", help = "Configure Knot Resolver daemon" }
 run = { cmd = "scripts/run", help = "Run the manager" }
 run-debug = { cmd = "scripts/run-debug", help = "Run the manager under debugger" }
 docs = { cmd = "scripts/docs", help = "Create HTML documentation" }
index ddbbcf552e40a35d876bf3d572067815a1f0b15d..cabc0025c2fd7f36a1e1ff9f86df4a171fcc98bb 100644 (file)
@@ -36,17 +36,23 @@ set -o nounset
 
 
 function build_kresd {
-       echo
-       echo Building Knot Resolver
-       echo ----------------------
-       echo -e "${blue}In case of an compilation error, run this command to try to fix it:${reset}"
-       echo -e "\t${blue}rm -r $(realpath .install_kresd) $(realpath .build_kresd)${reset}"
-       echo
        pushd ..
-       mkdir -p manager/.build_kresd manager/.install_kresd
-       meson manager/.build_kresd --prefix=$(realpath manager/.install_kresd) --default-library=static --buildtype=debug
-       ninja -C manager/.build_kresd
-       ninja install -C manager/.build_kresd
-       export PYTHONPATH="$(realpath manager/.build_kresd/python):${PYTHONPATH:-}"
+       if [ -d manager/.build_kresd ]; then
+               echo
+               echo Building Knot Resolver
+               echo ----------------------
+               echo -e "${blue}In case of an compilation error, run this command to try to fix it:${reset}"
+               echo -e "\t${blue}rm -r $(realpath .install_kresd) $(realpath .build_kresd)${reset}"
+               echo
+               ninja -C manager/.build_kresd
+               ninja install -C manager/.build_kresd
+               export PYTHONPATH="$(realpath manager/.build_kresd/python):${PYTHONPATH:-}"
+       else
+               echo
+               echo Knot Resolver daemon is not configured.
+               echo "Please run './poe configure' (optionally with additional Meson arguments)"
+               echo
+               exit 2
+       fi
        popd
 }
diff --git a/manager/scripts/meson-configure b/manager/scripts/meson-configure
new file mode 100755 (executable)
index 0000000..c99ddea
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+# ensure consistent behaviour
+src_dir="$(dirname "$(realpath "$0")")"
+source $src_dir/_env.sh
+
+pushd ..
+meson setup manager/.build_kresd --reconfigure --prefix=$(realpath manager/.install_kresd) "$@"
+popd
+
+build_kresd
index 05f093c92077e06cddd56d5d662b0c5933a7a8a6..535c497cc605c984f78000289dd86863b986feaa 100644 (file)
@@ -254,7 +254,6 @@ subdir('lib')
 ## Remaining code
 subdir('daemon')
 subdir('modules')
-subdir('manager')
 subdir('python')
 subdir('utils')
 if get_option('bench') == 'enabled'
@@ -340,7 +339,6 @@ run_target(
 # https://github.com/mesonbuild/meson/issues/2404
 s_managed_ta = managed_ta ? 'enabled' : 'disabled'
 s_install_root_keys = install_root_keys ? 'enabled' : 'disabled'
-s_build_manager = build_manager ? 'enabled' : 'disabled'
 s_build_utils = build_utils ? 'enabled' : 'disabled'
 s_build_dnstap = build_dnstap ? 'enabled' : 'disabled'
 s_build_unit_tests = build_unit_tests ? 'enabled' : 'disabled'
@@ -375,7 +373,6 @@ message('''
     cache_dir:          @0@'''.format(systemd_cache_dir) + '''
 
   optional components
-    manager:            @0@'''.format(s_build_manager) + '''
     utils:              @0@'''.format(s_build_utils) + '''
     dnstap:             @0@'''.format(s_build_dnstap) + '''
     unit_tests:         @0@'''.format(s_build_unit_tests) + '''
index 428d5aaaa26def4c0dfb43c902340667aa921185..0f40485032e3b943ea8181591f05c117bf015ec5 100644 (file)
@@ -125,18 +125,6 @@ option(
   description: 'build benchmarks',
 )
 
-option(
-  'manager',
-  type: 'combo',
-  choices: [
-    'auto',
-    'enabled',
-    'disabled',
-  ],
-  value: 'disabled',
-  description: 'build manager and its features',
-)
-
 option(
   'utils',
   type: 'combo',