From patchwork Fri Jan 22 20:34:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Lepiller X-Patchwork-Id: 26566 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 3AE7827BC18; Fri, 22 Jan 2021 20:35:10 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id A5B1827BC17 for ; Fri, 22 Jan 2021 20:35:09 +0000 (GMT) Received: from localhost ([::1]:36098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l339A-0001RN-Ou for patchwork@mira.cbaines.net; Fri, 22 Jan 2021 15:35:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3394-0001RG-HA for guix-patches@gnu.org; Fri, 22 Jan 2021 15:35:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:49939) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l3394-0006Q2-9h for guix-patches@gnu.org; Fri, 22 Jan 2021 15:35:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l3394-0002kK-7H for guix-patches@gnu.org; Fri, 22 Jan 2021 15:35:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#46044] [PATCH] Improvements to handling po files Resent-From: Julien Lepiller Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 22 Jan 2021 20:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 46044 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 46044@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.161134766410504 (code B ref -1); Fri, 22 Jan 2021 20:35:02 +0000 Received: (at submit) by debbugs.gnu.org; 22 Jan 2021 20:34:24 +0000 Received: from localhost ([127.0.0.1]:33252 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l338R-0002jM-PG for submit@debbugs.gnu.org; Fri, 22 Jan 2021 15:34:24 -0500 Received: from lists.gnu.org ([209.51.188.17]:56820) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l338Q-0002jE-7B for submit@debbugs.gnu.org; Fri, 22 Jan 2021 15:34:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54990) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l338P-0000k3-MX for guix-patches@gnu.org; Fri, 22 Jan 2021 15:34:21 -0500 Received: from lepiller.eu ([2a00:5884:8208::1]:57738) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l338M-00064s-GX for guix-patches@gnu.org; Fri, 22 Jan 2021 15:34:21 -0500 Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id 37d620d9 for ; Fri, 22 Jan 2021 20:34:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=date:from :to:subject:message-id:mime-version:content-type; s=dkim; bh=s3M C9oMcC7IfY5BokMOyeDQy69yldp8hz18tMEdj1aI=; b=D1t5zKh6LhVPfNHpOVc K1exYLvPdvzzR/yePlEFDEpfR/66VrYO+ccyCaM+DIkLMSMib9BdIuJRGdAcbf+S 7wIfuQBcyG8LYlgxmSMlg4M2OwdFUm2R87yVcTl75eqAdFNvQ4NSoWHRxyUFEpli 1yWgw91Qd1GWxAhiUIAVzlse1xQG85NH4M9Ktz9W+60HfZeqQvgJ8xSHZvFcpSWv XJZ9hCi/SG/Nc7mAwjmv8SesrYOjkeuVj1qIwsgz9oqlodEbZUzP7PmqQ/gV0Pwu vhjluNHVrgdvS6+b8q3WIDu9KRhkT5DepSH7Nbv9PGNocCVke2gaFe3xnxqJpDAq 9gQ== Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 3f8a0cdb (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Fri, 22 Jan 2021 20:34:10 +0000 (UTC) Date: Fri, 22 Jan 2021 21:34:02 +0100 From: Julien Lepiller Message-ID: <20210122213402.1f964c7f@tachikoma.lepiller.eu> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:5884:8208::1; envelope-from=julien@lepiller.eu; helo=lepiller.eu X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 Guix, here are two patches to improve our handling of po files. Yesterday I pushed again new po files that were broken, and I didn't notice. The first patch ensure po files are normalized. The TP automatically normalized po, but weblate doesn't, using the indent method instead. This creates huge patches like yesterday. Instead, normalizing ensures we only see relevant changes. The second patch adds a check-po target to the Makefile that runs msgfmt on every po file we have, to make sure they are at least correct. That's not enough for manual translations, but that can be spotted easily when running "make". This would have spotted the issues I introduced yesterday. From 8be36b2d651be108bc1e7fe7790f889dd19c679d Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Fri, 22 Jan 2021 21:24:23 +0100 Subject: [PATCH 2/2] Makefile.am: Add check-po rule. * Makefile.am (make-check-po-rule): New definition. Add top-level 'eval' and calls to 'make-check-po-rule' to generate 'check-po.DOMAIN' rules. (check-po): New rule. --- Makefile.am | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Makefile.am b/Makefile.am index d479032f83..371fc42394 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1003,14 +1003,46 @@ download-po.$(1): endef +# make-check-po-rule DOMAIN DIRECTORY [FILE-NAME-PREFIX] +define make-check-po-rule + +check-po.$(1): + if [ -f "$(top_srcdir)/$(2)/LINGUAS" ]; then \ + LINGUAS="`grep -v '^[[:blank:]]*#' < $(top_srcdir)/$(2)/LINGUAS`" ; \ + else \ + LINGUAS="`(cd $(top_srcdir)/$(2); \ + for i in *.po; do echo $$$$i; done) | cut -d . -f 2`" ; \ + fi ; \ + for lang in $$$$LINGUAS; do \ + if [ -f "$(top_srcdir)/$(2)/$(3)$$$$lang.po" ]; \ + then \ + if ! msgfmt -c "$(top_srcdir)/$(2)/$(3)$$$$lang.po" ; \ + then \ + exit 1 ; \ + fi ; \ + fi ; \ + done + +.PHONY: check-po.$(1) + +endef + $(eval $(call make-download-po-rule,documentation-cookbook,po/doc,guix-cookbook.)) $(eval $(call make-download-po-rule,documentation-manual,po/doc,guix-manual.)) $(eval $(call make-download-po-rule,guix,po/guix)) $(eval $(call make-download-po-rule,packages,po/packages)) +$(eval $(call make-check-po-rule,documentation-cookbook,po/doc,guix-cookbook.)) +$(eval $(call make-check-po-rule,documentation-manual,po/doc,guix-manual.)) +$(eval $(call make-check-po-rule,guix,po/guix)) +$(eval $(call make-check-po-rule,packages,po/packages)) + download-po: $(foreach domain,guix packages documentation-manual documentation-cookbook,download-po.$(domain)) .PHONY: download-po +check-po: $(foreach domain,guix packages documentation-manual documentation-cookbook,check-po.$(domain)) +.PHONY: check-po + ## -------------- ## ## Silent rules. ## ## -------------- ## -- 2.30.0