Patchwork Makefile: do update on a temporary copy of a po file

login
register
mail settings
Submitter Simon Heimberg
Date Nov. 5, 2013, 9:33 a.m.
Message ID <94dec8e6cf107a55354c.1383643992@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/2859/
State Accepted
Commit ce5d711475a314608bea33c5acebc323e2122098
Headers show

Comments

Simon Heimberg - Nov. 5, 2013, 9:33 a.m.
# HG changeset patch
# User Simon Heimberg <simohe@besonet.ch>
# Date 1383641016 -3600
#      Tue Nov 05 09:43:36 2013 +0100
# Branch stable
# Node ID 94dec8e6cf107a55354ccd58eb7ba8cd2c4f910c
# Parent  3d8f013071ebf4e134cf1dec71d6a7a5d4fa1397
Makefile: do update on a temporary copy of a po file

This avoids having a half completed file (with a new timestamp) when msgmerge
has failed.
Matt Mackall - Nov. 13, 2013, 7:37 p.m.
On Tue, 2013-11-05 at 10:33 +0100, Simon Heimberg wrote:
> # HG changeset patch
> # User Simon Heimberg <simohe@besonet.ch>
> # Date 1383641016 -3600
> #      Tue Nov 05 09:43:36 2013 +0100
> # Branch stable
> # Node ID 94dec8e6cf107a55354ccd58eb7ba8cd2c4f910c
> # Parent  3d8f013071ebf4e134cf1dec71d6a7a5d4fa1397
> Makefile: do update on a temporary copy of a po file

Queued for default, thanks. I've change the ~ to .tmp and added an
ignore rule as ~ is used for editor backups.

Patch

diff -r 3d8f013071eb -r 94dec8e6cf10 Makefile
--- a/Makefile	Tue Nov 05 09:43:26 2013 +0100
+++ b/Makefile	Tue Nov 05 09:43:36 2013 +0100
@@ -126,7 +126,10 @@ 
 	mv -f i18n/hg.pot~ i18n/hg.pot
 
 %.po: i18n/hg.pot
-	msgmerge --no-location --update $@ $^
+        # work on a temporary copy for never having a half completed target
+	cp $@ $@~
+	msgmerge --no-location --update $@~ $^
+	mv -f $@~ $@
 
 .PHONY: help all local build doc clean install install-bin install-doc \
 	install-home install-home-bin install-home-doc dist dist-notests tests \