diff options
Diffstat (limited to 'scripts/chromium-depot-tool')
-rwxr-xr-x | scripts/chromium-depot-tool | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/scripts/chromium-depot-tool b/scripts/chromium-depot-tool deleted file mode 100755 index e5de0ee..0000000 --- a/scripts/chromium-depot-tool +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/python2 -# Copyright 2010 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -"""Transparent wrapper for chromium depot_tools.""" - -import httplib -import os.path -import pysvn -import re -import sys - -sys.path.insert(0, "/usr/lib/portage/pym") -import portage.output - -DAV_QUERY = '<propfind xmlns="DAV:"><allprop/></propfind>' - -CHECKOUT_DIR = os.path.expanduser('~/.chromium-depot-tools') -CHECKOUT_URL = 'http://src.chromium.org/svn/trunk/tools/depot_tools' - -eoutput = portage.output.EOutput() - -if not os.path.exists(CHECKOUT_DIR): - os.makedirs(CHECKOUT_DIR) - -svn_client = pysvn.Client() - -def IsCheckoutUpToDate(current_revision): - """ - Performs a quick version check. - - Returns true if the local depot_tools checkout is up to date. - """ - try: - conn = httplib.HTTPConnection('src.chromium.org') - conn.putrequest('PROPFIND', '/svn/!svn/vcc/default') - conn.endheaders() - conn.send(DAV_QUERY) - - response = conn.getresponse() - if response.status != 207: - eoutput.ewarn('Fast update check failed.') - return False - data = response.read() - match = re.match('.*/svn/!svn/bln/(\d+).*', data, re.DOTALL) - rev = match.group(1) - - conn = httplib.HTTPConnection('src.chromium.org') - conn.putrequest('PROPFIND', '/svn/!svn/bc/%s/trunk/tools/depot_tools' % rev) - conn.putheader('Depth', '0') - conn.endheaders() - conn.send(DAV_QUERY) - - response = conn.getresponse() - if response.status != 207: - eoutput.ewarn('Fast update check failed.') - return False - data = response.read() - match = re.match('.*/svn/!svn/ver/(\d+).*', data, re.DOTALL) - rev = int(match.group(1)) - - return rev == current_revision - except: - eoutput.ewarn('Fast update check failed.') - return False - -try: - entry = svn_client.info(CHECKOUT_DIR) -except pysvn.ClientError: - eoutput.einfo('Checking out depot_tools...') - svn_client.checkout(CHECKOUT_URL, CHECKOUT_DIR) -else: - if not IsCheckoutUpToDate(entry.commit_revision.number): - eoutput.einfo('Updating depot_tools...') - svn_client.cleanup(CHECKOUT_DIR) - svn_client.update(CHECKOUT_DIR) - -tools = { - 'drover': 'drover.py', - 'gcl': 'gcl.py', - 'gclient': 'gclient.py', -} - -argv = sys.argv[:] -argv[0] = os.path.basename(argv[0]) -if argv[0] in tools: - tool = argv[0] - argv = argv[1:] -elif len(sys.argv) >= 1: - tool = argv[1] - argv = argv[2:] - -os.execvp('python2', - ['python2', os.path.join(CHECKOUT_DIR, tools[tool])] + argv) |