Documentation: wire up sanity checks for Meson
Wire up sanity checks for Meson to verify that no man pages are missing. This check is similar to the same check we already have for our tests. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Dec 27, 2024 at 14:59 UTC
5419445b4d19b0979b14f239fe2362210174f613
3 files changed
+48
Documentation/.gitignore
+1
@@ -12,6 +12,7 @@ cmds-*.txt
12
mergetools-*.txt
13
SubmittingPatches.txt
14
tmp-doc-diff/
15
+tmp-meson-diff/
16
GIT-ASCIIDOCFLAGS
17
/.build/
18
/GIT-EXCLUDED-PROGRAMS
Documentation/Makefile
+16
@@ -339,6 +339,7 @@ clean:
339
$(RM) $(cmds_txt) $(mergetools_txt) *.made
340
$(RM) GIT-ASCIIDOCFLAGS
341
$(RM) asciidoc.conf asciidoctor-extensions.rb
342
+ $(RM) -rf tmp-meson-diff
343
344
docinfo.html: docinfo-html.in
345
$(QUIET_GEN)$(RM) $@ && cat $< >$@
@@ -494,6 +495,20 @@ lint-docs-fsck-msgids: $(LINT_DOCS_FSCK_MSGIDS)
495
lint-docs-manpages:
496
$(QUIET_GEN)./lint-manpages.sh
497
498
+.PHONY: lint-docs-meson
499
+lint-docs-meson:
500
+ @# awk acts up when trying to match single quotes, so we use \047 instead.
501
+ @mkdir -p tmp-meson-diff && \
502
+ awk "/^manpages = {$$/ {flag=1 ; next } /^}$$/ { flag=0 } flag { gsub(/^ \047/, \"\"); gsub(/\047 : [157],\$$/, \"\"); print }" meson.build | \
503
+ grep -v -e '#' -e '^$$' | \
504
+ sort >tmp-meson-diff/meson.txt && \
505
+ ls git*.txt scalar.txt | grep -v -e git-bisect-lk2009.txt -e git-tools.txt >tmp-meson-diff/actual.txt && \
506
+ if ! cmp tmp-meson-diff/meson.txt tmp-meson-diff/actual.txt; then \
507
+ echo "Meson man pages differ from actual man pages:"; \
508
+ diff -u tmp-meson-diff/meson.txt tmp-meson-diff/actual.txt; \
509
+ exit 1; \
510
+ fi
511
+
512
## Lint: list of targets above
513
.PHONY: lint-docs
514
lint-docs: lint-docs-fsck-msgids
@@ -501,6 +516,7 @@ lint-docs: lint-docs-gitlink
516
lint-docs: lint-docs-man-end-blurb
517
lint-docs: lint-docs-man-section-order
518
lint-docs: lint-docs-manpages
519
+lint-docs: lint-docs-meson
520
521
ifeq ($(wildcard po/Makefile),po/Makefile)
522
doc-l10n install-l10n::
Documentation/meson.build
+31
@@ -471,3 +471,34 @@ if get_option('docs').contains('html')
471
subdir('howto')
472
subdir('technical')
473
endif
474
+
475
+# Sanity check that we are not missing any tests present in 't/'. This check
476
+# only runs once at configure time and is thus best-effort, only. Furthermore,
477
+# it only verifies man pages for the sake of simplicity.
478
+configured_manpages = manpages.keys() + [ 'git-bisect-lk2009.txt', 'git-tools.txt' ]
479
+actual_manpages = run_command(shell, '-c', 'ls git*.txt scalar.txt',
480
+ check: true,
481
+ env: script_environment,
482
+).stdout().strip().split('\n')
483
+
484
+if configured_manpages != actual_manpages
485
+ missing_manpage = [ ]
486
+ foreach actual_manpage : actual_manpages
487
+ if actual_manpage not in configured_manpages
488
+ missing_manpage += actual_manpage
489
+ endif
490
+ endforeach
491
+ if missing_manpage.length() > 0
492
+ error('Man page found, but not configured:\n\n - ' + '\n - '.join(missing_manpage))
493
+ endif
494
+
495
+ superfluous_manpage = [ ]
496
+ foreach configured_manpage : configured_manpages
497
+ if configured_manpage not in actual_manpages
498
+ superfluous_manpage += configured_manpage
499
+ endif
500
+ endforeach
501
+ if superfluous_manpage.length() > 0
502
+ error('Man page configured, but not found:\n\n - ' + '\n - '.join(superfluous_manpage))
503
+ endif
504
+endif