From 513c95894c44656f6e7d6a6d1f688e6686440d8d Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 23 Jan 2018 23:16:05 +0100 Subject: [PATCH] build: remove unused, unmaintained Kivy build method This code has never been used and contains some insecure uses of shell=True Building Kivy apps should be done with the buildozer=yes method. The buildozer method should probably be moved to a provisioner once that is in place. --- .gitlab-ci.yml | 2 + fdroidserver/build.py | 69 ------------------- fdroidserver/metadata.py | 10 ++- tests/metadata/dump/com.politedroid.yaml | 4 -- tests/metadata/dump/org.adaway.yaml | 28 -------- .../dump/org.smssecure.smssecure.yaml | 8 --- tests/metadata/dump/org.videolan.vlc.yaml | 66 ------------------ 7 files changed, 6 insertions(+), 181 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0d6785ba..8e64d558 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,6 +31,8 @@ metadata_v0: - git checkout $GITCOMMIT - cd fdroiddata - ../tests/dump_internal_metadata_format.py + - sed -i -e '/kivy\W false/d' + metadata/dump_*/*.yaml - diff -uw metadata/dump_* debian_testing: diff --git a/fdroidserver/build.py b/fdroidserver/build.py index 05700cf7..b8229f16 100644 --- a/fdroidserver/build.py +++ b/fdroidserver/build.py @@ -489,9 +489,6 @@ def build_local(app, build, vcs, build_dir, output_dir, log_dir, srclib_dir, ext p = FDroidPopen(cmd, cwd=root_dir) - elif bmethod == 'kivy': - pass - elif bmethod == 'buildozer': pass @@ -637,67 +634,6 @@ def build_local(app, build, vcs, build_dir, output_dir, log_dir, srclib_dir, ext bindir = os.path.join(root_dir, 'target') - elif bmethod == 'kivy': - logging.info("Building Kivy project...") - - spec = os.path.join(root_dir, 'buildozer.spec') - if not os.path.exists(spec): - raise BuildException("Expected to find buildozer-compatible spec at {0}" - .format(spec)) - - defaults = {'orientation': 'landscape', 'icon': '', - 'permissions': '', 'android.api': "18"} - bconfig = ConfigParser(defaults, allow_no_value=True) - bconfig.read(spec) - - distdir = os.path.join('python-for-android', 'dist', 'fdroid') - if os.path.exists(distdir): - shutil.rmtree(distdir) - - modules = bconfig.get('app', 'requirements').split(',') - - cmd = 'ANDROIDSDK=' + config['sdk_path'] - cmd += ' ANDROIDNDK=' + ndk_path - cmd += ' ANDROIDNDKVER=' + build.ndk - cmd += ' ANDROIDAPI=' + str(bconfig.get('app', 'android.api')) - cmd += ' VIRTUALENV=virtualenv' - cmd += ' ./distribute.sh' - cmd += ' -m ' + "'" + ' '.join(modules) + "'" - cmd += ' -d fdroid' - p = subprocess.Popen(cmd, cwd='python-for-android', shell=True) - if p.returncode != 0: - raise BuildException("Distribute build failed") - - cid = bconfig.get('app', 'package.domain') + '.' + bconfig.get('app', 'package.name') - if cid != app.id: - raise BuildException("Package ID mismatch between metadata and spec") - - orientation = bconfig.get('app', 'orientation', 'landscape') - if orientation == 'all': - orientation = 'sensor' - - cmd = ['./build.py' - '--dir', root_dir, - '--name', bconfig.get('app', 'title'), - '--package', app.id, - '--version', bconfig.get('app', 'version'), - '--orientation', orientation - ] - - perms = bconfig.get('app', 'permissions') - for perm in perms.split(','): - cmd.extend(['--permission', perm]) - - if config.get('app', 'fullscreen') == 0: - cmd.append('--window') - - icon = bconfig.get('app', 'icon.filename') - if icon: - cmd.extend(['--icon', os.path.join(root_dir, icon)]) - - cmd.append('release') - p = FDroidPopen(cmd, cwd=distdir) - elif bmethod == 'buildozer': logging.info("Building Kivy project using buildozer...") @@ -812,11 +748,6 @@ def build_local(app, build, vcs, build_dir, output_dir, log_dir, srclib_dir, ext raise BuildException('Failed to find output') src = m.group(1) src = os.path.join(bindir, src) + '.apk' - elif omethod == 'kivy': - src = os.path.join('python-for-android', 'dist', 'default', 'bin', - '{0}-{1}-release.apk'.format( - bconfig.get('app', 'title'), - bconfig.get('app', 'version'))) elif omethod == 'buildozer': src = None diff --git a/fdroidserver/metadata.py b/fdroidserver/metadata.py index a67bf152..b014c0dc 100644 --- a/fdroidserver/metadata.py +++ b/fdroidserver/metadata.py @@ -213,7 +213,6 @@ build_flags_order = [ 'patch', 'gradle', 'maven', - 'kivy', 'buildozer', 'output', 'srclibs', @@ -256,7 +255,6 @@ class Build(dict): self.patch = [] self.gradle = [] self.maven = False - self.kivy = False self.buildozer = False self.output = None self.srclibs = [] @@ -299,7 +297,7 @@ class Build(dict): raise AttributeError("No such attribute: " + name) def build_method(self): - for f in ['maven', 'gradle', 'kivy', 'buildozer']: + for f in ['maven', 'gradle', 'buildozer']: if self.get(f): return f if self.output: @@ -310,7 +308,7 @@ class Build(dict): def output_method(self): if self.output: return 'raw' - for f in ['maven', 'gradle', 'kivy', 'buildozer']: + for f in ['maven', 'gradle', 'buildozer']: if self.get(f): return f return 'ant' @@ -871,7 +869,7 @@ def post_metadata_parse(app): elif v == [False]: return ['no'] - _bool_allowed = ('disable', 'kivy', 'maven', 'buildozer') + _bool_allowed = ('disable', 'maven', 'buildozer') builds = [] if 'builds' in app: @@ -1114,7 +1112,7 @@ def write_yaml(mf, app): value = getattr(build, field) if field == 'gradle' and value == ['off']: value = [ruamel.yaml.scalarstring.SingleQuotedScalarString('off')] - if field in ('disable', 'kivy', 'maven', 'buildozer'): + if field in ('disable', 'maven', 'buildozer'): if value == 'no': continue elif value == 'yes': diff --git a/tests/metadata/dump/com.politedroid.yaml b/tests/metadata/dump/com.politedroid.yaml index 8d6ba982..9a0a9d7f 100644 --- a/tests/metadata/dump/com.politedroid.yaml +++ b/tests/metadata/dump/com.politedroid.yaml @@ -55,7 +55,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -89,7 +88,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -123,7 +121,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -158,7 +155,6 @@ builds: - 'yes' gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false diff --git a/tests/metadata/dump/org.adaway.yaml b/tests/metadata/dump/org.adaway.yaml index 89595b82..83c84877 100644 --- a/tests/metadata/dump/org.adaway.yaml +++ b/tests/metadata/dump/org.adaway.yaml @@ -76,7 +76,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -111,7 +110,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -147,7 +145,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -183,7 +180,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -219,7 +215,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -255,7 +250,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -290,7 +284,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -325,7 +318,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -360,7 +352,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -395,7 +386,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -430,7 +420,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -465,7 +454,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -499,7 +487,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -534,7 +521,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -568,7 +554,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -603,7 +588,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -638,7 +622,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -673,7 +656,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -715,7 +697,6 @@ builds: gradleprops: [] init: rm android-libs/Donations/custom_rules.xml && git clone https://github.com/dschuermann/HtmlSpanner android-libs/HtmlSpanner - kivy: false maven: false ndk: null novcheck: false @@ -762,7 +743,6 @@ builds: gradleprops: [] init: rm android-libs/Donations/custom_rules.xml && git clone https://github.com/dschuermann/HtmlSpanner android-libs/HtmlSpanner - kivy: false maven: false ndk: null novcheck: false @@ -804,7 +784,6 @@ builds: - 'yes' gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -841,7 +820,6 @@ builds: - 'yes' gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -878,7 +856,6 @@ builds: - 'yes' gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -915,7 +892,6 @@ builds: - 'yes' gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -952,7 +928,6 @@ builds: - 'yes' gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -989,7 +964,6 @@ builds: - 'yes' gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -1026,7 +1000,6 @@ builds: - 'yes' gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -1063,7 +1036,6 @@ builds: - 'yes' gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false diff --git a/tests/metadata/dump/org.smssecure.smssecure.yaml b/tests/metadata/dump/org.smssecure.smssecure.yaml index b8f9927f..99458452 100644 --- a/tests/metadata/dump/org.smssecure.smssecure.yaml +++ b/tests/metadata/dump/org.smssecure.smssecure.yaml @@ -73,7 +73,6 @@ builds: - 'yes' gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -119,7 +118,6 @@ builds: - 'yes' gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -157,7 +155,6 @@ builds: - 'yes' gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -194,7 +191,6 @@ builds: - 'yes' gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -231,7 +227,6 @@ builds: - 'yes' gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -267,7 +262,6 @@ builds: - 'yes' gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -303,7 +297,6 @@ builds: - 'yes' gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -339,7 +332,6 @@ builds: - 'yes' gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false diff --git a/tests/metadata/dump/org.videolan.vlc.yaml b/tests/metadata/dump/org.videolan.vlc.yaml index e47d51b4..d57852dd 100644 --- a/tests/metadata/dump/org.videolan.vlc.yaml +++ b/tests/metadata/dump/org.videolan.vlc.yaml @@ -77,7 +77,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -114,7 +113,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -151,7 +149,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -188,7 +185,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -222,7 +218,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -258,7 +253,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -294,7 +288,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -330,7 +323,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -366,7 +358,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -401,7 +392,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -436,7 +426,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -471,7 +460,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -506,7 +494,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -541,7 +528,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -576,7 +562,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -611,7 +596,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -646,7 +630,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -681,7 +664,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -716,7 +698,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -751,7 +732,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -786,7 +766,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -821,7 +800,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -856,7 +834,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -891,7 +868,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -926,7 +902,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -961,7 +936,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -996,7 +970,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -1031,7 +1004,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -1066,7 +1038,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -1101,7 +1072,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -1136,7 +1106,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -1171,7 +1140,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -1206,7 +1174,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -1241,7 +1208,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -1276,7 +1242,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -1311,7 +1276,6 @@ builds: gradle: [] gradleprops: [] init: '' - kivy: false maven: false ndk: null novcheck: false @@ -1347,7 +1311,6 @@ builds: - VanillaARMv6fpu gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -1384,7 +1347,6 @@ builds: - VanillaARMv7 gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -1421,7 +1383,6 @@ builds: - VanillaX86 gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -1458,7 +1419,6 @@ builds: - VanillaARMv6fpu gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -1495,7 +1455,6 @@ builds: - VanillaARMv7 gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -1532,7 +1491,6 @@ builds: - VanillaX86 gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -1569,7 +1527,6 @@ builds: - VanillaARMv6fpu gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -1606,7 +1563,6 @@ builds: - VanillaARMv7 gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -1643,7 +1599,6 @@ builds: - VanillaX86 gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -1680,7 +1635,6 @@ builds: - VanillaARMv6fpu gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -1717,7 +1671,6 @@ builds: - VanillaARMv7 gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -1754,7 +1707,6 @@ builds: - VanillaX86 gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -1791,7 +1743,6 @@ builds: - VanillaARMv6fpu gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -1828,7 +1779,6 @@ builds: - VanillaARMv7 gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -1865,7 +1815,6 @@ builds: - VanillaX86 gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -1902,7 +1851,6 @@ builds: - VanillaARMv6fpu gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -1939,7 +1887,6 @@ builds: - VanillaARMv7 gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -1976,7 +1923,6 @@ builds: - VanillaX86 gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -2013,7 +1959,6 @@ builds: - VanillaARMv6fpu gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -2050,7 +1995,6 @@ builds: - VanillaARMv7 gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -2087,7 +2031,6 @@ builds: - VanillaX86 gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -2124,7 +2067,6 @@ builds: - VanillaARMv6fpu gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -2161,7 +2103,6 @@ builds: - VanillaARMv7 gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -2198,7 +2139,6 @@ builds: - VanillaX86 gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -2235,7 +2175,6 @@ builds: - VanillaARMv6fpu gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -2272,7 +2211,6 @@ builds: - VanillaARMv7 gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -2309,7 +2247,6 @@ builds: - VanillaX86 gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -2346,7 +2283,6 @@ builds: - VanillaARMv6fpu gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -2383,7 +2319,6 @@ builds: - VanillaARMv7 gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false @@ -2420,7 +2355,6 @@ builds: - VanillaX86 gradleprops: [] init: '' - kivy: false maven: false ndk: r10d novcheck: false