[pypy-commit] buildbot default: Trying to add symlinks to the latest revision (i.e. the most

arigo noreply at buildbot.pypy.org
Sat Jul 2 18:00:22 CEST 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r520:c90683df63c9
Date: 2011-07-02 18:07 +0200
http://bitbucket.org/pypy/buildbot/changeset/c90683df63c9/

Log:	Trying to add symlinks to the latest revision (i.e. the most
	recently uploaded one).

diff --git a/bot2/pypybuildbot/builds.py b/bot2/pypybuildbot/builds.py
--- a/bot2/pypybuildbot/builds.py
+++ b/bot2/pypybuildbot/builds.py
@@ -28,9 +28,15 @@
         masterdest = os.path.join(masterdest, branch)
         if not os.path.exists(masterdest):
             os.makedirs(masterdest)
+        #
+        assert '%(final_file_name)s' in self.basename
+        symname = self.basename.replace('%(final_file_name)s', 'latest')
+        assert '%' not in symname
+        self.symlinkname = os.path.join(masterdest, symname)
+        #
         basename = WithProperties(self.basename).render(properties)
-        masterdest = os.path.join(masterdest, basename)
-        self.masterdest = masterdest
+        self.masterdest = os.path.join(masterdest, basename)
+        #
         transfer.FileUpload.start(self)
 
     def finished(self, *args, **kwds):
@@ -39,6 +45,10 @@
             os.chmod(self.masterdest, 0644)
         except OSError:
             pass
+        try:
+            os.symlink(os.path.basename(self.masterdest), self.symlinkname)
+        except OSError:
+            pass
 
 class Translate(ShellCmd):
     name = "translate"
diff --git a/bot2/pypybuildbot/pypylist.py b/bot2/pypybuildbot/pypylist.py
--- a/bot2/pypybuildbot/pypylist.py
+++ b/bot2/pypybuildbot/pypylist.py
@@ -13,6 +13,7 @@
     # to get the desired order keep in mind that they are reversed at the end,
     # so the highest the value, the bigger the priority
     VCS_PRIORITY = {
+        'latest': 150,
         'hg': 100,
         'svn': 50,
         }
@@ -64,8 +65,13 @@
         if dashes == 4:
             # svn based
             self.exe, self.backend, self.features, self.rev, self.platform = name.split('-')
-            self.numrev = int(self.rev)
-            self.vcs = 'svn'
+            if self.rev == 'latest':
+                self.rev = -1
+                self.numrev = -1
+                self.vcs = 'latest'
+            else:
+                self.numrev = int(self.rev)
+                self.vcs = 'svn'
         elif dashes == 5:
             # mercurial based
             self.exe, self.backend, self.features, num, hgid, self.platform = name.split('-')
diff --git a/bot2/pypybuildbot/test/test_builds.py b/bot2/pypybuildbot/test/test_builds.py
--- a/bot2/pypybuildbot/test/test_builds.py
+++ b/bot2/pypybuildbot/test/test_builds.py
@@ -8,6 +8,8 @@
             return None
         if item == 'got_revision':
             return 123
+        if item == 'final_file_name':
+            return '123-ea5ca8'
     
     def render(self, x):
         return x
@@ -51,7 +53,7 @@
 def test_pypy_upload():
     pth = py.test.ensuretemp('buildbot')
     inst = builds.PyPyUpload(slavesrc='slavesrc', masterdest=str(pth.join('mstr')),
-                             basename='base-%(got_revision)s', workdir='.',
+                             basename='base-%(final_file_name)s', workdir='.',
                              blocksize=100)
     factory, kw = inst.factory
     rebuilt = factory(**kw)
@@ -60,7 +62,10 @@
     rebuilt.runCommand = lambda *args: FakeDeferred()
     rebuilt.start()
     assert pth.join('mstr').check(dir=True)
-    assert rebuilt.masterdest == str(pth.join('mstr', 'trunk', 'base-123'))
+    assert rebuilt.masterdest == str(pth.join('mstr', 'trunk',
+                                              'base-123-ea5ca8'))
+    assert rebuilt.symlinkname == str(pth.join('mstr', 'trunk',
+                                               'base-latest'))
 
 class TestPytestCmd(object):
     


More information about the pypy-commit mailing list