blob: 0b8090d0bd504c766ed77e8648e3b2a3b74cbcce [file] [log] [blame]
[email protected]3bdfbeb2014-02-06 04:52:541#!/usr/bin/env python
[email protected]38b04f82010-07-13 23:03:342
vapierae39f562016-10-11 02:08:173# repo default configuration
4#
5import os
6REPO_URL = os.environ.get('REPO_URL', None)
7if not REPO_URL:
8 REPO_URL = 'https://chromium.googlesource.com/external/repo'
9REPO_REV = 'stable'
[email protected]38b04f82010-07-13 23:03:3410
11# Copyright (C) 2008 Google Inc.
12#
13# Licensed under the Apache License, Version 2.0 (the "License");
14# you may not use this file except in compliance with the License.
15# You may obtain a copy of the License at
16#
17# http://www.apache.org/licenses/LICENSE-2.0
18#
19# Unless required by applicable law or agreed to in writing, software
20# distributed under the License is distributed on an "AS IS" BASIS,
21# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22# See the License for the specific language governing permissions and
23# limitations under the License.
24
[email protected]38b04f82010-07-13 23:03:3425# increment this whenever we make important changes to this script
vapierae39f562016-10-11 02:08:1726VERSION = (1, 23)
[email protected]38b04f82010-07-13 23:03:3427
28# increment this if the MAINTAINER_KEYS block is modified
vapier74751962016-09-14 23:08:3429KEYRING_VERSION = (1, 5)
[email protected]38b04f82010-07-13 23:03:3430MAINTAINER_KEYS = """
31
32 Repo Maintainer <[email protected]>
33-----BEGIN PGP PUBLIC KEY BLOCK-----
34Version: GnuPG v1.4.2.2 (GNU/Linux)
35
36mQGiBEj3ugERBACrLJh/ZPyVSKeClMuznFIrsQ+hpNnmJGw1a9GXKYKk8qHPhAZf
37WKtrBqAVMNRLhL85oSlekRz98u41H5si5zcuv+IXJDF5MJYcB8f22wAy15lUqPWi
38VCkk1l8qqLiuW0fo+ZkPY5qOgrvc0HW1SmdH649uNwqCbcKb6CxaTxzhOwCgj3AP
39xI1WfzLqdJjsm1Nq98L0cLcD/iNsILCuw44PRds3J75YP0pze7YF/6WFMB6QSFGu
40aUX1FsTTzt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uLvp1vEDHnj41R52Fz51hgddT4rBsp0nL+5I
57socSOIIezw8T9vVzMY4ArCKFAVu2IVyBcahTfBS8q5EM63mONU6UVJEozfGljiMw
58xuQ7JwKcw0AUEKTKG7aBgBaTAgT8TOevpvlw91cAAwUP/jRkyVi/0WAb0qlEaq/S
59ouWxX1faR+vU3b+Y2/DGjtXQMzG0qpetaTHC/AxxHpgt/dCkWI6ljYDnxgPLwG0a
60Oasm94BjZc6vZwf1opFZUKsjOAAxRxNZyjUJKe4UZVuMTk6zo27Nt3LMnc0FO47v
61FcOjRyquvgNOS818irVHUf12waDx8gszKxQTTtFxU5/ePB2jZmhP6oXSe4K/LG5T
62+WBRPDrHiGPhCzJRzm9BP0lTnGCAj3o9W90STZa65RK7IaYpC8TB35JTBEbrrNCp
63w6lzd74LnNEp5eMlKDnXzUAgAH0yzCQeMl7t33QCdYx2hRs2wtTQSjGfAiNmj/WW
64Vl5Jn+2jCDnRLenKHwVRFsBX2e0BiRWt/i9Y8fjorLCXVj4z+7yW6DawdLkJorEo
65p3v5ILwfC7hVx4jHSnOgZ65L9s8EQdVr1ckN9243yta7rNgwfcqb60ILMFF1BRk/
660V7wCL+68UwwiQDvyMOQuqkysKLSDCLb7BFcyA7j6KG+5hpsREstFX2wK1yKeraz
675xGrFy8tfAaeBMIQ17gvFSp/suc9DYO0ICK2BISzq+F+ZiAKsjMYOBNdH/h0zobQ
68HTHs37+/QLMomGEGKZMWi0dShU2J5mNRQu3Hhxl3hHDVbt5CeJBb26aQcQrFz69W
69zE3GNvmJosh6leayjtI9P2A6iEkEGBECAAkFAkj3uiACGwwACgkQFlMNXpIPXGWp
70TACbBS+Up3RpfYVfd63c1cDdlru13pQAn3NQy/SN858MkxN+zym86UBgOad2
71=CMiZ
72-----END PGP PUBLIC KEY BLOCK-----
[email protected]8db6c882012-12-25 17:02:3773
74 Conley Owens <[email protected]>
75-----BEGIN PGP PUBLIC KEY BLOCK-----
76Version: GnuPG v1.4.11 (GNU/Linux)
77
[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gp9tu1kKauuToZhWHMRMqYSOGikQJwWSFYKT1KdNcOXLQF6+bfoJ6sjVYdwfmNQL
95Ixn8QVhoTDedcqClSWB17VDEFDFa7MmqXZz2qtM3X1R/MUMHqPtegQzBGNhRdnI2
96V45+1Nnx/uuCxDbeI4RbHzujnxDiq70AEQEAAYkBHwQYAQIACQUCUdG9zwIbDAAK
97CRBnt+RIaSs4LNVeB/0Y2pZ8I7gAAcEM0Xw8drr4omg2fUoK1J33ozlA/RxeA/lJ
98I3KnyCDTpXuIeBKPGkdL8uMATC9Z8DnBBajRlftNDVZS3Hz4G09G9QpMojvJkFJV
99By+01Flw/X+eeN8NpqSuLV4W+AjEO8at/VvgKr1AFvBRdZ7GkpI1o6DgPe7ZqX+1
100dzQZt3e13W0rVBb/bUgx9iSLoeWP3aq/k+/GRGOR+S6F6BBSl0SQ2EF2+dIywb1x
101JuinEP+AwLAUZ1Bsx9ISC0Agpk2VeHXPL3FGhroEmoMvBzO0kTFGyoeT7PR/BfKv
102+H/g3HsL2LOB9uoIm8/5p2TTU5ttYCXMHhQZ81AY
103=AUp4
[email protected]8db6c882012-12-25 17:02:37104-----END PGP PUBLIC KEY BLOCK-----
[email protected]538283f2013-08-13 21:37:50105
106 Stefan Zager <[email protected]>
107-----BEGIN PGP PUBLIC KEY BLOCK-----
108Version: GnuPG v1.4.11 (GNU/Linux)
109
110mQINBFIJOcgBEADwZIq4GRGoO1RJFKlrtVK501cwT5H+Acbizc9N5RxTkFmqxDjb
1119ApUaPW6S1b8+nrzE9P1Ri5erfzipuStfaZ/Wl3mP1JjKulibddmgnPOEbAJ673k
112Vj85RUO4rt2oZAHnZN3D3gFJzVY8JVlZ47Enj9fTqzcW78FVsPCpIT9P2LpTLWeE
113jX9Cjxeimy6VvyJstIcDLYhlpUN5UWen79L4LFAkHf3luLuU4W3p9NriqUsy5UG2
1148vO6QdhKrCr5wsjDFFeVnpMtjlSeZJAWH+XhFFibMX1xP5R9BTuJfzw3kOVKvcE0
115e9Clx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uELKH6Vuh9nzgEefFWty6vPbKEyZLu19D
132B80aqP1cTN88FjtKQ/eTF29TUB6AefUeBS17e2e3WUMy4nc8tduuOFYfiHP40ScP
133wOoatwfzpiTIPGbocUEPL+pS0O/Xy8SINxFMCud3zA==
134=Vd2S
135-----END PGP PUBLIC KEY BLOCK-----
[email protected]33c182b2014-09-08 17:50:45136
137 David James <[email protected]>
138-----BEGIN PGP PUBLIC KEY BLOCK-----
139Version: GnuPG v1
140
141mQINBFQKWWsBEACjAxD8xLqNVFX/qOAKFW7R63J3KkkXQKyH5KmSWZnmdfTg4AeR
142h9sAUls16nHiOFp/MRLFFhax8dm33zfED+zHpISFUkMq2Q3UyP6Z6eSpJyYriEF1
143hP7PpwksEnh+hoQ36fhsY1vaQRgTCO8XkFVcChb1CoKUl104PornVlZ378RBUUnK
144FAPhRSTEJtK1QXv6JtQXFzEQbX3jgxsKvpw/Zg7V3FnaMRhHw84YvCAbWz9ayTov
145SBOIczOscD9T/F3NbSlgFwWlQ7JeixdOsCMaYh7gYcXqdq2jluHuKQlTGmGlFwGm
1465TOh6NwvVUV68JZfer2CGMQv4JImQfousy9V+KGddTBfjYkwtmG9oTkSWBLuO91/
147q+TFdHkzNxivPcC+iluJkzrJHcS6aUg8vkLZfT2wrGZUBFH7GsZiKht2env1HyVZ
14864md/auhee4ED3V0mtWSWYyjriAQUIE0LHVHP1zyEf5gVwDZyuE2HlFZr1eFJWiH
149jcxQnGi7IpxF2//NCTvO2dc3eTi4f1EexOyomu9AWk/iIDCgCpkU38XlWgVrvmM1
150Mw5pDm691L1Xn3v3yMRZZUCottUpUEnz5qAa0eQHWBU4PpXUCaWElwwuT+3Lcx1U
151Rdq74UPNb+hBGzrID/KmeU0NxGmhzRIwl+LKdCvnM2v4AvRHIjQPBqC5fQARAQAB
152tCNEYXZpZCBKYW1lcyA8ZGF2aWRqYW1lc0Bnb29nbGUuY29tPokCOAQTAQIAIgUC
153VApZawIbAwYLCQgHAwIGFQgCCQoLBBYCAwEC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
170126so5sBhJTSGbIV/fb93PZCIfzfJCA4pinYPJH46zn2Ih3AF9mi4eguBK9/oGBe
17103LsNBsfoEI81rRuAl5NeFNa+YXf3w7olF2qbwZXcGmRBteUBBvfonW64nk8w+Ui
172x14gzHJXH6l9jsIavA1AMtFulmh6eEf8hsDUzq8s0Yg9PphVmknxPVW44EttOwCi
173OnlVelRSbABcCNNTv1vOC8ubvt191YRNwAgGMRmXfeEFce76ckVJei/tiENycMXl
174Ff3+km6WmswsDmKxz+DfNtf5SXM24EifO2Q6uX9pbg+AcIWI9Sc2WAfmqCooTU8g
175H2Ua0dskiAi9qq4DPYrwPO+OzAT10nn/TqmDABEBAAGJAh8EGAECAAkFAlQKWWsC
176GwwACgkQSlDprdejN6wHURAAncjYkIkSseO8lldTVu0qJi2vetc2Q6bR8Lw1hTAT
177TB2LcbFheTu6Q/sxDSC5slovFSgyDp8wNkDf88+fxV38LC00IeWz7a9EGPzLzA+D
178fNFdctnxXZGaYB3cQ17TkKFj4AMqbzKPkt4xYWU/WdSWPPd4feFJVjg7l8BIxafF
17958ZYbWN3DwAgKE9DDZ9praTNC/2ytWh21a2j8LR4GlYERW1pMGrMt37IGvZqbU6W
180a7HWaB7f0eXg5M5GTr7KP6TTGwY/500cI4fDme6bih/jXDS4vV53b1HHgvzQFXw/
181XURueobmqsbQQzDGsqPzkYJM4fxXu0TWNhW8CieZMMypPq3uSgvN3jTu2JB9NAEz
18221Pso0NzKm6wxhMzPA6KWILmR2KQn/t51NTE6u0+8e9RmQeg9Ce+IpPzPLsGuNca
183u+r4LcB98D8jIUXz9PPbIHiDLJjMWOG8olZz1zcHpt86b+bf8c9TxFAE8p3G/jpQ
184qanHjtbgNmkz+JpvJ9CTEEo69tkcbmOaCNwCWQL+Doqqi7tWMYUbAw0Rk+lOSu/N
1854cAccd41XU/GmIs9zKkbORWubhfFndc7AXnPUU2otjqMQq0f+QCQrHPdyARf2QCm
186j8zzwdwkRpt3SSvqzh3+L3Zq8xeb2M6u/QLz4aLFTR7yQJed0DJFUcISii9ccJr/
187IM4=
188=6VNc
189-----END PGP PUBLIC KEY BLOCK-----
vapier74751962016-09-14 23:08:34190
191 Mike Frysinger <[email protected]>
192-----BEGIN PGP PUBLIC KEY BLOCK-----
193Version: GnuPG v1
194
195mQINBFfYaqQBEAC5M4xbKTZX0MJ9IITJRBjh78/b4z6BcSjJ02nBoyvVuH3yzWJS
196O51T0rAsbg/issl4U79tImzBHU4iqgZLO1anRXlVWaGP5N/DBcU6j5tNqNr6EFY/
1970MHgVrFUKzXWx6NsRnh2xCj7YL4u4DGqP/JO4rY698QNfeKW+u/PpK0FZjmDU1J4
198K9Uh3hrfsCKyaL9tJ0sJUl9uc+Yf2FENSCXaL670ymwC7KqJf/nShA4QjDSQlVZq
199Q8t27m0KY2URQi4dsIHYcYQ43VEvQ2ZAjfJkTzOqAk3NcSvRl3Chc8f+o0OiFaVR
200xOr3/Pph7nvfIoK0yr3rgBvR/be6aP7wyd6+E/KFszbhrpyZfZsFRGn9LyUqVm3T
201iO4GyWs+DvOUmDigMzcKYUHgQ8tk4T89wJd7yXMOlfZKWwMhN59ZuBlvXtogxrSz
202jD6Em1TYsvqGaK8fKRRdoP32DsXVt+mbECpNrZqFtsrcOhQhMvLjcC8kRongWD0U
203gfohjqPnDGL15ztyedP3iGgb/7usPFI+k3cHgiMfvmqD2F+iJ7h69sSb2nn8dx8P
204EiycPnOc8mBDiTAH8eq6T6P29G9mqYr/wyC3Xj66+1WOApXmQS2I6P4qKOdnJdNF
205UTIgOrrZfG/2NFThOtnTjeEUfpaYX3FXvVcxCP8tk6X6iUY6fPAqp4r/cQARAQAB
206tCRNaWtlIEZyeXNpbmdlciA8dmFwaWVyQGNocm9taXVtLm9yZz6JAjcEEwEIACEF
207AlfYaqQCGwMFCwkIBwIGFQgJCgsCBBYCAwECHgECF4AACgkQ2gP9ORa1AKgfthAA
208qnd73xSWl0/HbZ0y7jyaVNy04GARKcC46SCzcqbyRKoYgFpWshESIJbAarQKoRy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V0egPsus0tnfmps6ONhvxfZtkRWsJkQ0EDh8SbIEnBd8zolXXJnDSTpjL
226n9Sf5d2wH3L2SI53vhMouSB1UmhPhwNq7sFeTvYJ1juqmVdN+eQj5OxSvhOceAE8
227cT2GjBrfkP6Gcw8fPESLqJLx6jpyPrHS/TK1GNCnGZihDsZRNIcfpS9T1LoFKuHn
228eRZoYnWnFIZVjD9OLmRq3I2RcktWHFpAjWE3naSybXhfL++mp04PQyV2CUFVF6zY
2292nPL/TtwSF0WmReP2qO7gsuEhR0BuPaXEC3dihTpMZ4hkbe3F+aJ7VEEU9dKDUM=
230=i88c
231-----END PGP PUBLIC KEY BLOCK-----
[email protected]38b04f82010-07-13 23:03:34232"""
233
vapierae39f562016-10-11 02:08:17234GIT = 'git' # our git command
235MIN_GIT_VERSION = (1, 7, 2) # minimum supported git version
236repodir = '.repo' # name of repo's private directory
237S_repo = 'repo' # special repo repository
238S_manifests = 'manifests' # special manifest repository
239REPO_MAIN = S_repo + '/main.py' # main script
240MIN_PYTHON_VERSION = (2, 6) # minimum supported python version
241GITC_CONFIG_FILE = '/gitc/.config'
242GITC_FS_ROOT_DIR = '/gitc/manifest-rw/'
[email protected]38b04f82010-07-13 23:03:34243
244
[email protected]3bdfbeb2014-02-06 04:52:54245import errno
[email protected]38b04f82010-07-13 23:03:34246import optparse
[email protected]38b04f82010-07-13 23:03:34247import re
vapier74751962016-09-14 23:08:34248import shutil
[email protected]3bdfbeb2014-02-06 04:52:54249import stat
[email protected]38b04f82010-07-13 23:03:34250import subprocess
251import sys
[email protected]3bdfbeb2014-02-06 04:52:54252
253if sys.version_info[0] == 3:
254 import urllib.request
255 import urllib.error
256else:
257 import imp
258 import urllib2
259 urllib = imp.new_module('urllib')
260 urllib.request = urllib2
261 urllib.error = urllib2
262
263
264def _print(*objects, **kwargs):
265 sep = kwargs.get('sep', ' ')
266 end = kwargs.get('end', '\n')
267 out = kwargs.get('file', sys.stdout)
268 out.write(sep.join(objects) + end)
269
270
271# Python version check
272ver = sys.version_info
[email protected]3bdfbeb2014-02-06 04:52:54273if (ver[0], ver[1]) < MIN_PYTHON_VERSION:
274 _print('error: Python version %s unsupported.\n'
275 'Please use Python 2.6 - 2.7 instead.'
276 % sys.version.split(' ')[0], file=sys.stderr)
277 sys.exit(1)
[email protected]38b04f82010-07-13 23:03:34278
vapier74751962016-09-14 23:08:34279home_dot_repo = os.path.expanduser('~/.repoconfig')
[email protected]38b04f82010-07-13 23:03:34280gpg_dir = os.path.join(home_dot_repo, 'gnupg')
281
282extra_args = []
283init_optparse = optparse.OptionParser(usage="repo init -u url [options]")
284
285# Logging
286group = init_optparse.add_option_group('Logging options')
287group.add_option('-q', '--quiet',
288 dest="quiet", action="store_true", default=False,
289 help="be quiet")
290
291# Manifest
292group = init_optparse.add_option_group('Manifest options')
293group.add_option('-u', '--manifest-url',
294 dest='manifest_url',
295 help='manifest repository location', metavar='URL')
[email protected]38b04f82010-07-13 23:03:34296group.add_option('-b', '--manifest-branch',
297 dest='manifest_branch',
298 help='manifest branch or revision', metavar='REVISION')
299group.add_option('-m', '--manifest-name',
300 dest='manifest_name',
[email protected]b25b69b2011-06-16 17:41:05301 help='initial manifest file', metavar='NAME.xml')
[email protected]38b04f82010-07-13 23:03:34302group.add_option('--mirror',
303 dest='mirror', action='store_true',
[email protected]3bdfbeb2014-02-06 04:52:54304 help='create a replica of the remote repositories '
305 'rather than a client working directory')
[email protected]2c64b712011-01-11 22:57:47306group.add_option('--reference',
307 dest='reference',
308 help='location of mirror directory', metavar='DIR')
[email protected]b25b69b2011-06-16 17:41:05309group.add_option('--depth', type='int', default=None,
310 dest='depth',
311 help='create a shallow clone with given depth; see git clone')
[email protected]3bdfbeb2014-02-06 04:52:54312group.add_option('--archive',
313 dest='archive', action='store_true',
314 help='checkout an archive instead of a git repository for '
315 'each project. See git archive.')
[email protected]79245bf2012-06-14 21:22:01316group.add_option('-g', '--groups',
317 dest='groups', default='default',
[email protected]3bdfbeb2014-02-06 04:52:54318 help='restrict manifest projects to ones with specified '
319 'group(s) [default|all|G1,G2,G3|G4,-G5,-G6]',
[email protected]79245bf2012-06-14 21:22:01320 metavar='GROUP')
321group.add_option('-p', '--platform',
322 dest='platform', default="auto",
[email protected]8db6c882012-12-25 17:02:37323 help='restrict manifest projects to ones with a specified '
[email protected]79245bf2012-06-14 21:22:01324 'platform group [auto|all|none|linux|darwin|...]',
325 metavar='PLATFORM')
vapierae39f562016-10-11 02:08:17326group.add_option('--no-clone-bundle',
327 dest='no_clone_bundle', action='store_true',
328 help='disable use of /clone.bundle on HTTP/HTTPS')
[email protected]b25b69b2011-06-16 17:41:05329
[email protected]38b04f82010-07-13 23:03:34330
331# Tool
332group = init_optparse.add_option_group('repo Version options')
333group.add_option('--repo-url',
334 dest='repo_url',
335 help='repo repository location', metavar='URL')
336group.add_option('--repo-branch',
337 dest='repo_branch',
338 help='repo branch or revision', metavar='REVISION')
339group.add_option('--no-repo-verify',
340 dest='no_repo_verify', action='store_true',
341 help='do not verify repo source code')
342
[email protected]79245bf2012-06-14 21:22:01343# Other
344group = init_optparse.add_option_group('Other options')
345group.add_option('--config-name',
346 dest='config_name', action="store_true", default=False,
347 help='Always prompt for name/e-mail')
[email protected]38b04f82010-07-13 23:03:34348
vapierae39f562016-10-11 02:08:17349
350def _GitcInitOptions(init_optparse_arg):
351 init_optparse_arg.set_usage("repo gitc-init -u url -c client [options]")
352 g = init_optparse_arg.add_option_group('GITC options')
353 g.add_option('-f', '--manifest-file',
354 dest='manifest_file',
355 help='Optional manifest file to use for this GITC client.')
356 g.add_option('-c', '--gitc-client',
357 dest='gitc_client',
358 help='The name of the gitc_client instance to create or modify.')
359
360_gitc_manifest_dir = None
361
362
363def get_gitc_manifest_dir():
364 global _gitc_manifest_dir
365 if _gitc_manifest_dir is None:
366 _gitc_manifest_dir = ''
367 try:
368 with open(GITC_CONFIG_FILE, 'r') as gitc_config:
369 for line in gitc_config:
370 match = re.match('gitc_dir=(?P<gitc_manifest_dir>.*)', line)
371 if match:
372 _gitc_manifest_dir = match.group('gitc_manifest_dir')
373 except IOError:
374 pass
375 return _gitc_manifest_dir
376
377
378def gitc_parse_clientdir(gitc_fs_path):
379 """Parse a path in the GITC FS and return its client name.
380
381 @param gitc_fs_path: A subdirectory path within the GITC_FS_ROOT_DIR.
382
383 @returns: The GITC client name
384 """
385 if gitc_fs_path == GITC_FS_ROOT_DIR:
386 return None
387 if not gitc_fs_path.startswith(GITC_FS_ROOT_DIR):
388 manifest_dir = get_gitc_manifest_dir()
389 if manifest_dir == '':
390 return None
391 if manifest_dir[-1] != '/':
392 manifest_dir += '/'
393 if gitc_fs_path == manifest_dir:
394 return None
395 if not gitc_fs_path.startswith(manifest_dir):
396 return None
397 return gitc_fs_path.split(manifest_dir)[1].split('/')[0]
398 return gitc_fs_path.split(GITC_FS_ROOT_DIR)[1].split('/')[0]
399
400
[email protected]38b04f82010-07-13 23:03:34401class CloneFailure(Exception):
vapierae39f562016-10-11 02:08:17402
[email protected]38b04f82010-07-13 23:03:34403 """Indicate the remote clone of repo itself failed.
404 """
405
406
vapierae39f562016-10-11 02:08:17407def _Init(args, gitc_init=False):
[email protected]38b04f82010-07-13 23:03:34408 """Installs repo by cloning it over the network.
409 """
vapierae39f562016-10-11 02:08:17410 if gitc_init:
411 _GitcInitOptions(init_optparse)
[email protected]38b04f82010-07-13 23:03:34412 opt, args = init_optparse.parse_args(args)
[email protected]79245bf2012-06-14 21:22:01413 if args:
[email protected]38b04f82010-07-13 23:03:34414 init_optparse.print_usage()
415 sys.exit(1)
416
417 url = opt.repo_url
418 if not url:
419 url = REPO_URL
420 extra_args.append('--repo-url=%s' % url)
421
422 branch = opt.repo_branch
423 if not branch:
424 branch = REPO_REV
425 extra_args.append('--repo-branch=%s' % branch)
426
427 if branch.startswith('refs/heads/'):
428 branch = branch[len('refs/heads/'):]
429 if branch.startswith('refs/'):
[email protected]3bdfbeb2014-02-06 04:52:54430 _print("fatal: invalid branch name '%s'" % branch, file=sys.stderr)
[email protected]38b04f82010-07-13 23:03:34431 raise CloneFailure()
432
[email protected]3bdfbeb2014-02-06 04:52:54433 try:
vapierae39f562016-10-11 02:08:17434 if gitc_init:
435 gitc_manifest_dir = get_gitc_manifest_dir()
436 if not gitc_manifest_dir:
437 _print('fatal: GITC filesystem is not available. Exiting...',
438 file=sys.stderr)
439 sys.exit(1)
440 gitc_client = opt.gitc_client
441 if not gitc_client:
442 gitc_client = gitc_parse_clientdir(os.getcwd())
443 if not gitc_client:
444 _print('fatal: GITC client (-c) is required.', file=sys.stderr)
445 sys.exit(1)
446 client_dir = os.path.join(gitc_manifest_dir, gitc_client)
447 if not os.path.exists(client_dir):
448 os.makedirs(client_dir)
449 os.chdir(client_dir)
450 if os.path.exists(repodir):
451 # This GITC Client has already initialized repo so continue.
452 return
453
[email protected]3bdfbeb2014-02-06 04:52:54454 os.mkdir(repodir)
455 except OSError as e:
456 if e.errno != errno.EEXIST:
457 _print('fatal: cannot make %s directory: %s'
458 % (repodir, e.strerror), file=sys.stderr)
459 # Don't raise CloneFailure; that would delete the
[email protected]38b04f82010-07-13 23:03:34460 # name. Instead exit immediately.
461 #
462 sys.exit(1)
463
464 _CheckGitVersion()
465 try:
[email protected]8db6c882012-12-25 17:02:37466 if NeedSetupGnuPG():
467 can_verify = SetupGnuPG(opt.quiet)
[email protected]38b04f82010-07-13 23:03:34468 else:
469 can_verify = True
470
[email protected]38b04f82010-07-13 23:03:34471 dst = os.path.abspath(os.path.join(repodir, S_repo))
vapierae39f562016-10-11 02:08:17472 _Clone(url, dst, opt.quiet, not opt.no_clone_bundle)
[email protected]38b04f82010-07-13 23:03:34473
474 if can_verify and not opt.no_repo_verify:
475 rev = _Verify(dst, branch, opt.quiet)
476 else:
477 rev = 'refs/remotes/origin/%s^0' % branch
478
479 _Checkout(dst, branch, rev, opt.quiet)
480 except CloneFailure:
481 if opt.quiet:
[email protected]3bdfbeb2014-02-06 04:52:54482 _print('fatal: repo init failed; run without --quiet to see why',
483 file=sys.stderr)
[email protected]38b04f82010-07-13 23:03:34484 raise
485
486
[email protected]3bdfbeb2014-02-06 04:52:54487def ParseGitVersion(ver_str):
488 if not ver_str.startswith('git version '):
489 return None
490
491 num_ver_str = ver_str[len('git version '):].strip().split('-')[0]
492 to_tuple = []
493 for num_str in num_ver_str.split('.')[:3]:
494 if num_str.isdigit():
495 to_tuple.append(int(num_str))
496 else:
497 to_tuple.append(0)
498 return tuple(to_tuple)
499
500
[email protected]38b04f82010-07-13 23:03:34501def _CheckGitVersion():
502 cmd = [GIT, '--version']
[email protected]79245bf2012-06-14 21:22:01503 try:
504 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
[email protected]8db6c882012-12-25 17:02:37505 except OSError as e:
[email protected]3bdfbeb2014-02-06 04:52:54506 _print(file=sys.stderr)
507 _print("fatal: '%s' is not available" % GIT, file=sys.stderr)
508 _print('fatal: %s' % e, file=sys.stderr)
509 _print(file=sys.stderr)
510 _print('Please make sure %s is installed and in your path.' % GIT,
511 file=sys.stderr)
[email protected]79245bf2012-06-14 21:22:01512 raise CloneFailure()
513
[email protected]38b04f82010-07-13 23:03:34514 ver_str = proc.stdout.read().strip()
515 proc.stdout.close()
516 proc.wait()
517
[email protected]3bdfbeb2014-02-06 04:52:54518 ver_act = ParseGitVersion(ver_str)
519 if ver_act is None:
520 _print('error: "%s" unsupported' % ver_str, file=sys.stderr)
[email protected]38b04f82010-07-13 23:03:34521 raise CloneFailure()
522
[email protected]38b04f82010-07-13 23:03:34523 if ver_act < MIN_GIT_VERSION:
[email protected]3bdfbeb2014-02-06 04:52:54524 need = '.'.join(map(str, MIN_GIT_VERSION))
525 _print('fatal: git %s or later required' % need, file=sys.stderr)
[email protected]38b04f82010-07-13 23:03:34526 raise CloneFailure()
527
528
[email protected]8db6c882012-12-25 17:02:37529def NeedSetupGnuPG():
[email protected]38b04f82010-07-13 23:03:34530 if not os.path.isdir(home_dot_repo):
531 return True
532
533 kv = os.path.join(home_dot_repo, 'keyring-version')
534 if not os.path.exists(kv):
535 return True
536
537 kv = open(kv).read()
538 if not kv:
539 return True
540
[email protected]3bdfbeb2014-02-06 04:52:54541 kv = tuple(map(int, kv.split('.')))
[email protected]38b04f82010-07-13 23:03:34542 if kv < KEYRING_VERSION:
543 return True
544 return False
545
546
[email protected]8db6c882012-12-25 17:02:37547def SetupGnuPG(quiet):
[email protected]3bdfbeb2014-02-06 04:52:54548 try:
549 os.mkdir(home_dot_repo)
550 except OSError as e:
551 if e.errno != errno.EEXIST:
552 _print('fatal: cannot make %s directory: %s'
553 % (home_dot_repo, e.strerror), file=sys.stderr)
[email protected]38b04f82010-07-13 23:03:34554 sys.exit(1)
555
[email protected]3bdfbeb2014-02-06 04:52:54556 try:
557 os.mkdir(gpg_dir, stat.S_IRWXU)
558 except OSError as e:
559 if e.errno != errno.EEXIST:
560 _print('fatal: cannot make %s directory: %s' % (gpg_dir, e.strerror),
561 file=sys.stderr)
[email protected]38b04f82010-07-13 23:03:34562 sys.exit(1)
563
[email protected]2c64b712011-01-11 22:57:47564 env = os.environ.copy()
vapierae39f562016-10-11 02:08:17565 try:
566 env['GNUPGHOME'] = gpg_dir
567 except UnicodeEncodeError:
568 env['GNUPGHOME'] = gpg_dir.encode()
[email protected]38b04f82010-07-13 23:03:34569
570 cmd = ['gpg', '--import']
571 try:
572 proc = subprocess.Popen(cmd,
vapierae39f562016-10-11 02:08:17573 env=env,
574 stdin=subprocess.PIPE)
[email protected]8db6c882012-12-25 17:02:37575 except OSError as e:
[email protected]38b04f82010-07-13 23:03:34576 if not quiet:
[email protected]3bdfbeb2014-02-06 04:52:54577 _print('warning: gpg (GnuPG) is not available.', file=sys.stderr)
578 _print('warning: Installing it is strongly encouraged.', file=sys.stderr)
579 _print(file=sys.stderr)
[email protected]38b04f82010-07-13 23:03:34580 return False
581
582 proc.stdin.write(MAINTAINER_KEYS)
583 proc.stdin.close()
584
585 if proc.wait() != 0:
[email protected]3bdfbeb2014-02-06 04:52:54586 _print('fatal: registering repo maintainer keys failed', file=sys.stderr)
[email protected]38b04f82010-07-13 23:03:34587 sys.exit(1)
[email protected]3bdfbeb2014-02-06 04:52:54588 _print()
[email protected]38b04f82010-07-13 23:03:34589
590 fd = open(os.path.join(home_dot_repo, 'keyring-version'), 'w')
[email protected]3bdfbeb2014-02-06 04:52:54591 fd.write('.'.join(map(str, KEYRING_VERSION)) + '\n')
[email protected]38b04f82010-07-13 23:03:34592 fd.close()
593 return True
594
595
596def _SetConfig(local, name, value):
597 """Set a git configuration option to the specified value.
598 """
599 cmd = [GIT, 'config', name, value]
vapierae39f562016-10-11 02:08:17600 if subprocess.Popen(cmd, cwd=local).wait() != 0:
[email protected]38b04f82010-07-13 23:03:34601 raise CloneFailure()
602
603
[email protected]ad390562011-11-12 00:37:07604def _InitHttp():
605 handlers = []
606
[email protected]3bdfbeb2014-02-06 04:52:54607 mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
[email protected]ad390562011-11-12 00:37:07608 try:
609 import netrc
610 n = netrc.netrc()
611 for host in n.hosts:
612 p = n.hosts[host]
vapierae39f562016-10-11 02:08:17613 mgr.add_password(p[1], 'http://%s/' % host, p[0], p[2])
[email protected]79245bf2012-06-14 21:22:01614 mgr.add_password(p[1], 'https://%s/' % host, p[0], p[2])
vapierae39f562016-10-11 02:08:17615 except: # pylint: disable=bare-except
[email protected]ad390562011-11-12 00:37:07616 pass
[email protected]3bdfbeb2014-02-06 04:52:54617 handlers.append(urllib.request.HTTPBasicAuthHandler(mgr))
618 handlers.append(urllib.request.HTTPDigestAuthHandler(mgr))
[email protected]ad390562011-11-12 00:37:07619
620 if 'http_proxy' in os.environ:
621 url = os.environ['http_proxy']
[email protected]3bdfbeb2014-02-06 04:52:54622 handlers.append(urllib.request.ProxyHandler({'http': url, 'https': url}))
[email protected]ad390562011-11-12 00:37:07623 if 'REPO_CURL_VERBOSE' in os.environ:
[email protected]3bdfbeb2014-02-06 04:52:54624 handlers.append(urllib.request.HTTPHandler(debuglevel=1))
625 handlers.append(urllib.request.HTTPSHandler(debuglevel=1))
626 urllib.request.install_opener(urllib.request.build_opener(*handlers))
[email protected]ad390562011-11-12 00:37:07627
vapierae39f562016-10-11 02:08:17628
[email protected]ad390562011-11-12 00:37:07629def _Fetch(url, local, src, quiet):
630 if not quiet:
[email protected]3bdfbeb2014-02-06 04:52:54631 _print('Get %s' % url, file=sys.stderr)
[email protected]ad390562011-11-12 00:37:07632
[email protected]38b04f82010-07-13 23:03:34633 cmd = [GIT, 'fetch']
634 if quiet:
635 cmd.append('--quiet')
636 err = subprocess.PIPE
637 else:
638 err = None
[email protected]ad390562011-11-12 00:37:07639 cmd.append(src)
640 cmd.append('+refs/heads/*:refs/remotes/origin/*')
641 cmd.append('refs/tags/*:refs/tags/*')
[email protected]38b04f82010-07-13 23:03:34642
vapierae39f562016-10-11 02:08:17643 proc = subprocess.Popen(cmd, cwd=local, stderr=err)
[email protected]38b04f82010-07-13 23:03:34644 if err:
645 proc.stderr.read()
646 proc.stderr.close()
647 if proc.wait() != 0:
648 raise CloneFailure()
649
vapierae39f562016-10-11 02:08:17650
[email protected]ad390562011-11-12 00:37:07651def _DownloadBundle(url, local, quiet):
652 if not url.endswith('/'):
653 url += '/'
654 url += 'clone.bundle'
655
656 proc = subprocess.Popen(
vapierae39f562016-10-11 02:08:17657 [GIT, 'config', '--get-regexp', 'url.*.insteadof'],
658 cwd=local,
659 stdout=subprocess.PIPE)
[email protected]ad390562011-11-12 00:37:07660 for line in proc.stdout:
661 m = re.compile(r'^url\.(.*)\.insteadof (.*)$').match(line)
662 if m:
663 new_url = m.group(1)
664 old_url = m.group(2)
665 if url.startswith(old_url):
666 url = new_url + url[len(old_url):]
667 break
668 proc.stdout.close()
669 proc.wait()
670
671 if not url.startswith('http:') and not url.startswith('https:'):
672 return False
673
674 dest = open(os.path.join(local, '.git', 'clone.bundle'), 'w+b')
675 try:
676 try:
[email protected]3bdfbeb2014-02-06 04:52:54677 r = urllib.request.urlopen(url)
678 except urllib.error.HTTPError as e:
vapierae39f562016-10-11 02:08:17679 if e.code in [401, 403, 404, 501]:
[email protected]ad390562011-11-12 00:37:07680 return False
[email protected]3bdfbeb2014-02-06 04:52:54681 _print('fatal: Cannot get %s' % url, file=sys.stderr)
682 _print('fatal: HTTP error %s' % e.code, file=sys.stderr)
[email protected]ad390562011-11-12 00:37:07683 raise CloneFailure()
[email protected]3bdfbeb2014-02-06 04:52:54684 except urllib.error.URLError as e:
685 _print('fatal: Cannot get %s' % url, file=sys.stderr)
686 _print('fatal: error %s' % e.reason, file=sys.stderr)
[email protected]ad390562011-11-12 00:37:07687 raise CloneFailure()
688 try:
689 if not quiet:
[email protected]3bdfbeb2014-02-06 04:52:54690 _print('Get %s' % url, file=sys.stderr)
[email protected]ad390562011-11-12 00:37:07691 while True:
692 buf = r.read(8192)
693 if buf == '':
694 return True
695 dest.write(buf)
696 finally:
697 r.close()
698 finally:
699 dest.close()
700
vapierae39f562016-10-11 02:08:17701
[email protected]ad390562011-11-12 00:37:07702def _ImportBundle(local):
703 path = os.path.join(local, '.git', 'clone.bundle')
704 try:
705 _Fetch(local, local, path, True)
706 finally:
707 os.remove(path)
[email protected]38b04f82010-07-13 23:03:34708
vapierae39f562016-10-11 02:08:17709
710def _Clone(url, local, quiet, clone_bundle):
[email protected]38b04f82010-07-13 23:03:34711 """Clones a git repository to a new subdirectory of repodir
712 """
713 try:
714 os.mkdir(local)
[email protected]8db6c882012-12-25 17:02:37715 except OSError as e:
[email protected]3bdfbeb2014-02-06 04:52:54716 _print('fatal: cannot make %s directory: %s' % (local, e.strerror),
717 file=sys.stderr)
[email protected]38b04f82010-07-13 23:03:34718 raise CloneFailure()
719
720 cmd = [GIT, 'init', '--quiet']
721 try:
vapierae39f562016-10-11 02:08:17722 proc = subprocess.Popen(cmd, cwd=local)
[email protected]8db6c882012-12-25 17:02:37723 except OSError as e:
[email protected]3bdfbeb2014-02-06 04:52:54724 _print(file=sys.stderr)
725 _print("fatal: '%s' is not available" % GIT, file=sys.stderr)
726 _print('fatal: %s' % e, file=sys.stderr)
727 _print(file=sys.stderr)
728 _print('Please make sure %s is installed and in your path.' % GIT,
vapierae39f562016-10-11 02:08:17729 file=sys.stderr)
[email protected]38b04f82010-07-13 23:03:34730 raise CloneFailure()
731 if proc.wait() != 0:
[email protected]3bdfbeb2014-02-06 04:52:54732 _print('fatal: could not create %s' % local, file=sys.stderr)
[email protected]38b04f82010-07-13 23:03:34733 raise CloneFailure()
734
[email protected]ad390562011-11-12 00:37:07735 _InitHttp()
[email protected]38b04f82010-07-13 23:03:34736 _SetConfig(local, 'remote.origin.url', url)
vapierae39f562016-10-11 02:08:17737 _SetConfig(local,
738 'remote.origin.fetch',
739 '+refs/heads/*:refs/remotes/origin/*')
740 if clone_bundle and _DownloadBundle(url, local, quiet):
[email protected]ad390562011-11-12 00:37:07741 _ImportBundle(local)
vapierae39f562016-10-11 02:08:17742 _Fetch(url, local, 'origin', quiet)
[email protected]38b04f82010-07-13 23:03:34743
744
745def _Verify(cwd, branch, quiet):
746 """Verify the branch has been signed by a tag.
747 """
748 cmd = [GIT, 'describe', 'origin/%s' % branch]
749 proc = subprocess.Popen(cmd,
750 stdout=subprocess.PIPE,
751 stderr=subprocess.PIPE,
vapierae39f562016-10-11 02:08:17752 cwd=cwd)
[email protected]38b04f82010-07-13 23:03:34753 cur = proc.stdout.read().strip()
754 proc.stdout.close()
755
756 proc.stderr.read()
757 proc.stderr.close()
758
759 if proc.wait() != 0 or not cur:
[email protected]3bdfbeb2014-02-06 04:52:54760 _print(file=sys.stderr)
761 _print("fatal: branch '%s' has not been signed" % branch, file=sys.stderr)
[email protected]38b04f82010-07-13 23:03:34762 raise CloneFailure()
763
764 m = re.compile(r'^(.*)-[0-9]{1,}-g[0-9a-f]{1,}$').match(cur)
765 if m:
766 cur = m.group(1)
767 if not quiet:
[email protected]3bdfbeb2014-02-06 04:52:54768 _print(file=sys.stderr)
769 _print("info: Ignoring branch '%s'; using tagged release '%s'"
vapierae39f562016-10-11 02:08:17770 % (branch, cur), file=sys.stderr)
[email protected]3bdfbeb2014-02-06 04:52:54771 _print(file=sys.stderr)
[email protected]38b04f82010-07-13 23:03:34772
[email protected]2c64b712011-01-11 22:57:47773 env = os.environ.copy()
vapierae39f562016-10-11 02:08:17774 try:
775 env['GNUPGHOME'] = gpg_dir
776 except UnicodeEncodeError:
777 env['GNUPGHOME'] = gpg_dir.encode()
[email protected]38b04f82010-07-13 23:03:34778
779 cmd = [GIT, 'tag', '-v', cur]
780 proc = subprocess.Popen(cmd,
vapierae39f562016-10-11 02:08:17781 stdout=subprocess.PIPE,
782 stderr=subprocess.PIPE,
783 cwd=cwd,
784 env=env)
[email protected]38b04f82010-07-13 23:03:34785 out = proc.stdout.read()
786 proc.stdout.close()
787
788 err = proc.stderr.read()
789 proc.stderr.close()
790
791 if proc.wait() != 0:
[email protected]3bdfbeb2014-02-06 04:52:54792 _print(file=sys.stderr)
793 _print(out, file=sys.stderr)
794 _print(err, file=sys.stderr)
795 _print(file=sys.stderr)
[email protected]38b04f82010-07-13 23:03:34796 raise CloneFailure()
797 return '%s^0' % cur
798
799
800def _Checkout(cwd, branch, rev, quiet):
801 """Checkout an upstream branch into the repository and track it.
802 """
803 cmd = [GIT, 'update-ref', 'refs/heads/default', rev]
vapierae39f562016-10-11 02:08:17804 if subprocess.Popen(cmd, cwd=cwd).wait() != 0:
[email protected]38b04f82010-07-13 23:03:34805 raise CloneFailure()
806
807 _SetConfig(cwd, 'branch.default.remote', 'origin')
808 _SetConfig(cwd, 'branch.default.merge', 'refs/heads/%s' % branch)
809
810 cmd = [GIT, 'symbolic-ref', 'HEAD', 'refs/heads/default']
vapierae39f562016-10-11 02:08:17811 if subprocess.Popen(cmd, cwd=cwd).wait() != 0:
[email protected]38b04f82010-07-13 23:03:34812 raise CloneFailure()
813
814 cmd = [GIT, 'read-tree', '--reset', '-u']
815 if not quiet:
816 cmd.append('-v')
817 cmd.append('HEAD')
vapierae39f562016-10-11 02:08:17818 if subprocess.Popen(cmd, cwd=cwd).wait() != 0:
[email protected]38b04f82010-07-13 23:03:34819 raise CloneFailure()
820
821
822def _FindRepo():
823 """Look for a repo installation, starting at the current directory.
824 """
[email protected]8db6c882012-12-25 17:02:37825 curdir = os.getcwd()
[email protected]38b04f82010-07-13 23:03:34826 repo = None
827
[email protected]2c64b712011-01-11 22:57:47828 olddir = None
[email protected]8db6c882012-12-25 17:02:37829 while curdir != '/' \
vapierae39f562016-10-11 02:08:17830 and curdir != olddir \
831 and not repo:
[email protected]8db6c882012-12-25 17:02:37832 repo = os.path.join(curdir, repodir, REPO_MAIN)
[email protected]38b04f82010-07-13 23:03:34833 if not os.path.isfile(repo):
834 repo = None
[email protected]8db6c882012-12-25 17:02:37835 olddir = curdir
836 curdir = os.path.dirname(curdir)
837 return (repo, os.path.join(curdir, repodir))
[email protected]38b04f82010-07-13 23:03:34838
839
vapierae39f562016-10-11 02:08:17840class _Options(object):
[email protected]38b04f82010-07-13 23:03:34841 help = False
842
843
844def _ParseArguments(args):
845 cmd = None
846 opt = _Options()
847 arg = []
848
[email protected]3bdfbeb2014-02-06 04:52:54849 for i in range(len(args)):
[email protected]38b04f82010-07-13 23:03:34850 a = args[i]
851 if a == '-h' or a == '--help':
852 opt.help = True
853
854 elif not a.startswith('-'):
855 cmd = a
856 arg = args[i + 1:]
857 break
858 return cmd, opt, arg
859
860
861def _Usage():
vapierae39f562016-10-11 02:08:17862 gitc_usage = ""
863 if get_gitc_manifest_dir():
864 gitc_usage = " gitc-init Initialize a GITC Client.\n"
865
[email protected]3bdfbeb2014-02-06 04:52:54866 _print(
vapierae39f562016-10-11 02:08:17867 """usage: repo COMMAND [ARGS]
[email protected]38b04f82010-07-13 23:03:34868
869repo is not yet installed. Use "repo init" to install it here.
870
871The most commonly used repo commands are:
872
873 init Install repo in the current working directory
vapierae39f562016-10-11 02:08:17874""" + gitc_usage +
875 """ help Display detailed help on a command
[email protected]38b04f82010-07-13 23:03:34876
877For access to the full online help, install repo ("repo init").
[email protected]3bdfbeb2014-02-06 04:52:54878""", file=sys.stderr)
[email protected]38b04f82010-07-13 23:03:34879 sys.exit(1)
880
881
882def _Help(args):
883 if args:
884 if args[0] == 'init':
885 init_optparse.print_help()
[email protected]2c64b712011-01-11 22:57:47886 sys.exit(0)
vapierae39f562016-10-11 02:08:17887 elif args[0] == 'gitc-init':
888 _GitcInitOptions(init_optparse)
889 init_optparse.print_help()
890 sys.exit(0)
[email protected]38b04f82010-07-13 23:03:34891 else:
[email protected]3bdfbeb2014-02-06 04:52:54892 _print("error: '%s' is not a bootstrap command.\n"
893 ' For access to online help, install repo ("repo init").'
894 % args[0], file=sys.stderr)
[email protected]38b04f82010-07-13 23:03:34895 else:
896 _Usage()
897 sys.exit(1)
898
899
900def _NotInstalled():
[email protected]3bdfbeb2014-02-06 04:52:54901 _print('error: repo is not installed. Use "repo init" to install it here.',
902 file=sys.stderr)
[email protected]38b04f82010-07-13 23:03:34903 sys.exit(1)
904
905
906def _NoCommands(cmd):
[email protected]3bdfbeb2014-02-06 04:52:54907 _print("""error: command '%s' requires repo to be installed first.
908 Use "repo init" to install it here.""" % cmd, file=sys.stderr)
[email protected]38b04f82010-07-13 23:03:34909 sys.exit(1)
910
911
912def _RunSelf(wrapper_path):
913 my_dir = os.path.dirname(wrapper_path)
914 my_main = os.path.join(my_dir, 'main.py')
915 my_git = os.path.join(my_dir, '.git')
916
917 if os.path.isfile(my_main) and os.path.isdir(my_git):
918 for name in ['git_config.py',
919 'project.py',
920 'subcmds']:
921 if not os.path.exists(os.path.join(my_dir, name)):
922 return None, None
923 return my_main, my_git
924 return None, None
925
926
927def _SetDefaultsTo(gitdir):
928 global REPO_URL
929 global REPO_REV
930
931 REPO_URL = gitdir
932 proc = subprocess.Popen([GIT,
933 '--git-dir=%s' % gitdir,
934 'symbolic-ref',
935 'HEAD'],
vapierae39f562016-10-11 02:08:17936 stdout=subprocess.PIPE,
937 stderr=subprocess.PIPE)
[email protected]38b04f82010-07-13 23:03:34938 REPO_REV = proc.stdout.read().strip()
939 proc.stdout.close()
940
941 proc.stderr.read()
942 proc.stderr.close()
943
944 if proc.wait() != 0:
[email protected]3bdfbeb2014-02-06 04:52:54945 _print('fatal: %s has no current branch' % gitdir, file=sys.stderr)
[email protected]38b04f82010-07-13 23:03:34946 sys.exit(1)
947
948
949def main(orig_args):
[email protected]38b04f82010-07-13 23:03:34950 cmd, opt, args = _ParseArguments(orig_args)
951
vapierae39f562016-10-11 02:08:17952 repo_main, rel_repo_dir = None, None
953 # Don't use the local repo copy, make sure to switch to the gitc client first.
954 if cmd != 'gitc-init':
955 repo_main, rel_repo_dir = _FindRepo()
956
[email protected]38b04f82010-07-13 23:03:34957 wrapper_path = os.path.abspath(__file__)
958 my_main, my_git = _RunSelf(wrapper_path)
959
vapierae39f562016-10-11 02:08:17960 cwd = os.getcwd()
961 if get_gitc_manifest_dir() and cwd.startswith(get_gitc_manifest_dir()):
962 _print('error: repo cannot be used in the GITC local manifest directory.'
963 '\nIf you want to work on this GITC client please rerun this '
964 'command from the corresponding client under /gitc/',
965 file=sys.stderr)
966 sys.exit(1)
[email protected]8db6c882012-12-25 17:02:37967 if not repo_main:
[email protected]38b04f82010-07-13 23:03:34968 if opt.help:
969 _Usage()
970 if cmd == 'help':
971 _Help(args)
972 if not cmd:
973 _NotInstalled()
vapierae39f562016-10-11 02:08:17974 if cmd == 'init' or cmd == 'gitc-init':
[email protected]38b04f82010-07-13 23:03:34975 if my_git:
976 _SetDefaultsTo(my_git)
977 try:
vapierae39f562016-10-11 02:08:17978 _Init(args, gitc_init=(cmd == 'gitc-init'))
[email protected]38b04f82010-07-13 23:03:34979 except CloneFailure:
vapier74751962016-09-14 23:08:34980 shutil.rmtree(os.path.join(repodir, S_repo), ignore_errors=True)
[email protected]38b04f82010-07-13 23:03:34981 sys.exit(1)
[email protected]8db6c882012-12-25 17:02:37982 repo_main, rel_repo_dir = _FindRepo()
[email protected]38b04f82010-07-13 23:03:34983 else:
984 _NoCommands(cmd)
985
[email protected]38b04f82010-07-13 23:03:34986 if my_main:
[email protected]8db6c882012-12-25 17:02:37987 repo_main = my_main
[email protected]38b04f82010-07-13 23:03:34988
[email protected]3bdfbeb2014-02-06 04:52:54989 ver_str = '.'.join(map(str, VERSION))
990 me = [sys.executable, repo_main,
[email protected]8db6c882012-12-25 17:02:37991 '--repo-dir=%s' % rel_repo_dir,
[email protected]38b04f82010-07-13 23:03:34992 '--wrapper-version=%s' % ver_str,
993 '--wrapper-path=%s' % wrapper_path,
994 '--']
995 me.extend(orig_args)
996 me.extend(extra_args)
997 try:
[email protected]3bdfbeb2014-02-06 04:52:54998 os.execv(sys.executable, me)
[email protected]8db6c882012-12-25 17:02:37999 except OSError as e:
[email protected]3bdfbeb2014-02-06 04:52:541000 _print("fatal: unable to start %s" % repo_main, file=sys.stderr)
1001 _print("fatal: %s" % e, file=sys.stderr)
[email protected]38b04f82010-07-13 23:03:341002 sys.exit(148)
1003
1004
1005if __name__ == '__main__':
vapier74751962016-09-14 23:08:341006 if ver[0] == 3:
1007 _print('warning: Python 3 support is currently experimental. YMMV.\n'
1008 'Please use Python 2.6 - 2.7 instead.',
1009 file=sys.stderr)
[email protected]38b04f82010-07-13 23:03:341010 main(sys.argv[1:])