[Buildbot-commits] buildbot/buildbot/slave commands.py,1.36,1.37 bot.py,1.13,1.14

Brian Warner warner at users.sourceforge.net
Tue Jul 19 23:12:02 UTC 2005


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

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

merge in build-on-branch code: Merged from warner at monolith.lothar.com--2005 (patch 0-18, 40-41)

Patches applied:

 * warner at monolith.lothar.com--2005/buildbot--dev--0--patch-40
   Merged from arch at buildbot.sf.net--2004 (patch 232-238)

 * warner at monolith.lothar.com--2005/buildbot--dev--0--patch-41
   Merged from local-usebranches (warner at monolith.lothar.com--2005/buildbot--usebranches--0( (patch 0-18)

 * warner at monolith.lothar.com--2005/buildbot--usebranches--0--base-0
   tag of warner at monolith.lothar.com--2005/buildbot--dev--0--patch-38

 * warner at monolith.lothar.com--2005/buildbot--usebranches--0--patch-1
   rearrange build scheduling

 * warner at monolith.lothar.com--2005/buildbot--usebranches--0--patch-2
   replace ugly 4-tuple with a distinct SourceStamp class

 * warner at monolith.lothar.com--2005/buildbot--usebranches--0--patch-3
   document upcoming features, clean up CVS branch= argument

 * warner at monolith.lothar.com--2005/buildbot--usebranches--0--patch-4
   Merged from arch at buildbot.sf.net--2004 (patch 227-231), warner at monolith.lothar.com--2005 (patch 39)

 * warner at monolith.lothar.com--2005/buildbot--usebranches--0--patch-5
   implement per-Step Locks, add tests (which all fail)

 * warner at monolith.lothar.com--2005/buildbot--usebranches--0--patch-6
   implement scheduler.Dependent, add (failing) tests

 * warner at monolith.lothar.com--2005/buildbot--usebranches--0--patch-7
   make test_dependencies work

 * warner at monolith.lothar.com--2005/buildbot--usebranches--0--patch-8
   finish making Locks work, tests now pass

 * warner at monolith.lothar.com--2005/buildbot--usebranches--0--patch-9
   fix test failures when run against twisted >2.0.1

 * warner at monolith.lothar.com--2005/buildbot--usebranches--0--patch-10
   rename test_interlock.py to test_locks.py

 * warner at monolith.lothar.com--2005/buildbot--usebranches--0--patch-11
   add more Locks tests, add branch examples to manual

 * warner at monolith.lothar.com--2005/buildbot--usebranches--0--patch-12
   rewrite test_vc.py, create repositories in setUp rather than offline

 * warner at monolith.lothar.com--2005/buildbot--usebranches--0--patch-13
   make new tests work with twisted-1.3.0

 * warner at monolith.lothar.com--2005/buildbot--usebranches--0--patch-14
   implement/test build-on-branch for most VC systems

 * warner at monolith.lothar.com--2005/buildbot--usebranches--0--patch-15
   minor changes: test-case-name tags, init cleanup

 * warner at monolith.lothar.com--2005/buildbot--usebranches--0--patch-16
   Merged from arch at buildbot.sf.net--2004 (patch 232-233)

 * warner at monolith.lothar.com--2005/buildbot--usebranches--0--patch-17
   Merged from arch at buildbot.sf.net--2004 (patch 234-236)

 * warner at monolith.lothar.com--2005/buildbot--usebranches--0--patch-18
   Merged from arch at buildbot.sf.net--2004 (patch 237-238), warner at monolith.lothar.com--2005 (patch 40)


Index: bot.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/slave/bot.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- bot.py	6 May 2005 04:57:58 -0000	1.13
+++ bot.py	19 Jul 2005 23:12:00 -0000	1.14
@@ -61,9 +61,9 @@
     # when the step is started
     remoteStep = None
 
-    def __init__(self, parent, name, not_really):
-        #service.Service.__init__(self)
-        self.name = name
+    def __init__(self, name, not_really):
+        #service.Service.__init__(self) # Service has no __init__ method
+        self.setName(name)
         self.not_really = not_really
         
     def __repr__(self):
@@ -267,7 +267,7 @@
                             % (name, b.builddir, builddir))
                     b.setBuilddir(builddir)
             else:
-                b = SlaveBuilder(self, name, self.not_really)
+                b = SlaveBuilder(name, self.not_really)
                 b.usePTY = self.usePTY
                 b.setServiceParent(self)
                 b.setBuilddir(builddir)
@@ -446,4 +446,6 @@
         self.bf.continueTrying = 0
         service.MultiService.stopService(self)
         # now kill the TCP connection
-        self.connection._connection.disconnect()
+        # twisted >2.0.1 does this for us, and leaves _connection=None
+        if self.connection._connection:
+            self.connection._connection.disconnect()

Index: commands.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/slave/commands.py,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- commands.py	19 Jul 2005 01:55:21 -0000	1.36
+++ commands.py	19 Jul 2005 23:12:00 -0000	1.37
@@ -618,6 +618,8 @@
                         that experience transient network failures.
     """
 
+    sourcedata = ""
+
     def setup(self, args):
         self.workdir = args['workdir']
         self.mode = args.get('mode', "update")
@@ -637,12 +639,15 @@
             self.srcdir = "source" # hardwired directory name, sorry
         else:
             self.srcdir = self.workdir
+        self.sourcedatafile = os.path.join(self.builder.basedir,
+                                           self.srcdir,
+                                           ".buildbot-sourcedata")
 
         d = defer.succeed(None)
         # do we need to clobber anything?
         if self.mode in ("copy", "clobber", "export"):
             d.addCallback(self.doClobber, self.workdir)
-        if not self.sourcedirIsUpdateable():
+        if not (self.sourcedirIsUpdateable() and self.sourcedataMatches()):
             # the directory cannot be updated, so we have to clobber it.
             # Perhaps the master just changed modes from 'export' to
             # 'update'.
@@ -665,15 +670,32 @@
     def doVC(self, res):
         if self.interrupted:
             raise AbandonChain(1)
-        if self.sourcedirIsUpdateable():
+        if self.sourcedirIsUpdateable() and self.sourcedataMatches():
             d = self.doVCUpdate()
             d.addCallback(self.maybeDoVCFallback)
         else:
             d = self.doVCFull()
             d.addBoth(self.maybeDoVCRetry)
         d.addCallback(self._abandonOnFailure)
+        d.addCallback(self.writeSourcedata)
         return d
 
+    def sourcedataMatches(self):
+        try:
+            olddata = open(self.sourcedatafile, "r").read()
+            if olddata != self.sourcedata:
+                return False
+        except IOError:
+            return False
+        return True
+
+    def writeSourcedata(self, res):
+        open(self.sourcedatafile, "w").write(self.sourcedata)
+        return res
+
+    def sourcedirIsUpdateable(self):
+        raise NotImplementedError("this must be implemented in a subclass")
+
     def doVCUpdate(self):
         raise NotImplementedError("this must be implemented in a subclass")
 
@@ -823,6 +845,8 @@
         self.global_options = args.get('global_options', [])
         self.branch = args.get('branch')
         self.login = args.get('login')
+        self.sourcedata = "%s\n%s\n%s\n" % (self.cvsroot, self.cvsmodule,
+                                            self.branch)
 
     def sourcedirIsUpdateable(self):
         if os.path.exists(os.path.join(self.builder.basedir,
@@ -897,6 +921,7 @@
     def setup(self, args):
         SourceBase.setup(self, args)
         self.svnurl = args['svnurl']
+        self.sourcedata = "%s\n" % self.svnurl
 
     def sourcedirIsUpdateable(self):
         if os.path.exists(os.path.join(self.builder.basedir,
@@ -944,6 +969,7 @@
     def setup(self, args):
         SourceBase.setup(self, args)
         self.repourl = args['repourl']
+        self.sourcedata = "%s\n" % self.repourl
 
     def sourcedirIsUpdateable(self):
         if os.path.exists(os.path.join(self.builder.basedir,
@@ -988,6 +1014,7 @@
     def setup(self, args):
         SourceBase.setup(self, args)
         self.repourl = args['repourl']
+        #self.sourcedata = "" # TODO
 
     def sourcedirIsUpdateable(self):
         if os.path.exists(os.path.join(self.builder.basedir,
@@ -1036,8 +1063,18 @@
         self.url = args['url']
         self.version = args['version']
         self.revision = args.get('revision')
+        self.buildconfig = args.get('build-config')
+        self.sourcedata = "%s\n%s\n%s\n" % (self.url, self.version,
+                                            self.buildconfig)
 
     def sourcedirIsUpdateable(self):
+        if self.revision:
+            # Arch cannot roll a directory backwards, so if they ask for a
+            # specific revision, clobber the directory. Technically this
+            # could be limited to the cases where the requested revision is
+            # later than our current one, but it's too hard to extract the
+            # current revision from the tree.
+            return False
         if os.path.exists(os.path.join(self.builder.basedir,
                                        self.srcdir, ".buildbot-patched")):
             return False
@@ -1134,6 +1171,8 @@
         # require that the buildmaster configuration to provide both the
         # archive name and the URL.
         self.archive = args['archive'] # required for Baz
+        self.sourcedata = "%s\n%s\n%s\n" % (self.url, self.version,
+                                            self.buildconfig)
 
     # in _didRegister, the regexp won't match, so we'll stick with the name
     # in self.archive





More information about the Commits mailing list