summaryrefslogtreecommitdiffstats
path: root/scripts/poe-tasks
diff options
context:
space:
mode:
authorAleš Mrázek <ales.mrazek@nic.cz>2024-09-09 23:44:28 +0200
committerAleš Mrázek <ales.mrazek@nic.cz>2024-09-30 11:16:07 +0200
commit5cb2ac348919318c5f9f7aee3e005c4d802be2c2 (patch)
treeaabd4acd3aaaea0d0edbe90764cf2e96c0f565cd /scripts/poe-tasks
parentMerge !1618: daemon udp connect: use connected udp communication (diff)
downloadknot-resolver-5cb2ac348919318c5f9f7aee3e005c4d802be2c2.tar.xz
knot-resolver-5cb2ac348919318c5f9f7aee3e005c4d802be2c2.zip
scripts/poe-tasks: text and naming improvements
Diffstat (limited to 'scripts/poe-tasks')
-rwxr-xr-xscripts/poe-tasks/clean4
-rwxr-xr-xscripts/poe-tasks/configure8
-rwxr-xr-xscripts/poe-tasks/man4
-rwxr-xr-xscripts/poe-tasks/run10
-rw-r--r--scripts/poe-tasks/utils/_env.sh48
5 files changed, 43 insertions, 31 deletions
diff --git a/scripts/poe-tasks/clean b/scripts/poe-tasks/clean
index ff69ad69..697f7dd2 100755
--- a/scripts/poe-tasks/clean
+++ b/scripts/poe-tasks/clean
@@ -10,9 +10,9 @@ echo --------------------------------------------
rm -vrf .coverage .mypy_cache .pytest_cache
echo
-echo Removing meson build directories and files
+echo Removing Meson build directories and files
echo ------------------------------------------
-rm -vrf .build_kresd .install_kresd build build_doc dist
+rm -vrf $build_dir $install_dir build build_doc dist
echo
echo Removing __pycache__ directories and files
diff --git a/scripts/poe-tasks/configure b/scripts/poe-tasks/configure
index ea2bdeb3..c7cfbb2f 100755
--- a/scripts/poe-tasks/configure
+++ b/scripts/poe-tasks/configure
@@ -4,10 +4,6 @@
src_dir="$(dirname "$(realpath "$0")")"
source $src_dir/utils/_env.sh
-reconfigure=''
-if [ -f .build_kresd/ninja.build ]; then
- reconfigure='--reconfigure'
-fi
-meson setup .build_kresd "$reconfigure" --prefix=$(realpath .install_kresd) -Duser=$USER -Dgroup=$(id -gn) "$@"
+kres_meson_configure
-build_kresd
+kres_meson_build
diff --git a/scripts/poe-tasks/man b/scripts/poe-tasks/man
index 3cdafb34..f6986d58 100755
--- a/scripts/poe-tasks/man
+++ b/scripts/poe-tasks/man
@@ -4,6 +4,6 @@
src_dir="$(dirname "$(realpath "$0")")"
source $src_dir/utils/_env.sh
-build_kresd
+build_knot_resolver_c
-man -l .install_kresd/share/man/man8/$1*
+man -l .install/share/man/man8/$1*
diff --git a/scripts/poe-tasks/run b/scripts/poe-tasks/run
index 90f02632..cd3ca37d 100755
--- a/scripts/poe-tasks/run
+++ b/scripts/poe-tasks/run
@@ -4,11 +4,11 @@
src_dir="$(dirname "$(realpath "$0")")"
source $src_dir/utils/_env.sh
-build_kresd
+kres_meson_build
echo
-echo Building Knot Resolver Manager native extensions
-echo ------------------------------------------------
+echo Building Knot Resolver Python komponents
+echo ----------------------------------------
poetry build
# copy native modules from build directory to source directory
shopt -s globstar
@@ -22,8 +22,8 @@ shopt -u globstar
shopt -u nullglob
echo
-echo The Knot Resolver management API is accessible on http://localhost:5000
-echo -----------------------------------------------------------------------
+echo The Knot Resolver API is accessible on http://localhost:5000
+echo ------------------------------------------------------------
# run the knot-resolver manager
python3 -m knot_resolver.manager $@
diff --git a/scripts/poe-tasks/utils/_env.sh b/scripts/poe-tasks/utils/_env.sh
index 1ea73a39..59947fb5 100644
--- a/scripts/poe-tasks/utils/_env.sh
+++ b/scripts/poe-tasks/utils/_env.sh
@@ -17,6 +17,10 @@ if test -z "$gitroot"; then
fi
cd $gitroot
+# build dirs
+build_dir=$gitroot/.build
+install_dir=$gitroot/.install
+
# ensure consistent environment with virtualenv
if test -z "$VIRTUAL_ENV" -a "$CI" != "true" -a -z "$KNOT_ENV"; then
echo -e "${yellow}You are NOT running the script within the project's virtual environment.${reset}"
@@ -41,31 +45,43 @@ fi
mkdir -p "$KRES_CONFIG_DIR/runtime" "$KRES_CONFIG_DIR/cache"
# env variables
-if [ -z "${KRES_MANAGER_CONFIG:-}" ]; then
- KRES_MANAGER_CONFIG="$KRES_CONFIG_DIR/config.dev.yaml"
+if [ -z "${KRES_CONFIG_FILE:-}" ]; then
+ KRES_CONFIG_FILE="$KRES_CONFIG_DIR/config.dev.yaml"
fi
-if [ -z "${KRES_MANAGER_API_SOCK:-}" ]; then
- KRES_MANAGER_API_SOCK="$KRES_CONFIG_DIR/manager.sock"
+if [ -z "${KRES_API_SOCK_FILE:-}" ]; then
+ KRES_API_SOCK_FILE="$KRES_CONFIG_DIR/kres-api.sock"
fi
-export KRES_MANAGER_CONFIG
-export KRES_MANAGER_API_SOCK
+export KRES_CONFIG_FILE
+export KRES_API_SOCK_FILE
+
+function kres_meson_configure {
+ reconfigure=''
+ if [ -f .build/ninja.build ]; then
+ reconfigure='--reconfigure'
+ fi
+ echo
+ echo Configuring Knot Resolver Meson
+ echo -------------------------------
+ echo -e "${blue}${reset}"
+ echo
+ meson setup $build_dir $reconfigure --prefix=$install_dir -Duser=$USER -Dgroup=$(id -gn) "$@"
+}
-function build_kresd {
- if [ -d .build_kresd ]; then
+function kres_meson_build {
+ if [ -d .build ]; then
echo
- echo Building Knot Resolver
- echo ----------------------
+ echo Building Knot Resolver C komponents
+ 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 -e "\t${blue}rm -r $install_dir $build_dir${reset}"
echo
- ninja -C .build_kresd
- ninja install -C .build_kresd
- export PYTHONPATH="$(realpath .build_kresd/python):${PYTHONPATH:-}"
+ ninja -C $build_dir
+ ninja install -C $build_dir
else
echo
- echo Knot Resolver daemon is not configured.
- echo "Please run './poe configure' (optionally with additional Meson arguments)"
+ echo Knot Resolver is not configured for building.
+ echo "Please run './poe configure' (optionally with additional Meson arguments)".
echo
exit 2
fi