diff options
author | lloyd <[email protected]> | 2013-03-04 22:12:42 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2013-03-04 22:12:42 +0000 |
commit | 2d5a3473654aaf4c3f76c1bec03239e35a182544 (patch) | |
tree | d83a4a0dbb270b52f6c0195c1ad01c62f4cdc2d5 /src | |
parent | 8027827632dbbd491303e2e56a8648f0991daeb0 (diff) |
Support for passphrase file
Diffstat (limited to 'src')
-rwxr-xr-x | src/build-data/scripts/dist.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/build-data/scripts/dist.py b/src/build-data/scripts/dist.py index 0e28a1c6b..745b11b13 100755 --- a/src/build-data/scripts/dist.py +++ b/src/build-data/scripts/dist.py @@ -90,12 +90,18 @@ def datestamp(db, rev_id): logging.info('Could not retreive date for %s' % (rev_id)) return 0 -def gpg_sign(keyid, files): +def gpg_sign(keyid, passphrase_file, files): for filename in files: logging.info('Signing %s using PGP id %s' % (filename, keyid)) - gpg = subprocess.Popen(['gpg', '--armor', '--detach-sign', - '--local-user', keyid, filename], + cmd = ['gpg', '--batch', '--armor', '--detach-sign', '--local-user', keyid, filename] + + if passphrase_file != None: + gpg += ['--passphrase-file', passphrase_file] + + logging.debug('Running %s' % (' '.join(cmd))) + + gpg = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -128,6 +134,10 @@ def parse_args(args): default='EFBADFBC', help='PGP signing key (default %default)') + parser.add_option('--pgp-passphrase-file', metavar='FILE', + default=None + help='PGP signing key passphrase file') + return parser.parse_args(args) def remove_file_if_exists(fspath): @@ -295,7 +305,7 @@ def main(args = None): output_files.append(output_archive) if options.pgp_key_id != '': - gpg_sign(options.pgp_key_id, output_files) + gpg_sign(options.pgp_key_id, options.pgp_passphrase_file, output_files) shutil.rmtree(output_basename) |