Date: Wed, 30 Jun 2021 11:42:26 GMT From: Ceri Davies <ceri@FreeBSD.org> To: doc-committers@FreeBSD.org, dev-commits-doc-all@FreeBSD.org Subject: git: 5b5d636b4a - main - Makefile: If DOC_LANG is set, stop hugo from building other languages. Message-ID: <202106301142.15UBgQGF030472@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by ceri: URL: https://cgit.FreeBSD.org/doc/commit/?id=5b5d636b4ac16ae3dcd3a5a9554331904f4f0287 commit 5b5d636b4ac16ae3dcd3a5a9554331904f4f0287 Author: Ceri Davies <ceri@FreeBSD.org> AuthorDate: 2021-06-30 11:39:33 +0000 Commit: Ceri Davies <ceri@FreeBSD.org> CommitDate: 2021-06-30 11:39:33 +0000 Makefile: If DOC_LANG is set, stop hugo from building other languages. The hugo driven targets currently build all the languages despite anything 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 it's left out before adding it back in. Reviewed by: dbaio, ygy Differential Revision: https://reviews.freebsd.org/D30796 --- documentation/Makefile | 27 ++++++++++++++++++++++++--- website/Makefile | 29 +++++++++++++++++++++++++++-- 2 files changed, 51 insertions(+), 5 deletions(-) diff --git a/documentation/Makefile b/documentation/Makefile index 519f3edb65..58a42c4aee 100644 --- a/documentation/Makefile +++ b/documentation/Makefile @@ -20,6 +20,9 @@ MAINTAINER=carlavilla@FreeBSD.org # List of languages without book translations ARTICLEONLY_LANGS= bd da ko tr +# List of all languages we have content for +ALL_LANGUAGES= bd da de el en es fr hu it ja ko mn nl pl pt-br ru tr zh-cn zh-tw + LOCALBASE?= /usr/local PYTHON_CMD = ${LOCALBASE}/bin/python3 @@ -27,10 +30,15 @@ RUBY_CMD = ${LOCALBASE}/bin/ruby HUGO_CMD = ${LOCALBASE}/bin/hugo HUGO_ARGS?= --verbose --minify ASCIIDOCTORPDF_CMD= ${LOCALBASE}/bin/asciidoctor-pdf + .if defined(DOC_LANG) && !empty(DOC_LANG) LANGUAGES= ${DOC_LANG:S/,/ /g} +.if ${LANGUAGES:Men} == "" +.warning "Warning: cannot skip 'en'; adding it back" +LANGUAGES+= en +.endif .else -LANGUAGES= bd da de el en es fr hu it ja ko mn nl pl pt-br ru tr zh-cn zh-tw +LANGUAGES= ${ALL_LANGUAGES} .endif RUBYLIB = ../shared/lib @@ -59,6 +67,16 @@ BOOK_LANGS= ${LANGUAGES} BOOK_LANGS:= ${BOOK_LANGS:N${a}} .endfor + +# Take the list of all languages, and take out the ones we have been +# asked for. We'll feed this to hugo. +SKIP_LANGS= +.for a in ${ALL_LANGUAGES} +.if ${LANGUAGES:M${a}} == "" +SKIP_LANGS+= ${a} +.endif +.endfor + .ORDER: all run .ORDER: requirements @@ -82,6 +100,8 @@ requirements: starting-message: .PHONY @echo --------------------------------------------------------------- @echo Building the documentation + @echo included languages: ${LANGUAGES} + @echo excluded languages: ${SKIP_LANGS} @echo --------------------------------------------------------------- generate-books-toc: .PHONY @@ -97,10 +117,11 @@ static/pgpkeys/pgpkeys.txt: static/pgpkeys/*key ${RUBY_CMD} ./tools/global-pgpkeys-creator.rb run-local: .PHONY - ${HUGO_CMD} server ${HUGO_ARGS} -D $(BIND:D--bind=$(BIND)) --baseURL="http://$(.HOST):1313" + HUGO_DISABLELANGUAGES="${SKIP_LANGS}" ${HUGO_CMD} server \ + ${HUGO_ARGS} -D $(BIND:D--bind=$(BIND)) --baseURL="http://$(.HOST):1313" build: .PHONY - ${HUGO_CMD} ${HUGO_ARGS} + HUGO_DISABLELANGUAGES="${SKIP_LANGS}" ${HUGO_CMD} ${HUGO_ARGS} toc-clean: .PHONY rm -f $$(${PYTHON_CMD} ./tools/books-toc-parts-creator.py -l ${BOOK_LANGS} -o) diff --git a/website/Makefile b/website/Makefile index df9a71b985..e62d177b57 100644 --- a/website/Makefile +++ b/website/Makefile @@ -15,6 +15,9 @@ MAINTAINER=carlavilla@FreeBSD.org +# List of all languages we have content for +ALL_LANGUAGES= de el en es fr hu it ja nl ru tr zh-cn zh-tw + PYTHON_CMD = /usr/local/bin/python3 HUGO_CMD = /usr/local/bin/hugo HUGO_ARGS?= --verbose @@ -31,6 +34,25 @@ RUBYLIB = ../shared/lib .HOST=$(HOSTNAME) .endif +.if defined(DOC_LANG) && !empty(DOC_LANG) +LANGUAGES= ${DOC_LANG:S/,/ /g} +.if ${LANGUAGES:Men} == "" +.warning "Warning: cannot skip 'en'; adding it back" +LANGUAGES+= en +.endif +.else +LANGUAGES= ${ALL_LANGUAGES} +.endif + +# Take the list of all languages, and take out the ones we have been +# asked for via DOC_LANG. We'll feed this to hugo. +SKIP_LANGS= +.for a in ${ALL_LANGUAGES} +.if ${LANGUAGES:M${a}} == "" +SKIP_LANGS+= ${a} +.endif +.endfor + .ORDER: all run .ORDER: starting-message generate-releases @@ -46,6 +68,8 @@ clean: hugo-clean releases-clean starting-message: .PHONY @echo "---------------------------------------------------------------" @echo "Building the website started on $$(date)" + @echo " included languages: ${LANGUAGES}" + @echo " excluded languages: ${SKIP_LANGS}" @echo "---------------------------------------------------------------" end-message: .PHONY @@ -59,10 +83,11 @@ data/releases.toml: ${PYTHON_CMD} ./tools/releases-toml.py -p ./shared/releases.adoc run-local: .PHONY - ${HUGO_CMD} server ${HUGO_ARGS} -D $(BIND:D--bind=$(BIND)) --baseURL="http://$(.HOST):1313" + HUGO_DISABLELANGUAGES="${SKIP_LANGS}" ${HUGO_CMD} server \ + ${HUGO_ARGS} -D $(BIND:D--bind=$(BIND)) --baseURL="http://$(.HOST):1313" build: .PHONY - ${HUGO_CMD} ${HUGO_ARGS} + HUGO_DISABLELANGUAGES="${SKIP_LANGS}" ${HUGO_CMD} ${HUGO_ARGS} post-build: cgi-permissions
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106301142.15UBgQGF030472>