Revert "tools-bliss: update repo to v2.0"

This reverts commit 78646b12fa3057e5e031c899a94a5f6049566014.
diff --git a/linux-x86/bin/repo b/linux-x86/bin/repo
index 2b12529..2f634d9 100755
--- a/linux-x86/bin/repo
+++ b/linux-x86/bin/repo
@@ -10,93 +10,13 @@
 
 from __future__ import print_function
 
-import os
-import platform
-import subprocess
-import sys
-
-
-def exec_command(cmd):
-  """Execute |cmd| or return None on failure."""
-  try:
-    if platform.system() == 'Windows':
-      ret = subprocess.call(cmd)
-      sys.exit(ret)
-    else:
-      os.execvp(cmd[0], cmd)
-  except:
-    pass
-
-
-def check_python_version():
-  """Make sure the active Python version is recent enough."""
-  def reexec(prog):
-    exec_command([prog] + sys.argv)
-
-  MIN_PYTHON_VERSION = (3, 6)
-
-  ver = sys.version_info
-  major = ver.major
-  minor = ver.minor
-
-  # Abort on very old Python 2 versions.
-  if (major, minor) < (2, 7):
-    print('repo: error: Your Python version is too old. '
-          'Please use Python {}.{} or newer instead.'.format(
-              *MIN_PYTHON_VERSION), file=sys.stderr)
-    sys.exit(1)
-
-  # Try to re-exec the version specific Python 3 if needed.
-  if (major, minor) < MIN_PYTHON_VERSION:
-    # Python makes releases ~once a year, so try our min version +10 to help
-    # bridge the gap.  This is the fallback anyways so perf isn't critical.
-    min_major, min_minor = MIN_PYTHON_VERSION
-    for inc in range(0, 10):
-      reexec('python{}.{}'.format(min_major, min_minor + inc))
-
-    # Try the generic Python 3 wrapper, but only if it's new enough.  We don't
-    # want to go from (still supported) Python 2.7 to (unsupported) Python 3.5.
-    try:
-      proc = subprocess.Popen(
-          ['python3', '-c', 'import sys; '
-           'print(sys.version_info.major, sys.version_info.minor)'],
-          stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-      (output, _) = proc.communicate()
-      python3_ver = tuple(int(x) for x in output.decode('utf-8').split())
-    except (OSError, subprocess.CalledProcessError):
-      python3_ver = None
-
-    # The python3 version looks like it's new enough, so give it a try.
-    if python3_ver and python3_ver >= MIN_PYTHON_VERSION:
-      reexec('python3')
-
-    # We're still here, so diagnose things for the user.
-    if major < 3:
-      print('repo: warning: Python 2 is no longer supported; '
-            'Please upgrade to Python {}.{}+.'.format(*MIN_PYTHON_VERSION),
-            file=sys.stderr)
-    else:
-      print('repo: error: Python 3 version is too old; '
-            'Please use Python {}.{} or newer.'.format(*MIN_PYTHON_VERSION),
-            file=sys.stderr)
-      sys.exit(1)
-
-
-if __name__ == '__main__':
-  # TODO(vapier): Enable this on Windows once we have Python 3 issues fixed.
-  if platform.system() != 'Windows':
-    check_python_version()
-
-
 # repo default configuration
 #
 import os
 REPO_URL = os.environ.get('REPO_URL', None)
 if not REPO_URL:
   REPO_URL = 'https://gerrit.googlesource.com/git-repo'
-REPO_REV = os.environ.get('REPO_REV')
-if not REPO_REV:
-  REPO_REV = 'stable'
+REPO_REV = 'stable'
 
 # Copyright (C) 2008 Google Inc.
 #
@@ -113,10 +33,10 @@
 # limitations under the License.
 
 # increment this whenever we make important changes to this script
-VERSION = (2, 0)
+VERSION = (1, 26)
 
 # increment this if the MAINTAINER_KEYS block is modified
-KEYRING_VERSION = (2, 0)
+KEYRING_VERSION = (1, 2)
 
 # Each individual key entry is created by using:
 # gpg --armor --export keyid
@@ -163,14 +83,47 @@
 TACbBS+Up3RpfYVfd63c1cDdlru13pQAn3NQy/SN858MkxN+zym86UBgOad2
 =CMiZ
 -----END PGP PUBLIC KEY BLOCK-----
+
+     Conley Owens <cco3@android.com>
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.11 (GNU/Linux)
+
+mQENBFHRvc8BCADFg45Xx/y6QDC+T7Y/gGc7vx0ww7qfOwIKlAZ9xG3qKunMxo+S
+hPCnzEl3cq+6I1Ww/ndop/HB3N3toPXRCoN8Vs4/Hc7by+SnaLFnacrm+tV5/OgT
+V37Lzt8lhay1Kl+YfpFwHYYpIEBLFV9knyfRXS/428W2qhdzYfvB15/AasRmwmor
+py4NIzSs8UD/SPr1ihqNCdZM76+MQyN5HMYX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RxeA/lJ
+I3KnyCDTpXuIeBKPGkdL8uMATC9Z8DnBBajRlftNDVZS3Hz4G09G9QpMojvJkFJV
+By+01Flw/X+eeN8NpqSuLV4W+AjEO8at/VvgKr1AFvBRdZ7GkpI1o6DgPe7ZqX+1
+dzQZt3e13W0rVBb/bUgx9iSLoeWP3aq/k+/GRGOR+S6F6BBSl0SQ2EF2+dIywb1x
+JuinEP+AwLAUZ1Bsx9ISC0Agpk2VeHXPL3FGhroEmoMvBzO0kTFGyoeT7PR/BfKv
++H/g3HsL2LOB9uoIm8/5p2TTU5ttYCXMHhQZ81AY
+=AUp4
+-----END PGP PUBLIC KEY BLOCK-----
 """
 
 GIT = 'git'                      # our git command
-MIN_GIT_VERSION = (2, 10, 2)     # 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, 7)      # minimum supported python version
 GITC_CONFIG_FILE = '/gitc/.config'
 GITC_FS_ROOT_DIR = '/gitc/manifest-rw/'
 
@@ -178,9 +131,12 @@
 import collections
 import errno
 import optparse
+import platform
 import re
 import shutil
 import stat
+import subprocess
+import sys
 
 if sys.version_info[0] == 3:
   import urllib.request
@@ -193,6 +149,17 @@
   urllib.error = urllib2
 
 
+# Python version check
+ver = sys.version_info
+if (ver[0], ver[1]) < MIN_PYTHON_VERSION:
+  print('error: Python version {} unsupported.\n'
+        'Please use Python {}.{} instead.'.format(
+            sys.version.split(' ')[0],
+            MIN_PYTHON_VERSION[0],
+            MIN_PYTHON_VERSION[1],
+        ), file=sys.stderr)
+  sys.exit(1)
+
 home_dot_repo = os.path.expanduser('~/.repoconfig')
 gpg_dir = os.path.join(home_dot_repo, 'gnupg')
 
@@ -268,10 +235,10 @@
 group = init_optparse.add_option_group('repo Version options')
 group.add_option('--repo-url',
                  dest='repo_url',
-                 help='repo repository location ($REPO_URL)', metavar='URL')
+                 help='repo repository location', metavar='URL')
 group.add_option('--repo-branch',
                  dest='repo_branch',
-                 help='repo branch or revision ($REPO_REV)', metavar='REVISION')
+                 help='repo branch or revision', metavar='REVISION')
 group.add_option('--no-repo-verify',
                  dest='no_repo_verify', action='store_true',
                  help='do not verify repo source code')
@@ -399,18 +366,15 @@
 
   _CheckGitVersion()
   try:
-    if opt.no_repo_verify:
-      do_verify = False
+    if NeedSetupGnuPG():
+      can_verify = SetupGnuPG(opt.quiet)
     else:
-      if NeedSetupGnuPG():
-        do_verify = SetupGnuPG(opt.quiet)
-      else:
-        do_verify = True
+      can_verify = True
 
     dst = os.path.abspath(os.path.join(repodir, S_repo))
     _Clone(url, dst, opt.quiet, not opt.no_clone_bundle)
 
-    if do_verify:
+    if can_verify and not opt.no_repo_verify:
       rev = _Verify(dst, branch, opt.quiet)
     else:
       rev = 'refs/remotes/origin/%s^0' % branch
@@ -549,8 +513,9 @@
     sys.exit(1)
   print()
 
-  with open(os.path.join(home_dot_repo, 'keyring-version'), 'w') as fd:
-    fd.write('.'.join(map(str, KEYRING_VERSION)) + '\n')
+  fd = open(os.path.join(home_dot_repo, 'keyring-version'), 'w')
+  fd.write('.'.join(map(str, KEYRING_VERSION)) + '\n')
+  fd.close()
   return True
 
 
@@ -959,9 +924,15 @@
         '--']
   me.extend(orig_args)
   me.extend(extra_args)
-  exec_command(me)
-  print("fatal: unable to start %s" % repo_main, file=sys.stderr)
-  sys.exit(148)
+  try:
+    if platform.system() == "Windows":
+      sys.exit(subprocess.call(me))
+    else:
+      os.execv(sys.executable, me)
+  except OSError as e:
+    print("fatal: unable to start %s" % repo_main, file=sys.stderr)
+    print("fatal: %s" % e, file=sys.stderr)
+    sys.exit(148)
 
 
 if __name__ == '__main__':