From: Aleš Mrázek Date: Mon, 16 Sep 2024 15:53:12 +0000 (+0200) Subject: scripts/poe-tasks: doc-schema added X-Git-Tag: v6.0.9~9^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ad88a404edffd477d78f210f2d4328543e8a8ff;p=thirdparty%2Fknot-resolver.git scripts/poe-tasks: doc-schema added The script that generates the configuration JSON schema with the correct values. --- diff --git a/pyproject.toml b/pyproject.toml index b14e2c668..35e12da5c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -75,6 +75,7 @@ configure = { cmd = "scripts/poe-tasks/configure", help = "(Re)configure Meson b run = { cmd = "scripts/poe-tasks/run", help = "Run Knot Resolver" } run-debug = { cmd = "scripts/poe-tasks/run-debug", help = "Debug Knot Resolver with debugpy" } doc = { cmd = "scripts/poe-tasks/doc", help = "Create Knot Resolver HTML documentation" } +doc-schema = { cmd = "scripts/poe-tasks/doc-schema", help = "Generate a JSON schema of the Knot Resolver configuration"} test = { cmd = "scripts/poe-tasks/test", help = "Run pytest unit tests" } check = { cmd = "scripts/poe-tasks/check", help = "Check that all dependencies are installed and run static code analysis" } examples = { cmd = "scripts/poe-tasks/examples", help = "Validate all configuration examples using 'kresctl validate' utility" } diff --git a/python/knot_resolver/constants.py b/python/knot_resolver/constants.py index 5288b519b..2acb86603 100644 --- a/python/knot_resolver/constants.py +++ b/python/knot_resolver/constants.py @@ -7,7 +7,7 @@ GROUP = "knot-resolver" # dirs paths RUN_DIR = Path("/run/knot-resolver") ETC_DIR = Path("/etc/knot-resolver") -SBIN_DIR = Path("/usr/bin") +SBIN_DIR = Path("/usr/sbin") CACHE_DIR = Path("/var/cache/knot-resolver") # files paths diff --git a/scripts/poe-tasks/clean b/scripts/poe-tasks/clean index f5d4ca1a4..a50044f0e 100755 --- a/scripts/poe-tasks/clean +++ b/scripts/poe-tasks/clean @@ -14,7 +14,7 @@ echo echo ------------------------------------------ echo Removing Meson build directories and files echo ------------------------------------------ -rm -vrf "$build_dir" "$KRES_INSTALL_DIR" "$build_doc_dir" build dist +rm -vrf "$build_dir" "$KRES_INSTALL_DIR" "$build_schema_dir" "$build_doc_dir" build dist echo echo ------------------------------------------ diff --git a/scripts/poe-tasks/doc-schema b/scripts/poe-tasks/doc-schema new file mode 100755 index 000000000..4cf5c1862 --- /dev/null +++ b/scripts/poe-tasks/doc-schema @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +# ensure consistent behaviour +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 diff --git a/scripts/poe-tasks/utils/_env.sh b/scripts/poe-tasks/utils/_env.sh index b6cbb19e2..13ed2d5dd 100644 --- a/scripts/poe-tasks/utils/_env.sh +++ b/scripts/poe-tasks/utils/_env.sh @@ -20,6 +20,7 @@ cd $gitroot # build dirs build_dir="$gitroot/.build" build_doc_dir="$gitroot/.build_doc" +build_schema_dir="$gitroot/.build_schema" install_dir="$gitroot/.install" # ensure consistent environment with virtualenv