--- /dev/null
+from pathlib import Path
+
+VERSION = "@version@"
+USER = "@user@"
+GROUP = "@group@"
+
+# dirs paths
+RUN_DIR = Path("@run_dir@")
+ETC_DIR = Path("@etc_dir@")
+SBIN_DIR = Path("@sbin_dir@")
+
+# files paths
+CONFIG_FILE = ETC_DIR / "config.yaml"
+API_SOCK_FILE = RUN_DIR / "kres-api.sock"
+
+# environmental variables
+CONFIG_FILE_ENV_VAR = "KRES_CONFIG_FILE"
+API_SOCK_FILE_ENV_VAR = "KRES_API_SOCK_FILE"
+
+# executables paths
+KRESD_EXECUTABLE = SBIN_DIR / "kresd"
+KRES_CACHE_GC_EXECUTABLE = SBIN_DIR / "kres-cache-gc"
-import logging
-from importlib.metadata import version
-from importlib.util import find_spec
from pathlib import Path
-# Installed Knot Resolver build options from Meson is semi-optional.
-# They are needed to run the resolver, but not for its unit tests.
-if find_spec("knot_resolver_build_options"):
- import knot_resolver_build_options as build_conf # type: ignore[import-not-found]
-else:
- build_conf = None
+VERSION = "6.0.8"
+USER = "knot-resolver"
+GROUP = "knot-resolver"
-VERSION = version("knot_resolver") if find_spec("knot_resolver") else "6"
-WORKERS_MAX_DEFAULT = 256
-LOGGING_LEVEL_STARTUP = logging.DEBUG
-PID_FILE_NAME = "knot-resolver.pid"
+# dirs paths
+RUN_DIR = Path("/run/knot-resolver")
+ETC_DIR = Path("/etc/knot-resolver")
+SBIN_DIR = Path("/usr/bin")
-FIX_COUNTER_ATTEMPTS_MAX = 2
-FIX_COUNTER_DECREASE_INTERVAL_SEC = 30 * 60
-WATCHDOG_INTERVAL_SEC: float = 5
+# files paths
+CONFIG_FILE = ETC_DIR / "config.yaml"
+API_SOCK_FILE = RUN_DIR / "kres-api.sock"
-USER_DEFAULT = build_conf.user if build_conf else "knot-resolver"
-GROUP_DEFAULT = build_conf.group if build_conf else "knot-resolver"
+# environmental variables
+CONFIG_FILE_ENV_VAR = "KRES_CONFIG_FILE"
+API_SOCK_FILE_ENV_VAR = "KRES_API_SOCK_FILE"
-RUN_DIR_DEFAULT: Path = build_conf.run_dir if build_conf else Path("/var/run/knot-resolver")
-ETC_DIR_DEFAULT: Path = build_conf.etc_dir if build_conf else Path("/etc/knot-resolver")
-CONFIG_FILE_PATH_DEFAULT = ETC_DIR_DEFAULT / "config.yaml"
-CONFIG_FILE_PATH_ENV_VAR = "KRES_MANAGER_CONFIG"
-API_SOCK_PATH_DEFAULT = RUN_DIR_DEFAULT / "kres-api.sock"
-API_SOCK_PATH_ENV_VAR = "KRES_MANAGER_API_SOCK"
-
-
-def kresd_executable() -> Path:
- assert build_conf is not None
- return build_conf.sbin_dir / "kresd"
-
-
-def kres_cache_gc_executable() -> Path:
- assert build_conf is not None
- return build_conf.sbin_dir / "kres-cache-gc"
+# executables paths
+KRESD_EXECUTABLE = SBIN_DIR / "kresd"
+KRES_CACHE_GC_EXECUTABLE = SBIN_DIR / "kres-cache-gc"
+++ /dev/null
-from pathlib import Path
-
-__version__ = "@kres_version@"
-
-sbin_dir = Path("@sbin_dir@")
-bin_dir = Path("@bin_dir@")
-etc_dir = Path("@etc_dir@")
-run_dir = Path("@run_dir@")
-lib_dir = Path("@lib_dir@")
-modules_dir = Path("@modules_dir@")
-user = "@user@"
-group = "@group@"
# python
# SPDX-License-Identifier: GPL-3.0-or-later
-python_config = configuration_data()
-python_config.set('kres_version', meson.project_version())
-python_config.set('sbin_dir', sbin_dir)
-python_config.set('bin_dir', bin_dir)
-python_config.set('etc_dir', etc_dir)
-python_config.set('run_dir', run_dir)
-python_config.set('lib_dir', lib_dir)
-python_config.set('modules_dir', modules_dir)
-python_config.set('user', user)
-python_config.set('group', group)
+constants_config = configuration_data()
+constants_config.set('version', meson.project_version())
+constants_config.set('user', user)
+constants_config.set('group', group)
+constants_config.set('run_dir', run_dir)
+constants_config.set('etc_dir', etc_dir)
+constants_config.set('sbin_dir', sbin_dir)
configure_file(
- input: 'knot_resolver_build_options.py.in',
- output: 'knot_resolver_build_options.py',
- configuration: python_config,
-)
-
-configure_file(
- input: 'setup.py.in',
- output: 'setup.py',
- configuration: python_config,
+ input: 'constants.py.in',
+ output: 'constants.py',
+ configuration: constants_config,
)
+++ /dev/null
-from setuptools import setup
-
-# TODO: Migrate this to a pyproject.toml once Debian 11 support is dropped.
-setup(
- name="knot_resolver_build_options",
- version="@kres_version@",
- description="Knot Resolver helper data for Python",
- author="Oto Šťáva",
- author_email="oto.stava@nic.cz",
- python_requires=">=3.8,<4.0",
- py_modules=["knot_resolver_build_options"],
-)
source $src_dir/utils/_env.sh
kres_meson_configure
-
-kres_meson_build
echo -e "${blue}${reset}"
echo
meson setup $build_dir $reconfigure --prefix=$install_dir -Duser=$USER -Dgroup=$(id -gn) "$@"
+ echo
+ echo Copying Knot Resolver constants.py module
+ echo -----------------------------------------
+ cp -v $build_dir/python/constants.py $gitroot/python/knot_resolver/constants.py
+ echo
}
function kres_meson_build {
echo
ninja -C $build_dir
ninja install -C $build_dir
+ echo
else
echo
echo Knot Resolver is not configured for building.