blob: 773ad8258933bde7e0119c8794aaccf1ac9a89ed [file] [log] [blame]
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -07001#!/bin/sh
2
3## repo default configuration
4##
Shawn O. Pearce24d8dfb2008-12-18 07:21:32 -08005REPO_URL='git://android.git.kernel.org/tools/repo.git'
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -07006REPO_REV='stable'
7
8# Copyright (C) 2008 Google Inc.
9#
10# Licensed under the Apache License, Version 2.0 (the "License");
11# you may not use this file except in compliance with the License.
12# You may obtain a copy of the License at
13#
14# http://www.apache.org/licenses/LICENSE-2.0
15#
16# Unless required by applicable law or agreed to in writing, software
17# distributed under the License is distributed on an "AS IS" BASIS,
18# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19# See the License for the specific language governing permissions and
20# limitations under the License.
21
22magic='--calling-python-from-/bin/sh--'
Shawn O. Pearce7542d662008-10-21 07:11:36 -070023"""exec" python -E "$0" "$@" """#$magic"
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070024if __name__ == '__main__':
25 import sys
26 if sys.argv[-1] == '#%s' % magic:
27 del sys.argv[-1]
28del magic
29
30# increment this whenever we make important changes to this script
Shawn O. Pearce0fc3a392011-01-10 09:01:24 -080031VERSION = (1, 10)
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -070032
33# increment this if the MAINTAINER_KEYS block is modified
34KEYRING_VERSION = (1,0)
35MAINTAINER_KEYS = """
36
37 Repo Maintainer <repo@android.kernel.org>
38-----BEGIN PGP PUBLIC KEY BLOCK-----
39Version: GnuPG v1.4.2.2 (GNU/Linux)
40
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
76=CMiZ
77-----END PGP PUBLIC KEY BLOCK-----
78"""
79
80GIT = 'git' # our git command
81MIN_GIT_VERSION = (1, 5, 4) # minimum supported git version
82repodir = '.repo' # name of repo's private directory
83S_repo = 'repo' # special repo reposiory
84S_manifests = 'manifests' # special manifest repository
85REPO_MAIN = S_repo + '/main.py' # main script
86
87
88import optparse
89import os
90import re
91import readline
92import subprocess
93import sys
94
95home_dot_repo = os.path.expanduser('~/.repoconfig')
96gpg_dir = os.path.join(home_dot_repo, 'gnupg')
97
98extra_args = []
99init_optparse = optparse.OptionParser(usage="repo init -u url [options]")
100
101# Logging
102group = init_optparse.add_option_group('Logging options')
103group.add_option('-q', '--quiet',
104 dest="quiet", action="store_true", default=False,
105 help="be quiet")
106
107# Manifest
108group = init_optparse.add_option_group('Manifest options')
109group.add_option('-u', '--manifest-url',
110 dest='manifest_url',
111 help='manifest repository location', metavar='URL')
Shawn O. Pearce5f947bb2009-07-03 17:24:17 -0700112group.add_option('-o', '--origin',
113 dest='manifest_origin',
114 help="use REMOTE instead of 'origin' to track upstream",
115 metavar='REMOTE')
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -0700116group.add_option('-b', '--manifest-branch',
117 dest='manifest_branch',
118 help='manifest branch or revision', metavar='REVISION')
119group.add_option('-m', '--manifest-name',
120 dest='manifest_name',
Shawn O. Pearceb3d2c922009-07-03 17:24:45 -0700121 help='initial manifest file (deprecated)',
122 metavar='NAME.xml')
Shawn O. Pearcee284ad12008-11-04 07:37:10 -0800123group.add_option('--mirror',
124 dest='mirror', action='store_true',
125 help='mirror the forrest')
Shawn O. Pearce88443382010-10-08 10:02:09 +0200126group.add_option('--reference',
127 dest='reference',
128 help='location of mirror directory', metavar='DIR')
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -0700129
130# Tool
Shawn O. Pearcefd89b672009-04-18 11:28:57 -0700131group = init_optparse.add_option_group('repo Version options')
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -0700132group.add_option('--repo-url',
133 dest='repo_url',
134 help='repo repository location', metavar='URL')
135group.add_option('--repo-branch',
136 dest='repo_branch',
137 help='repo branch or revision', metavar='REVISION')
138group.add_option('--no-repo-verify',
139 dest='no_repo_verify', action='store_true',
140 help='do not verify repo source code')
141
142
143class CloneFailure(Exception):
144 """Indicate the remote clone of repo itself failed.
145 """
146
147
148def _Init(args):
149 """Installs repo by cloning it over the network.
150 """
151 opt, args = init_optparse.parse_args(args)
152 if args or not opt.manifest_url:
153 init_optparse.print_usage()
154 sys.exit(1)
155
156 url = opt.repo_url
157 if not url:
158 url = REPO_URL
159 extra_args.append('--repo-url=%s' % url)
160
161 branch = opt.repo_branch
162 if not branch:
163 branch = REPO_REV
164 extra_args.append('--repo-branch=%s' % branch)
165
166 if branch.startswith('refs/heads/'):
167 branch = branch[len('refs/heads/'):]
168 if branch.startswith('refs/'):
169 print >>sys.stderr, "fatal: invalid branch name '%s'" % branch
170 raise CloneFailure()
171
172 if not os.path.isdir(repodir):
173 try:
174 os.mkdir(repodir)
175 except OSError, e:
176 print >>sys.stderr, \
177 'fatal: cannot make %s directory: %s' % (
178 repodir, e.strerror)
179 # Don't faise CloneFailure; that would delete the
180 # name. Instead exit immediately.
181 #
182 sys.exit(1)
183
184 _CheckGitVersion()
185 try:
186 if _NeedSetupGnuPG():
187 can_verify = _SetupGnuPG(opt.quiet)
188 else:
189 can_verify = True
190
191 if not opt.quiet:
192 print >>sys.stderr, 'Getting repo ...'
193 print >>sys.stderr, ' from %s' % url
194
195 dst = os.path.abspath(os.path.join(repodir, S_repo))
196 _Clone(url, dst, opt.quiet)
197
198 if can_verify and not opt.no_repo_verify:
199 rev = _Verify(dst, branch, opt.quiet)
200 else:
201 rev = 'refs/remotes/origin/%s^0' % branch
202
203 _Checkout(dst, branch, rev, opt.quiet)
204 except CloneFailure:
205 if opt.quiet:
206 print >>sys.stderr, \
207 'fatal: repo init failed; run without --quiet to see why'
208 raise
209
210
211def _CheckGitVersion():
212 cmd = [GIT, '--version']
213 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
214 ver_str = proc.stdout.read().strip()
215 proc.stdout.close()
Shawn O. Pearce16191342008-10-28 08:33:34 -0700216 proc.wait()
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -0700217
218 if not ver_str.startswith('git version '):
219 print >>sys.stderr, 'error: "%s" unsupported' % ver_str
220 raise CloneFailure()
221
222 ver_str = ver_str[len('git version '):].strip()
223 ver_act = tuple(map(lambda x: int(x), ver_str.split('.')[0:3]))
224 if ver_act < MIN_GIT_VERSION:
225 need = '.'.join(map(lambda x: str(x), MIN_GIT_VERSION))
226 print >>sys.stderr, 'fatal: git %s or later required' % need
227 raise CloneFailure()
228
229
230def _NeedSetupGnuPG():
231 if not os.path.isdir(home_dot_repo):
232 return True
233
234 kv = os.path.join(home_dot_repo, 'keyring-version')
235 if not os.path.exists(kv):
236 return True
237
238 kv = open(kv).read()
239 if not kv:
240 return True
241
242 kv = tuple(map(lambda x: int(x), kv.split('.')))
243 if kv < KEYRING_VERSION:
244 return True
245 return False
246
247
248def _SetupGnuPG(quiet):
249 if not os.path.isdir(home_dot_repo):
250 try:
251 os.mkdir(home_dot_repo)
252 except OSError, e:
253 print >>sys.stderr, \
254 'fatal: cannot make %s directory: %s' % (
255 home_dot_repo, e.strerror)
256 sys.exit(1)
257
258 if not os.path.isdir(gpg_dir):
259 try:
260 os.mkdir(gpg_dir, 0700)
261 except OSError, e:
262 print >>sys.stderr, \
263 'fatal: cannot make %s directory: %s' % (
264 gpg_dir, e.strerror)
265 sys.exit(1)
266
Shawn O. Pearcef18cb762010-12-07 11:41:05 -0800267 env = os.environ.copy()
268 env['GNUPGHOME'] = gpg_dir.encode()
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -0700269
270 cmd = ['gpg', '--import']
271 try:
272 proc = subprocess.Popen(cmd,
273 env = env,
274 stdin = subprocess.PIPE)
275 except OSError, e:
276 if not quiet:
277 print >>sys.stderr, 'warning: gpg (GnuPG) is not available.'
278 print >>sys.stderr, 'warning: Installing it is strongly encouraged.'
279 print >>sys.stderr
280 return False
281
282 proc.stdin.write(MAINTAINER_KEYS)
283 proc.stdin.close()
284
285 if proc.wait() != 0:
286 print >>sys.stderr, 'fatal: registering repo maintainer keys failed'
287 sys.exit(1)
288 print
289
290 fd = open(os.path.join(home_dot_repo, 'keyring-version'), 'w')
291 fd.write('.'.join(map(lambda x: str(x), KEYRING_VERSION)) + '\n')
292 fd.close()
293 return True
294
295
296def _SetConfig(local, name, value):
297 """Set a git configuration option to the specified value.
298 """
299 cmd = [GIT, 'config', name, value]
300 if subprocess.Popen(cmd, cwd = local).wait() != 0:
301 raise CloneFailure()
302
303
304def _Fetch(local, quiet, *args):
305 cmd = [GIT, 'fetch']
306 if quiet:
307 cmd.append('--quiet')
308 err = subprocess.PIPE
309 else:
310 err = None
311 cmd.extend(args)
312 cmd.append('origin')
313
314 proc = subprocess.Popen(cmd, cwd = local, stderr = err)
315 if err:
316 proc.stderr.read()
317 proc.stderr.close()
318 if proc.wait() != 0:
319 raise CloneFailure()
320
321
322def _Clone(url, local, quiet):
323 """Clones a git repository to a new subdirectory of repodir
324 """
325 try:
326 os.mkdir(local)
327 except OSError, e:
328 print >>sys.stderr, \
329 'fatal: cannot make %s directory: %s' \
330 % (local, e.strerror)
331 raise CloneFailure()
332
333 cmd = [GIT, 'init', '--quiet']
334 try:
335 proc = subprocess.Popen(cmd, cwd = local)
336 except OSError, e:
337 print >>sys.stderr
338 print >>sys.stderr, "fatal: '%s' is not available" % GIT
339 print >>sys.stderr, 'fatal: %s' % e
340 print >>sys.stderr
341 print >>sys.stderr, 'Please make sure %s is installed'\
342 ' and in your path.' % GIT
343 raise CloneFailure()
344 if proc.wait() != 0:
345 print >>sys.stderr, 'fatal: could not create %s' % local
346 raise CloneFailure()
347
348 _SetConfig(local, 'remote.origin.url', url)
349 _SetConfig(local, 'remote.origin.fetch',
350 '+refs/heads/*:refs/remotes/origin/*')
351 _Fetch(local, quiet)
352 _Fetch(local, quiet, '--tags')
353
354
355def _Verify(cwd, branch, quiet):
356 """Verify the branch has been signed by a tag.
357 """
358 cmd = [GIT, 'describe', 'origin/%s' % branch]
359 proc = subprocess.Popen(cmd,
360 stdout=subprocess.PIPE,
361 stderr=subprocess.PIPE,
362 cwd = cwd)
363 cur = proc.stdout.read().strip()
364 proc.stdout.close()
365
366 proc.stderr.read()
367 proc.stderr.close()
368
369 if proc.wait() != 0 or not cur:
370 print >>sys.stderr
371 print >>sys.stderr,\
372 "fatal: branch '%s' has not been signed" \
373 % branch
374 raise CloneFailure()
375
376 m = re.compile(r'^(.*)-[0-9]{1,}-g[0-9a-f]{1,}$').match(cur)
377 if m:
378 cur = m.group(1)
379 if not quiet:
380 print >>sys.stderr
381 print >>sys.stderr, \
382 "info: Ignoring branch '%s'; using tagged release '%s'" \
383 % (branch, cur)
384 print >>sys.stderr
385
Shawn O. Pearcef18cb762010-12-07 11:41:05 -0800386 env = os.environ.copy()
387 env['GNUPGHOME'] = gpg_dir.encode()
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -0700388
389 cmd = [GIT, 'tag', '-v', cur]
390 proc = subprocess.Popen(cmd,
391 stdout = subprocess.PIPE,
392 stderr = subprocess.PIPE,
393 cwd = cwd,
394 env = env)
395 out = proc.stdout.read()
396 proc.stdout.close()
397
398 err = proc.stderr.read()
399 proc.stderr.close()
400
401 if proc.wait() != 0:
402 print >>sys.stderr
403 print >>sys.stderr, out
404 print >>sys.stderr, err
405 print >>sys.stderr
406 raise CloneFailure()
407 return '%s^0' % cur
408
409
410def _Checkout(cwd, branch, rev, quiet):
411 """Checkout an upstream branch into the repository and track it.
412 """
413 cmd = [GIT, 'update-ref', 'refs/heads/default', rev]
414 if subprocess.Popen(cmd, cwd = cwd).wait() != 0:
415 raise CloneFailure()
416
417 _SetConfig(cwd, 'branch.default.remote', 'origin')
418 _SetConfig(cwd, 'branch.default.merge', 'refs/heads/%s' % branch)
419
420 cmd = [GIT, 'symbolic-ref', 'HEAD', 'refs/heads/default']
421 if subprocess.Popen(cmd, cwd = cwd).wait() != 0:
422 raise CloneFailure()
423
424 cmd = [GIT, 'read-tree', '--reset', '-u']
425 if not quiet:
426 cmd.append('-v')
427 cmd.append('HEAD')
428 if subprocess.Popen(cmd, cwd = cwd).wait() != 0:
429 raise CloneFailure()
430
431
432def _FindRepo():
433 """Look for a repo installation, starting at the current directory.
434 """
435 dir = os.getcwd()
436 repo = None
437
Anthony Newnamb0f9a022010-11-29 13:15:24 -0600438 olddir = None
439 while dir != '/' \
440 and dir != olddir \
441 and not repo:
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -0700442 repo = os.path.join(dir, repodir, REPO_MAIN)
443 if not os.path.isfile(repo):
444 repo = None
Anthony Newnamb0f9a022010-11-29 13:15:24 -0600445 olddir = dir
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -0700446 dir = os.path.dirname(dir)
447 return (repo, os.path.join(dir, repodir))
448
449
450class _Options:
451 help = False
452
453
454def _ParseArguments(args):
455 cmd = None
456 opt = _Options()
457 arg = []
458
459 for i in xrange(0, len(args)):
460 a = args[i]
461 if a == '-h' or a == '--help':
462 opt.help = True
463
464 elif not a.startswith('-'):
465 cmd = a
466 arg = args[i + 1:]
467 break
468 return cmd, opt, arg
469
470
471def _Usage():
472 print >>sys.stderr,\
473"""usage: repo COMMAND [ARGS]
474
475repo is not yet installed. Use "repo init" to install it here.
476
477The most commonly used repo commands are:
478
479 init Install repo in the current working directory
480 help Display detailed help on a command
481
482For access to the full online help, install repo ("repo init").
483"""
484 sys.exit(1)
485
486
487def _Help(args):
488 if args:
489 if args[0] == 'init':
490 init_optparse.print_help()
Trond Norbyed3fd5372011-01-03 11:35:15 +0100491 sys.exit(0)
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -0700492 else:
493 print >>sys.stderr,\
494 "error: '%s' is not a bootstrap command.\n"\
495 ' For access to online help, install repo ("repo init").'\
496 % args[0]
497 else:
498 _Usage()
499 sys.exit(1)
500
501
502def _NotInstalled():
503 print >>sys.stderr,\
504'error: repo is not installed. Use "repo init" to install it here.'
505 sys.exit(1)
506
507
508def _NoCommands(cmd):
509 print >>sys.stderr,\
510"""error: command '%s' requires repo to be installed first.
511 Use "repo init" to install it here.""" % cmd
512 sys.exit(1)
513
514
515def _RunSelf(wrapper_path):
516 my_dir = os.path.dirname(wrapper_path)
517 my_main = os.path.join(my_dir, 'main.py')
518 my_git = os.path.join(my_dir, '.git')
519
520 if os.path.isfile(my_main) and os.path.isdir(my_git):
Shawn O. Pearcec8a300f2009-05-18 13:19:57 -0700521 for name in ['git_config.py',
The Android Open Source Projectcf31fe92008-10-21 07:00:00 -0700522 'project.py',
523 'subcmds']:
524 if not os.path.exists(os.path.join(my_dir, name)):
525 return None, None
526 return my_main, my_git
527 return None, None
528
529
530def _SetDefaultsTo(gitdir):
531 global REPO_URL
532 global REPO_REV
533
534 REPO_URL = gitdir
535 proc = subprocess.Popen([GIT,
536 '--git-dir=%s' % gitdir,
537 'symbolic-ref',
538 'HEAD'],
539 stdout = subprocess.PIPE,
540 stderr = subprocess.PIPE)
541 REPO_REV = proc.stdout.read().strip()
542 proc.stdout.close()
543
544 proc.stderr.read()
545 proc.stderr.close()
546
547 if proc.wait() != 0:
548 print >>sys.stderr, 'fatal: %s has no current branch' % gitdir
549 sys.exit(1)
550
551
552def main(orig_args):
553 main, dir = _FindRepo()
554 cmd, opt, args = _ParseArguments(orig_args)
555
556 wrapper_path = os.path.abspath(__file__)
557 my_main, my_git = _RunSelf(wrapper_path)
558
559 if not main:
560 if opt.help:
561 _Usage()
562 if cmd == 'help':
563 _Help(args)
564 if not cmd:
565 _NotInstalled()
566 if cmd == 'init':
567 if my_git:
568 _SetDefaultsTo(my_git)
569 try:
570 _Init(args)
571 except CloneFailure:
572 for root, dirs, files in os.walk(repodir, topdown=False):
573 for name in files:
574 os.remove(os.path.join(root, name))
575 for name in dirs:
576 os.rmdir(os.path.join(root, name))
577 os.rmdir(repodir)
578 sys.exit(1)
579 main, dir = _FindRepo()
580 else:
581 _NoCommands(cmd)
582
583 if my_main:
584 main = my_main
585
586 ver_str = '.'.join(map(lambda x: str(x), VERSION))
587 me = [main,
588 '--repo-dir=%s' % dir,
589 '--wrapper-version=%s' % ver_str,
590 '--wrapper-path=%s' % wrapper_path,
591 '--']
592 me.extend(orig_args)
593 me.extend(extra_args)
594 try:
595 os.execv(main, me)
596 except OSError, e:
597 print >>sys.stderr, "fatal: unable to start %s" % main
598 print >>sys.stderr, "fatal: %s" % e
599 sys.exit(148)
600
601
602if __name__ == '__main__':
603 main(sys.argv[1:])
604