Commit 14f633b4 authored by agable@chromium.org's avatar agable@chromium.org

Update fetch to support more flexible refspecs

R=machenbach@chromium.org
BUG=415464

Review URL: https://codereview.chromium.org/656623003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@292588 0039d316-1c4b-4281-b951-d872f2087c98
parent 04d16a56
......@@ -5,8 +5,4 @@
base_dir=$(dirname "$0")
if [[ "#grep#fetch#cleanup#diff#" != *"#$1#"* ]]; then
"$base_dir"/update_depot_tools
fi
PYTHONDONTWRITEBYTECODE=1 exec python "$base_dir/fetch.py" "$@"
......@@ -139,20 +139,18 @@ class GclientGitSvnCheckout(GclientGitCheckout, SvnCheckout):
def __init__(self, options, spec, root):
super(GclientGitSvnCheckout, self).__init__(options, spec, root)
assert 'svn_url' in self.spec
assert 'svn_branch' in self.spec
assert 'svn_ref' in self.spec
def init(self):
# Ensure we are authenticated with subversion for all submodules.
git_svn_dirs = json.loads(self.spec.get('submodule_git_svn_spec', '{}'))
git_svn_dirs.update({self.root: self.spec})
for _, svn_spec in git_svn_dirs.iteritems():
try:
self.run_svn('ls', '--non-interactive', svn_spec['svn_url'])
except subprocess.CalledProcessError:
print 'Please run `svn ls %s`' % svn_spec['svn_url']
return 1
if svn_spec.get('svn_url'):
try:
self.run_svn('ls', '--non-interactive', svn_spec['svn_url'])
except subprocess.CalledProcessError:
print 'Please run `svn ls %s`' % svn_spec['svn_url']
return 1
super(GclientGitSvnCheckout, self).init()
......@@ -164,12 +162,17 @@ class GclientGitSvnCheckout(GclientGitCheckout, SvnCheckout):
wd = os.path.join(self.base, real_path)
if self.options.dry_run:
print 'cd %s' % wd
prefix = svn_spec.get('svn_prefix', 'origin/')
self.run_git('svn', 'init', '--prefix=' + prefix, '-T',
svn_spec['svn_branch'], svn_spec['svn_url'], cwd=wd)
self.run_git('config', '--replace', 'svn-remote.svn.fetch',
svn_spec['svn_branch'] + ':refs/remotes/' + prefix +
svn_spec['svn_ref'], cwd=wd)
if svn_spec.get('auto'):
self.run_git('auto-svn', cwd=wd)
continue
self.run_git('svn', 'init', svn_spec['svn_url'], cwd=wd)
self.run_git('config', '--unset-all', 'svn-remote.svn.fetch', cwd=wd)
for svn_branch, git_ref in svn_spec.get('git_svn_fetch', {}).items():
self.run_git('config', '--add', 'svn-remote.svn.fetch',
'%s:%s' % (svn_branch, git_ref), cwd=wd)
for svn_branch, git_ref in svn_spec.get('git_svn_branches', {}).items():
self.run_git('config', '--add', 'svn-remote.svn.branches',
'%s:%s' % (svn_branch, git_ref), cwd=wd)
self.run_git('svn', 'fetch', cwd=wd)
......
......@@ -17,9 +17,7 @@ class Blink(recipe_util.Recipe):
def fetch_spec(props):
submodule_spec = {
'third_party/WebKit': {
'svn_url': 'svn://svn.chromium.org/blink/trunk',
'svn_branch': 'trunk',
'svn_ref': 'master',
'auto': True,
}
}
return {
......
......@@ -31,11 +31,9 @@ class Chromium(recipe_util.Recipe):
spec['target_os'] = props['target_os'].split(',')
if props.get('target_os_only'):
spec['target_os_only'] = props['target_os_only']
checkout_type = 'gclient_git'
spec_type = '%s_spec' % checkout_type
return {
'type': checkout_type,
spec_type: spec,
'type': 'gclient_git',
'gclient_git_spec': spec,
}
@staticmethod
......
......@@ -15,25 +15,16 @@ class DepotTools(recipe_util.Recipe):
@staticmethod
def fetch_spec(props):
url = 'https://chromium.googlesource.com/chromium/tools/depot_tools.git'
solution = { 'name' :'src',
'url' : url,
'deps_file': '.DEPS.git',
'managed' : False,
'custom_deps': {},
'safesync_url': '',
solution = {
'name' : 'depot_tools',
'url' : url,
'deps_file' : 'DEPS',
'managed' : False,
}
spec = {
'solutions': [solution],
'svn_url': 'svn://svn.chromium.org/chrome',
'svn_branch': 'trunk/tools/depot_tools',
'svn_ref': 'master',
'auto': True,
}
if props.get('submodule_git_svn_spec'):
spec['submodule_git_svn_spec'] = props['submodule_git_svn_spec']
if props.get('target_os'):
spec['target_os'] = props['target_os'].split(',')
if props.get('target_os_only'):
spec['target_os_only'] = props['target_os_only']
checkout_type = 'gclient_git_svn'
if props.get('nosvn'):
checkout_type = 'gclient_git'
......@@ -45,7 +36,7 @@ class DepotTools(recipe_util.Recipe):
@staticmethod
def expected_root(_props):
return 'src'
return 'depot_tools'
def main(argv=None):
......
......@@ -16,18 +16,17 @@ class NaCl(recipe_util.Recipe):
def fetch_spec(props):
url = ('https://chromium.googlesource.com/native_client/'
'src/native_client.git')
solution = { 'name' :'native_client',
'url' : url,
'deps_file': '.DEPS.git',
'managed' : False,
'custom_deps': {},
'safesync_url': '',
solution = {
'name' : 'native_client',
'url' : url,
'deps_file' : '.DEPS.git',
'managed' : False,
'custom_deps' : {},
'safesync_url': '',
}
spec = {
'solutions': [solution],
'svn_url': 'svn://svn.chromium.org/native_client',
'svn_branch': 'trunk/src/native_client',
'svn_ref': 'master',
'auto': True
}
if props.get('submodule_git_svn_spec'):
spec['submodule_git_svn_spec'] = props['submodule_git_svn_spec']
......
......@@ -15,12 +15,13 @@ class Naclports(recipe_util.Recipe):
@staticmethod
def fetch_spec(props):
url = 'https://chromium.googlesource.com/external/naclports.git'
solution = { 'name' :'src',
'url' : url,
'deps_file': 'DEPS',
'managed' : False,
'custom_deps': {},
'safesync_url': '',
solution = {
'name' : 'src',
'url' : url,
'deps_file' : 'DEPS',
'managed' : False,
'custom_deps' : {},
'safesync_url': '',
}
spec = {
'solutions': [solution],
......
......@@ -14,20 +14,26 @@ class V8(recipe_util.Recipe):
@staticmethod
def fetch_spec(props):
ref = 'bleeding_edge'
url = 'https://chromium.googlesource.com/external/v8.git@%s' % ref
solution = { 'name' :'v8',
'url' : url,
'deps_file': '.DEPS.git',
'managed' : False,
'custom_deps': {},
'safesync_url': '',
url = 'https://chromium.googlesource.com/v8/v8.git'
solution = {
'name' : 'v8',
'url' : url,
'deps_file' : '.DEPS.git',
'managed' : False,
'custom_deps' : {},
'safesync_url': '',
}
spec = {
'solutions': [solution],
'with_branch_heads': True,
'svn_url': 'https://v8.googlecode.com/svn',
'svn_branch': 'branches/bleeding_edge',
'svn_ref': 'bleeding_edge',
'git_svn_fetch': {
'branches/bleeding_edge': 'refs/remotes/origin/master',
'trunk': 'refs/remotes/origin/candidates',
'branches/3.28': 'refs/remotes/branch-heads/3.28',
'branches/3.29': 'refs/remotes/branch-heads/3.29',
},
'git_svn_branches': {},
}
checkout_type = 'gclient_git_svn'
if props.get('nosvn'):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment