From patchwork Thu Jan 20 14:05:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 36654 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 4E84427BBEA; Thu, 20 Jan 2022 20:04:48 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id AC04C27BBE9 for ; Thu, 20 Jan 2022 20:04:47 +0000 (GMT) Received: from localhost ([::1]:49852 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nAdfp-0000M8-Dg for patchwork@mira.cbaines.net; Thu, 20 Jan 2022 15:04:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nAY4g-00057Q-GT for guix-patches@gnu.org; Thu, 20 Jan 2022 09:06:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35772) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nAY4g-00079G-0V for guix-patches@gnu.org; Thu, 20 Jan 2022 09:06:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nAY4f-0004mY-Nx for guix-patches@gnu.org; Thu, 20 Jan 2022 09:06:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#46872] [PATCH] doc: Define canned recipes for creating translated manuals. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 20 Jan 2022 14:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46872 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxime Devos Cc: 46872@debbugs.gnu.org Received: via spool by 46872-submit@debbugs.gnu.org id=B46872.164268752918344 (code B ref 46872); Thu, 20 Jan 2022 14:06:01 +0000 Received: (at 46872) by debbugs.gnu.org; 20 Jan 2022 14:05:29 +0000 Received: from localhost ([127.0.0.1]:56908 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nAY46-0004lh-76 for submit@debbugs.gnu.org; Thu, 20 Jan 2022 09:05:29 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:49766) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nAY41-0004lO-3L for 46872@debbugs.gnu.org; Thu, 20 Jan 2022 09:05:25 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 720838D4; Thu, 20 Jan 2022 15:05:14 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eUArt3a5I9CR; Thu, 20 Jan 2022 15:05:13 +0100 (CET) Received: from ribbon (91-160-117-201.subs.proxad.net [91.160.117.201]) by hera.aquilenet.fr (Postfix) with ESMTPSA id B8F3A224; Thu, 20 Jan 2022 15:05:12 +0100 (CET) From: Ludovic =?utf-8?q?Court=C3=A8s?= References: Date: Thu, 20 Jan 2022 15:05:12 +0100 In-Reply-To: (Maxime Devos's message of "Tue, 02 Mar 2021 14:40:20 +0100") Message-ID: <874k5y8puv.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Spamd-Bar: / Authentication-Results: hera.aquilenet.fr; none X-Rspamd-Server: hera X-Rspamd-Queue-Id: 720838D4 X-Spamd-Result: default: False [-0.10 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain,text/x-patch]; RCPT_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Hi Maxime, Maxime Devos skribis: > From 140504026807af6d4e94154b629edb6c7bdf3c27 Mon Sep 17 00:00:00 2001 > From: Maxime Devos > Date: Tue, 2 Mar 2021 14:13:59 +0100 > Subject: [PATCH] doc: Define canned recipes for creating translated manuals. > MIME-Version: 1.0 > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: 8bit > > It is expected that at some point in the future, the manual's > source will be split in several files per-chapter. Prevent > the build recipes from diverging by defining and using two > ‘canned recipes’ in the makefile for translating the manual > and individual chapters. > > * doc/local.mk > (guix.%.texi, guix-cookbook.%.texi): move recipe ... > (translate_manual_command): ... to here. > (contributing.%.texi): move recipe ... > (translate_chapter_command): ... to here. This had fallen through the cracks. I updated it so it applies on current master (see below). However, it doesn’t work as expected: --8<---------------cut here---------------start------------->8--- $ rm -f doc/contributing.fr.texi $ make doc/contributing.fr.texi make: 'doc/contributing.fr.texi' is up to date. $ ls -l doc/contributing.fr.texi ls: ne eblas atingi 'doc/contributing.fr.texi': Dosiero aŭ dosierujo ne ekzistas --8<---------------cut here---------------end--------------->8--- If I inline the expansion of ‘translate_chapter_command’, everything works as expected. My GNU Make is rusty and fuzzy, but I wonder if we can expand text that includes tabs. I vaguely remember that I’d usually define functions that would expand the whole text: target/prerequisites + commands. WDYT? Ludo’. diff --git a/doc/local.mk b/doc/local.mk index 9619971296..627d27a5ef 100644 --- a/doc/local.mk +++ b/doc/local.mk @@ -5,6 +5,7 @@ # Copyright © 2016 Taylan Ulrich Bayırlı/Kammer # Copyright © 2016, 2018 Mathieu Lirzin # Copyright © 2018, 2021 Julien Lepiller +# Copyright © 2021 Maxime Devos # # This file is part of GNU Guix. # @@ -111,22 +112,33 @@ $(top_srcdir)/pre-inst-env $(GUILE) --no-auto-compile \ $@.tmp $< endef +# This canned recipe is used in the rules below to translate a Texinfo manual +# using the translations in po/doc. The argument $(1) is the name of the +# untranslated manual, without a .texi extension or directory prefixes. +define translate_manual_command + -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/$(1).texi" -p "$<" -l "$@.tmp" + -sed -i "s|$(1)\.info|$$(basename "$@" | sed 's|texi$$|info|')|" "$@.tmp" + -$(AM_V_POXREF)LC_ALL=en_US.UTF-8 $(xref_command) + -mv "$@.tmp" "$@" +endef + +# Likewise, but for individual chapters (or sections), which do not have an +# Info file name to modify. +define translate_chapter_command + -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/$(1).texi" -p "$<" -l "$@.tmp" + -$(AM_V_POXREF)LC_ALL=en_US.UTF-8 $(xref_command) + -mv "$@.tmp" "$@" +endef + + $(srcdir)/%D%/guix.%.texi: po/doc/guix-manual.%.po $(srcdir)/%D%/contributing.%.texi guix/build/po.go - -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/guix.texi" -p "$<" -l "$@.tmp" - -sed -i "s|guix\.info|$$(basename "$@" | sed 's|texi$$|info|')|" "$@.tmp" - -$(AM_V_POXREF)LC_ALL=en_US.UTF-8 $(xref_command) - -mv "$@.tmp" "$@" + $(call translate_manual_command,guix) $(srcdir)/%D%/guix-cookbook.%.texi: po/doc/guix-cookbook.%.po guix/build/po.go - -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/guix-cookbook.texi" -p "$<" -l "$@.tmp" - -sed -i "s|guix-cookbook\.info|$$(basename "$@" | sed 's|texi$$|info|')|" "$@.tmp" - -$(AM_V_POXREF)LC_ALL=en_US.UTF-8 $(xref_command) - -mv "$@.tmp" "$@" + $(call translate_manual_command,guix-cookbook) $(srcdir)/%D%/contributing.%.texi: po/doc/guix-manual.%.po guix/build/po.go - -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/contributing.texi" -p "$<" -l "$@.tmp" - -$(AM_V_POXREF)LC_ALL=en_US.UTF-8 $(xref_command) - -mv "$@.tmp" "$@" + $(call translate_manual_chapter,contributing) %D%/os-config-%.texi: gnu/system/examples/%.tmpl $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \