Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: fetch.py

Issue 1187913002: Run install-build-deps in the middle of 'fetch chromium' (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | recipes/chromium.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """ 6 """
7 Tool to perform checkouts in one easy command line! 7 Tool to perform checkouts in one easy command line!
8 8
9 Usage: 9 Usage:
10 fetch <recipe> [--property=value [--property2=value2 ...]] 10 fetch <recipe> [--property=value [--property2=value2 ...]]
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 def init(self): 56 def init(self):
57 pass 57 pass
58 58
59 def sync(self): 59 def sync(self):
60 pass 60 pass
61 61
62 def run(self, cmd, **kwargs): 62 def run(self, cmd, **kwargs):
63 print 'Running: %s' % (' '.join(pipes.quote(x) for x in cmd)) 63 print 'Running: %s' % (' '.join(pipes.quote(x) for x in cmd))
64 if self.options.dry_run: 64 if self.options.dry_run:
65 return 0 65 return ''
66 return subprocess.check_output(cmd, **kwargs) 66 return subprocess.check_output(cmd, **kwargs)
67 67
68 68
69 class GclientCheckout(Checkout): 69 class GclientCheckout(Checkout):
70 70
71 def run_gclient(self, *cmd, **kwargs): 71 def run_gclient(self, *cmd, **kwargs):
72 if not spawn.find_executable('gclient'): 72 if not spawn.find_executable('gclient'):
73 cmd_prefix = (sys.executable, os.path.join(SCRIPT_PATH, 'gclient.py')) 73 cmd_prefix = (sys.executable, os.path.join(SCRIPT_PATH, 'gclient.py'))
74 else: 74 else:
75 cmd_prefix = ('gclient',) 75 cmd_prefix = ('gclient',)
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 gclient_spec = 'solutions = [\n%s\n]\n' % '\n'.join(soln_strings) 126 gclient_spec = 'solutions = [\n%s\n]\n' % '\n'.join(soln_strings)
127 extra_keys = ['target_os', 'target_os_only'] 127 extra_keys = ['target_os', 'target_os_only']
128 gclient_spec += ''.join('%s = %s\n' % (key, _format_literal(self.spec[key])) 128 gclient_spec += ''.join('%s = %s\n' % (key, _format_literal(self.spec[key]))
129 for key in extra_keys if key in self.spec) 129 for key in extra_keys if key in self.spec)
130 return gclient_spec 130 return gclient_spec
131 131
132 def init(self): 132 def init(self):
133 # Configure and do the gclient checkout. 133 # Configure and do the gclient checkout.
134 self.run_gclient('config', '--spec', self._format_spec()) 134 self.run_gclient('config', '--spec', self._format_spec())
135 sync_cmd = ['sync'] 135 sync_cmd = ['sync']
136 if self.options.nohooks: 136 if self.options.nohooks or self.spec.get('fetch_hooks'):
137 sync_cmd.append('--nohooks') 137 sync_cmd.append('--nohooks')
138 if self.options.no_history: 138 if self.options.no_history:
139 sync_cmd.append('--no-history') 139 sync_cmd.append('--no-history')
140 if self.spec.get('with_branch_heads', False): 140 if self.spec.get('with_branch_heads', False):
141 sync_cmd.append('--with_branch_heads') 141 sync_cmd.append('--with_branch_heads')
142 self.run_gclient(*sync_cmd) 142 self.run_gclient(*sync_cmd)
143 143
144 for cmd in self.spec.get('fetch_hooks', []):
145 self.run(cmd)
146 if self.spec.get('fetch_hooks') and not self.options.nohooks:
147 self.run_gclient('runhooks')
148
144 # Configure git. 149 # Configure git.
145 wd = os.path.join(self.base, self.root) 150 wd = os.path.join(self.base, self.root)
146 if self.options.dry_run: 151 if self.options.dry_run:
147 print 'cd %s' % wd 152 print 'cd %s' % wd
148 self.run_git( 153 self.run_git(
149 'submodule', 'foreach', 154 'submodule', 'foreach',
150 'git config -f $toplevel/.git/config submodule.$name.ignore all', 155 'git config -f $toplevel/.git/config submodule.$name.ignore all',
151 cwd=wd) 156 cwd=wd)
152 self.run_git( 157 self.run_git(
153 'config', '--add', 'remote.origin.fetch', 158 'config', '--add', 'remote.origin.fetch',
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 spec, root = run_recipe_fetch(recipe, props) 341 spec, root = run_recipe_fetch(recipe, props)
337 return run(options, spec, root) 342 return run(options, spec, root)
338 343
339 344
340 if __name__ == '__main__': 345 if __name__ == '__main__':
341 try: 346 try:
342 sys.exit(main()) 347 sys.exit(main())
343 except KeyboardInterrupt: 348 except KeyboardInterrupt:
344 sys.stderr.write('interrupted\n') 349 sys.stderr.write('interrupted\n')
345 sys.exit(1) 350 sys.exit(1)
OLDNEW
« no previous file with comments | « no previous file | recipes/chromium.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698