michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: """ michael@0: Pull a specified revision of chromium from SVN. michael@0: michael@0: Usage: python pull-chromium.py michael@0: michael@0: You will have to set up a Chromium tree before running this step. See michael@0: http://dev.chromium.org/developers/how-tos/get-the-code for details about michael@0: doing this efficiently. michael@0: """ michael@0: michael@0: import sys, os michael@0: from subprocess import check_call michael@0: from shutil import rmtree michael@0: michael@0: topsrcdir, chromiumtree, rev = sys.argv[1:] michael@0: michael@0: if not os.path.exists(os.path.join(topsrcdir, 'client.py')): michael@0: print >>sys.stderr, "Incorrect topsrcdir" michael@0: sys.exit(1) michael@0: michael@0: if not os.path.exists(os.path.join(chromiumtree, 'src/DEPS')): michael@0: print >>sys.stderr, "Incorrect chromium directory, missing DEPS" michael@0: sys.exit(1) michael@0: michael@0: check_call(['gclient', 'sync', '--force', '--revision=src@%s' % rev], cwd=chromiumtree) michael@0: michael@0: chromiumsrc = os.path.join(topsrcdir, 'ipc/chromium/src') michael@0: os.path.exists(chromiumsrc) and rmtree(chromiumsrc) michael@0: michael@0: def doexport(svnpath): michael@0: localpath = os.path.join(chromiumsrc, svnpath) michael@0: os.makedirs(os.path.dirname(localpath)) michael@0: check_call(['svn', 'export', '-r', 'BASE', os.path.join(chromiumtree, 'src', svnpath), localpath]) michael@0: michael@0: doexport('base') michael@0: doexport('chrome/common') michael@0: doexport('build/build_config.h') michael@0: doexport('testing/gtest/include') michael@0: doexport('third_party/libevent') michael@0: michael@0: michael@0: