diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2018-12-06 15:36:55 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2018-12-12 14:20:32 +0100 |
commit | c2e1b5c4c447dfbdc9e176edefcdb04ab8f9de45 (patch) | |
tree | eaa09240101e8fe108babeeb8c3652e16d5849b3 | |
parent | daed099b49740aee8e738eaa0bfa0b9b85664d07 (diff) | |
download | NetworkManager-c2e1b5c4c447dfbdc9e176edefcdb04ab8f9de45.tar.gz |
meson: add check on settings docs
Move the autotools check on settings docs to a shell script and call
it from meson too.
-rw-r--r-- | Makefile.am | 12 | ||||
-rw-r--r-- | clients/common/meson.build | 14 | ||||
-rw-r--r-- | meson_options.txt | 1 | ||||
-rwxr-xr-x | tools/check-settings-docs.sh | 19 |
4 files changed, 26 insertions, 20 deletions
diff --git a/Makefile.am b/Makefile.am index d298e54d91..68f4f0a28e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3833,16 +3833,7 @@ $(clients_common_settings_doc_h): clients/common/settings-docs.xsl libnm/nm-prop $(AM_V_GEN) $(XSLTPROC) --output $@ $< $(word 2,$^) DISTCLEANFILES += $(clients_common_settings_doc_h) check-local-settings-docs: $(clients_common_settings_doc_h) - @if test -z "$$NMTST_NO_CHECK_SETTINGS_DOCS" ; then \ - if ! cmp -s "$(srcdir)/$(clients_common_settings_doc_h).in" "$(builddir)/$(clients_common_settings_doc_h)" ; then \ - if test "$$NM_TEST_REGENERATE" == 1 ; then \ - cp -f "$(builddir)/$(clients_common_settings_doc_h)" "$(srcdir)/$(clients_common_settings_doc_h).in"; \ - else \ - echo "The generated file \"$(builddir)/$(clients_common_settings_doc_h)\" differs from the source file \"$(srcdir)/$(clients_common_settings_doc_h).in\". You probably should copy the generated file over to the source file. You can skip this test by setting \$$NMTST_NO_CHECK_SETTINGS_DOCS=yes". You can also automatically copy the file by rerunning the test with \$$NM_TEST_REGENERATE=1 ; \ - false; \ - fi; \ - fi;\ - fi + $(srcdir)/tools/check-settings-docs.sh "$(srcdir)" "$(builddir)" "$(clients_common_settings_doc_h)" check_local += check-local-settings-docs else $(clients_common_settings_doc_h): $(clients_common_settings_doc_h).in clients/common/.dirstamp @@ -5166,6 +5157,7 @@ EXTRA_DIST += \ tools/check-config-options.sh \ tools/check-docs.sh \ tools/check-exports.sh \ + tools/check-settings-docs.sh \ tools/create-exports-NetworkManager.sh \ tools/debug-helper.py \ tools/meson-post-install.sh \ diff --git a/clients/common/meson.build b/clients/common/meson.build index 0db2868e7c..30fd2cfa96 100644 --- a/clients/common/meson.build +++ b/clients/common/meson.build @@ -37,15 +37,11 @@ if enable_introspection command: [xsltproc, '--output', '@OUTPUT@', join_paths(meson.current_source_dir(), 'settings-docs.xsl'), '@INPUT@'] ) - # FIXME: if enabled the check happens even if the settings_docs_source is not set - ''' - if get_option('check_settings_docs') - res = run_command(find_program('cmp'), '-s', settings_docs + '.in', settings_docs_source.full_path()) - if res.returncode() != 0 - message('The generated file ' + settings_docs_source.full_path() + ' differs from the source file ' + settings_docs + '.in' + '. You probably should copy the generated file over to the source file. You can skip this test by setting -Dcheck_settings_docs=false') - endif - endif - ''' + test( + 'check-settings-docs', + find_program(join_paths(meson.source_root(), 'tools', 'check-settings-docs.sh')), + args: [meson.source_root(), meson.build_root(), 'clients/common/' + settings_docs] + ) else settings_docs_source = configure_file( input: settings_docs + '.in', diff --git a/meson_options.txt b/meson_options.txt index d249567171..221ba2b804 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -74,4 +74,3 @@ option('libpsl', type: 'boolean', value: true, description: 'Link against libpsl option('json_validation', type: 'boolean', value: true, description: 'Enable JSON validation in libnm') option('crypto', type: 'combo', choices: ['nss', 'gnutls'], value: 'nss', description: 'Cryptography library to use for certificate and key operations') option('qt', type: 'boolean', value: true, description: 'enable Qt examples') -option('check_settings_docs', type: 'boolean', value: false, description: 'compare check settings-docs.h file') diff --git a/tools/check-settings-docs.sh b/tools/check-settings-docs.sh new file mode 100755 index 0000000000..8695ccc030 --- /dev/null +++ b/tools/check-settings-docs.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +srcdir=$1 +builddir=$2 +doc_h=$3 + +if [ -z "$NMTST_NO_CHECK_SETTINGS_DOCS" ] ; then + if ! cmp -s "${srcdir}/${doc_h}.in" "${builddir}/${doc_h}"; then + if [ "$NM_TEST_REGENERATE" = 1 ] ; then + cp -f "${builddir}/${doc_h}" "${srcdir}/${doc_h}.in" + else + echo "*** Error: the generated file '${builddir}/${doc_h}' differs from the source file '${srcdir}/${doc_h}.in'. You probably should copy the generated file over to the source file. You can skip this test by setting NMTST_NO_CHECK_SETTINGS_DOCS=yes. You can also automatically copy the file by rerunning the test with NM_TEST_REGENERATE=1" + exit 1 + fi + fi +fi + +exit 0 + |