From bf913703c5c41d025ccd10e17c53a2851124fd50 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 1 Dec 2017 10:07:21 +0100 Subject: [PATCH] nightly: only use read_config to load final, generated config.py This needs to use the config loading routine to find Java `keytool`, but since it doesn't need to fully load the config, isolate that usage in the function. Then read_config() is only ever called once, as is it meant to be used, once the config.py is generated. Using `from . import common; common.config = foo` will not always work, due to some oddities to how the `from` imports work. So the full module has to be imported in order to make sure its always properly set. --- fdroidserver/nightly.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fdroidserver/nightly.py b/fdroidserver/nightly.py index 20c55e96..ddb66ebb 100644 --- a/fdroidserver/nightly.py +++ b/fdroidserver/nightly.py @@ -51,7 +51,9 @@ def _ssh_key_from_debug_keystore(): privkey = os.path.join(tmp_dir, '.privkey') key_pem = os.path.join(tmp_dir, '.key.pem') p12 = os.path.join(tmp_dir, '.keystore.p12') - subprocess.check_call([common.config['keytool'], '-importkeystore', + _config = dict() + common.fill_config_defaults(_config) + subprocess.check_call([_config['keytool'], '-importkeystore', '-srckeystore', KEYSTORE_FILE, '-srcalias', KEY_ALIAS, '-srcstorepass', PASSWORD, '-srckeypass', PASSWORD, '-destkeystore', p12, '-destalias', KEY_ALIAS, @@ -91,7 +93,6 @@ def main(): help=_("Don't use rsync checksums")) # TODO add --with-btlog options = parser.parse_args() - common.read_config(None) # force a tighter umask since this writes private key material umask = os.umask(0o077) -- 2.30.2