+**/__pycache__/
*.6
*.Plo
*.a
*.gcno
*.gcov
*.info
+*.junit.xml
*.la
*.lo
*.log
*.so.*
*.swp
*~
+.coverage
.deps
.dirstamp
.libs
+.mypy_cache
.pytest_cache
-/.build-depend
+/.build*/
/.cache
+/.install_dev
/aclocal.m4
/ar-lib
/autom4te.cache/*
/daemon/lua/*.inc
/daemon/lua/trust_anchors.lua
/depcomp
+/dist
/distro/tests/*/.vagrant
/doc/**/.doctrees
/doc/**/doxyxml
kresd.amalg.c
libkres.amalg.c
luacov.*.out
-**/__pycache__/
-dist/
-.coverage
-.mypy_cache
-.install/
-.build/
-.build_doc/
poetry.lock
-*.junit.xml
echo Removing mypy, pytest and other cached files
echo --------------------------------------------
rm -vrf .coverage .mypy_cache .pytest_cache
-
echo
echo ------------------------------------------
echo Removing Meson build directories and files
echo ------------------------------------------
-rm -vrf "$build_dir" "$KRES_INSTALL_DIR" "$build_schema_dir" "$build_doc_dir" build dist
-
+rm -vrf "$build_dir" "$build_dev_dir" "$KRES_DEV_INSTALL_DIR" build dist
echo
echo ------------------------------------------
echo Removing __pycache__ directories and files
src_dir="$(dirname "$(realpath "$0")")"
source $src_dir/utils/_env.sh
-meson_setup_configure
+echo
+meson_setup_configure_dev
+echo
+echo -----------------------------------------------
+echo Copying constants.py module configured by Meson
+echo -----------------------------------------------
+cp -v $build_dev_dir/python/constants.py $gitroot/python/knot_resolver/constants.py
+echo
src_dir="$(dirname "$(realpath "$0")")"
source $src_dir/utils/_env.sh
-echo
-echo -----------------------------------------------------
-echo Configuring documentation build directory using Meson
-echo -----------------------------------------------------
-meson $build_doc_dir -Ddoc=enabled
-echo
+meson_setup_configure -Ddoc=enabled
+
echo ----------------------------------
echo Building documentation using ninja
echo ----------------------------------
-ninja -C $build_doc_dir doc
+ninja -C $build_dir doc
echo
src_dir="$(dirname "$(realpath "$0")")"
source $src_dir/utils/_env.sh
-rm -rf $build_schema_dir > /dev/null
-meson setup \
- $build_schema_dir \
- --buildtype=release \
- --prefix=/usr > /dev/null
-cp -v $build_schema_dir/python/constants.py $gitroot/python/knot_resolver/constants.py
-
-python -m knot_resolver.client schema > $gitroot/doc/_static/config.schema.json
-rm -rf $build_schema_dir
+schema_file="$gitroot/doc/_static/config.schema.json"
+
+meson_setup_configure > /dev/null
+cp $build_dir/python/constants.py $gitroot/python/knot_resolver/constants.py
+python -m knot_resolver.client schema > $schema_file
+
+echo New configuration JSON schem saved to $schema_file
\ No newline at end of file
src_dir="$(dirname "$(realpath "$0")")"
source $src_dir/utils/_env.sh
-is_buil_dir_configured
+echo
+is_build_dev_dir_configured
+echo
# run knot-resolver client
-python3 -m knot_resolver.client --config "$KRES_CONFIG_FILE" "$@"
+python3 -m knot_resolver.client --config "$KRES_DEV_CONFIG_FILE" "$@"
src_dir="$(dirname "$(realpath "$0")")"
source $src_dir/utils/_env.sh
-ninja_install
+echo
+ninja_dev_install
+echo
+echo ------------------------------------
+echo Creating missing runtime directories
+echo ------------------------------------
+mkdir -vp $KRES_DEV_INSTALL_DIR/run/knot-resolver $KRES_DEV_INSTALL_DIR/var/cache/knot-resolver
echo
echo ---------------------------------------
echo Building Python komponents using Poetry
echo --------------------------------------
echo Starting Knot Resolver wit the Manager
echo --------------------------------------
-python3 -m knot_resolver.manager --config "$KRES_CONFIG_FILE" "$@"
+python3 -m knot_resolver.manager --config "$KRES_DEV_CONFIG_FILE" "$@"
# build dirs
build_dir="$gitroot/.build"
-build_doc_dir="$gitroot/.build_doc"
-build_schema_dir="$gitroot/.build_schema"
-install_dir="$gitroot/.install"
+build_dev_dir="$gitroot/.build_dev"
+install_dev_dir="$gitroot/.install_dev"
# ensure consistent environment with virtualenv
if test -z "$VIRTUAL_ENV" -a "$CI" != "true" -a -z "$KNOT_ENV"; then
set -o nounset
# Set enviromental variables if not
-if [ -z "${KRES_INSTALL_DIR:-}" ]; then
- KRES_INSTALL_DIR="$install_dir"
+if [ -z "${KRES_DEV_INSTALL_DIR:-}" ]; then
+ KRES_DEV_INSTALL_DIR="$install_dev_dir"
fi
-if [ -z "${KRES_CONFIG_FILE:-}" ]; then
- KRES_CONFIG_FILE="$gitroot/etc/config/config.dev.yaml"
+if [ -z "${KRES_DEV_CONFIG_FILE:-}" ]; then
+ KRES_DEV_CONFIG_FILE="$gitroot/etc/config/config.dev.yaml"
fi
-export KRES_INSTALL_DIR
-export KRES_CONFIG_FILE
+export KRES_DEV_INSTALL_DIR
+export KRES_DEV_CONFIG_FILE
function meson_setup_configure {
- reconfigure=''
- if [ -d .build ]; then
+ local reconfigure=''
+ if [ -d $build_dir ]; then
reconfigure='--reconfigure'
fi
- echo
echo ---------------------------------------
echo Configuring build directory using Meson
echo ---------------------------------------
meson setup \
$build_dir \
$reconfigure \
- --prefix=$KRES_INSTALL_DIR \
+ --prefix=/usr \
+ "$@"
+}
+
+function meson_setup_configure_dev {
+ local reconfigure=''
+ if [ -d $build_dev_dir ]; then
+ reconfigure='--reconfigure'
+ fi
+ echo ---------------------------------------
+ echo Configuring build directory using Meson
+ echo ---------------------------------------
+ meson setup \
+ $build_dev_dir \
+ $reconfigure \
+ --prefix=$KRES_DEV_INSTALL_DIR \
-D user=$(id -un) \
-D group=$(id -gn) \
"$@"
- echo
- echo -----------------------------------------------
- echo Copying constants.py module configured by Meson
- echo -----------------------------------------------
- cp -v $build_dir/python/constants.py $gitroot/python/knot_resolver/constants.py
- echo
}
-function is_buil_dir_configured {
- if [ ! -d .build ]; then
+function is_build_dev_dir_configured {
+ if [ ! -d $build_dev_dir ]; then
echo
echo Knot Resolver build directory is not configured by Meson.
echo "Please run './poe configure' (optionally with additional Meson arguments)".
fi
}
-function ninja_install {
+function ninja_dev_install {
- is_buil_dir_configured
+ is_build_dev_dir_configured
echo
echo --------------------------------------------
- echo Building/installing C komponents using ninja
+ echo Building/installing C komponents using Ninja
echo --------------------------------------------
- ninja -C $build_dir
- ninja install -C $build_dir
-
- mkdir -vp $KRES_INSTALL_DIR/run/knot-resolver $KRES_INSTALL_DIR/var/cache/knot-resolver
- echo
+ ninja -C $build_dev_dir
+ ninja install -C $build_dev_dir
}