[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] close racecondition with make -j in header_wrappers.py

From: Olaf Hering <olh_at_suse.de>
Date: Wed, 23 Jan 2008 16:04:51 +0100

sometimes make -j fails. I came up with the change below.
This change is in use since Feb 2006.
Still applies to trunk.

/usr/bin/python /usr/src/packages/BUILD/subversion-1.3.x/build/generator/swig/header_wrappers.py /usr/src/packages/BUILD/subversion-1.3.x/build.conf /usr/bin/swig /usr/src/packages/BUILD/subversion-1.3.x/subversion/include/svn_auth.h

/usr/src/packages/BUILD/subversion-1.3.x/subversion/bindings/swig/core.i:613: Error: Unable to find 'svn_auth_h.swg'
/usr/bin/swig -I/usr/src/packages/BUILD/subversion-1.3.x/subversion/bindings/swig -I/usr/src/packages/BUILD/subversion-1.3.x/subversion/bindings/swig/include -I/usr/src/packages/BUILD/subversion-1.3.x/subversion/bindings/swig/proxy -I/usr/src/packages/BUILD/subversion-1.3.x/subversion/bindings/swig/proxy -I/usr/src/packages/BUILD/subversion-1.3.x/subversion/include -I/usr/include -I/usr/include/apr-1 -python -classic -w451 -w305 -o subversion/bindings/swig/python/core.c /usr/src/packages/BUILD/subversion-1.3.x/subversion/bindings/swig/core.i

 build/generator/swig/header_wrappers.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/build/generator/swig/header_wrappers.py
+++ b/build/generator/swig/header_wrappers.py
@@ -239,7 +239,7 @@ class Generator(generator.swig.Generator
       self.proxy_filename(base_fname))
 
     # Open the output file
- self.ofile = open(output_fname, 'w')
+ self.ofile = open(output_fname + "~", 'w')
     self.ofile.write('/* Proxy classes for %s\n' % base_fname)
     self.ofile.write(' * DO NOT EDIT -- AUTOMATICALLY GENERATED */\n')
 
@@ -264,6 +264,7 @@ class Generator(generator.swig.Generator
 
     # Close our output file
     self.ofile.close()
+ os.rename(output_fname + "~", output_fname)
 
   def process_header_file(self, fname):
     """Generate a wrapper around a header file"""

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-01-23 16:05:02 CET

This is an archived mail posted to the Subversion Dev mailing list.