git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/1] Add optional targets for documentation l10n

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 4, 2019, 21:05 UTC
Message-ID
<xmqqk1jkb0c9.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20190104165406.22358-2-jn.avila@free.fr>
Jean-Noël Avila <jn.avila@free.fr> writes:
Show 28 quoted lines
> From: Jean-Noel Avila <jn.avila@free.fr>
>
> The standard doc lists can be filtered to allow using the compilation
> rules with translated manpages where all the pages of the original
> version may not be present.
>
> The install variable are reused in the secondary repo so that the
> configured paths can be used for translated manpages too.
>
> Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
> ---
>  Documentation/Makefile | 25 +++++++++++++++++++------
>  1 file changed, 19 insertions(+), 6 deletions(-)
>
> diff --git a/Documentation/Makefile b/Documentation/Makefile
> index b5be2e2d3f..1f61a1fe86 100644
> --- a/Documentation/Makefile
> +++ b/Documentation/Makefile
> @@ -35,13 +35,18 @@ MAN7_TXT += gittutorial-2.txt
>  MAN7_TXT += gittutorial.txt
>  MAN7_TXT += gitworkflows.txt
>  
> -MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT)
> +TMP_MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT)
> +MAN_FILTER ?= $(TMP_MAN_TXT)
> +MAN_TXT = $(filter $(TMP_MAN_TXT), $(MAN_FILTER))
> +undefine TMP_MAN_TXT
> +

I think your arguments to $(filter) is the other way around, but other than that, I think I get what you are trying to do. Let me make sure I got it right.

The idea is to use $(filter PATTERN..., TEXT) that removes words in TEXT that do not match any of the words in PATTERN, and for normal build, MAN_FILTER is set identical to TMP_MAN_TXT (which is the original MAN_TXT), so there is no filtering happen, but in a build that does tweak MAN_FILTER, MAN_TXT can become a subset of the original MAN_TXT.

Am I on the right track?
>  MAN_XML = $(patsubst %.txt,%.xml,$(MAN_TXT))
>  MAN_HTML = $(patsubst %.txt,%.html,$(MAN_TXT))
And these act on already-filtered MAN_TXT
Show 17 quoted lines
>  OBSOLETE_HTML += everyday.html
>  OBSOLETE_HTML += git-remote-helpers.html
> -DOC_HTML = $(MAN_HTML) $(OBSOLETE_HTML)
> +
> +TMP_DOC_HTML = $(MAN_HTML) $(OBSOLETE_HTML)
>  
>  ARTICLES += howto-index
>  ARTICLES += git-tools
> @@ -81,11 +86,14 @@ TECH_DOCS += technical/trivial-merge
>  SP_ARTICLES += $(TECH_DOCS)
>  SP_ARTICLES += technical/api-index
>  
> -DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
> +TMP_DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
> +HTML_FILTER ?= $(TMP_DOC_HTML)
> +DOC_HTML = $(filter $(HTML_FILTER),$(TMP_DOC_HTML))
> +undefine TMP_DOC_HTML
This one uses $(filter) in the right direction.

So is it expected that HTML help pages that correspond to manpages are strict subset of manpages?

I see HTML_FILTER may be useful to filter HTML pages that come from $(ARTICLES), but I'd expect that all $(MAN_HTML) that came from the already-filtered $(MAN_TXT) would not require any further filtering. With the approach shown, the secondary project ends up needing to list all the translated MAN_TXT twice (once for MAN_FILTER, and again for HTML_FILTER), doesn't it?

I am wondering if it makes more sense to have HTML_FILTER filter _only_ parts of the DOC_HTML that does not come from MAN_TXT (i.e. those $(ARTICLES) pages).

Show 6 quoted lines
> -DOC_MAN1 = $(patsubst %.txt,%.1,$(MAN1_TXT))
> -DOC_MAN5 = $(patsubst %.txt,%.5,$(MAN5_TXT))
> -DOC_MAN7 = $(patsubst %.txt,%.7,$(MAN7_TXT))
> +DOC_MAN1 = $(patsubst %.txt,%.1,$(filter $(MAN_FILTER), $(MAN1_TXT)))
> +DOC_MAN5 = $(patsubst %.txt,%.5,$(filter $(MAN_FILTER), $(MAN5_TXT)))
> +DOC_MAN7 = $(patsubst %.txt,%.7,$(filter $(MAN_FILTER), $(MAN7_TXT)))
These are OK, too.

By the way, lose the SP after ',' in $(filter). As we can see in the context lines in the patch, args to $(make-functions) are separated with comma without surrounding SP by convention.

What kind of PATTERN does the secondary project supply when invoking this Makefile? If it is list of filenames, I am wondering if it is simpler to have it override MAN{1,5,7}_TXT variables, without adding these "TMP_* + fliter + undef TMP_*" dance.

Show 12 quoted lines
>  prefix ?= $(HOME)
>  bindir ?= $(prefix)/bin
> @@ -444,4 +452,9 @@ print-man1:
>  lint-docs::
>  	$(QUIET_LINT)$(PERL_PATH) lint-gitlink.perl
>  
> +ifeq ($(wildcard po/Makefile),po/Makefile)
> +doc-l10n install-l10n::
> +	$(MAKE) -C po $@
> +endif
> +
>  .PHONY: FORCE
Previous: Jean-Noël AvilaNext: Jean-Noël AVILA
Message 3 of 8 in “i18n: add framework for localizing the manpages”
  1. 0/1 i18n: add framework for localizing the manpagesJean-Noël Avila, Jan 4, 2019
  2. 1/1 Add optional targets for documentation l10nJean-Noël Avila, Jan 4, 2019
  3. Junio C HamanoJan 4, 2019
  4. Jean-Noël AVILAJan 5, 2019
  5. Junio C HamanoJan 7, 2019
  6. Add optional targets for documentation l10nJean-Noël Avila, Jan 5, 2019
  7. Junio C HamanoJan 7, 2019
  8. Add optional targets for documentation l10nJean-Noël Avila, Jan 7, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.