From 02a91cba66f8ac46cdfbc2561f2339b680bc5bd2 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 23 Sep 2022 10:58:05 +0200 Subject: [PATCH] update: only show missing ipfs_cid warning once. --- fdroidserver/common.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 45505fe9..2c642675 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -287,6 +287,9 @@ def fill_config_defaults(thisconfig): if not thisconfig.get('apksigner'): logging.warning(_('apksigner not found! Cannot sign or verify modern APKs')) + if 'ipfs_cid' not in thisconfig and shutil.which('ipfs_cid'): + logging.warning(_("ipfs_cid not found, skipping CIDv1 generation")) + for k in ['ndk_paths', 'java_paths']: d = thisconfig[k] for k2 in d.copy(): @@ -4144,17 +4147,15 @@ def run_yamllint(path, indent=0): def calculate_IPFS_cid(filename): - """ - Calculate the IPFS CID of a file and add it to the index. + """Calculate the IPFS CID of a file and add it to the index. uses ipfs_cid package at https://packages.debian.org/sid/ipfs-cid Returns CIDv1 of a file as per IPFS recommendation """ - exe_name = 'ipfs_cid' - if not set_command_in_config(exe_name) or not config.get(exe_name): - logging.info(_("%s not found, skipping CIDv1 generation") % exe_name) + cmd = config and config.get('ipfs_cid') + if not cmd: return - file_cid = subprocess.run([config[exe_name], filename], capture_output=True) + file_cid = subprocess.run([cmd, filename], capture_output=True) if file_cid.returncode == 0: cid_output = file_cid.stdout.decode()