From 14f633b4a6676c613952a68a8c723d74d2e4c1b8 Mon Sep 17 00:00:00 2001 From: "agable@chromium.org" Date: Wed, 22 Oct 2014 10:35:33 +0000 Subject: [PATCH] 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 --- fetch | 4 ---- fetch.py | 31 +++++++++++++++++-------------- recipes/blink.py | 4 +--- recipes/chromium.py | 6 ++---- recipes/depot_tools.py | 23 +++++++---------------- recipes/nacl.py | 17 ++++++++--------- recipes/naclports.py | 13 +++++++------ recipes/v8.py | 26 ++++++++++++++++---------- 8 files changed, 58 insertions(+), 66 deletions(-) diff --git a/fetch b/fetch index 37e8e795d..bea6718c7 100755 --- a/fetch +++ b/fetch @@ -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" "$@" diff --git a/fetch.py b/fetch.py index f5640cc95..e579f916e 100755 --- a/fetch.py +++ b/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) diff --git a/recipes/blink.py b/recipes/blink.py index 2e3aa9ace..b453f5d6b 100644 --- a/recipes/blink.py +++ b/recipes/blink.py @@ -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 { diff --git a/recipes/chromium.py b/recipes/chromium.py index 7ebf9841a..6416ee0bb 100644 --- a/recipes/chromium.py +++ b/recipes/chromium.py @@ -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 diff --git a/recipes/depot_tools.py b/recipes/depot_tools.py index 1c9f7eee0..7c3b91cec 100644 --- a/recipes/depot_tools.py +++ b/recipes/depot_tools.py @@ -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): diff --git a/recipes/nacl.py b/recipes/nacl.py index 3e3595fa7..3d83f44d6 100644 --- a/recipes/nacl.py +++ b/recipes/nacl.py @@ -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'] diff --git a/recipes/naclports.py b/recipes/naclports.py index 3e687418a..10a0b28fb 100644 --- a/recipes/naclports.py +++ b/recipes/naclports.py @@ -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], diff --git a/recipes/v8.py b/recipes/v8.py index b243867cb..24632ccc1 100644 --- a/recipes/v8.py +++ b/recipes/v8.py @@ -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'):