Patchwork [2,of,2] Makefile: intermediate steps work with temporary copy of hg.pot

login
register
mail settings
Submitter Simon Heimberg
Date Nov. 18, 2013, 11:24 p.m.
Message ID <7f4fb953d5fafe7dbced.1384817082@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/3062/
State Accepted
Commit c845b1a95eed0d9545a33c04693f47a838412ac9
Headers show

Comments

Simon Heimberg - Nov. 18, 2013, 11:24 p.m.
# HG changeset patch
# User Simon Heimberg <simohe@besonet.ch>
# Date 1384687106 -3600
#      Sun Nov 17 12:18:26 2013 +0100
# Node ID 7f4fb953d5fafe7dbceded880af9ec7c0b5de832
# Parent  1a083ec12a747cfcffa7a6557678193399f921d1
Makefile: intermediate steps work with temporary copy of hg.pot

In case of abortion or a failing step, the target file remains untouched
instead of being in an intermediate state.

Patch

diff -r 1a083ec12a74 -r 7f4fb953d5fa Makefile
--- a/Makefile	Sun Nov 17 12:17:55 2013 +0100
+++ b/Makefile	Sun Nov 17 12:18:26 2013 +0100
@@ -108,7 +108,7 @@ 
 	  mercurial/fileset.py mercurial/revset.py \
 	  mercurial/templatefilters.py mercurial/templatekw.py \
 	  mercurial/filemerge.py \
-	  $(DOCFILES) > i18n/hg.pot
+	  $(DOCFILES) > i18n/hg.pot.tmp
         # All strings marked for translation in Mercurial contain
         # ASCII characters only. But some files contain string
         # literals like this '\037\213'. xgettext thinks it has to
@@ -120,8 +120,11 @@ 
 	  --msgid-bugs-address "<mercurial-devel@selenic.com>" \
 	  --copyright-holder "Matt Mackall <mpm@selenic.com> and others" \
 	  --from-code ISO-8859-1 --join --sort-by-file --add-comments=i18n: \
-	  -d hg -p i18n -o hg.pot
-	$(PYTHON) i18n/posplit i18n/hg.pot
+	  -d hg -p i18n -o hg.pot.tmp
+	$(PYTHON) i18n/posplit i18n/hg.pot.tmp
+        # The target file is not created before the last step. So it never is in
+        # an intermediate state.
+	mv -f i18n/hg.pot.tmp i18n/hg.pot
 
 %.po: i18n/hg.pot
         # work on a temporary copy for never having a half completed target