Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Unified Diff: Tools/Scripts/update-w3c-deps

Issue 148173016: Checkpoint work to import new tests from the w3c repos. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: more cleanup Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/W3CImportExpectations ('k') | Tools/Scripts/webkitpy/w3c/test_importer.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Tools/Scripts/update-w3c-deps
diff --git a/Tools/Scripts/update-w3c-deps b/Tools/Scripts/update-w3c-deps
new file mode 100755
index 0000000000000000000000000000000000000000..0c1bc5bd7f306a220d9be5ce2da4aee553709494
--- /dev/null
+++ b/Tools/Scripts/update-w3c-deps
@@ -0,0 +1,108 @@
+#!/usr/bin/python
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Pull latest revisions of the W3C test repos and update our DEPS entries."""
+import optparse
+import subprocess
+import sys
+
+from webkitpy.common import version_check
+
+from webkitpy.common.host import Host
+from webkitpy.common.webkit_finder import WebKitFinder
+
+def main():
+ parser = optparse.OptionParser()
+ parser.description = __doc__
+ parser.add_option('-n', '--dryrun', action='store_true')
+ parser.add_option('-v', '--verbose', action='store_true')
+
+ options, args = parser.parse_args()
+ if args:
+ parser.error('%prog does not take any arguments')
+ sys.exit(1)
+
+ cmd = CommandRunner(Host(), options)
+
+ update_repo(cmd, 'web-platform-tests')
+ update_repo(cmd, 'csswg-test')
+
+
+def update_repo(cmd, repo):
+ blink_commitish = cmd.run(['git', 'show-ref', 'HEAD']).split()[0]
ojan 2014/02/08 00:36:28 Should this assert you're in a clean checkout? FIX
Dirk Pranke 2014/02/08 01:04:31 I'm not actually sure you want to assert, but I ha
+
+ cmd.cd('LayoutTests', 'w3c', repo)
+ cmd.run(['git', 'fetch', 'origin'])
+ new_commits = cmd.run(['git', 'log', '--oneline', 'origin/blink..origin/master'])
+ if not new_commits and cmd.options.verbose:
+ print >>sys.stderr, 'No new commits found in %s' % repo
+ # FIXME: check if there are any changes to W3CImportExpectations, too.
+ return
+
+ master_commitish = cmd.run(['git', 'show-ref', 'origin/master']).split()[0]
+ status = cmd.run(['git', 'status'])
+ if status and not 'nothing to commit, working directory clean' in status:
ojan 2014/02/08 00:36:28 This is kind of gross. webkitpy git does the follo
Dirk Pranke 2014/02/08 01:04:31 Yeah, will look into doing something stronger here
Dirk Pranke 2014/03/10 21:19:27 Turns out that 'git diff --quiet commitish' probab
+ print >> sys.stderr, "%s is not clean, exiting" % repo
+ sys.exit(1)
+
+ if cmd.run(['git', 'branch', '--list', 'blink']):
+ cmd.run(['git', 'checkout', 'origin/master'])
+ cmd.run(['git', 'branch', '-D', 'blink'])
+ cmd.run(['git', 'checkout', '--track', '-b', 'blink', 'origin/blink'])
+
+ # FIXME: Figure out why Gerrit won't let me record merge commits ...
+ # cmd.run(['git', 'merge', '--no-commit', '-s', 'ours', 'origin/master'])
+
+ cmd.run(['git', 'rm', '-fr', '*'])
+ cmd.run(['git', 'checkout', 'origin/blink', 'README.blink'])
+ cmd.run(['git', 'checkout', 'origin/master', '--', '.'])
+ cmd.run([sys.executable, cmd.path_from_webkit_base('Tools', 'Scripts', 'import-w3c-tests')])
+ cmd.run(['git', 'add', '--all', '.'])
+ cmd.run(['git', 'commit', '-m', 'import origin/master@%s using blink@%s' %
+ (master_commitish, blink_commitish)])
+
+
+class CommandRunner(object):
+ def __init__(self, host, options):
+ host = host
+ self.executive = host.executive
+ self.fs = host.filesystem
+ self.finder = WebKitFinder(self.fs)
+ self.options = options
+
+ def run(self, cmd, **args):
+ cmd_str = ' '.join([arg for arg in cmd])
+ if self.options.verbose:
+ print >>sys.stderr, cmd_str
+ if self.options.dryrun:
+ return
+
+ proc = self.executive.popen(cmd, stdout=self.executive.PIPE,
+ stderr=self.executive.PIPE, **args)
+ out, err = proc.communicate()
+ if proc.returncode:
+ print >> sys.stderr, "'%s' failed:\n%s\%s" % (cmd_str, out, err)
+ sys.exit(proc.returncode)
+ if self.options.verbose:
+ if out:
+ print out
+ if err:
+ print >>sys.stderr, err
+ return out
+
+ def cd(self, *comps):
+ dest = self.path_from_webkit_base(*comps)
+ if self.options.verbose:
+ print "cd %s" % dest
+ if self.options.dryrun:
+ return
+ self.fs.chdir(dest)
+
+ def path_from_webkit_base(self, *comps):
+ return self.finder.path_from_webkit_base(*comps)
+
+
+if __name__ == '__main__':
+ main()
« no previous file with comments | « LayoutTests/W3CImportExpectations ('k') | Tools/Scripts/webkitpy/w3c/test_importer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698