diff options
Diffstat (limited to 'repo')
| -rwxr-xr-x | repo | 23 |
1 files changed, 16 insertions, 7 deletions
| @@ -23,7 +23,7 @@ REPO_REV = 'stable' | |||
| 23 | # limitations under the License. | 23 | # limitations under the License. |
| 24 | 24 | ||
| 25 | # increment this whenever we make important changes to this script | 25 | # increment this whenever we make important changes to this script |
| 26 | VERSION = (1, 22) | 26 | VERSION = (1, 23) |
| 27 | 27 | ||
| 28 | # increment this if the MAINTAINER_KEYS block is modified | 28 | # increment this if the MAINTAINER_KEYS block is modified |
| 29 | KEYRING_VERSION = (1, 2) | 29 | KEYRING_VERSION = (1, 2) |
| @@ -196,6 +196,9 @@ group.add_option('-p', '--platform', | |||
| 196 | help='restrict manifest projects to ones with a specified ' | 196 | help='restrict manifest projects to ones with a specified ' |
| 197 | 'platform group [auto|all|none|linux|darwin|...]', | 197 | 'platform group [auto|all|none|linux|darwin|...]', |
| 198 | metavar='PLATFORM') | 198 | metavar='PLATFORM') |
| 199 | group.add_option('--no-clone-bundle', | ||
| 200 | dest='no_clone_bundle', action='store_true', | ||
| 201 | help='disable use of /clone.bundle on HTTP/HTTPS') | ||
| 199 | 202 | ||
| 200 | 203 | ||
| 201 | # Tool | 204 | # Tool |
| @@ -339,7 +342,7 @@ def _Init(args, gitc_init=False): | |||
| 339 | can_verify = True | 342 | can_verify = True |
| 340 | 343 | ||
| 341 | dst = os.path.abspath(os.path.join(repodir, S_repo)) | 344 | dst = os.path.abspath(os.path.join(repodir, S_repo)) |
| 342 | _Clone(url, dst, opt.quiet) | 345 | _Clone(url, dst, opt.quiet, not opt.no_clone_bundle) |
| 343 | 346 | ||
| 344 | if can_verify and not opt.no_repo_verify: | 347 | if can_verify and not opt.no_repo_verify: |
| 345 | rev = _Verify(dst, branch, opt.quiet) | 348 | rev = _Verify(dst, branch, opt.quiet) |
| @@ -432,7 +435,10 @@ def SetupGnuPG(quiet): | |||
| 432 | sys.exit(1) | 435 | sys.exit(1) |
| 433 | 436 | ||
| 434 | env = os.environ.copy() | 437 | env = os.environ.copy() |
| 435 | env['GNUPGHOME'] = gpg_dir.encode() | 438 | try: |
| 439 | env['GNUPGHOME'] = gpg_dir | ||
| 440 | except UnicodeEncodeError: | ||
| 441 | env['GNUPGHOME'] = gpg_dir.encode() | ||
| 436 | 442 | ||
| 437 | cmd = ['gpg', '--import'] | 443 | cmd = ['gpg', '--import'] |
| 438 | try: | 444 | try: |
| @@ -543,7 +549,7 @@ def _DownloadBundle(url, local, quiet): | |||
| 543 | try: | 549 | try: |
| 544 | r = urllib.request.urlopen(url) | 550 | r = urllib.request.urlopen(url) |
| 545 | except urllib.error.HTTPError as e: | 551 | except urllib.error.HTTPError as e: |
| 546 | if e.code in [401, 403, 404]: | 552 | if e.code in [401, 403, 404, 501]: |
| 547 | return False | 553 | return False |
| 548 | _print('fatal: Cannot get %s' % url, file=sys.stderr) | 554 | _print('fatal: Cannot get %s' % url, file=sys.stderr) |
| 549 | _print('fatal: HTTP error %s' % e.code, file=sys.stderr) | 555 | _print('fatal: HTTP error %s' % e.code, file=sys.stderr) |
| @@ -574,7 +580,7 @@ def _ImportBundle(local): | |||
| 574 | os.remove(path) | 580 | os.remove(path) |
| 575 | 581 | ||
| 576 | 582 | ||
| 577 | def _Clone(url, local, quiet): | 583 | def _Clone(url, local, quiet, clone_bundle): |
| 578 | """Clones a git repository to a new subdirectory of repodir | 584 | """Clones a git repository to a new subdirectory of repodir |
| 579 | """ | 585 | """ |
| 580 | try: | 586 | try: |
| @@ -604,7 +610,7 @@ def _Clone(url, local, quiet): | |||
| 604 | _SetConfig(local, | 610 | _SetConfig(local, |
| 605 | 'remote.origin.fetch', | 611 | 'remote.origin.fetch', |
| 606 | '+refs/heads/*:refs/remotes/origin/*') | 612 | '+refs/heads/*:refs/remotes/origin/*') |
| 607 | if _DownloadBundle(url, local, quiet): | 613 | if clone_bundle and _DownloadBundle(url, local, quiet): |
| 608 | _ImportBundle(local) | 614 | _ImportBundle(local) |
| 609 | _Fetch(url, local, 'origin', quiet) | 615 | _Fetch(url, local, 'origin', quiet) |
| 610 | 616 | ||
| @@ -638,7 +644,10 @@ def _Verify(cwd, branch, quiet): | |||
| 638 | _print(file=sys.stderr) | 644 | _print(file=sys.stderr) |
| 639 | 645 | ||
| 640 | env = os.environ.copy() | 646 | env = os.environ.copy() |
| 641 | env['GNUPGHOME'] = gpg_dir.encode() | 647 | try: |
| 648 | env['GNUPGHOME'] = gpg_dir | ||
| 649 | except UnicodeEncodeError: | ||
| 650 | env['GNUPGHOME'] = gpg_dir.encode() | ||
| 642 | 651 | ||
| 643 | cmd = [GIT, 'tag', '-v', cur] | 652 | cmd = [GIT, 'tag', '-v', cur] |
| 644 | proc = subprocess.Popen(cmd, | 653 | proc = subprocess.Popen(cmd, |
