Author: David Schneider <[email protected]>
Branch: 
Changeset: r856:34a71026b5ae
Date: 2013-09-04 09:45 +0200
http://bitbucket.org/pypy/buildbot/changeset/34a71026b5ae/

Log:    restore CheckGotRevision step to keep the build naming and ordering

diff --git a/bot2/pypybuildbot/builds.py b/bot2/pypybuildbot/builds.py
--- a/bot2/pypybuildbot/builds.py
+++ b/bot2/pypybuildbot/builds.py
@@ -55,8 +55,8 @@
         if not os.path.exists(masterdest):
             os.makedirs(masterdest)
         #
-        assert '%(got_revision)s' in self.basename
-        symname = self.basename.replace('%(got_revision)s', 'latest')
+        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)
         #
@@ -168,6 +168,26 @@
         builder.saveYourself()
 
 # _______________________________________________________________
+class CheckGotRevision(ShellCmd):
+    description = 'got_revision'
+    command = ['hg', 'parents', '--template', 'got_revision:{rev}:{node}']
+
+    def commandComplete(self, cmd):
+        if cmd.rc == 0:
+            got_revision = cmd.logs['stdio'].getText()
+            got_revision = got_revision.split('got_revision:')[-1]
+            # manually get the effect of {node|short} without using a
+            # '|' in the command-line, because it doesn't work on Windows
+            num = got_revision.find(':')
+            if num > 0:
+                got_revision = got_revision[:num + 13]
+            #
+            final_file_name = got_revision.replace(':', '-')
+            # ':' should not be part of filenames --- too many issues
+            self.build.setProperty('got_revision', got_revision,
+                                   'got_revision')
+            self.build.setProperty('final_file_name', final_file_name,
+                                   'got_revision')
 
 def update_hg(platform, factory, repourl, workdir, use_branch,
               force_branch=None):
@@ -195,11 +215,12 @@
     update_hg(platform, factory, repourl, workdir, use_branch=True,
               force_branch=force_branch)
     #
+    factory.addStep(CheckGotRevision(workdir=workdir))
 
 
 def build_name(platform, jit=False, flags=[], placeholder=None):
     if placeholder is None:
-        placeholder = '%(got_revision)s'
+        placeholder = '%(final_file_name)s'
     if jit or '-Ojit' in flags:
         kind = 'jit'
     else:
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
@@ -62,7 +62,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 = inst._getStepFactory().factory
     kw = inst._getStepFactory().kwargs
@@ -73,7 +73,7 @@
     rebuilt.start()
     assert pth.join('mstr').check(dir=True)
     assert rebuilt.masterdest == str(pth.join('mstr', 'trunk',
-                                              'base-123'))
+                                              'base-123-ea5ca8'))
     assert rebuilt.symlinkname == str(pth.join('mstr', 'trunk',
                                                'base-latest'))
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to