[pypy-svn] buildbot commit cb83f6b653e6: handle nicely the tarballs generated by a mercurial-based buildbot

Bitbucket commits-noreply at bitbucket.org
Tue Dec 14 09:17:13 CET 2010


# HG changeset patch -- Bitbucket.org
# Project buildbot
# URL http://bitbucket.org/pypy/buildbot/overview
# User Antonio Cuni <anto.cuni at gmail.com>
# Date 1292314628 -3600
# Node ID cb83f6b653e624b671ea80fd59bca231db6e3a64
# Parent  a7823765f22f7c3385b6392ab3744055d3eac61e
handle nicely the tarballs generated by a mercurial-based buildbot

--- a/bot2/pypybuildbot/pypylist.py
+++ b/bot2/pypybuildbot/pypylist.py
@@ -4,6 +4,7 @@ import itertools
 import re
 import py
 import cgi
+import urllib
 from twisted.web import resource
 from twisted.web.static import File, DirectoryLister
 
@@ -11,6 +12,11 @@ class PyPyTarball(object):
 
     # 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 = {
+        'hg': 100,
+        'svn': 50,
+        }
+    
     FEATURES_PRIORITY = {
         'jit':      100,
         'nojit':     50,
@@ -42,10 +48,12 @@ class PyPyTarball(object):
         try:
             self.parse_filename()
         except ValueError:
+            self.vcs = None
             self.exe = None
             self.backend = None
             self.features = None
             self.rev = -1
+            self.numrev = -1
             self.platform = None
 
     def parse_filename(self):
@@ -53,9 +61,18 @@ class PyPyTarball(object):
             raise ValueError
         name = self.filename.replace('.tar.bz2', '')
         self.exe, self.backend, self.features, self.rev, self.platform = name.split('-')
+        if ':' in self.rev:
+            # mercurial based
+            num, _ = self.rev.split(':')
+            self.numrev = int(num)
+            self.vcs = 'hg'
+        else:
+            self.numrev = int(self.rev)
+            self.vcs = 'svn'
 
     def key(self):
-        return (self.rev,
+        return (self.VCS_PRIORITY.get(self.vcs, -1),
+                self.numrev,
                 self.FEATURES_PRIORITY.get(self.features, -1),
                 self.PLATFORM_PRIORITY.get(self.platform, -1))
 
@@ -175,7 +192,7 @@ td,th {padding-left: 0.5em; padding-righ
         return tableContent
 
     def _add_test_results(self, element, rowClass):
-        filename = element['href']
+        filename = urllib.unquote(element['href'])
         f = py.path.local(self.path).join(filename)
         date = datetime.date.fromtimestamp(f.mtime())
         element['date'] = date.isoformat()

--- a/bot2/pypybuildbot/test/test_pypylist.py
+++ b/bot2/pypybuildbot/test/test_pypylist.py
@@ -1,14 +1,27 @@
 import py
 from pypybuildbot.pypylist import PyPyTarball
 
-def test_pypytarball():
+def test_pypytarball_svn():
     t = PyPyTarball('pypy-c-jit-75654-linux.tar.bz2')
     assert t.filename == 'pypy-c-jit-75654-linux.tar.bz2'
     assert t.exe == 'pypy'
     assert t.backend == 'c'
     assert t.features == 'jit'
     assert t.rev == '75654'
+    assert t.numrev == 75654
     assert t.platform == 'linux'
+    assert t.vcs == 'svn'
+
+def test_pypytarball_hg():
+    t = PyPyTarball('pypy-c-jit-75654:foo-linux.tar.bz2')
+    assert t.filename == 'pypy-c-jit-75654:foo-linux.tar.bz2'
+    assert t.exe == 'pypy'
+    assert t.backend == 'c'
+    assert t.features == 'jit'
+    assert t.rev == '75654:foo'
+    assert t.numrev == 75654
+    assert t.platform == 'linux'
+    assert t.vcs == 'hg'
 
 def test_invalid_filename():
     t = PyPyTarball('foo')
@@ -29,11 +42,13 @@ def test_sort():
             'pypy-c-jit-10000-linux64.tar.bz2',
             'pypy-c-jit-10000-win32.tar.bz2',
             'pypy-c-stackless-10000-linux.tar.bz2',
+            'pypy-c-jit-1000:e5b73981fc8d-linux.tar.bz2', # this is mercurial based
             ])
 
     files.sort(key=PyPyTarball.key, reverse=True)
     files = [f.filename for f in files]
     assert files == [
+        'pypy-c-jit-1000:e5b73981fc8d-linux.tar.bz2', # mercurial first
         'pypy-c-jit-20000-linux.tar.bz2',
         'pypy-c-jit-10000-linux.tar.bz2',
         'pypy-c-jit-10000-linux64.tar.bz2',



More information about the Pypy-commit mailing list