]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
scripts/poe-tasks: doc-schema added
authorAleš Mrázek <ales.mrazek@nic.cz>
Mon, 16 Sep 2024 15:53:12 +0000 (17:53 +0200)
committerAleš Mrázek <ales.mrazek@nic.cz>
Mon, 30 Sep 2024 09:16:07 +0000 (11:16 +0200)
The script that generates the configuration JSON schema with the correct values.

pyproject.toml
python/knot_resolver/constants.py
scripts/poe-tasks/clean
scripts/poe-tasks/doc-schema [new file with mode: 0755]
scripts/poe-tasks/utils/_env.sh

index b14e2c668dae5fa350d760b51dc96bf1e467e3b6..35e12da5ca3e905230062ef86cdfc043e124fb89 100644 (file)
@@ -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" }
index 5288b519b2c94685391d6ae915ab7422045d0e6c..2acb86603574f604271bf3a9fb520af7047eb294 100644 (file)
@@ -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
index f5d4ca1a4ddc1cbeb7bd704a0edc5e27d648d99d..a50044f0e2b43c6ebec3972c5d067578d90a2a47 100755 (executable)
@@ -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 (executable)
index 0000000..4cf5c18
--- /dev/null
@@ -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
index b6cbb19e2dbf4ea3b6b1d182e96e2f84a40dc5d9..13ed2d5dd5061830c24af74d765c4b8fff102dda 100644 (file)
@@ -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