build: pass both filenames to "tools/check-compare-generated.sh" script

It just feels nicer to be explicit about the filenames and
not rely on a specific naming.

Also, in meson we can directly pass the target as argument, which
expands to the filename but also adds a dependency.
This commit is contained in:
Thomas Haller 2022-10-26 09:59:42 +02:00
parent 489f65bf9c
commit 139f4b4b2e
No known key found for this signature in database
GPG Key ID: 29C2366E4DFC5728
4 changed files with 11 additions and 14 deletions

View File

@ -2001,7 +2001,7 @@ if BUILD_DOCS
src/nmcli/generate-docs-nm-settings-nmcli.xml: src/nmcli/generate-docs-nm-settings-nmcli
$(AM_V_GEN) src/nmcli/generate-docs-nm-settings-nmcli > "$@"
check-local-generate-docs-nm-settings-nmcli: src/nmcli/generate-docs-nm-settings-nmcli.xml
$(srcdir)/tools/check-compare-generated.sh "$(srcdir)" "$(builddir)" "$<"
$(srcdir)/tools/check-compare-generated.sh "$(srcdir)/src/nmcli/generate-docs-nm-settings-nmcli.xml.in" "$(builddir)/src/nmcli/generate-docs-nm-settings-nmcli.xml"
check_local += check-local-generate-docs-nm-settings-nmcli
DISTCLEANFILES += src/nmcli/generate-docs-nm-settings-nmcli.xml
else
@ -4832,7 +4832,7 @@ $(libnmc_setting_settings_doc_h): src/libnmc-setting/settings-docs-input.xml src
$(AM_V_GEN) "$(PYTHON)" $(srcdir)/tools/generate-docs-settings-docs.py --output $@ --xml $<
DISTCLEANFILES += $(libnmc_setting_settings_doc_h)
check-local-settings-docs: $(libnmc_setting_settings_doc_h)
$(srcdir)/tools/check-compare-generated.sh "$(srcdir)" "$(builddir)" "$(libnmc_setting_settings_doc_h)"
$(srcdir)/tools/check-compare-generated.sh "$(srcdir)/$(libnmc_setting_settings_doc_h).in" "$(builddir)/$(libnmc_setting_settings_doc_h)"
check_local += check-local-settings-docs
else
$(libnmc_setting_settings_doc_h): $(libnmc_setting_settings_doc_h).in src/libnmc-setting/.dirstamp

View File

@ -31,9 +31,8 @@ if enable_docs
'check-settings-docs',
find_program(join_paths(source_root, 'tools', 'check-compare-generated.sh')),
args: [
source_root,
build_root,
'src/libnmc-setting/settings-docs.h',
source_root + '/src/libnmc-setting/settings-docs.h.in',
settings_docs_source,
],
)
else

View File

@ -81,9 +81,8 @@ if enable_docs
'check-local-generate-docs-nm-settings-nmcli',
find_program(join_paths(source_root, 'tools', 'check-compare-generated.sh')),
args: [
source_root,
build_root,
'src/nmcli/generate-docs-nm-settings-nmcli.xml',
source_root + '/src/nmcli/generate-docs-nm-settings-nmcli.xml.in',
generate_docs_nm_settings_nmcli_xml,
],
)
else

View File

@ -2,17 +2,16 @@
set -e
srcdir="$1"
builddir="$2"
doc_h="$3"
f_commited="$1"
f_generated="$2"
[ -n "$NMTST_NO_CHECK_SETTINGS_DOCS" ] && exit 0
cmp -s "${srcdir}/${doc_h}.in" "${builddir}/${doc_h}" && exit 0
cmp -s "$f_commited" "$f_generated" && exit 0
if [ "$NM_TEST_REGENERATE" = 1 ] ; then
cp -f "${builddir}/${doc_h}" "${srcdir}/${doc_h}.in"
cp -f "$f_generated" "$f_commited"
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"
echo "*** Error: the generated file '$f_generated' differs from the source file '$f_commited'. 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