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 @@ ...@@ -5,8 +5,4 @@
base_dir=$(dirname "$0") 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" "$@" PYTHONDONTWRITEBYTECODE=1 exec python "$base_dir/fetch.py" "$@"
...@@ -139,20 +139,18 @@ class GclientGitSvnCheckout(GclientGitCheckout, SvnCheckout): ...@@ -139,20 +139,18 @@ class GclientGitSvnCheckout(GclientGitCheckout, SvnCheckout):
def __init__(self, options, spec, root): def __init__(self, options, spec, root):
super(GclientGitSvnCheckout, self).__init__(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): def init(self):
# Ensure we are authenticated with subversion for all submodules. # Ensure we are authenticated with subversion for all submodules.
git_svn_dirs = json.loads(self.spec.get('submodule_git_svn_spec', '{}')) git_svn_dirs = json.loads(self.spec.get('submodule_git_svn_spec', '{}'))
git_svn_dirs.update({self.root: self.spec}) git_svn_dirs.update({self.root: self.spec})
for _, svn_spec in git_svn_dirs.iteritems(): for _, svn_spec in git_svn_dirs.iteritems():
try: if svn_spec.get('svn_url'):
self.run_svn('ls', '--non-interactive', svn_spec['svn_url']) try:
except subprocess.CalledProcessError: self.run_svn('ls', '--non-interactive', svn_spec['svn_url'])
print 'Please run `svn ls %s`' % svn_spec['svn_url'] except subprocess.CalledProcessError:
return 1 print 'Please run `svn ls %s`' % svn_spec['svn_url']
return 1
super(GclientGitSvnCheckout, self).init() super(GclientGitSvnCheckout, self).init()
...@@ -164,12 +162,17 @@ class GclientGitSvnCheckout(GclientGitCheckout, SvnCheckout): ...@@ -164,12 +162,17 @@ class GclientGitSvnCheckout(GclientGitCheckout, SvnCheckout):
wd = os.path.join(self.base, real_path) wd = os.path.join(self.base, real_path)
if self.options.dry_run: if self.options.dry_run:
print 'cd %s' % wd print 'cd %s' % wd
prefix = svn_spec.get('svn_prefix', 'origin/') if svn_spec.get('auto'):
self.run_git('svn', 'init', '--prefix=' + prefix, '-T', self.run_git('auto-svn', cwd=wd)
svn_spec['svn_branch'], svn_spec['svn_url'], cwd=wd) continue
self.run_git('config', '--replace', 'svn-remote.svn.fetch', self.run_git('svn', 'init', svn_spec['svn_url'], cwd=wd)
svn_spec['svn_branch'] + ':refs/remotes/' + prefix + self.run_git('config', '--unset-all', 'svn-remote.svn.fetch', cwd=wd)
svn_spec['svn_ref'], 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) self.run_git('svn', 'fetch', cwd=wd)
......
...@@ -17,9 +17,7 @@ class Blink(recipe_util.Recipe): ...@@ -17,9 +17,7 @@ class Blink(recipe_util.Recipe):
def fetch_spec(props): def fetch_spec(props):
submodule_spec = { submodule_spec = {
'third_party/WebKit': { 'third_party/WebKit': {
'svn_url': 'svn://svn.chromium.org/blink/trunk', 'auto': True,
'svn_branch': 'trunk',
'svn_ref': 'master',
} }
} }
return { return {
......
...@@ -31,11 +31,9 @@ class Chromium(recipe_util.Recipe): ...@@ -31,11 +31,9 @@ class Chromium(recipe_util.Recipe):
spec['target_os'] = props['target_os'].split(',') spec['target_os'] = props['target_os'].split(',')
if props.get('target_os_only'): if props.get('target_os_only'):
spec['target_os_only'] = props['target_os_only'] spec['target_os_only'] = props['target_os_only']
checkout_type = 'gclient_git'
spec_type = '%s_spec' % checkout_type
return { return {
'type': checkout_type, 'type': 'gclient_git',
spec_type: spec, 'gclient_git_spec': spec,
} }
@staticmethod @staticmethod
......
...@@ -15,25 +15,16 @@ class DepotTools(recipe_util.Recipe): ...@@ -15,25 +15,16 @@ class DepotTools(recipe_util.Recipe):
@staticmethod @staticmethod
def fetch_spec(props): def fetch_spec(props):
url = 'https://chromium.googlesource.com/chromium/tools/depot_tools.git' url = 'https://chromium.googlesource.com/chromium/tools/depot_tools.git'
solution = { 'name' :'src', solution = {
'url' : url, 'name' : 'depot_tools',
'deps_file': '.DEPS.git', 'url' : url,
'managed' : False, 'deps_file' : 'DEPS',
'custom_deps': {}, 'managed' : False,
'safesync_url': '',
} }
spec = { spec = {
'solutions': [solution], 'solutions': [solution],
'svn_url': 'svn://svn.chromium.org/chrome', 'auto': True,
'svn_branch': 'trunk/tools/depot_tools',
'svn_ref': 'master',
} }
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' checkout_type = 'gclient_git_svn'
if props.get('nosvn'): if props.get('nosvn'):
checkout_type = 'gclient_git' checkout_type = 'gclient_git'
...@@ -45,7 +36,7 @@ class DepotTools(recipe_util.Recipe): ...@@ -45,7 +36,7 @@ class DepotTools(recipe_util.Recipe):
@staticmethod @staticmethod
def expected_root(_props): def expected_root(_props):
return 'src' return 'depot_tools'
def main(argv=None): def main(argv=None):
......
...@@ -16,18 +16,17 @@ class NaCl(recipe_util.Recipe): ...@@ -16,18 +16,17 @@ class NaCl(recipe_util.Recipe):
def fetch_spec(props): def fetch_spec(props):
url = ('https://chromium.googlesource.com/native_client/' url = ('https://chromium.googlesource.com/native_client/'
'src/native_client.git') 'src/native_client.git')
solution = { 'name' :'native_client', solution = {
'url' : url, 'name' : 'native_client',
'deps_file': '.DEPS.git', 'url' : url,
'managed' : False, 'deps_file' : '.DEPS.git',
'custom_deps': {}, 'managed' : False,
'safesync_url': '', 'custom_deps' : {},
'safesync_url': '',
} }
spec = { spec = {
'solutions': [solution], 'solutions': [solution],
'svn_url': 'svn://svn.chromium.org/native_client', 'auto': True
'svn_branch': 'trunk/src/native_client',
'svn_ref': 'master',
} }
if props.get('submodule_git_svn_spec'): if props.get('submodule_git_svn_spec'):
spec['submodule_git_svn_spec'] = props['submodule_git_svn_spec'] spec['submodule_git_svn_spec'] = props['submodule_git_svn_spec']
......
...@@ -15,12 +15,13 @@ class Naclports(recipe_util.Recipe): ...@@ -15,12 +15,13 @@ class Naclports(recipe_util.Recipe):
@staticmethod @staticmethod
def fetch_spec(props): def fetch_spec(props):
url = 'https://chromium.googlesource.com/external/naclports.git' url = 'https://chromium.googlesource.com/external/naclports.git'
solution = { 'name' :'src', solution = {
'url' : url, 'name' : 'src',
'deps_file': 'DEPS', 'url' : url,
'managed' : False, 'deps_file' : 'DEPS',
'custom_deps': {}, 'managed' : False,
'safesync_url': '', 'custom_deps' : {},
'safesync_url': '',
} }
spec = { spec = {
'solutions': [solution], 'solutions': [solution],
......
...@@ -14,20 +14,26 @@ class V8(recipe_util.Recipe): ...@@ -14,20 +14,26 @@ class V8(recipe_util.Recipe):
@staticmethod @staticmethod
def fetch_spec(props): def fetch_spec(props):
ref = 'bleeding_edge' url = 'https://chromium.googlesource.com/v8/v8.git'
url = 'https://chromium.googlesource.com/external/v8.git@%s' % ref solution = {
solution = { 'name' :'v8', 'name' : 'v8',
'url' : url, 'url' : url,
'deps_file': '.DEPS.git', 'deps_file' : '.DEPS.git',
'managed' : False, 'managed' : False,
'custom_deps': {}, 'custom_deps' : {},
'safesync_url': '', 'safesync_url': '',
} }
spec = { spec = {
'solutions': [solution], 'solutions': [solution],
'with_branch_heads': True,
'svn_url': 'https://v8.googlecode.com/svn', 'svn_url': 'https://v8.googlecode.com/svn',
'svn_branch': 'branches/bleeding_edge', 'git_svn_fetch': {
'svn_ref': 'bleeding_edge', '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' checkout_type = 'gclient_git_svn'
if props.get('nosvn'): 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