Page MenuHomeFreeBSD

If DOC_LANG is set, stop hugo from building languages that aren't in it (except en)
ClosedPublic

Authored by ceri on Jun 17 2021, 10:52 AM.

Details

Summary

The hugo driven targets currently build all the languages despite anything you set in DOC_LANG or elsewhere.

Have DOC_LANG drive HUGO_DISABLELANGUAGES in order to stop that.
With the caveat, that hugo always has to build en as it's the default language, so add a warning if you try not to.

Test Plan

make
make DOC_LANG=en
make DOC_LANG="fr el"
make DOC_LANG=en,fr,ja

Diff Detail

Repository
R9 FreeBSD doc repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ceri requested review of this revision.Jun 17 2021, 10:52 AM
ceri created this revision.

I got some errors when building without en on a clean tree.
How to reproduce:

$ cd documentation
$ git clean -fx
$ make HUGO_ARGS="--verbose --debug --path-warnings" DOC_LANG="pt-br"
make: "/usr/home/dbaio/FreeBSD/git/doc/documentation/Makefile" line 110: warning: "Warning: cannot skip 'en' for hugo builds; adding it back"
make: "/usr/home/dbaio/FreeBSD/git/doc/documentation/Makefile" line 118: warning: "Warning: cannot skip 'en' for hugo builds; adding it back"
---------------------------------------------------------------
Building the documentation
included languages: pt-br
excluded languages: bd da de el en es fr hu it ja ko mn nl pl ru tr zh-cn zh-tw
---------------------------------------------------------------
/usr/local/bin/python3 ./tools/books-toc-parts-creator.py -l    pt-br
/usr/local/bin/python3 ./tools/books-toc-creator.py -l          pt-br
/usr/local/bin/python3 ./tools/books-toc-figures-creator.py -l  pt-br
/usr/local/bin/python3 ./tools/books-toc-tables-creator.py -l   pt-br
/usr/local/bin/python3 ./tools/books-toc-examples-creator.py -l pt-br
/usr/local/bin/ruby ./tools/global-pgpkeys-creator.rb
HUGO_DISABLELANGUAGES="bd da de el es fr hu it ja ko mn nl pl ru tr zh-cn zh-tw" /usr/local/bin/hugo --verbose --debug --path-warning
[...]
ERROR 2021/06/19 10:40:44 books/developers-handbook/parti.adoc: asciidoctor: ERROR: <stdin>: line 5: include file not found: /usr/home/dbaio/FreeBSD/git/doc/documentation/content/en/books/developers-handbook/toc-1.adoc
INFO 2021/06/19 10:40:44 Rendering books/handbook/book.adoc with /usr/local/bin/asciidoctor using asciidoctor args [-r man-macro -r inter-document-references-macro -r sectnumoffset-treeprocessor -r packages-macro -r git-macro --no-header-footer -] ...
ERROR 2021/06/19 10:40:44 books/developers-handbook/partii.adoc: asciidoctor: ERROR: <stdin>: line 5: include file not found: /usr/home/dbaio/FreeBSD/git/doc/documentation/content/en/books/developers-handbook/toc-2.adoc
[...]
Error: Error building site: logged 26 error(s)

todo/future: combine all functions that are repeating in both makefiles.

website/Makefile
18

Please, add this comment to documentation/Makefile as well

66–67

Messages are different from documentation/Makefile, I think it's better to keep them equal.

ceri marked 2 inline comments as done.

Fix build with dbaio's clean tree; address comments.

This revision is now accepted and ready to land.Jun 29 2021, 10:30 PM