From 82b1d7ad14a302ae63920f035a5192ce79a5b7c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Tue, 15 Nov 2016 20:55:06 +0000 Subject: [PATCH 1/3] all: make newer pycodestyle happy Apparently the "two empty lines" rule is now stricter. --- fdroid | 1 + fdroidserver/build.py | 2 ++ fdroidserver/checkupdates.py | 1 + fdroidserver/common.py | 3 +++ fdroidserver/import.py | 1 + fdroidserver/install.py | 1 + fdroidserver/lint.py | 4 ++++ fdroidserver/metadata.py | 4 ++++ fdroidserver/readmeta.py | 1 + fdroidserver/rewritemeta.py | 1 + fdroidserver/scanner.py | 1 + fdroidserver/server.py | 1 + fdroidserver/signindex.py | 1 + fdroidserver/stats.py | 2 ++ fdroidserver/update.py | 1 + fdroidserver/verify.py | 1 + makebuildserver | 2 ++ tests/common.TestCase | 1 + 18 files changed, 29 insertions(+) diff --git a/fdroid b/fdroid index 53cc00c5..af670d1b 100755 --- a/fdroid +++ b/fdroid @@ -143,5 +143,6 @@ def main(): raise sys.exit(0) + if __name__ == "__main__": main() diff --git a/fdroidserver/build.py b/fdroidserver/build.py index cbbed3cd..ac9ae552 100644 --- a/fdroidserver/build.py +++ b/fdroidserver/build.py @@ -995,6 +995,7 @@ def parse_commandline(): return options, parser + options = None config = None @@ -1191,5 +1192,6 @@ def main(): sys.exit(0) + if __name__ == "__main__": main() diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index 2cc21e56..43447ca8 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -574,5 +574,6 @@ def main(): logging.info("Finished.") + if __name__ == "__main__": main() diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 08708f31..80eb8a0e 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -1273,6 +1273,7 @@ def getsrclib(spec, srclib_dir, subdir=None, basepath=False, return (name, number, libdir) + gradle_version_regex = re.compile(r"[^/]*'com\.android\.tools\.build:gradle:([^\.]+\.[^\.]+).*'.*") @@ -1879,6 +1880,7 @@ def place_srclib(root_dir, number, libpath): if not placed: o.write('android.library.reference.%d=%s\n' % (number, relpath)) + apk_sigfile = re.compile(r'META-INF/[0-9A-Za-z]+\.(SF|RSA|DSA|EC)') @@ -1913,6 +1915,7 @@ def verify_apks(signed_apk, unsigned_apk, tmp_dir): logging.info("...successfully verified") return None + apk_badchars = re.compile('''[/ :;'"]''') diff --git a/fdroidserver/import.py b/fdroidserver/import.py index 97c82f6f..60146536 100644 --- a/fdroidserver/import.py +++ b/fdroidserver/import.py @@ -67,6 +67,7 @@ def getrepofrompage(url): return (None, "No information found." + page) + config = None options = None diff --git a/fdroidserver/install.py b/fdroidserver/install.py index 350003ac..022b6262 100644 --- a/fdroidserver/install.py +++ b/fdroidserver/install.py @@ -114,5 +114,6 @@ def main(): logging.info("\nFinished") + if __name__ == "__main__": main() diff --git a/fdroidserver/lint.py b/fdroidserver/lint.py index 41d4b21f..fb35d9cb 100644 --- a/fdroidserver/lint.py +++ b/fdroidserver/lint.py @@ -33,6 +33,7 @@ def enforce_https(domain): return (re.compile(r'.*[^sS]://[^/]*' + re.escape(domain) + r'(/.*)?'), domain + " URLs should always use https://") + https_enforcings = [ enforce_https('github.com'), enforce_https('gitlab.com'), @@ -47,6 +48,7 @@ def forbid_shortener(domain): return (re.compile(r'https?://[^/]*' + re.escape(domain) + r'/.*'), "URL shorteners should not be used") + http_url_shorteners = [ forbid_shortener('goo.gl'), forbid_shortener('t.co'), @@ -191,6 +193,7 @@ def check_useless_fields(app): if app.UpdateCheckName == app.id: yield "Update Check Name is set to the known app id - it can be removed" + filling_ucms = re.compile(r'^(Tags.*|RepoManifest.*)') @@ -204,6 +207,7 @@ def check_empty_fields(app): if not app.Categories: yield "Categories are not set" + all_categories = set([ "Connectivity", "Development", diff --git a/fdroidserver/metadata.py b/fdroidserver/metadata.py index e03efbee..ddfb19b5 100644 --- a/fdroidserver/metadata.py +++ b/fdroidserver/metadata.py @@ -218,6 +218,7 @@ class App(): else: self.set_field(f, v) + TYPE_UNKNOWN = 0 TYPE_OBSOLETE = 1 TYPE_STRING = 2 @@ -370,6 +371,7 @@ class Build(): for f, v in d.items(): self.set_flag(f, v) + flagtypes = { 'extlibs': TYPE_LIST, 'srclibs': TYPE_LIST, @@ -429,6 +431,7 @@ class FieldValidator(): warn_or_exception("'%s' is not a valid %s in %s. Regex pattern: %s" % (v, self.name, appid, self.matching)) + # Generic value types valuetypes = { FieldValidator("Integer", @@ -819,6 +822,7 @@ def read_metadata(xref=True): return apps + # Port legacy ';' separators list_sep = re.compile(r'[,;]') diff --git a/fdroidserver/readmeta.py b/fdroidserver/readmeta.py index 88ac7be3..7ec1cb05 100644 --- a/fdroidserver/readmeta.py +++ b/fdroidserver/readmeta.py @@ -34,5 +34,6 @@ def main(): metadata.read_metadata(xref=True) + if __name__ == "__main__": main() diff --git a/fdroidserver/rewritemeta.py b/fdroidserver/rewritemeta.py index 25ed0875..abd6b69a 100644 --- a/fdroidserver/rewritemeta.py +++ b/fdroidserver/rewritemeta.py @@ -93,5 +93,6 @@ def main(): logging.debug("Finished.") + if __name__ == "__main__": main() diff --git a/fdroidserver/scanner.py b/fdroidserver/scanner.py index 6e06f7c5..1ac76e59 100644 --- a/fdroidserver/scanner.py +++ b/fdroidserver/scanner.py @@ -325,5 +325,6 @@ def main(): logging.info("Finished:") print("%d problems found" % probcount) + if __name__ == "__main__": main() diff --git a/fdroidserver/server.py b/fdroidserver/server.py index ed39f0a7..e40bb55c 100644 --- a/fdroidserver/server.py +++ b/fdroidserver/server.py @@ -318,5 +318,6 @@ def main(): sys.exit(0) + if __name__ == "__main__": main() diff --git a/fdroidserver/signindex.py b/fdroidserver/signindex.py index c550b995..caf9adb3 100644 --- a/fdroidserver/signindex.py +++ b/fdroidserver/signindex.py @@ -75,5 +75,6 @@ def main(): if signed == 0: logging.info("Nothing to do") + if __name__ == "__main__": main() diff --git a/fdroidserver/stats.py b/fdroidserver/stats.py index 1f822ba0..8a1aec2a 100644 --- a/fdroidserver/stats.py +++ b/fdroidserver/stats.py @@ -41,6 +41,7 @@ def carbon_send(key, value): s.sendall(msg) s.close() + options = None config = None @@ -299,5 +300,6 @@ def main(): logging.info("Finished.") + if __name__ == "__main__": main() diff --git a/fdroidserver/update.py b/fdroidserver/update.py index 110de3ef..fcf9c092 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -1626,5 +1626,6 @@ def main(): logging.info("Finished.") + if __name__ == "__main__": main() diff --git a/fdroidserver/verify.py b/fdroidserver/verify.py index 82a690c4..4c381984 100644 --- a/fdroidserver/verify.py +++ b/fdroidserver/verify.py @@ -96,5 +96,6 @@ def main(): logging.info("{0} successfully verified".format(verified)) logging.info("{0} NOT verified".format(notverified)) + if __name__ == "__main__": main() diff --git a/makebuildserver b/makebuildserver index 4a0e22b1..96182e40 100755 --- a/makebuildserver +++ b/makebuildserver @@ -44,6 +44,7 @@ def vagrant(params, cwd=None, printout=False): out = p.communicate()[0] return (p.returncode, out) + boxfile = 'buildserver.box' serverdir = 'buildserver' @@ -303,6 +304,7 @@ def sha256_for_file(path): s.update(data) return s.hexdigest() + for srcurl, shasum in cachefiles: filename = os.path.basename(srcurl) local_filename = os.path.join(cachedir, filename) diff --git a/tests/common.TestCase b/tests/common.TestCase index d01568a2..c95ec9de 100755 --- a/tests/common.TestCase +++ b/tests/common.TestCase @@ -157,6 +157,7 @@ class CommonTest(unittest.TestCase): p = fdroidserver.common.FDroidPopen(commands, stderr_to_stdout=False) self.assertEqual(p.output, 'stdout message\n') + if __name__ == "__main__": parser = optparse.OptionParser() parser.add_option("-v", "--verbose", action="store_true", default=False, From 483338843fc4dac87df0b0d79a0fc99f57bcbe2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Tue, 15 Nov 2016 20:56:04 +0000 Subject: [PATCH 2/3] makebs: update to support repo r40 --- makebuildserver | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/makebuildserver b/makebuildserver index 96182e40..0d3df6b7 100755 --- a/makebuildserver +++ b/makebuildserver @@ -123,8 +123,8 @@ if config['apt_package_cache']: cachefiles = [ ('https://dl.google.com/android/repository/tools_r25.2.2-linux.zip', '10d5185af8fee80a7ee093585bf84962d0a877b92a8fef489e2030e910f6a360'), - ('https://dl.google.com/android/repository/android_m2repository_r39.zip', - '1feec6fb7cd94a7f804fa8664b517b16fa11c6c851ae592c72bb2f0d24729084'), + ('https://dl.google.com/android/repository/android_m2repository_r40.zip', + 'be4c20cdecba6186d046b4a499895a9a8be1955427dc3f3e7495fa9dcc392d29'), ('https://dl.google.com/android/repository/android-1.5_r04-linux.zip', '85b6c8f9797e56aa415d3a282428bb640c96b0acb17c11d41621bb2a5302fe64'), ('https://dl.google.com/android/repository/android-1.6_r03-linux.zip', From 8cdf1b022353d3ba4cdf3d2e99e851b740999f1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Tue, 15 Nov 2016 20:56:15 +0000 Subject: [PATCH 3/3] makebs: add gradle 3.2 --- buildserver/gradle | 2 +- makebuildserver | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/buildserver/gradle b/buildserver/gradle index 4a7def31..571d6156 100755 --- a/buildserver/gradle +++ b/buildserver/gradle @@ -24,7 +24,7 @@ d_plugin_k=( 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 d_plugin_v=(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=(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 1.12 1.11 1.10 1.9 1.8 1.7 1.6 1.4) +plugin_v=(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 1.12 1.11 1.10 1.9 1.8 1.7 1.6 1.4) v_all=${plugin_v[@]} echo "Available gradle versions: ${v_all[@]}" diff --git a/makebuildserver b/makebuildserver index 0d3df6b7..69fc9346 100755 --- a/makebuildserver +++ b/makebuildserver @@ -279,6 +279,8 @@ cachefiles = [ '39c906941a474444afbddc38144ed44166825acb0a57b0551dddb04bbf157f80'), ('https://services.gradle.org/distributions/gradle-3.1-bin.zip', 'c7de3442432253525902f7e8d7eac8b5fd6ce1623f96d76916af6d0e383010fc'), + ('https://services.gradle.org/distributions/gradle-3.2-bin.zip', + '5321b36837226dc0377047a328f12010f42c7bf88ee4a3b1cee0c11040082935'), ('https://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin', '102d6723f67ff1384330d12c45854315d6452d6510286f4e5891e00a5a8f1d5a'), ('https://dl.google.com/android/ndk/android-ndk-r9b-linux-x86_64.tar.bz2',