Skip to content

Commit 5419445

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d8af27d commit 5419445

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

Documentation/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ cmds-*.txt
1212
mergetools-*.txt
1313
SubmittingPatches.txt
1414
tmp-doc-diff/
15+
tmp-meson-diff/
1516
GIT-ASCIIDOCFLAGS
1617
/.build/
1718
/GIT-EXCLUDED-PROGRAMS

Documentation/Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ clean:
339339
$(RM) $(cmds_txt) $(mergetools_txt) *.made
340340
$(RM) GIT-ASCIIDOCFLAGS
341341
$(RM) asciidoc.conf asciidoctor-extensions.rb
342+
$(RM) -rf tmp-meson-diff
342343

343344
docinfo.html: docinfo-html.in
344345
$(QUIET_GEN)$(RM) $@ && cat $< >$@
@@ -494,13 +495,28 @@ lint-docs-fsck-msgids: $(LINT_DOCS_FSCK_MSGIDS)
494495
lint-docs-manpages:
495496
$(QUIET_GEN)./lint-manpages.sh
496497

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+
497512
## Lint: list of targets above
498513
.PHONY: lint-docs
499514
lint-docs: lint-docs-fsck-msgids
500515
lint-docs: lint-docs-gitlink
501516
lint-docs: lint-docs-man-end-blurb
502517
lint-docs: lint-docs-man-section-order
503518
lint-docs: lint-docs-manpages
519+
lint-docs: lint-docs-meson
504520

505521
ifeq ($(wildcard po/Makefile),po/Makefile)
506522
doc-l10n install-l10n::

Documentation/meson.build

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,3 +471,34 @@ if get_option('docs').contains('html')
471471
subdir('howto')
472472
subdir('technical')
473473
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

0 commit comments

Comments
 (0)