diff options
| -rwxr-xr-x | repo | 21 |
1 files changed, 12 insertions, 9 deletions
| @@ -650,13 +650,19 @@ def SetupGnuPG(quiet): | |||
| 650 | file=sys.stderr) | 650 | file=sys.stderr) |
| 651 | sys.exit(1) | 651 | sys.exit(1) |
| 652 | 652 | ||
| 653 | env = os.environ.copy() | 653 | if not quiet: |
| 654 | _setenv('GNUPGHOME', gpg_dir, env) | 654 | print('repo: Updating release signing keys to keyset ver %s' % |
| 655 | 655 | ('.'.join(str(x) for x in KEYRING_VERSION),)) | |
| 656 | cmd = ['gpg', '--import'] | 656 | # NB: We use --homedir (and cwd below) because some environments (Windows) do |
| 657 | # not correctly handle full native paths. We avoid the issue by changing to | ||
| 658 | # the right dir with cwd=gpg_dir before executing gpg, and then telling gpg to | ||
| 659 | # use the cwd (.) as its homedir which leaves the path resolution logic to it. | ||
| 660 | cmd = ['gpg', '--homedir', '.', '--import'] | ||
| 657 | try: | 661 | try: |
| 658 | run_command(cmd, env=env, stdin=subprocess.PIPE, | 662 | # gpg can be pretty chatty. Always capture the output and if something goes |
| 659 | capture_output=quiet, | 663 | # wrong, the builtin check failure will dump stdout & stderr for debugging. |
| 664 | run_command(cmd, stdin=subprocess.PIPE, capture_output=True, | ||
| 665 | cwd=gpg_dir, check=True, | ||
| 660 | input=MAINTAINER_KEYS.encode('utf-8')) | 666 | input=MAINTAINER_KEYS.encode('utf-8')) |
| 661 | except OSError: | 667 | except OSError: |
| 662 | if not quiet: | 668 | if not quiet: |
| @@ -665,9 +671,6 @@ def SetupGnuPG(quiet): | |||
| 665 | print(file=sys.stderr) | 671 | print(file=sys.stderr) |
| 666 | return False | 672 | return False |
| 667 | 673 | ||
| 668 | if not quiet: | ||
| 669 | print() | ||
| 670 | |||
| 671 | with open(os.path.join(home_dot_repo, 'keyring-version'), 'w') as fd: | 674 | with open(os.path.join(home_dot_repo, 'keyring-version'), 'w') as fd: |
| 672 | fd.write('.'.join(map(str, KEYRING_VERSION)) + '\n') | 675 | fd.write('.'.join(map(str, KEYRING_VERSION)) + '\n') |
| 673 | return True | 676 | return True |
