Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Extend auto_nacl_deps_bump.py to check Chromium's LKGR

Don't run a try job if Chromium's LKGR hasn't yet caught up to the last
nacl_revision change, because the "patch" step would fail.
  • Loading branch information...
commit d2c3ed9aa1ee4482fb31525be8c28ed0914f59a7 1 parent 570e9d2
@mseaborn authored
Showing with 117 additions and 0 deletions.
  1. +19 −0 auto_nacl_deps_bump.py
  2. +27 −0 get_chromium_lkgr.py
  3. +71 −0 get_nacl_revs.py
View
19 auto_nacl_deps_bump.py
@@ -9,6 +9,8 @@
import pysvn
+import get_chromium_lkgr
+import get_nacl_revs
import nacl_deps_bump
@@ -58,6 +60,23 @@ def Main():
if rev_diff > REVS_THRESHOLD:
print 'revision count threshold passed: trigger new build'
do_build = True
+
+ # Check Chromium's LKGR to avoid bad try runs.
+ last_deps_bump = get_nacl_revs.GetSvnLastDepsBump()
+ print 'The last nacl_revision change in Chromium was in r%i' % last_deps_bump
+ chromium_lkgr = get_chromium_lkgr.GetLkgr()
+ print 'Chromium LKGR is r%i' % chromium_lkgr
+ if chromium_lkgr >= last_deps_bump:
+ print 'Chromium LKGR includes last nacl_revision change (good)'
+ else:
+ print 'Chromium LKGR has not caught up yet (bad)'
+ # Don't attempt to run a new try job, because we generate a patch
+ # against Chromium's latest revision which would fail to apply
+ # against LKGR, which is what the trybots use by default. We
+ # could pass "-rHEAD" to the trybots, but then the trybots are
+ # more likely to fail if we get a bad revision of Chromium.
+ do_build = False
+
if do_build:
nacl_deps_bump.Main(['--revision', str(newest_rev)])
View
27 get_chromium_lkgr.py
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 The Native Client Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import time
+import urllib2
+
+
+# This script gets Chromium's LKGR value (Last Known Good Revision).
+# We record the value in a log for posterity, because
+# chromium-status.appspot.com does not appear to log it, or at least
+# does not make the log available.
+
+
+def GetLkgr():
+ data = urllib2.urlopen('http://chromium-status.appspot.com/lkgr').read()
+ lkgr_rev = int(data.strip())
+ time_now = time.time()
+ time_str = time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(time_now))
+ log_file = open('chromium_lkgr.log', 'a')
+ log_file.write('%s,%s,%s\n' % (lkgr_rev, time_now, time_str))
+ return lkgr_rev
+
+
+if __name__ == '__main__':
+ print GetLkgr()
View
71 get_nacl_revs.py
@@ -0,0 +1,71 @@
+#!/usr/bin/python
+# Copyright (c) 2012 The Native Client Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import re
+import subprocess
+
+import nacl_deps_bump
+
+
+# This script lists the Chromium revisions in which nacl_revision was
+# changed in DEPS.
+
+
+def GetCommandOutput(command):
+ proc = subprocess.Popen(command, stdout=subprocess.PIPE)
+ stdout = proc.communicate()[0]
+ status = proc.wait()
+ assert status == 0, (command, status)
+ return stdout
+
+
+# Returns (Chromium Git commit ID, nacl_revision) for each revision of
+# Chromium.
+def GetAllDepsRevs():
+ proc = subprocess.Popen(['git', 'rev-list', 'origin/master', '--', 'DEPS'],
+ stdout=subprocess.PIPE)
+ for line in proc.stdout:
+ commit = line.rstrip('\n')
+ deps = GetCommandOutput(['git', 'cat-file', 'blob', '%s:DEPS' % commit])
+ match = nacl_deps_bump.MatchKey(deps, 'nacl_revision')
+ assert match is not None
+ nacl_rev = match.group(1)
+ yield commit, nacl_rev
+
+
+# Returns (Chromium Git commit ID, nacl_revision) for each revision of
+# Chromium in which nacl_revision has been changed.
+def GetDepsRevs():
+ seq = GetAllDepsRevs()
+ commit, nacl_rev = seq.next()
+ while True:
+ commit2, nacl_rev2 = seq.next()
+ if nacl_rev != nacl_rev2:
+ yield commit, nacl_rev
+ commit = commit2
+ nacl_rev = nacl_rev2
+
+
+def GetSvnRevisionFromGitCommit(commit):
+ data = GetCommandOutput(['git', 'cat-file', 'commit', commit])
+ match = re.search('\ngit-svn-id: .*@(\d+).*\s*$', data, re.S)
+ if match is None:
+ raise AssertionError('No git-svn-id in %r' % data)
+ return int(match.group(1))
+
+
+# Get the SVN revision number of the last nacl_revision change.
+def GetSvnLastDepsBump():
+ commit, nacl_rev = GetDepsRevs().next()
+ return GetSvnRevisionFromGitCommit(commit)
+
+
+def Main():
+ for commit, nacl_rev in GetDepsRevs():
+ print GetSvnRevisionFromGitCommit(commit), nacl_rev
+
+
+if __name__ == '__main__':
+ Main()
Please sign in to comment.
Something went wrong with that request. Please try again.