]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3730] Add other meson targets
authorAndrei Pavel <andrei@isc.org>
Fri, 21 Feb 2025 13:06:10 +0000 (15:06 +0200)
committerAndrei Pavel <andrei@isc.org>
Fri, 21 Feb 2025 16:43:18 +0000 (18:43 +0200)
- add-changelog-entry
- coverage (.lcovrc)
- cppcheck, cppcheck-report
- doc (renamed from docs)
- grammar
- mes-doc
- uml
- update-python-dependencies
- valgrind (add_test_setup instead of custom target)

15 files changed:
.lcovrc [new file with mode: 0644]
configure.ac
doc/devel/meson.build
doc/make-grammar.sh.in [new file with mode: 0755]
doc/meson.build
doc/sphinx/make-mes-doc.sh.in [new file with mode: 0755]
doc/sphinx/make-uml.sh.in [new file with mode: 0755]
doc/sphinx/make-update-python-dependencies.sh.in [new file with mode: 0755]
doc/sphinx/meson.build
doc/sphinx/regen-doc.sh.in [deleted file]
meson.build
src/bin/netconf/netconf_messages.cc
src/bin/netconf/netconf_messages.h
src/lib/log/tests/meson.build
src/lib/process/cfgrpt/meson.build

diff --git a/.lcovrc b/.lcovrc
new file mode 100644 (file)
index 0000000..5bf1d6b
--- /dev/null
+++ b/.lcovrc
@@ -0,0 +1 @@
+ignore_errors = gcov,inconsistent,mismatch,source
index d6dd2a969e811cc28031b251bd8083a8cb4c2939..f337c0e6008a184f09ea3eb64d7c3bcf8e43b3f8 100644 (file)
@@ -1393,10 +1393,6 @@ AC_ARG_ENABLE(logger-checks,
 AM_CONDITIONAL(ENABLE_LOGGER_CHECKS, test x$enable_logger_checks != xno)
 AM_COND_IF([ENABLE_LOGGER_CHECKS], [AC_DEFINE([ENABLE_LOGGER_CHECKS], [1], [Check logger messages?])])
 
-# Check for asciidoc
-AC_PATH_PROG(ASCIIDOC, asciidoc, no)
-AM_CONDITIONAL(HAVE_ASCIIDOC, test "x$ASCIIDOC" != "xno")
-
 # Check for plantuml
 AC_PATH_PROG(PLANTUML, plantuml, no)
 AM_CONDITIONAL(HAVE_PLANTUML, test "x$PLANTUML" != "xno")
index 1e344fd92d3a07238174744bf8825cc61c051ccd..020fac8f4f8082e6a986c6f6a71c9f69472c8306 100644 (file)
@@ -13,4 +13,4 @@ configure_file(
     configuration: make_devel_conf_data,
 )
 make_devel = f'@current_build_dir@/make-devel.sh'
-run_target('make-devel', command: [CD_AND_RUN, current_source_dir, make_devel])
+MAKE_DEVEL = run_target('make-devel', command: [CD_AND_RUN, current_source_dir, make_devel])
diff --git a/doc/make-grammar.sh.in b/doc/make-grammar.sh.in
new file mode 100755 (executable)
index 0000000..9f5530c
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# Expressions don't expand in single quotes, use double quotes for that. [SC2016]
+# shellcheck disable=SC2016
+
+set -euv
+
+cd @TOP_SOURCE_DIR@
+
+mkdir -p doc/sphinx/grammar
+
+./tools/extract_bnf.sh src/bin/dhcp4/dhcp4_parser \
+  --markdown ':ref:`dhcp4`' > doc/sphinx/grammar/grammar-dhcp4-parser.rst
+./tools/extract_bnf.sh src/bin/dhcp6/dhcp6_parser \
+  --markdown ':ref:`dhcp6`' > doc/sphinx/grammar/grammar-dhcp6-parser.rst
+./tools/extract_bnf.sh src/bin/d2/d2_parser \
+  --markdown ':ref:`dhcp-ddns-server`' > doc/sphinx/grammar/grammar-d2-parser.rst
+./tools/extract_bnf.sh src/bin/agent/agent_parser \
+  --markdown ':ref:`kea-ctrl-agent`' > doc/sphinx/grammar/grammar-ca-parser.rst
+./tools/extract_bnf.sh src/bin/netconf/netconf_parser \
+  --markdown ':ref:`netconf`' > doc/sphinx/grammar/grammar-netconf-parser.rst
index 8a0e9278c0deebec8e6473aab6918ec7bd78ac5b..d632dfe5292827782d901d78e848b956360476b2 100644 (file)
@@ -78,13 +78,11 @@ examples = [
     'examples/netconf/comments.json',
     'examples/netconf/simple-dhcp4.json',
     'examples/netconf/simple-dhcp6.json',
-
     'examples/template-power-user-home/info.md',
     'examples/template-power-user-home/kea-ca-1.conf',
     'examples/template-power-user-home/kea-ca-2.conf',
     'examples/template-power-user-home/kea-dhcp4-1.conf',
     'examples/template-power-user-home/kea-dhcp4-2.conf',
-
     'examples/template-ha-mt-tls/info.md',
     'examples/template-ha-mt-tls/kea-ca-1.conf',
     'examples/template-ha-mt-tls/kea-ca-2.conf',
@@ -93,4 +91,9 @@ examples = [
 ]
 install_data(examples, preserve_path: true, install_dir: 'share/doc/kea')
 
-# grammar target
+make_grammar = configure_file(
+    input: 'make-grammar.sh.in',
+    output: 'make-grammar.sh',
+    configuration: {'TOP_SOURCE_DIR': TOP_SOURCE_DIR},
+)
+MAKE_GRAMMAR = run_target('make-grammar', command: [make_grammar])
diff --git a/doc/sphinx/make-mes-doc.sh.in b/doc/sphinx/make-mes-doc.sh.in
new file mode 100755 (executable)
index 0000000..e4383a0
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+set -euv
+
+cd @TOP_SOURCE_DIR@
+
+# api-files.txt
+find src/share/api -type f -name '[a-z]*.json' | sort -V > "@srcdir@/api-files.txt"
+
+# mes-files.txt
+find . -type f -name '*.mes' | sort -V | sed 's#^./##g' > "@srcdir@/mes-files.txt"
+
+# debug-messages.rst
+@PYTHON@ ./tools/check-messages.py --generate-debug-messages-page
+
+# kea-messages.rst
+cd @srcdir@
+@PYTHON@ ./mes2doc.py -o kea-messages.rst
diff --git a/doc/sphinx/make-uml.sh.in b/doc/sphinx/make-uml.sh.in
new file mode 100755 (executable)
index 0000000..684f8ab
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+set -euv
+
+cd @srcdir@
+
+if test "@HAVE_PLANTUML@" != "no" ; then
+    # uml-to-png
+    # shellcheck disable=SC2043
+    for uml in @umls@; do @PLANTUML@ -tpng "$uml"; done
+    # uml-to-svg
+    # shellcheck disable=SC2043
+    for uml in @umls@; do @PLANTUML@ -tsvg "$uml"; done
+    # format-svgs
+    if test "@HAVE_XMLLINT" != "no" ; then
+        # shellcheck disable=SC2043
+        for svg in @svgs@; do xmllint --format "$svg" > tmp; mv tmp "$svg"; done
+    else
+        printf 'WARNING: xmllint not found. SVGs not formatted.\n'
+    fi
+    # uml-to-txt
+    # shellcheck disable=SC2043
+    for uml in @tumls@; do @PLANTUML@ -ttxt "$uml"; done
+    # shellcheck disable=SC2043
+    for txt in @txts@; do sed 's/ *$//g' "$txt" > tmp; mv tmp "$txt"; done
+fi
diff --git a/doc/sphinx/make-update-python-dependencies.sh.in b/doc/sphinx/make-update-python-dependencies.sh.in
new file mode 100755 (executable)
index 0000000..a61d53e
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -euv
+
+cd @srcdir@
+
+if test "@HAVE_PIP_COMPILE@" != "no" ; then
+    rm -f ./src/requirements.txt
+    pip-compile -r ./src/requirements.in
+fi
index eb0d5f891547f42df3e8df4da4cb468d0e0e30d5..0368fbfea15efb6dc61ce803d7a8850a108c774d 100644 (file)
@@ -120,23 +120,36 @@ mandir = get_option('mandir')
 mandir8 = f'@PREFIX@/@mandir@/man8/'
 make_conf_data.set('mandir8', mandir8)
 
+MAKE_DOC = disabler()
 if sphinx_exe.found()
     make_doc = configure_file(
         input: 'make-doc.sh.in',
         output: 'make-doc.sh',
         configuration: make_conf_data,
     )
-    run_target('make-doc', command: [make_doc])
+    MAKE_DOC = run_target('make-doc', command: [make_doc])
 endif
-regen_doc = configure_file(
-    input: 'regen-doc.sh.in',
-    output: 'regen-doc.sh',
-    configuration: make_conf_data,
-)
 make_install = configure_file(
     input: 'make-install.sh.in',
     output: 'make-install.sh',
     configuration: make_conf_data,
 )
-run_target('regen-doc', command: [regen_doc])
+make_mes_doc = configure_file(
+    input: 'make-mes-doc.sh.in',
+    output: 'make-mes-doc.sh',
+    configuration: make_conf_data,
+)
+make_uml = configure_file(
+    input: 'make-uml.sh.in',
+    output: 'make-uml.sh',
+    configuration: make_conf_data,
+)
+make_update_python_dependencies = configure_file(
+    input: 'make-update-python-dependencies.sh.in',
+    output: 'make-update-python-dependencies.sh',
+    configuration: make_conf_data,
+)
 meson.add_install_script(make_install)
+MAKE_MES_DOC = run_target('make-mes-doc', command: [make_mes_doc])
+MAKE_UML = run_target('make-uml', command: [make_uml])
+MAKE_UPDATE_PYTHON_DEPENDENCIES = run_target('make-update-python-dependencies', command: [make_update_python_dependencies])
diff --git a/doc/sphinx/regen-doc.sh.in b/doc/sphinx/regen-doc.sh.in
deleted file mode 100755 (executable)
index a8a0039..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/sh
-
-set -v
-set -e
-
-cd @srcdir@
-
-# mes-files.txt
-cd @TOP_SOURCE_DIR@
-find . -type f -name '*.mes' | sort -V | sed 's#^./##g' > @srcdir@/mes-files.txt
-
-# debug-messages.rst
-@PYTHON@ @TOP_SOURCE_DIR@/tools/check-messages.py --generate-debug-messages-page
-
-# kea-messages.rst
-@PYTHON@ @srcdir@/mes2doc.py -o @srcdir@/kea-messages.rst
-
-# api-files.txt
-cd @TOP_SOURCE_DIR@
-find src/share/api -type f -name '[a-z]*.json' | sort -V > @srcdir@/api-files.txt
-
-cd @srcdir@
-if test "@HAVE_PLANTUML@" != "no" ; then
-    # uml-to-png
-    # shellcheck disable=SC2043
-    for uml in @umls@; do @PLANTUML@ -tpng "$uml"; done
-    # uml-to-svg
-    # shellcheck disable=SC2043
-    for uml in @umls@; do @PLANTUML@ -tsvg "$uml"; done
-    # format-svgs
-    if test "@HAVE_XMLLINT" != "no" ; then
-        # shellcheck disable=SC2043
-       for svg in @svgs@; do xmllint --format "$svg" > tmp; mv tmp "$svg"; done
-    else
-       printf 'WARNING: xmllint not found. SVGs not formatted.\n'
-    fi
-    # uml-to-txt
-    # shellcheck disable=SC2043
-    for uml in @tumls@; do @PLANTUML@ -ttxt "$uml"; done
-    # shellcheck disable=SC2043
-    for txt in @txts@; do sed 's/ *$//g' "$txt" > tmp; mv tmp "$txt"; done
-fi
-
-cd @srcdir@
-if test "@HAVE_PIP_COMPILE@" != "no" ; then
-    rm -f ./src/requirements.txt
-    pip-compile -r ./src/requirements.in
-fi
index 26dad43a9645ea3ca44c5a8e66e0be33e8223ed4..744dbe93bd499e513a9d8d723a9af3f8dd97d4a2 100644 (file)
@@ -162,7 +162,6 @@ awk_exe = find_program('gawk', 'awk', required: false)
 doxygen_exe = find_program('doxygen', required: false)
 sphinx_exe = find_program('sphinx-build', 'sphinx-build-3', required: false)
 pdflatex_exe = find_program('pdflatex', required: false)
-asciidoc_exe = find_program('asciidoc', required: false)
 plantuml_exe = find_program('plantuml', required: false)
 xmllint_exe = find_program('xmllint', required: false)
 pip_compile_exe = find_program('pip-compile', required: false)
@@ -436,26 +435,6 @@ else
     conf_data.set('PREMIUM_EXTENDED_VERSION', '"no"')
 endif
 
-#### Configuration Files
-
-# TODO: Change to config.h.in when autotools are removed.
-configure_file(
-    input: 'meson-config.h.in',
-    output: 'config.h',
-    configuration: conf_data,
-    install: true,
-    install_dir: 'include/kea',
-)
-
-# TODO: Change to kea_version.h.in when autotools are removed.
-configure_file(
-    input: 'meson-kea_version.h.in',
-    output: 'kea_version.h',
-    configuration: conf_data,
-    install: true,
-    install_dir: 'include/kea',
-)
-
 #### Default Includes
 
 INCLUDES = [
@@ -669,18 +648,94 @@ else
     report_conf_data.set('GTEST_LIBDIR', 'unknown')
 endif
 
+#### Configuration Files
+
 config_report_sh = configure_file(
     input: 'config-report.sh.in',
     output: 'config-report.sh',
     configuration: report_conf_data,
 )
-config_report = custom_target(
-    'config.report',
+
+# TODO: Change to config.h.in when autotools are removed.
+configure_file(
+    input: 'meson-config.h.in',
+    output: 'config.h',
+    configuration: conf_data,
+    install: true,
+    install_dir: 'include/kea',
+)
+
+# TODO: Change to kea_version.h.in when autotools are removed.
+configure_file(
+    input: 'meson-kea_version.h.in',
+    output: 'kea_version.h',
+    configuration: conf_data,
+    install: true,
+    install_dir: 'include/kea',
+)
+
+#### Custom Targets
+
+run_target(
+    'add-changelog-entry',
+    command: ['changelog_unreleased/.add-entry.sh'],
+)
+
+CONFIG_REPORT = custom_target(
     output: 'config.report',
-    depend_files: config_report_sh,
+    depend_files: [config_report_sh],
     command: [f'@TOP_BUILD_DIR@/config-report.sh'],
 )
 
+run_target(
+    'cppcheck',
+    command: [
+        'cppcheck',
+        '-I.',
+        '-I./src/lib',
+        '-I./src/bin',
+        '--error-exitcode=1',
+        '--inline-suppr',
+        '--quiet',
+        '--max-configs=256',
+        f'--suppressions-list=@TOP_SOURCE_DIR@/src/cppcheck-suppress.lst',
+        '--template={file}:{line}: check_fail: {message} ({severity},{id})',
+        '--xml',
+        '--xml-version=2',
+        '.',
+        '>',
+        'cppcheck-result.xml',
+        '2>&1',
+    ],
+)
+
+run_target(
+    'cppcheck-report',
+    command: [
+        'cppcheck-htmlreport',
+        '--file',
+        './cppcheck-result.xml',
+        '--report-dir',
+        './report',
+        '--title',
+        '"cppcheck report"',
+    ],
+)
+
+add_test_setup(
+    'valgrind',
+    exe_wrapper: [
+        valgrind_exe,
+        '--child-silent-after-fork=yes',
+        '--fullpath-after=',
+        '--leak-check=full',
+        '--num-callers=64',
+        '--quiet',
+        '--show-leak-kinds=all',
+        '--suppressions=src/valgrind.supp',
+    ],
+)
+
 #### Build Starts Here
 
 LIBS_BUILT_SO_FAR = []
@@ -694,18 +749,26 @@ if have_premium
     subdir('premium')
 endif
 
-alias_target('messages', TARGETS_GEN_MESSAGES)
-alias_target('parser', TARGETS_GEN_PARSER)
-
 top_docs = [
     'AUTHORS',
+    'CONTRIBUTING.md',
     'COPYING',
     'ChangeLog',
     'README',
-    'CONTRIBUTING.md',
     'SECURITY.md',
-    'platforms.rst',
     'code_of_conduct.md',
+    'platforms.rst',
 ]
 install_data(top_docs, install_dir: 'share/doc/kea')
 install_emptydir('var/run/kea')
+
+#### More Custom Targets
+
+alias_target('doc', MAKE_DOC)
+alias_target('devel', MAKE_DEVEL)
+alias_target('grammar', MAKE_GRAMMAR)
+alias_target('messages', TARGETS_GEN_MESSAGES)
+alias_target('mes-doc', MAKE_MES_DOC)
+alias_target('parser', TARGETS_GEN_PARSER)
+alias_target('uml', MAKE_UML)
+alias_target('update-python-dependencies', MAKE_UPDATE_PYTHON_DEPENDENCIES)
index e8acb1d4ca5cb643a3cf49889be95daf9f923978..e1bdb7dc0138461588ea5f53cb2370945ae4882f 100644 (file)
@@ -1,4 +1,4 @@
-// File created from ../../../src/bin/netconf/netconf_messages.mes
+// File created from src/bin/netconf/netconf_messages.mes
 
 #include <cstddef>
 #include <log/message_types.h>
index d9918d95a766e4ecd54abe8b2a29040e03ad3fd5..da79c1a3fbfd6bbbd382b69cb83d1f47e547fae3 100644 (file)
@@ -1,4 +1,4 @@
-// File created from ../../../src/bin/netconf/netconf_messages.mes
+// File created from src/bin/netconf/netconf_messages.mes
 
 #ifndef NETCONF_MESSAGES_H
 #define NETCONF_MESSAGES_H
index c3cd9d9a049bdc1077fcc507d658f9887bc3e486..3409d51ec82722509cb936f953cb1f3e98a2556d 100644 (file)
@@ -36,25 +36,25 @@ kea_log_init_tests = executable(
 )
 test('kea-log-init-tests', kea_log_init_tests, protocol: 'gtest')
 
-logger_example = executable(
+executable(
     'logger_example',
     'logger_example.cc',
     include_directories: [include_directories('.')] + INCLUDES,
     link_with: [kea_util_unittests_lib] + LIBS_BUILT_SO_FAR,
 )
-init_logger_test = executable(
+executable(
     'init_logger_test',
     'init_logger_test.cc',
     include_directories: [include_directories('.')] + INCLUDES,
     link_with: [kea_util_unittests_lib] + LIBS_BUILT_SO_FAR,
 )
-buffer_logger_test = executable(
+executable(
     'buffer_logger_test',
     'buffer_logger_test.cc',
     include_directories: [include_directories('.')] + INCLUDES,
     link_with: [kea_util_unittests_lib] + LIBS_BUILT_SO_FAR,
 )
-logger_lock_test = executable(
+executable(
     'logger_lock_test',
     'logger_lock_test.cc',
     'log_test_messages.cc',
index c791e23159ac24196f073bdcf1dac506ea2e9c73..2a66d3ec96b3d28477e39d91230c9685988edc91 100644 (file)
@@ -1,6 +1,6 @@
 mk_cfgrpt = f'@TOP_SOURCE_DIR@/tools/mk_cfgrpt.sh'
 config_report_cc = custom_target(
-    input: config_report,
+    input: CONFIG_REPORT,
     output: 'config_report.cc',
     command: [mk_cfgrpt, '@INPUT@', '@OUTPUT@'],
 )