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

Unified Diff: repo

Issue 146723003: Update to repo version v1.12.13-cr1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: repo
diff --git a/repo b/repo
index f56d678189965f307f4c73c411c845a1c5b19e0e..c617e5fb76fa3022273971d98bd44412748c7dab 100755
--- a/repo
+++ b/repo
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env python
## repo default configuration
##
@@ -19,19 +19,11 @@ REPO_REV='stable'
# See the License for the specific language governing permissions and
# limitations under the License.
-magic='--calling-python-from-/bin/sh--'
-"""exec" python -E "$0" "$@" """#$magic"
-if __name__ == '__main__':
- import sys
- if sys.argv[-1] == '#%s' % magic:
- del sys.argv[-1]
-del magic
-
# increment this whenever we make important changes to this script
-VERSION = (1, 18)
+VERSION = (1, 21)
# increment this if the MAINTAINER_KEYS block is modified
-KEYRING_VERSION = (1,2)
+KEYRING_VERSION = (1, 3)
MAINTAINER_KEYS = """
Repo Maintainer <repo@android.kernel.org>
@@ -80,32 +72,32 @@ TACbBS+Up3RpfYVfd63c1cDdlru13pQAn3NQy/SN858MkxN+zym86UBgOad2
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.11 (GNU/Linux)
-mQENBFBiLPwBCACvISTASOgFXwADw2GYRH2I2z9RvYkYoZ6ThTTNlMXbbYYKO2Wo
-a9LQDNW0TbCEekg5UKk0FD13XOdWaqUt4Gtuvq9c43GRSjMO6NXH+0BjcQ8vUtY2
-/W4CYUevwdo4nQ1+1zsOCu1XYe/C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Cud3zA==
"""
GIT = 'git' # our git command
-MIN_GIT_VERSION = (1, 5, 4) # minimum supported git version
+MIN_GIT_VERSION = (1, 7, 2) # minimum supported git version
repodir = '.repo' # name of repo's private directory
S_repo = 'repo' # special repo repository
S_manifests = 'manifests' # special manifest repository
REPO_MAIN = S_repo + '/main.py' # main script
+MIN_PYTHON_VERSION = (2, 6) # minimum supported python version
+import errno
import optparse
import os
import re
+import stat
import subprocess
import sys
-import urllib2
+
+if sys.version_info[0] == 3:
+ import urllib.request
+ import urllib.error
+else:
+ import imp
+ import urllib2
+ urllib = imp.new_module('urllib')
+ urllib.request = urllib2
+ urllib.error = urllib2
+
+
+def _print(*objects, **kwargs):
+ sep = kwargs.get('sep', ' ')
+ end = kwargs.get('end', '\n')
+ out = kwargs.get('file', sys.stdout)
+ out.write(sep.join(objects) + end)
+
+
+# Python version check
+ver = sys.version_info
+if ver[0] == 3:
+ _print('warning: Python 3 support is currently experimental. YMMV.\n'
+ 'Please use Python 2.6 - 2.7 instead.',
+ file=sys.stderr)
+if (ver[0], ver[1]) < MIN_PYTHON_VERSION:
+ _print('error: Python version %s unsupported.\n'
+ 'Please use Python 2.6 - 2.7 instead.'
+ % sys.version.split(' ')[0], file=sys.stderr)
+ sys.exit(1)
home_dot_repo = os.path.expanduser('~/.repoconfig')
gpg_dir = os.path.join(home_dot_repo, 'gnupg')
@@ -180,16 +204,22 @@ group.add_option('-m', '--manifest-name',
help='initial manifest file', metavar='NAME.xml')
group.add_option('--mirror',
dest='mirror', action='store_true',
- help='mirror the forrest')
+ help='create a replica of the remote repositories '
+ 'rather than a client working directory')
group.add_option('--reference',
dest='reference',
help='location of mirror directory', metavar='DIR')
group.add_option('--depth', type='int', default=None,
dest='depth',
help='create a shallow clone with given depth; see git clone')
+group.add_option('--archive',
+ dest='archive', action='store_true',
+ help='checkout an archive instead of a git repository for '
+ 'each project. See git archive.')
group.add_option('-g', '--groups',
dest='groups', default='default',
- help='restrict manifest projects to ones with a specified group',
+ help='restrict manifest projects to ones with specified '
+ 'group(s) [default|all|G1,G2,G3|G4,-G5,-G6]',
metavar='GROUP')
group.add_option('-p', '--platform',
dest='platform', default="auto",
@@ -242,17 +272,16 @@ def _Init(args):
if branch.startswith('refs/heads/'):
branch = branch[len('refs/heads/'):]
if branch.startswith('refs/'):
- print >>sys.stderr, "fatal: invalid branch name '%s'" % branch
+ _print("fatal: invalid branch name '%s'" % branch, file=sys.stderr)
raise CloneFailure()
- if not os.path.isdir(repodir):
- try:
- os.mkdir(repodir)
- except OSError as e:
- print >>sys.stderr, \
- 'fatal: cannot make %s directory: %s' % (
- repodir, e.strerror)
- # Don't faise CloneFailure; that would delete the
+ try:
+ os.mkdir(repodir)
+ except OSError as e:
+ if e.errno != errno.EEXIST:
+ _print('fatal: cannot make %s directory: %s'
+ % (repodir, e.strerror), file=sys.stderr)
+ # Don't raise CloneFailure; that would delete the
# name. Instead exit immediately.
#
sys.exit(1)
@@ -275,37 +304,50 @@ def _Init(args):
_Checkout(dst, branch, rev, opt.quiet)
except CloneFailure:
if opt.quiet:
- print >>sys.stderr, \
- 'fatal: repo init failed; run without --quiet to see why'
+ _print('fatal: repo init failed; run without --quiet to see why',
+ file=sys.stderr)
raise
+def ParseGitVersion(ver_str):
+ if not ver_str.startswith('git version '):
+ return None
+
+ num_ver_str = ver_str[len('git version '):].strip().split('-')[0]
+ to_tuple = []
+ for num_str in num_ver_str.split('.')[:3]:
+ if num_str.isdigit():
+ to_tuple.append(int(num_str))
+ else:
+ to_tuple.append(0)
+ return tuple(to_tuple)
+
+
def _CheckGitVersion():
cmd = [GIT, '--version']
try:
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
except OSError as e:
- print >>sys.stderr
- print >>sys.stderr, "fatal: '%s' is not available" % GIT
- print >>sys.stderr, 'fatal: %s' % e
- print >>sys.stderr
- print >>sys.stderr, 'Please make sure %s is installed'\
- ' and in your path.' % GIT
+ _print(file=sys.stderr)
+ _print("fatal: '%s' is not available" % GIT, file=sys.stderr)
+ _print('fatal: %s' % e, file=sys.stderr)
+ _print(file=sys.stderr)
+ _print('Please make sure %s is installed and in your path.' % GIT,
+ file=sys.stderr)
raise CloneFailure()
ver_str = proc.stdout.read().strip()
proc.stdout.close()
proc.wait()
- if not ver_str.startswith('git version '):
- print >>sys.stderr, 'error: "%s" unsupported' % ver_str
+ ver_act = ParseGitVersion(ver_str)
+ if ver_act is None:
+ _print('error: "%s" unsupported' % ver_str, file=sys.stderr)
raise CloneFailure()
- ver_str = ver_str[len('git version '):].strip()
- ver_act = tuple(map(lambda x: int(x), ver_str.split('.')[0:3]))
if ver_act < MIN_GIT_VERSION:
- need = '.'.join(map(lambda x: str(x), MIN_GIT_VERSION))
- print >>sys.stderr, 'fatal: git %s or later required' % need
+ need = '.'.join(map(str, MIN_GIT_VERSION))
+ _print('fatal: git %s or later required' % need, file=sys.stderr)
raise CloneFailure()
@@ -321,29 +363,27 @@ def NeedSetupGnuPG():
if not kv:
return True
- kv = tuple(map(lambda x: int(x), kv.split('.')))
+ kv = tuple(map(int, kv.split('.')))
if kv < KEYRING_VERSION:
return True
return False
def SetupGnuPG(quiet):
- if not os.path.isdir(home_dot_repo):
- try:
- os.mkdir(home_dot_repo)
- except OSError as e:
- print >>sys.stderr, \
- 'fatal: cannot make %s directory: %s' % (
- home_dot_repo, e.strerror)
+ try:
+ os.mkdir(home_dot_repo)
+ except OSError as e:
+ if e.errno != errno.EEXIST:
+ _print('fatal: cannot make %s directory: %s'
+ % (home_dot_repo, e.strerror), file=sys.stderr)
sys.exit(1)
- if not os.path.isdir(gpg_dir):
- try:
- os.mkdir(gpg_dir, 0700)
- except OSError as e:
- print >>sys.stderr, \
- 'fatal: cannot make %s directory: %s' % (
- gpg_dir, e.strerror)
+ try:
+ os.mkdir(gpg_dir, stat.S_IRWXU)
+ except OSError as e:
+ if e.errno != errno.EEXIST:
+ _print('fatal: cannot make %s directory: %s' % (gpg_dir, e.strerror),
+ file=sys.stderr)
sys.exit(1)
env = os.environ.copy()
@@ -356,21 +396,21 @@ def SetupGnuPG(quiet):
stdin = subprocess.PIPE)
except OSError as e:
if not quiet:
- print >>sys.stderr, 'warning: gpg (GnuPG) is not available.'
- print >>sys.stderr, 'warning: Installing it is strongly encouraged.'
- print >>sys.stderr
+ _print('warning: gpg (GnuPG) is not available.', file=sys.stderr)
+ _print('warning: Installing it is strongly encouraged.', file=sys.stderr)
+ _print(file=sys.stderr)
return False
proc.stdin.write(MAINTAINER_KEYS)
proc.stdin.close()
if proc.wait() != 0:
- print >>sys.stderr, 'fatal: registering repo maintainer keys failed'
+ _print('fatal: registering repo maintainer keys failed', file=sys.stderr)
sys.exit(1)
- print
+ _print()
fd = open(os.path.join(home_dot_repo, 'keyring-version'), 'w')
- fd.write('.'.join(map(lambda x: str(x), KEYRING_VERSION)) + '\n')
+ fd.write('.'.join(map(str, KEYRING_VERSION)) + '\n')
fd.close()
return True
@@ -386,7 +426,7 @@ def _SetConfig(local, name, value):
def _InitHttp():
handlers = []
- mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
+ mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
try:
import netrc
n = netrc.netrc()
@@ -396,20 +436,20 @@ def _InitHttp():
mgr.add_password(p[1], 'https://%s/' % host, p[0], p[2])
except:
pass
- handlers.append(urllib2.HTTPBasicAuthHandler(mgr))
- handlers.append(urllib2.HTTPDigestAuthHandler(mgr))
+ handlers.append(urllib.request.HTTPBasicAuthHandler(mgr))
+ handlers.append(urllib.request.HTTPDigestAuthHandler(mgr))
if 'http_proxy' in os.environ:
url = os.environ['http_proxy']
- handlers.append(urllib2.ProxyHandler({'http': url, 'https': url}))
+ handlers.append(urllib.request.ProxyHandler({'http': url, 'https': url}))
if 'REPO_CURL_VERBOSE' in os.environ:
- handlers.append(urllib2.HTTPHandler(debuglevel=1))
- handlers.append(urllib2.HTTPSHandler(debuglevel=1))
- urllib2.install_opener(urllib2.build_opener(*handlers))
+ handlers.append(urllib.request.HTTPHandler(debuglevel=1))
+ handlers.append(urllib.request.HTTPSHandler(debuglevel=1))
+ urllib.request.install_opener(urllib.request.build_opener(*handlers))
def _Fetch(url, local, src, quiet):
if not quiet:
- print >>sys.stderr, 'Get %s' % url
+ _print('Get %s' % url, file=sys.stderr)
cmd = [GIT, 'fetch']
if quiet:
@@ -454,20 +494,20 @@ def _DownloadBundle(url, local, quiet):
dest = open(os.path.join(local, '.git', 'clone.bundle'), 'w+b')
try:
try:
- r = urllib2.urlopen(url)
- except urllib2.HTTPError as e:
- if e.code == 404:
+ r = urllib.request.urlopen(url)
+ except urllib.error.HTTPError as e:
+ if e.code in [403, 404]:
return False
- print >>sys.stderr, 'fatal: Cannot get %s' % url
- print >>sys.stderr, 'fatal: HTTP error %s' % e.code
+ _print('fatal: Cannot get %s' % url, file=sys.stderr)
+ _print('fatal: HTTP error %s' % e.code, file=sys.stderr)
raise CloneFailure()
- except urllib2.URLError as e:
- print >>sys.stderr, 'fatal: Cannot get %s' % url
- print >>sys.stderr, 'fatal: error %s' % e.reason
+ except urllib.error.URLError as e:
+ _print('fatal: Cannot get %s' % url, file=sys.stderr)
+ _print('fatal: error %s' % e.reason, file=sys.stderr)
raise CloneFailure()
try:
if not quiet:
- print >>sys.stderr, 'Get %s' % url
+ _print('Get %s' % url, file=sys.stderr)
while True:
buf = r.read(8192)
if buf == '':
@@ -491,24 +531,23 @@ def _Clone(url, local, quiet):
try:
os.mkdir(local)
except OSError as e:
- print >>sys.stderr, \
- 'fatal: cannot make %s directory: %s' \
- % (local, e.strerror)
+ _print('fatal: cannot make %s directory: %s' % (local, e.strerror),
+ file=sys.stderr)
raise CloneFailure()
cmd = [GIT, 'init', '--quiet']
try:
proc = subprocess.Popen(cmd, cwd = local)
except OSError as e:
- print >>sys.stderr
- print >>sys.stderr, "fatal: '%s' is not available" % GIT
- print >>sys.stderr, 'fatal: %s' % e
- print >>sys.stderr
- print >>sys.stderr, 'Please make sure %s is installed'\
- ' and in your path.' % GIT
+ _print(file=sys.stderr)
+ _print("fatal: '%s' is not available" % GIT, file=sys.stderr)
+ _print('fatal: %s' % e, file=sys.stderr)
+ _print(file=sys.stderr)
+ _print('Please make sure %s is installed and in your path.' % GIT,
+ file=sys.stderr)
raise CloneFailure()
if proc.wait() != 0:
- print >>sys.stderr, 'fatal: could not create %s' % local
+ _print('fatal: could not create %s' % local, file=sys.stderr)
raise CloneFailure()
_InitHttp()
@@ -536,21 +575,18 @@ def _Verify(cwd, branch, quiet):
proc.stderr.close()
if proc.wait() != 0 or not cur:
- print >>sys.stderr
- print >>sys.stderr,\
- "fatal: branch '%s' has not been signed" \
- % branch
+ _print(file=sys.stderr)
+ _print("fatal: branch '%s' has not been signed" % branch, file=sys.stderr)
raise CloneFailure()
m = re.compile(r'^(.*)-[0-9]{1,}-g[0-9a-f]{1,}$').match(cur)
if m:
cur = m.group(1)
if not quiet:
- print >>sys.stderr
- print >>sys.stderr, \
- "info: Ignoring branch '%s'; using tagged release '%s'" \
- % (branch, cur)
- print >>sys.stderr
+ _print(file=sys.stderr)
+ _print("info: Ignoring branch '%s'; using tagged release '%s'"
+ % (branch, cur), file=sys.stderr)
+ _print(file=sys.stderr)
env = os.environ.copy()
env['GNUPGHOME'] = gpg_dir.encode()
@@ -568,10 +604,10 @@ def _Verify(cwd, branch, quiet):
proc.stderr.close()
if proc.wait() != 0:
- print >>sys.stderr
- print >>sys.stderr, out
- print >>sys.stderr, err
- print >>sys.stderr
+ _print(file=sys.stderr)
+ _print(out, file=sys.stderr)
+ _print(err, file=sys.stderr)
+ _print(file=sys.stderr)
raise CloneFailure()
return '%s^0' % cur
@@ -625,7 +661,7 @@ def _ParseArguments(args):
opt = _Options()
arg = []
- for i in xrange(0, len(args)):
+ for i in range(len(args)):
a = args[i]
if a == '-h' or a == '--help':
opt.help = True
@@ -638,7 +674,7 @@ def _ParseArguments(args):
def _Usage():
- print >>sys.stderr,\
+ _print(
"""usage: repo COMMAND [ARGS]
repo is not yet installed. Use "repo init" to install it here.
@@ -649,7 +685,7 @@ The most commonly used repo commands are:
help Display detailed help on a command
For access to the full online help, install repo ("repo init").
-"""
+""", file=sys.stderr)
sys.exit(1)
@@ -659,25 +695,23 @@ def _Help(args):
init_optparse.print_help()
sys.exit(0)
else:
- print >>sys.stderr,\
- "error: '%s' is not a bootstrap command.\n"\
- ' For access to online help, install repo ("repo init").'\
- % args[0]
+ _print("error: '%s' is not a bootstrap command.\n"
+ ' For access to online help, install repo ("repo init").'
+ % args[0], file=sys.stderr)
else:
_Usage()
sys.exit(1)
def _NotInstalled():
- print >>sys.stderr,\
-'error: repo is not installed. Use "repo init" to install it here.'
+ _print('error: repo is not installed. Use "repo init" to install it here.',
+ file=sys.stderr)
sys.exit(1)
def _NoCommands(cmd):
- print >>sys.stderr,\
-"""error: command '%s' requires repo to be installed first.
- Use "repo init" to install it here.""" % cmd
+ _print("""error: command '%s' requires repo to be installed first.
+ Use "repo init" to install it here.""" % cmd, file=sys.stderr)
sys.exit(1)
@@ -714,7 +748,7 @@ def _SetDefaultsTo(gitdir):
proc.stderr.close()
if proc.wait() != 0:
- print >>sys.stderr, 'fatal: %s has no current branch' % gitdir
+ _print('fatal: %s has no current branch' % gitdir, file=sys.stderr)
sys.exit(1)
@@ -755,8 +789,8 @@ def main(orig_args):
if my_main:
repo_main = my_main
- ver_str = '.'.join(map(lambda x: str(x), VERSION))
- me = [repo_main,
+ ver_str = '.'.join(map(str, VERSION))
+ me = [sys.executable, repo_main,
'--repo-dir=%s' % rel_repo_dir,
'--wrapper-version=%s' % ver_str,
'--wrapper-path=%s' % wrapper_path,
@@ -764,10 +798,10 @@ def main(orig_args):
me.extend(orig_args)
me.extend(extra_args)
try:
- os.execv(repo_main, me)
+ os.execv(sys.executable, me)
except OSError as e:
- print >>sys.stderr, "fatal: unable to start %s" % repo_main
- print >>sys.stderr, "fatal: %s" % e
+ _print("fatal: unable to start %s" % repo_main, file=sys.stderr)
+ _print("fatal: %s" % e, file=sys.stderr)
sys.exit(148)
« 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