From 29838a8baeed0cc36f2aea36b78772c7a181f29c Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 5 Oct 2022 14:31:42 +0200 Subject: [PATCH 1/5] gitlab-ci: update alpine to supported version --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: From 02a91cba66f8ac46cdfbc2561f2339b680bc5bd2 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 23 Sep 2022 10:58:05 +0200 Subject: [PATCH 2/5] 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() From 828eb938c33c472dff7fceaa931375f1acb96c45 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 5 Oct 2022 14:45:57 +0200 Subject: [PATCH 3/5] gradlew-fdroid: Gradle Android Plugin 7.3 needs Gradle 7.4 --- gradlew-fdroid | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 1.5 1.3 1.2 1.1 1.0 0.14 0.13 0.12 0.11 0.10 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2) -d_plugin_v=(7.3.3 7.2 7.0.2 6.7.1 6.5 6.1.1 5.6.4 5.4.1 5.1.1 4.10.1 4.6 4.4 4.1 3.3 2.14.1 2.14.1 2.12 2.12 2.4 2.4 2.3 2.2.1 2.2.1 2.1 2.1 1.12 1.12 1.12 1.11 1.10 1.9 1.8 1.6 1.6 1.4 1.4) +d_plugin_k=(7.3 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 1.5 1.3 1.2 1.1 1.0 0.14 0.13 0.12 0.11 0.10 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2) +d_plugin_v=(7.4 7.3.3 7.2 7.0.2 6.7.1 6.5 6.1.1 5.6.4 5.4.1 5.1.1 4.10.1 4.6 4.4 4.1 3.3 2.14.1 2.14.1 2.12 2.12 2.4 2.4 2.3 2.2.1 2.2.1 2.1 2.1 1.12 1.12 1.12 1.11 1.10 1.9 1.8 1.6 1.6 1.4 1.4) # All gradle versions we know about plugin_v=(7.5.1 7.5 7.4.2 7.4.1 7.4 7.3.3 7.3.2 7.3.1 7.3 7.2 7.1.1 7.1 7.0.2 7.0.1 7.0 6.9.2 6.9.1 6.9 6.8.3 6.8.2 6.8.1 6.8 6.7.1 6.7 6.6.1 6.6 6.5.1 6.5 6.4.1 6.4 6.3 6.2.2 6.2.1 6.2 6.1.1 6.1 6.0.1 6.0 5.6.4 5.6.3 5.6.2 5.6.1 5.6 5.5.1 5.5 5.4.1 5.4 5.3.1 5.3 5.2.1 5.2 5.1.1 5.1 5.0 4.10.3 4.10.2 4.10.1 4.10 4.9 4.8.1 4.8 4.7 4.6 4.5.1 4.5 4.4.1 4.4 4.3.1 4.3 4.2.1 4.2 4.1 4.0.2 4.0.1 4.0 3.5.1 3.5 3.4.1 3.4 3.3 3.2.1 3.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) From 353ee84a6fc864fbf2d10165fa1514459292d962 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 5 Oct 2022 16:46:26 +0200 Subject: [PATCH 4/5] test that get_apk_id throws exceptions (issuebot#60) --- tests/common.TestCase | 11 +++++++++++ 1 file changed, 11 insertions(+) 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') From f97dc0d010c1a637fa821936fa003646785b70c4 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 6 Sep 2022 15:49:21 +0200 Subject: [PATCH 5/5] version 2.2 alpha 0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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',