From 2b7a8a8fb8e75575f3213ed631f70090b4f1f012 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 21 Feb 2012 14:20:13 +0000 Subject: [PATCH 2/3] Write intermediate files by writing a temporary file first Otherwise, we have a race condition: the file exists, so make can proceed, but its contents are not right yet. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=36398 --- telepathy-glib/codegen.am | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/telepathy-glib/codegen.am b/telepathy-glib/codegen.am index c15dfc7..ec5338a 100644 --- a/telepathy-glib/codegen.am +++ b/telepathy-glib/codegen.am @@ -143,14 +143,16 @@ _gen/stable-stamp: $(wildcard $(abs_srcdir)/*.xml) _gen/spec-stamp touch $@ _gen/stable-spec.xml: stable-interfaces.xml _gen/stable-stamp $(tools_dir)/xincludator.py - $(AM_V_GEN)$(PYTHON) $(tools_dir)/xincludator.py $< > $@ + $(AM_V_GEN)$(PYTHON) $(tools_dir)/xincludator.py $< > $@.tmp + @mv $@.tmp $@ # Grab a list of re-entrant tp_cli_*_run_* methods we are committed to # generating for backwards compatibility. _gen/reentrant-methods.list: \ $(top_srcdir)/docs/reference/telepathy-glib-sections.txt \ _gen/spec-stamp - $(AM_V_GEN)$(GREP) 'tp_cli_.*_run_.*' $< > $@ + $(AM_V_GEN)$(GREP) 'tp_cli_.*_run_.*' $< > $@.tmp + @mv $@.tmp $@ # Things generated from the whole spec at once @@ -207,7 +209,8 @@ _gen/error-str.h _gen/error-str.c: _gen/stable-spec.xml \ # Things generated per interface _gen/tp-spec-%.xml: %.xml _gen/spec-stamp $(tools_dir)/xincludator.py - $(AM_V_GEN)$(PYTHON) $(tools_dir)/xincludator.py $< > $@ + $(AM_V_GEN)$(PYTHON) $(tools_dir)/xincludator.py $< > $@.tmp + @mv $@.tmp $@ _gen/tp-svc-%.c _gen/tp-svc-%.h: _gen/tp-spec-%.xml \ $(tools_dir)/glib-ginterface-gen.py \ -- 1.7.9.1