[Buildbot-commits] buildbot/buildbot scheduler.py,1.16,1.17

Brian Warner warner at users.sourceforge.net
Sun May 7 18:36:43 UTC 2006


Update of /cvsroot/buildbot/buildbot/buildbot
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26989/buildbot

Modified Files:
	scheduler.py 
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-532
Creator:  Brian Warner <warner at lothar.com>

Try_Jobdir: windows fix, add logging to Build.setupBuild

	* buildbot/scheduler.py (Try_Jobdir.messageReceived): when
	operating under windows, move the file before opening it, since
	you can't rename a file that somebody has open.

	* buildbot/process/base.py (Build.setupBuild): if something goes
	wrong while creating a Step, log the name and arguments, since the
	error message when you get the number of arguments wrong is really
	opaque.


Index: scheduler.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/scheduler.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- scheduler.py	17 Apr 2006 19:22:34 -0000	1.16
+++ scheduler.py	7 May 2006 18:36:41 -0000	1.17
@@ -4,7 +4,7 @@
 
 from twisted.internet import reactor
 from twisted.application import service, internet, strports
-from twisted.python import log
+from twisted.python import log, runtime
 from twisted.protocols import basic
 from twisted.cred import portal, checkers
 from twisted.spread import pb
@@ -587,10 +587,22 @@
 
     def messageReceived(self, filename):
         md = os.path.join(self.parent.basedir, self.jobdir)
-        path = os.path.join(md, "new", filename)
-        f = open(path, "r")
-        os.rename(os.path.join(md, "new", filename),
-                  os.path.join(md, "cur", filename))
+        if runtime.platformType == "posix":
+            # open the file before moving it, because I'm afraid that once
+            # it's in cur/, someone might delete it at any moment
+            path = os.path.join(md, "new", filename)
+            f = open(path, "r")
+            os.rename(os.path.join(md, "new", filename),
+                      os.path.join(md, "cur", filename))
+        else:
+            # do this backwards under windows, because you can't move a file
+            # that somebody is holding open. This was causing a Permission
+            # Denied error on bear's win32-twisted1.3 buildslave.
+            os.rename(os.path.join(md, "new", filename),
+                      os.path.join(md, "cur", filename))
+            path = os.path.join(md, "cur", filename)
+            f = open(path, "r")
+
         try:
             builderNames, ss, bsid = self.parseJob(f)
         except BadJobfile:





More information about the Commits mailing list