diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7727ee2b..37dd1dff 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -203,7 +203,7 @@ gradlew-fdroid: # Run all the various linters and static analysis tools. lint_format_safety_bandit_checks: - image: alpine:3.13 + image: alpine:3.16 variables: LANG: C.UTF-8 script: 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() diff --git a/gradlew-fdroid b/gradlew-fdroid index 571da45b..b07ccba7 100755 --- a/gradlew-fdroid +++ b/gradlew-fdroid @@ -196,8 +196,8 @@ contains() { # (key) should accept. plugin versions are actually prefixes and catch sub- # versions as well. Pairs are taken from: # https://developer.android.com/studio/releases/gradle-plugin#updating-gradle -d_plugin_k=(7.2.0 7.1 7.0 4.2 4.1 4.0 3.6 3.5 3.4 3.3 3.2 3.1 3.0 2.3 2.2 2.1.3 2.1 2.0 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.2 3.1 3.0 2.14.1 2.14 2.13 2.12 2.11 2.10 2.9 2.8 2.7 2.6 2.5 2.4 2.3 2.2.1 2.2 2.1 2.0 1.12 1.11 1.10 1.9 1.8 1.7 1.6 1.5 1.4 1.3 1.2 1.1 1.0 0.9.2 0.9.1 0.9 0.8 0.7) diff --git a/setup.py b/setup.py index 1d2cf6c6..253637ec 100755 --- a/setup.py +++ b/setup.py @@ -82,7 +82,7 @@ with open("README.md", "r") as fh: setup( name='fdroidserver', - version='2.1', + version='2.2a0', description='F-Droid Server Tools', long_description=long_description, long_description_content_type='text/markdown', diff --git a/tests/common.TestCase b/tests/common.TestCase index 26270a1b..ff260046 100755 --- a/tests/common.TestCase +++ b/tests/common.TestCase @@ -975,6 +975,17 @@ class CommonTest(unittest.TestCase): self.assertEqual(versionCode, vc, 'aapt versionCode parsing failed for ' + apkfilename) self.assertEqual(versionName, vn, 'aapt versionName parsing failed for ' + apkfilename) + def test_get_apk_id_bad_apk(self): + """get_apk_id should never return None on error, only raise exceptions""" + with self.assertRaises(KeyError): + fdroidserver.common.get_apk_id('Norway_bouvet_europe_2.obf.zip') + shutil.copy('Norway_bouvet_europe_2.obf.zip', self.tmpdir) + os.chdir(self.tmpdir) + with ZipFile('Norway_bouvet_europe_2.obf.zip', 'a') as zipfp: + zipfp.writestr('AndroidManifest.xml', 'not a manifest') + with self.assertRaises(KeyError): + fdroidserver.common.get_apk_id('Norway_bouvet_europe_2.obf.zip') + def test_get_apk_id_bad_path(self): with self.assertRaises(FDroidException): fdroidserver.common.get_apk_id('nope')