From cfa88a53355574647694de3070278c110606d351 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 13 May 2020 14:59:37 +0200 Subject: [PATCH 1/6] gitlab-ci: fix binfmt support for focal to run apksigner This manually mounts the binfmt_misc dir if its not present. It seems the Ubuntu/focal release stopped auto-mounting binfmt_misc: https://bugs.launchpad.net/binfmt-support/+bug/1878413 --- .gitlab-ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3832c933..a7d00a05 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -92,8 +92,10 @@ ubuntu_lts_ppa: - echo "deb http://ppa.launchpad.net/fdroid/fdroidserver/ubuntu $RELEASE main" >> /etc/apt/sources.list - apt-get update - apt-get dist-upgrade + - mount | grep binfmt_misc || mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc - apt-get install --install-recommends binfmt-support fdroidserver git python3-defusedxml python3-setuptools - - grep binfmt /proc/modules || apt -qy purge apksigner + - ls -l /proc/sys/fs/binfmt_misc || true + - test -e /proc/sys/fs/binfmt_misc/jarwrapper || apt -qy purge apksigner - cd tests - ./run-tests From 77367f1bff3aadab8eae0e98d01aa3b9aa3d29ea Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 13 May 2020 22:21:46 +0200 Subject: [PATCH 2/6] server: disable extraneous HTTP errors in upload_apk_to_virustotal This should be in the lowest level so that both the low level call, upload_apk_to_virustotal(), and the next level up, upload_to_virustotal(), both inherit this. --- fdroidserver/server.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fdroidserver/server.py b/fdroidserver/server.py index e261222b..b7f4ce53 100644 --- a/fdroidserver/server.py +++ b/fdroidserver/server.py @@ -512,9 +512,6 @@ def upload_to_virustotal(repo_section, virustotal_apikey): import requests requests # stop unused import warning - logging.getLogger("urllib3").setLevel(logging.WARNING) - logging.getLogger("requests").setLevel(logging.WARNING) - if repo_section == 'repo': if not os.path.exists('virustotal'): os.mkdir('virustotal') @@ -534,6 +531,9 @@ def upload_apk_to_virustotal(virustotal_apikey, packageName, apkName, hash, versionCode, **kwargs): import requests + logging.getLogger("urllib3").setLevel(logging.WARNING) + logging.getLogger("requests").setLevel(logging.WARNING) + outputfilename = os.path.join('virustotal', packageName + '_' + str(versionCode) + '_' + hash + '.json') From ba854ab24aa7bc0db7c421bf240b9fb08c353abc Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 13 May 2020 15:00:15 +0200 Subject: [PATCH 3/6] support Cordova's gradle file https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html --- fdroidserver/common.py | 1 + 1 file changed, 1 insertion(+) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 59b58e34..f0699f58 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -1364,6 +1364,7 @@ def manifest_paths(app_dir, flavours): os.path.join(app_dir, 'src', 'main', 'AndroidManifest.xml'), os.path.join(app_dir, 'src', 'AndroidManifest.xml'), os.path.join(app_dir, 'build.gradle'), + os.path.join(app_dir, 'build-extras.gradle'), os.path.join(app_dir, 'build.gradle.kts')] for flavour in flavours: From 30f2d62597d76bc2b012018aa94175c694539809 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 13 May 2020 15:00:38 +0200 Subject: [PATCH 4/6] import: fix --omit-disable flag, its a boolean --- fdroidserver/import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fdroidserver/import.py b/fdroidserver/import.py index 40746b99..70567bb9 100644 --- a/fdroidserver/import.py +++ b/fdroidserver/import.py @@ -73,7 +73,7 @@ def main(): help=_("Comma separated list of categories.")) parser.add_argument("-l", "--license", default=None, help=_("Overall license of the project.")) - parser.add_argument("--omit-disable", default=False, + parser.add_argument("--omit-disable", action="store_true", default=False, help=_("Do not add 'disable:' to the generated build entries")) parser.add_argument("--rev", default=None, help=_("Allows a different revision (or git branch) to be specified for the initial import")) From 1106795583213aa22d270b1a8bff5a2202e18750 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 1 Apr 2020 14:51:19 +0200 Subject: [PATCH 5/6] deploy: stop uploading to androidobservatory if its already up there --- fdroidserver/server.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fdroidserver/server.py b/fdroidserver/server.py index b7f4ce53..313ea424 100644 --- a/fdroidserver/server.py +++ b/fdroidserver/server.py @@ -492,12 +492,11 @@ def upload_apk_to_android_observatory(path): href = m.group() page = 'https://androidobservatory.org' - message = '' if href: message = (_('Found {apkfilename} at {url}') .format(apkfilename=apkfilename, url=(page + href))) - if message: logging.debug(message) + return # upload the file with a post request logging.info(_('Uploading {apkfilename} to androidobservatory.org') From df563d339acc2c35b896823625f96fd867494326 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 14 May 2020 11:54:32 +0200 Subject: [PATCH 6/6] fix pep8 E741 ambiguous variable name 'l' --- fdroidserver/install.py | 4 ++-- fdroidserver/lint.py | 22 +++++++++++----------- fdroidserver/scanner.py | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/fdroidserver/install.py b/fdroidserver/install.py index 968bb28f..c526f1ec 100644 --- a/fdroidserver/install.py +++ b/fdroidserver/install.py @@ -36,11 +36,11 @@ def devices(): p = SdkToolsPopen(['adb', "devices"]) if p.returncode != 0: raise FDroidException("An error occured when finding devices: %s" % p.output) - lines = [l for l in p.output.splitlines() if not l.startswith('* ')] + lines = [line for line in p.output.splitlines() if not line.startswith('* ')] if len(lines) < 3: return [] lines = lines[1:-1] - return [l.split()[0] for l in lines] + return [line.split()[0] for line in lines] def main(): diff --git a/fdroidserver/lint.py b/fdroidserver/lint.py index 276bf555..ab7d422c 100644 --- a/fdroidserver/lint.py +++ b/fdroidserver/lint.py @@ -189,9 +189,9 @@ def check_regexes(app): v = app.get(f) t = metadata.fieldtype(f) if t == metadata.TYPE_MULTILINE: - for l in v.splitlines(): - if m.match(l): - yield "%s at line '%s': %s" % (f, l, r) + for line in v.splitlines(): + if m.match(line): + yield "%s at line '%s': %s" % (f, line, r) else: if v is None: continue @@ -345,12 +345,12 @@ def check_duplicates(app): yield _("Description '%s' is just the app's summary") % app.Summary seenlines = set() - for l in app.Description.splitlines(): - if len(l) < 1: + for line in app.Description.splitlines(): + if len(line) < 1: continue - if l in seenlines: + if line in seenlines: yield _("Description has a duplicate line") - seenlines.add(l) + seenlines.add(line) desc_url = re.compile(r'(^|[^[])\[([^ ]+)( |\]|$)') @@ -369,18 +369,18 @@ def check_bulleted_lists(app): validchars = ['*', '#'] lchar = '' lcount = 0 - for l in app.Description.splitlines(): - if len(l) < 1: + for line in app.Description.splitlines(): + if len(line) < 1: lcount = 0 continue - if l[0] == lchar and l[1] == ' ': + if line[0] == lchar and line[1] == ' ': lcount += 1 if lcount > 2 and lchar not in validchars: yield _("Description has a list (%s) but it isn't bulleted (*) nor numbered (#)") % lchar break else: - lchar = l[0] + lchar = line[0] lcount = 1 diff --git a/fdroidserver/scanner.py b/fdroidserver/scanner.py index db990f97..3d5b700f 100644 --- a/fdroidserver/scanner.py +++ b/fdroidserver/scanner.py @@ -250,7 +250,7 @@ def scan_source(build_dir, build=metadata.Build()): if is_used_by_gradle(line): for name in suspects_found(line): count += handleproblem('usual suspect \'%s\' at line %d' % (name, i + 1), path_in_build_dir, filepath) - noncomment_lines = [l for l in lines if not common.gradle_comment.match(l)] + noncomment_lines = [line for line in lines if not common.gradle_comment.match(line)] joined = re.sub(r'[\n\r\s]+', ' ', ' '.join(noncomment_lines)) for m in gradle_mavenrepo.finditer(joined): url = m.group(2)