Patchwork Makefile: intermediate steps work with temporary copy of hg.pot

login
register
mail settings
Submitter Simon Heimberg
Date Nov. 5, 2013, 8:27 a.m.
Message ID <2b8d5d7a0cce24e8c162.1383640064@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/2858/
State Superseded
Commit c845b1a95eed0d9545a33c04693f47a838412ac9
Headers show

Comments

Simon Heimberg - Nov. 5, 2013, 8:27 a.m.
# HG changeset patch
# User Simon Heimberg <simohe@besonet.ch>
# Date 1383639939 -3600
#      Tue Nov 05 09:25:39 2013 +0100
# Branch stable
# Node ID 2b8d5d7a0cce24e8c1624f547d1b8aead1de3bf6
# Parent  2e096bfe9691bc594c925e19bf4f0c5d195b79dc
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 2e096bfe9691 -r 2b8d5d7a0cce Makefile
--- a/Makefile	Tue Nov 05 09:00:31 2013 +0100
+++ b/Makefile	Tue Nov 05 09:25:39 2013 +0100
@@ -107,7 +107,7 @@ 
 	  mercurial/fileset.py mercurial/revset.py \
 	  mercurial/templatefilters.py mercurial/templatekw.py \
 	  mercurial/filemerge.py \
-	  $(DOCFILES) > i18n/hg.pot
+	  $(DOCFILES) > i18n/hg.pot~
         # 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
@@ -119,8 +119,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~
+	$(PYTHON) i18n/posplit i18n/hg.pot~
+       # The target file is not created before the last step. So it never is in
+       # an intermediate state.
+	mv -f i18n/hg.pot~ i18n/hg.pot
 
 %.po: i18n/hg.pot
 	msgmerge --no-location --update $@ $^