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

Side by Side Diff: repo

Issue 10541155: Upgrade repo script to v1.17. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 8 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/sh 1 #!/bin/sh
2 2
3 ## repo default configuration 3 ## repo default configuration
4 ## 4 ##
5 REPO_URL='https://git.chromium.org/git/external/repo' 5 REPO_URL='https://git.chromium.org/git/external/repo'
6 REPO_REV='stable' 6 REPO_REV='stable'
7 7
8 # Copyright (C) 2008 Google Inc. 8 # Copyright (C) 2008 Google Inc.
9 # 9 #
10 # Licensed under the Apache License, Version 2.0 (the "License"); 10 # Licensed under the Apache License, Version 2.0 (the "License");
(...skipping 10 matching lines...) Expand all
21 21
22 magic='--calling-python-from-/bin/sh--' 22 magic='--calling-python-from-/bin/sh--'
23 """exec" python -E "$0" "$@" """#$magic" 23 """exec" python -E "$0" "$@" """#$magic"
24 if __name__ == '__main__': 24 if __name__ == '__main__':
25 import sys 25 import sys
26 if sys.argv[-1] == '#%s' % magic: 26 if sys.argv[-1] == '#%s' % magic:
27 del sys.argv[-1] 27 del sys.argv[-1]
28 del magic 28 del magic
29 29
30 # increment this whenever we make important changes to this script 30 # increment this whenever we make important changes to this script
31 VERSION = (1, 13) 31 VERSION = (1, 17)
32 32
33 # increment this if the MAINTAINER_KEYS block is modified 33 # increment this if the MAINTAINER_KEYS block is modified
34 KEYRING_VERSION = (1,0) 34 KEYRING_VERSION = (1,0)
35 MAINTAINER_KEYS = """ 35 MAINTAINER_KEYS = """
36 36
37 Repo Maintainer <repo@android.kernel.org> 37 Repo Maintainer <repo@android.kernel.org>
38 -----BEGIN PGP PUBLIC KEY BLOCK----- 38 -----BEGIN PGP PUBLIC KEY BLOCK-----
39 Version: GnuPG v1.4.2.2 (GNU/Linux) 39 Version: GnuPG v1.4.2.2 (GNU/Linux)
40 40
41 mQGiBEj3ugERBACrLJh/ZPyVSKeClMuznFIrsQ+hpNnmJGw1a9GXKYKk8qHPhAZf 41 mQGiBEj3ugERBACrLJh/ZPyVSKeClMuznFIrsQ+hpNnmJGw1a9GXKYKk8qHPhAZf
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 help='initial manifest file', metavar='NAME.xml') 118 help='initial manifest file', metavar='NAME.xml')
119 group.add_option('--mirror', 119 group.add_option('--mirror',
120 dest='mirror', action='store_true', 120 dest='mirror', action='store_true',
121 help='mirror the forrest') 121 help='mirror the forrest')
122 group.add_option('--reference', 122 group.add_option('--reference',
123 dest='reference', 123 dest='reference',
124 help='location of mirror directory', metavar='DIR') 124 help='location of mirror directory', metavar='DIR')
125 group.add_option('--depth', type='int', default=None, 125 group.add_option('--depth', type='int', default=None,
126 dest='depth', 126 dest='depth',
127 help='create a shallow clone with given depth; see git clone') 127 help='create a shallow clone with given depth; see git clone')
128 group.add_option('-g', '--groups',
129 dest='groups', default='default',
130 help='restrict manifest projects to ones with a specified group ',
131 metavar='GROUP')
132 group.add_option('-p', '--platform',
133 dest='platform', default="auto",
134 help='restrict manifest projects to ones with a specified'
135 'platform group [auto|all|none|linux|darwin|...]',
136 metavar='PLATFORM')
128 137
129 138
130 # Tool 139 # Tool
131 group = init_optparse.add_option_group('repo Version options') 140 group = init_optparse.add_option_group('repo Version options')
132 group.add_option('--repo-url', 141 group.add_option('--repo-url',
133 dest='repo_url', 142 dest='repo_url',
134 help='repo repository location', metavar='URL') 143 help='repo repository location', metavar='URL')
135 group.add_option('--repo-branch', 144 group.add_option('--repo-branch',
136 dest='repo_branch', 145 dest='repo_branch',
137 help='repo branch or revision', metavar='REVISION') 146 help='repo branch or revision', metavar='REVISION')
138 group.add_option('--no-repo-verify', 147 group.add_option('--no-repo-verify',
139 dest='no_repo_verify', action='store_true', 148 dest='no_repo_verify', action='store_true',
140 help='do not verify repo source code') 149 help='do not verify repo source code')
141 150
151 # Other
152 group = init_optparse.add_option_group('Other options')
153 group.add_option('--config-name',
154 dest='config_name', action="store_true", default=False,
155 help='Always prompt for name/e-mail')
142 156
143 class CloneFailure(Exception): 157 class CloneFailure(Exception):
144 """Indicate the remote clone of repo itself failed. 158 """Indicate the remote clone of repo itself failed.
145 """ 159 """
146 160
147 161
148 def _Init(args): 162 def _Init(args):
149 """Installs repo by cloning it over the network. 163 """Installs repo by cloning it over the network.
150 """ 164 """
151 opt, args = init_optparse.parse_args(args) 165 opt, args = init_optparse.parse_args(args)
152 if args or not opt.manifest_url: 166 if args:
153 init_optparse.print_usage() 167 init_optparse.print_usage()
154 sys.exit(1) 168 sys.exit(1)
155 169
156 url = opt.repo_url 170 url = opt.repo_url
157 if not url: 171 if not url:
158 url = REPO_URL 172 url = REPO_URL
159 extra_args.append('--repo-url=%s' % url) 173 extra_args.append('--repo-url=%s' % url)
160 174
161 branch = opt.repo_branch 175 branch = opt.repo_branch
162 if not branch: 176 if not branch:
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 _Checkout(dst, branch, rev, opt.quiet) 213 _Checkout(dst, branch, rev, opt.quiet)
200 except CloneFailure: 214 except CloneFailure:
201 if opt.quiet: 215 if opt.quiet:
202 print >>sys.stderr, \ 216 print >>sys.stderr, \
203 'fatal: repo init failed; run without --quiet to see why' 217 'fatal: repo init failed; run without --quiet to see why'
204 raise 218 raise
205 219
206 220
207 def _CheckGitVersion(): 221 def _CheckGitVersion():
208 cmd = [GIT, '--version'] 222 cmd = [GIT, '--version']
209 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) 223 try:
224 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
225 except OSError, e:
226 print >>sys.stderr
227 print >>sys.stderr, "fatal: '%s' is not available" % GIT
228 print >>sys.stderr, 'fatal: %s' % e
229 print >>sys.stderr
230 print >>sys.stderr, 'Please make sure %s is installed'\
231 ' and in your path.' % GIT
232 raise CloneFailure()
233
210 ver_str = proc.stdout.read().strip() 234 ver_str = proc.stdout.read().strip()
211 proc.stdout.close() 235 proc.stdout.close()
212 proc.wait() 236 proc.wait()
213 237
214 if not ver_str.startswith('git version '): 238 if not ver_str.startswith('git version '):
215 print >>sys.stderr, 'error: "%s" unsupported' % ver_str 239 print >>sys.stderr, 'error: "%s" unsupported' % ver_str
216 raise CloneFailure() 240 raise CloneFailure()
217 241
218 ver_str = ver_str[len('git version '):].strip() 242 ver_str = ver_str[len('git version '):].strip()
219 ver_act = tuple(map(lambda x: int(x), ver_str.split('.')[0:3])) 243 ver_act = tuple(map(lambda x: int(x), ver_str.split('.')[0:3]))
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 323
300 def _InitHttp(): 324 def _InitHttp():
301 handlers = [] 325 handlers = []
302 326
303 mgr = urllib2.HTTPPasswordMgrWithDefaultRealm() 327 mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
304 try: 328 try:
305 import netrc 329 import netrc
306 n = netrc.netrc() 330 n = netrc.netrc()
307 for host in n.hosts: 331 for host in n.hosts:
308 p = n.hosts[host] 332 p = n.hosts[host]
309 mgr.add_password(None, 'http://%s/' % host, p[0], p[2]) 333 mgr.add_password(p[1], 'http://%s/' % host, p[0], p[2])
310 mgr.add_password(None, 'https://%s/' % host, p[0], p[2]) 334 mgr.add_password(p[1], 'https://%s/' % host, p[0], p[2])
311 except: 335 except:
312 pass 336 pass
313 handlers.append(urllib2.HTTPBasicAuthHandler(mgr)) 337 handlers.append(urllib2.HTTPBasicAuthHandler(mgr))
338 handlers.append(urllib2.HTTPDigestAuthHandler(mgr))
314 339
315 if 'http_proxy' in os.environ: 340 if 'http_proxy' in os.environ:
316 url = os.environ['http_proxy'] 341 url = os.environ['http_proxy']
317 handlers.append(urllib2.ProxyHandler({'http': url, 'https': url})) 342 handlers.append(urllib2.ProxyHandler({'http': url, 'https': url}))
318 if 'REPO_CURL_VERBOSE' in os.environ: 343 if 'REPO_CURL_VERBOSE' in os.environ:
319 handlers.append(urllib2.HTTPHandler(debuglevel=1)) 344 handlers.append(urllib2.HTTPHandler(debuglevel=1))
320 handlers.append(urllib2.HTTPSHandler(debuglevel=1)) 345 handlers.append(urllib2.HTTPSHandler(debuglevel=1))
321 urllib2.install_opener(urllib2.build_opener(*handlers)) 346 urllib2.install_opener(urllib2.build_opener(*handlers))
322 347
323 def _Fetch(url, local, src, quiet): 348 def _Fetch(url, local, src, quiet):
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 try: 701 try:
677 os.execv(main, me) 702 os.execv(main, me)
678 except OSError, e: 703 except OSError, e:
679 print >>sys.stderr, "fatal: unable to start %s" % main 704 print >>sys.stderr, "fatal: unable to start %s" % main
680 print >>sys.stderr, "fatal: %s" % e 705 print >>sys.stderr, "fatal: %s" % e
681 sys.exit(148) 706 sys.exit(148)
682 707
683 708
684 if __name__ == '__main__': 709 if __name__ == '__main__':
685 main(sys.argv[1:]) 710 main(sys.argv[1:])
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698