diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 28633f26..90b6341d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -55,6 +55,11 @@ metadata_v0: - git checkout $GITCOMMIT - cd fdroiddata - ../tests/dump_internal_metadata_format.py + - sed -i + -e "s/CurrentVersionCode:.'\([0-9]*\)'/CurrentVersionCode:\1/" + -e "s/ versionCode:.'\([0-9]*\)'/ versionCode:\1/" + -e "s/ timeout:.'\([0-9]*\)'/ timeout:\1/" + metadata/dump_*/*.yaml - diff -uw metadata/dump_* .apt-template: &apt-template diff --git a/fdroidserver/build.py b/fdroidserver/build.py index 8cbc492a..0549bb48 100644 --- a/fdroidserver/build.py +++ b/fdroidserver/build.py @@ -336,7 +336,7 @@ def transform_first_char(string, method): def add_failed_builds_entry(failed_builds, appid, build, entry): - failed_builds.append([appid, int(build.versionCode), str(entry)]) + failed_builds.append([appid, build.versionCode, str(entry)]) def get_metadata_from_apk(app, build, apkfile): @@ -807,10 +807,10 @@ def build_local(app, build, vcs, build_dir, output_dir, log_dir, srclib_dir, ext vercode, version = get_metadata_from_apk(app, build, src) if version != build.versionName or vercode != build.versionCode: raise BuildException(("Unexpected version/version code in output;" - " APK: '%s' / '%s', " - " Expected: '%s' / '%s'") - % (version, str(vercode), build.versionName, - str(build.versionCode))) + " APK: '%s' / '%d', " + " Expected: '%s' / '%d'") + % (version, vercode, build.versionName, + build.versionCode)) if (options.scan_binary or config.get('scan_binary')) and not options.skipscan: if scanner.scan_binary(src): raise BuildException("Found blocklisted packages in final apk!") @@ -1096,7 +1096,7 @@ def main(): if build.timeout is None: timeout = 7200 else: - timeout = int(build.timeout) + timeout = build.timeout if options.server and timeout > 0: logging.debug(_('Setting {0} sec timeout for this build').format(timeout)) timer = threading.Timer(timeout, force_halt_build, [timeout]) diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index aeda879f..ecba9ba6 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -65,7 +65,7 @@ def check_http(app): m = re.search(codeex, page) if not m: raise FDroidException("No RE match for version code") - vercode = m.group(1).strip() + vercode = common.version_code_string_to_int(m.group(1).strip()) if urlver != '.': logging.debug("...requesting {0}".format(urlver)) @@ -116,7 +116,7 @@ def check_tags(app, pattern): htag = None hver = None - hcode = "0" + hcode = 0 tags = [] if repotype == 'git': @@ -181,10 +181,10 @@ def check_tags(app, pattern): logging.debug("UpdateCheckData found version {0} ({1})" .format(version, vercode)) - i_vercode = common.version_code_string_to_int(vercode) - if i_vercode > common.version_code_string_to_int(hcode): + vercode = common.version_code_string_to_int(vercode) + if vercode > hcode: htag = tag - hcode = str(i_vercode) + hcode = vercode hver = version else: for subdir in possible_subdirs(app): @@ -196,10 +196,9 @@ def check_tags(app, pattern): if vercode: logging.debug("Manifest exists in subdir '{0}'. Found version {1} ({2})" .format(subdir, version, vercode)) - i_vercode = common.version_code_string_to_int(vercode) - if i_vercode > common.version_code_string_to_int(hcode): + if vercode > hcode: htag = tag - hcode = str(i_vercode) + hcode = vercode hver = version if hver: @@ -255,7 +254,7 @@ def check_repomanifest(app, branch=None): hpak = None hver = None - hcode = "0" + hcode = 0 for subdir in possible_subdirs(app): root_dir = build_dir / subdir paths = common.manifest_paths(root_dir, last_build.gradle) @@ -263,10 +262,9 @@ def check_repomanifest(app, branch=None): if vercode: logging.debug("Manifest exists in subdir '{0}'. Found version {1} ({2})" .format(subdir, version, vercode)) - i_vercode = common.version_code_string_to_int(vercode) - if i_vercode > common.version_code_string_to_int(hcode): + if vercode > hcode: hpak = package - hcode = str(i_vercode) + hcode = vercode hver = version if not hpak: @@ -460,11 +458,11 @@ def checkupdates_app(app): raise FDroidException(_('no version information found')) elif vercode == app.CurrentVersionCode: logging.debug("...up to date") - elif int(vercode) > int(app.CurrentVersionCode): + elif vercode > app.CurrentVersionCode: logging.debug("...updating - old vercode={0}, new vercode={1}".format( app.CurrentVersionCode, vercode)) app.CurrentVersion = version - app.CurrentVersionCode = str(int(vercode)) + app.CurrentVersionCode = vercode updating = True else: raise FDroidException( @@ -501,12 +499,12 @@ def checkupdates_app(app): gotcur = False latest = None for build in app.get('Builds', []): - if int(build.versionCode) >= int(app.CurrentVersionCode): + if build.versionCode >= app.CurrentVersionCode: gotcur = True - if not latest or int(build.versionCode) > int(latest.versionCode): + if not latest or build.versionCode > latest.versionCode: latest = build - if int(latest.versionCode) > int(app.CurrentVersionCode): + if latest.versionCode > app.CurrentVersionCode: raise FDroidException( _( 'latest build recipe is newer: old vercode={old}, new vercode={new}' @@ -517,13 +515,15 @@ def checkupdates_app(app): newbuild = copy.deepcopy(latest) newbuild.disable = False newbuild.versionCode = app.CurrentVersionCode - newbuild.versionName = app.CurrentVersion + suffix.replace('%c', newbuild.versionCode) + newbuild.versionName = app.CurrentVersion + suffix.replace( + '%c', str(newbuild.versionCode) + ) logging.info("...auto-generating build for " + newbuild.versionName) if tag: newbuild.commit = tag else: - commit = pattern.replace('%v', app.CurrentVersion) - commit = commit.replace('%c', newbuild.versionCode) + commit = pattern.replace('%v', str(app.CurrentVersion)) + commit = commit.replace('%c', str(newbuild.versionCode)) newbuild.commit = commit app['Builds'].append(newbuild) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 98d1052c..d8038cdf 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -712,11 +712,7 @@ def read_pkg_args(appid_versionCode_pairs, allow_vercodes=False): p = apk_regex.sub(r':\1', p) if allow_vercodes and ':' in p: package, vercode = p.split(':') - try: - i_vercode = int(vercode, 0) - except ValueError: - i_vercode = int(vercode) - vercode = str(i_vercode) + vercode = version_code_string_to_int(vercode) else: package, vercode = p, None if package not in vercodes: @@ -819,7 +815,7 @@ def publishednameinfo(filename): filename = os.path.basename(filename) m = publish_name_regex.match(filename) try: - result = (m.group(1), m.group(2)) + result = (m.group(1), int(m.group(2))) except AttributeError as exc: raise FDroidException(_("Invalid name for published file: %s") % filename) from exc return result @@ -846,10 +842,10 @@ def apk_parse_release_filename(apkname): """ m = apk_release_filename_with_sigfp.match(apkname) if m: - return m.group('appid'), m.group('vercode'), m.group('sigfp') + return m.group('appid'), int(m.group('vercode')), m.group('sigfp') m = apk_release_filename.match(apkname) if m: - return m.group('appid'), m.group('vercode'), None + return m.group('appid'), int(m.group('vercode')), None return None, None, None @@ -1803,7 +1799,7 @@ def parse_androidmanifests(paths, app): matches = vcsearch_g(line) if matches: - vercode = matches.group(1) + vercode = version_code_string_to_int(matches.group(1)) if inside_required_flavour > 0: if '{' in line: @@ -1841,7 +1837,7 @@ def parse_androidmanifests(paths, app): if not vercode: matches = vcsearch_g(line) if matches: - vercode = matches.group(1) + vercode = version_code_string_to_int(matches.group(1)) if not android_plugin_file and ANDROID_PLUGIN_REGEX.match(line): android_plugin_file = True if android_plugin_file: @@ -1868,9 +1864,8 @@ def parse_androidmanifests(paths, app): base_dir = os.path.dirname(path) version = retrieve_string_singleline(base_dir, version) if XMLNS_ANDROID + "versionCode" in xml.attrib: - a = xml.attrib[XMLNS_ANDROID + "versionCode"] - if string_is_integer(a): - vercode = a + vercode = version_code_string_to_int( + xml.attrib[XMLNS_ANDROID + "versionCode"]) # Remember package name, may be defined separately from version+vercode if package is None: @@ -2635,9 +2630,9 @@ def get_apk_id_androguard(apkfile): appid = value elif versionCode is None and name == 'versionCode': if value.startswith('0x'): - versionCode = str(int(value, 16)) + versionCode = int(value, 16) else: - versionCode = value + versionCode = int(value) elif versionName is None and name == 'versionName': versionName = value @@ -2657,12 +2652,15 @@ def get_apk_id_androguard(apkfile): def get_apk_id_aapt(apkfile): + """Read (appid, versionCode, versionName) from an APK.""" p = SdkToolsPopen(['aapt', 'dump', 'badging', apkfile], output=False) m = APK_ID_TRIPLET_REGEX.match(p.output[0:p.output.index('\n')]) if m: - return m.group(1), m.group(2), m.group(3) - raise FDroidException(_("Reading packageName/versionCode/versionName failed, APK invalid: '{apkfilename}'") - .format(apkfilename=apkfile)) + return m.group(1), int(m.group(2)), m.group(3) + raise FDroidException(_( + "Reading packageName/versionCode/versionName failed," + "APK invalid: '{apkfilename}'" + ).format(apkfilename=apkfile)) def get_native_code(apkfile): @@ -3859,6 +3857,8 @@ def string_is_integer(string): def version_code_string_to_int(vercode): """Convert an version code string of any base into an int.""" + # TODO: Python 3.6 allows underscores in numeric literals + vercode = vercode.replace('_', '') try: return int(vercode, 0) except ValueError: diff --git a/fdroidserver/import_subcommand.py b/fdroidserver/import_subcommand.py index 8f89148b..b9fe070a 100644 --- a/fdroidserver/import_subcommand.py +++ b/fdroidserver/import_subcommand.py @@ -311,7 +311,7 @@ def main(): # Create a build line... build.versionName = versionName or 'Unknown' - build.versionCode = versionCode or '0' # TODO heinous but this is still a str + build.versionCode = versionCode or 0 if options.subdir: build.subdir = options.subdir build.gradle = ['yes'] diff --git a/fdroidserver/index.py b/fdroidserver/index.py index 24f8a56e..f4f5c08f 100644 --- a/fdroidserver/index.py +++ b/fdroidserver/index.py @@ -637,7 +637,7 @@ def convert_version(version, app, repodir): manifest[element] = version[element] if "versionCode" in version: - manifest["versionCode"] = int(version["versionCode"]) + manifest["versionCode"] = version["versionCode"] if "features" in version and version["features"]: manifest["features"] = features = [] @@ -684,12 +684,11 @@ def convert_version(version, app, repodir): ver["antiFeatures"][antif] = {} if "versionCode" in version: - if int(version["versionCode"]) > int(app["CurrentVersionCode"]): + if version["versionCode"] > app["CurrentVersionCode"]: ver["releaseChannels"] = ["Beta"] - versionCodeStr = str(version['versionCode']) # TODO build.versionCode should be int! for build in app.get('Builds', []): - if build['versionCode'] == versionCodeStr and "whatsNew" in build: + if build['versionCode'] == version['versionCode'] and "whatsNew" in build: ver["whatsNew"] = build["whatsNew"] break @@ -770,9 +769,8 @@ def make_v2(apps, packages, repodir, repodict, requestsdict, fdroid_signing_key_ continue if not package.get('versionName'): app = apps[packageName] - versionCodeStr = str(package['versionCode']) # TODO build.versionCode should be int! for build in app.get('Builds', []): - if build['versionCode'] == versionCodeStr: + if build['versionCode'] == package['versionCode']: versionName = build.get('versionName') logging.info(_('Overriding blank versionName in {apkfilename} from metadata: {version}') .format(apkfilename=package['apkName'], version=versionName)) @@ -905,6 +903,7 @@ def make_v1(apps, packages, repodir, repodict, requestsdict, fdroid_signing_key_ k = 'packageName' elif k == 'CurrentVersionCode': # TODO make SuggestedVersionCode the canonical name k = 'suggestedVersionCode' + v = str(v) elif k == 'CurrentVersion': # TODO make SuggestedVersionName the canonical name k = 'suggestedVersionName' else: @@ -931,9 +930,8 @@ def make_v1(apps, packages, repodir, repodict, requestsdict, fdroid_signing_key_ continue if not package.get('versionName'): app = apps[packageName] - versionCodeStr = str(package['versionCode']) # TODO build.versionCode should be int! for build in app.get('Builds', []): - if build['versionCode'] == versionCodeStr: + if build['versionCode'] == package['versionCode']: versionName = build.get('versionName') logging.info(_('Overriding blank versionName in {apkfilename} from metadata: {version}') .format(apkfilename=package['apkName'], version=versionName)) @@ -1013,7 +1011,7 @@ def v1_sort_packages(packages, fdroid_signing_key_fingerprints): versionCode = None if package.get('versionCode', None): - versionCode = -int(package['versionCode']) + versionCode = -package['versionCode'] return packageName, group, signer, versionCode @@ -1179,7 +1177,7 @@ def make_v0(apps, apks, repodir, repodict, requestsdict, fdroid_signing_key_fing # one is recommended. They are historically mis-named, and need # changing, but stay like this for now to support existing clients. addElement('marketversion', app.CurrentVersion, doc, apel) - addElement('marketvercode', app.CurrentVersionCode, doc, apel) + addElement('marketvercode', str(app.CurrentVersionCode), doc, apel) if app.Provides: pv = app.Provides.split(',') @@ -1214,7 +1212,7 @@ def make_v0(apps, apks, repodir, repodict, requestsdict, fdroid_signing_key_fing for apk in apklist: file_extension = common.get_file_extension(apk['apkName']) # find the APK for the "Current Version" - if current_version_code < int(app.CurrentVersionCode): + if current_version_code < app.CurrentVersionCode: current_version_file = apk['apkName'] if current_version_code < apk['versionCode']: current_version_code = apk['versionCode'] @@ -1224,9 +1222,11 @@ def make_v0(apps, apks, repodir, repodict, requestsdict, fdroid_signing_key_fing versionName = apk.get('versionName') if not versionName: - versionCodeStr = str(apk['versionCode']) # TODO build.versionCode should be int! for build in app.get('Builds', []): - if build['versionCode'] == versionCodeStr and 'versionName' in build: + if ( + build['versionCode'] == apk['versionCode'] + and 'versionName' in build + ): versionName = build['versionName'] break if versionName: diff --git a/fdroidserver/lint.py b/fdroidserver/lint.py index 001e5a20..43b101a9 100644 --- a/fdroidserver/lint.py +++ b/fdroidserver/lint.py @@ -240,10 +240,10 @@ def get_lastbuild(builds): lastbuild = None for build in builds: if not build.disable: - vercode = int(build.versionCode) + vercode = build.versionCode if lowest_vercode == -1 or vercode < lowest_vercode: lowest_vercode = vercode - if not lastbuild or int(build.versionCode) > int(lastbuild.versionCode): + if not lastbuild or build.versionCode > lastbuild.versionCode: lastbuild = build return lastbuild @@ -327,13 +327,10 @@ filling_ucms = re.compile(r'^(Tags.*|RepoManifest.*)') def check_checkupdates_ran(app): if filling_ucms.match(app.UpdateCheckMode): - if ( - not app.AutoName - and not app.CurrentVersion - and app.CurrentVersionCode == '0' - ): + if not app.AutoName and not app.CurrentVersion and app.CurrentVersionCode == 0: yield _( - "UpdateCheckMode is set but it looks like checkupdates hasn't been run yet" + "UpdateCheckMode is set but it looks like" + "checkupdates hasn't been run yet" ) @@ -637,7 +634,7 @@ def check_current_version_code(app): if archive_policy and archive_policy.split()[0] == "0": return cv = app.get('CurrentVersionCode') - if cv is not None and int(cv) == 0: + if cv is not None and cv == 0: return builds = app.get('Builds') @@ -645,7 +642,7 @@ def check_current_version_code(app): min_versionCode = None if builds: for build in builds: - vc = int(build['versionCode']) + vc = build['versionCode'] if min_versionCode is None or min_versionCode > vc: min_versionCode = vc if not build.get('disable'): @@ -654,7 +651,7 @@ def check_current_version_code(app): break if active_builds == 0: return # all builds are disabled - if cv is not None and int(cv) < min_versionCode: + if cv is not None and cv < min_versionCode: yield ( _( 'CurrentVersionCode {cv} is less than oldest build entry {versionCode}' diff --git a/fdroidserver/metadata.py b/fdroidserver/metadata.py index 15f5779d..c6cc4b6b 100644 --- a/fdroidserver/metadata.py +++ b/fdroidserver/metadata.py @@ -204,6 +204,7 @@ fieldtypes = { 'AntiFeatures': TYPE_LIST, 'AllowedAPKSigningKeys': TYPE_LIST, 'Builds': TYPE_BUILD, + 'CurrentVersionCode': TYPE_INT, } @@ -615,29 +616,31 @@ def split_list_values(s): def sorted_builds(builds): - return sorted(builds, key=lambda build: int(build.versionCode)) + return sorted(builds, key=lambda build: build.versionCode) esc_newlines = re.compile(r'\\( |\n)') def post_metadata_parse(app): - # TODO keep native types, convert only for .txt metadata - for k, v in app.items(): - if type(v) in (float, int): - app[k] = str(v) - if 'flavours' in app and app['flavours'] == [True]: app['flavours'] = 'yes' - for field, fieldtype in fieldtypes.items(): - if fieldtype != TYPE_LIST: - continue - value = app.get(field) - if isinstance(value, str): - app[field] = [value, ] - elif value is not None: - app[field] = [str(i) for i in value] + for k, v in app.items(): + if fieldtype(k) == TYPE_LIST: + if isinstance(v, str): + app[k] = [v, ] + elif v: + app[k] = [str(i) for i in v] + elif fieldtype(k) == TYPE_INT: + if v: + app[k] = int(v) + elif fieldtype(k) == TYPE_STRING: + if v: + app[k] = str(v) + else: + if type(v) in (float, int): + app[k] = str(v) def _yaml_bool_unmapable(v): return v in (True, False, [True], [False]) @@ -673,7 +676,7 @@ def post_metadata_parse(app): else: build[k] = [] elif flagtype(k) is TYPE_INT: - build[k] = str(v) + build[k] = v elif flagtype(k) is TYPE_STRING: if isinstance(v, bool) and k in _bool_allowed: build[k] = v diff --git a/fdroidserver/update.py b/fdroidserver/update.py index e6bea4bf..1ed8a3a8 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -168,7 +168,7 @@ def status_update_json(apps, apks): gotcurrentver = False for apk in apks: if apk['packageName'] == appid: - if str(apk['versionCode']) == app.get('CurrentVersionCode'): + if apk['versionCode'] == app.get('CurrentVersionCode'): gotcurrentver = True apklist.append(apk) validapks = 0 @@ -181,7 +181,7 @@ def status_update_json(apps, apks): if not build.get('disable'): builtit = False for apk in apklist: - if apk['versionCode'] == int(build.versionCode): + if apk['versionCode'] == build.versionCode: builtit = True validapks += 1 break @@ -493,8 +493,9 @@ def insert_obbs(repodir, apps, apks): if packagename == apk['packageName'] and apk['versionCode'] > highestVersionCode: highestVersionCode = apk['versionCode'] if versionCode > highestVersionCode: - obbWarnDelete(f, _('OBB file has newer versionCode({integer}) than any APK:') - .format(integer=str(versionCode))) + obbWarnDelete(f, _( + 'OBB file has newer versionCode({integer}) than any APK:' + ).format(integer=versionCode)) continue obbsha256 = common.sha256sum(f) obbs.append((packagename, versionCode, obbfile, obbsha256)) @@ -533,7 +534,7 @@ def translate_per_build_anti_features(apps, apks): for build in app.get('Builds', []): afl = build.get('antifeatures') if afl: - d[int(build.versionCode)] = afl + d[build.versionCode] = afl if len(d) > 0: antiFeatures[packageName] = d @@ -569,7 +570,7 @@ def _set_localized_text_entry(app, locale, key, f, versionCode=None): text = fp.read(limit * 2) if versionCode: for build in app["Builds"]: - if int(build["versionCode"]) == versionCode: + if build["versionCode"] == versionCode: if "whatsNew" not in build: build["whatsNew"] = collections.OrderedDict() build["whatsNew"][locale] = text[:limit] @@ -1002,9 +1003,16 @@ def insert_localized_app_metadata(apps): try: versionCode = int(base) locale = segments[-2] - if base in [a["versionCode"] for a in apps[packageName]["Builds"]]: - _set_localized_text_entry(apps[packageName], locale, 'whatsNew', - os.path.join(root, f), versionCode) + if versionCode in [ + a["versionCode"] for a in apps[packageName]["Builds"] + ]: + _set_localized_text_entry( + apps[packageName], + locale, + 'whatsNew', + os.path.join(root, f), + versionCode, + ) continue except ValueError: pass @@ -1477,7 +1485,7 @@ def process_apk(apkcache, apkfilename, repodir, knownapks, use_date_from_apk=Fal if apps: if apk['packageName'] in apps: for build in apps[apk['packageName']].get('Builds', []): - if int(build['versionCode']) == apk['versionCode'] and build['disable']: + if build['versionCode'] == apk['versionCode'] and build['disable']: return True, None, False # Check for debuggable apks... @@ -1809,7 +1817,7 @@ def apply_info_from_latest_apk(apps, apks): else: app.icon = bestapk['icon'] if 'icon' in bestapk else None if app.get('CurrentVersionCode') is None: - app['CurrentVersionCode'] = str(bestver) + app['CurrentVersionCode'] = bestver def make_categories_txt(repodir, categories): @@ -1828,7 +1836,7 @@ def archive_old_apks(apps, apks, archapks, repodir, archivedir, defaultkeepversi for apk in apk_list: if apk['packageName'] == appid: if app.get('CurrentVersionCode') is not None: - if apk['versionCode'] == common.version_code_string_to_int(app['CurrentVersionCode']): + if apk['versionCode'] == app['CurrentVersionCode']: currentVersionApk = apk continue apkList.append(apk) diff --git a/tests/build.TestCase b/tests/build.TestCase index cca5fa0c..0bfee1be 100755 --- a/tests/build.TestCase +++ b/tests/build.TestCase @@ -71,42 +71,42 @@ class BuildTest(unittest.TestCase): ( 'repo/obb.main.twoversions_1101613.apk', 'obb.main.twoversions', - '1101613', + 1101613, '0.1', None, ), ( 'org.bitbucket.tickytacky.mirrormirror_1.apk', 'org.bitbucket.tickytacky.mirrormirror', - '1', + 1, '1.0', None, ), ( 'org.bitbucket.tickytacky.mirrormirror_2.apk', 'org.bitbucket.tickytacky.mirrormirror', - '2', + 2, '1.0.1', None, ), ( 'org.bitbucket.tickytacky.mirrormirror_3.apk', 'org.bitbucket.tickytacky.mirrormirror', - '3', + 3, '1.0.2', None, ), ( 'org.bitbucket.tickytacky.mirrormirror_4.apk', 'org.bitbucket.tickytacky.mirrormirror', - '4', + 4, '1.0.3', None, ), ( 'org.dyndns.fules.ck_20.apk', 'org.dyndns.fules.ck', - '20', + 20, 'v1.6pre2', [ 'arm64-v8a', @@ -118,81 +118,81 @@ class BuildTest(unittest.TestCase): 'x86_64', ], ), - ('urzip.apk', 'info.guardianproject.urzip', '100', '0.1', None), - ('urzip-badcert.apk', 'info.guardianproject.urzip', '100', '0.1', None), - ('urzip-badsig.apk', 'info.guardianproject.urzip', '100', '0.1', None), - ('urzip-release.apk', 'info.guardianproject.urzip', '100', '0.1', None), + ('urzip.apk', 'info.guardianproject.urzip', 100, '0.1', None), + ('urzip-badcert.apk', 'info.guardianproject.urzip', 100, '0.1', None), + ('urzip-badsig.apk', 'info.guardianproject.urzip', 100, '0.1', None), + ('urzip-release.apk', 'info.guardianproject.urzip', 100, '0.1', None), ( 'urzip-release-unsigned.apk', 'info.guardianproject.urzip', - '100', + 100, '0.1', None, ), - ('repo/com.politedroid_3.apk', 'com.politedroid', '3', '1.2', None), - ('repo/com.politedroid_4.apk', 'com.politedroid', '4', '1.3', None), - ('repo/com.politedroid_5.apk', 'com.politedroid', '5', '1.4', None), - ('repo/com.politedroid_6.apk', 'com.politedroid', '6', '1.5', None), + ('repo/com.politedroid_3.apk', 'com.politedroid', 3, '1.2', None), + ('repo/com.politedroid_4.apk', 'com.politedroid', 4, '1.3', None), + ('repo/com.politedroid_5.apk', 'com.politedroid', 5, '1.4', None), + ('repo/com.politedroid_6.apk', 'com.politedroid', 6, '1.5', None), ( 'repo/duplicate.permisssions_9999999.apk', 'duplicate.permisssions', - '9999999', + 9999999, '', None, ), ( 'repo/info.zwanenburg.caffeinetile_4.apk', 'info.zwanenburg.caffeinetile', - '4', + 4, '1.3', None, ), ( 'repo/obb.main.oldversion_1444412523.apk', 'obb.main.oldversion', - '1444412523', + 1444412523, '0.1', None, ), ( 'repo/obb.mainpatch.current_1619_another-release-key.apk', 'obb.mainpatch.current', - '1619', + 1619, '0.1', None, ), ( 'repo/obb.mainpatch.current_1619.apk', 'obb.mainpatch.current', - '1619', + 1619, '0.1', None, ), ( 'repo/obb.main.twoversions_1101613.apk', 'obb.main.twoversions', - '1101613', + 1101613, '0.1', None, ), ( 'repo/obb.main.twoversions_1101615.apk', 'obb.main.twoversions', - '1101615', + 1101615, '0.1', None, ), ( 'repo/obb.main.twoversions_1101617.apk', 'obb.main.twoversions', - '1101617', + 1101617, '0.1', None, ), ( 'repo/urzip-; Рахма́, [rɐxˈmanʲɪnəf] سيرجي_رخمانينوف 谢·.apk', 'info.guardianproject.urzip', - '100', + 100, '0.1', None, ), @@ -228,7 +228,7 @@ class BuildTest(unittest.TestCase): build = fdroidserver.metadata.Build() build.commit = '1.0' build.output = app.id + '.apk' - build.versionCode = '1' + build.versionCode = 1 build.versionName = '1.0' build.ndk = 'r21e' # aka 21.4.7075529 vcs = mock.Mock() @@ -326,7 +326,7 @@ class BuildTest(unittest.TestCase): build.output = app.id + '.apk' build.scandelete = ['baz.so'] build.scanignore = ['foo.aar'] - build.versionCode = '1' + build.versionCode = 1 build.versionName = '1.0' vcs = mock.Mock() diff --git a/tests/checkupdates.TestCase b/tests/checkupdates.TestCase index 0a6fd135..ea59a63e 100755 --- a/tests/checkupdates.TestCase +++ b/tests/checkupdates.TestCase @@ -179,7 +179,7 @@ class CheckupdatesTest(unittest.TestCase): with mock.patch('urllib.request.urlopen', lambda a, b, c: respmock): vername, vercode = fdroidserver.checkupdates.check_http(app) self.assertEqual(vername, '1.1.9') - self.assertEqual(vercode, '10109') + self.assertEqual(vercode, 10109) def test_check_http_blocks_unknown_schemes(self): app = fdroidserver.metadata.App() @@ -230,7 +230,7 @@ class CheckupdatesTest(unittest.TestCase): mock_path.is_file.return_falue = True vername, vercode, _tag = fdroidserver.checkupdates.check_tags(app, None) self.assertEqual(vername, '1.1.9') - self.assertEqual(vercode, '10109') + self.assertEqual(vercode, 10109) app.UpdateCheckData = r'b.txt|c(.*)|.|v(.*)' with mock.patch( @@ -242,7 +242,7 @@ class CheckupdatesTest(unittest.TestCase): mock_path.is_file.return_falue = True vername, vercode, _tag = fdroidserver.checkupdates.check_tags(app, None) self.assertEqual(vername, '1.1.0') - self.assertEqual(vercode, '10109') + self.assertEqual(vercode, 10109) app.UpdateCheckData = r'b.txt|c(.*)||' with mock.patch( @@ -254,7 +254,7 @@ class CheckupdatesTest(unittest.TestCase): mock_path.is_file.return_falue = True vername, vercode, _tag = fdroidserver.checkupdates.check_tags(app, None) self.assertEqual(vername, '1.1.9') - self.assertEqual(vercode, '10109') + self.assertEqual(vercode, 10109) vcs.latesttags.return_value = ['Android-1.1.0', '1.1.8'] app.UpdateCheckData = r'b.txt|c(.*)||Android-([\d.]+)' @@ -267,21 +267,21 @@ class CheckupdatesTest(unittest.TestCase): mock_path.is_file.return_falue = True vername, vercode, _tag = fdroidserver.checkupdates.check_tags(app, None) self.assertEqual(vername, '1.1.0') - self.assertEqual(vercode, '10109') + self.assertEqual(vercode, 10109) app.UpdateCheckData = r'|\+(\d+)||Android-([\d.]+)' vcs.latesttags.return_value = ['Android-1.1.0+1'] with mock.patch('fdroidserver.common.getvcs', return_value=vcs): vername, vercode, _tag = fdroidserver.checkupdates.check_tags(app, None) self.assertEqual(vername, '1.1.0') - self.assertEqual(vercode, '1') + self.assertEqual(vercode, 1) app.UpdateCheckData = '|||' vcs.latesttags.return_value = ['2'] with mock.patch('fdroidserver.common.getvcs', return_value=vcs): vername, vercode, _tag = fdroidserver.checkupdates.check_tags(app, None) self.assertEqual(vername, '2') - self.assertEqual(vercode, '2') + self.assertEqual(vercode, 2) if __name__ == "__main__": diff --git a/tests/common.TestCase b/tests/common.TestCase index ff260046..3a301ee8 100755 --- a/tests/common.TestCase +++ b/tests/common.TestCase @@ -939,30 +939,30 @@ class CommonTest(unittest.TestCase): pass # aapt is not required if androguard is present testcases = [ - ('repo/obb.main.twoversions_1101613.apk', 'obb.main.twoversions', '1101613', '0.1'), - ('org.bitbucket.tickytacky.mirrormirror_1.apk', 'org.bitbucket.tickytacky.mirrormirror', '1', '1.0'), - ('org.bitbucket.tickytacky.mirrormirror_2.apk', 'org.bitbucket.tickytacky.mirrormirror', '2', '1.0.1'), - ('org.bitbucket.tickytacky.mirrormirror_3.apk', 'org.bitbucket.tickytacky.mirrormirror', '3', '1.0.2'), - ('org.bitbucket.tickytacky.mirrormirror_4.apk', 'org.bitbucket.tickytacky.mirrormirror', '4', '1.0.3'), - ('org.dyndns.fules.ck_20.apk', 'org.dyndns.fules.ck', '20', 'v1.6pre2'), - ('urzip.apk', 'info.guardianproject.urzip', '100', '0.1'), - ('urzip-badcert.apk', 'info.guardianproject.urzip', '100', '0.1'), - ('urzip-badsig.apk', 'info.guardianproject.urzip', '100', '0.1'), - ('urzip-release.apk', 'info.guardianproject.urzip', '100', '0.1'), - ('urzip-release-unsigned.apk', 'info.guardianproject.urzip', '100', '0.1'), - ('repo/com.politedroid_3.apk', 'com.politedroid', '3', '1.2'), - ('repo/com.politedroid_4.apk', 'com.politedroid', '4', '1.3'), - ('repo/com.politedroid_5.apk', 'com.politedroid', '5', '1.4'), - ('repo/com.politedroid_6.apk', 'com.politedroid', '6', '1.5'), - ('repo/duplicate.permisssions_9999999.apk', 'duplicate.permisssions', '9999999', ''), - ('repo/info.zwanenburg.caffeinetile_4.apk', 'info.zwanenburg.caffeinetile', '4', '1.3'), - ('repo/obb.main.oldversion_1444412523.apk', 'obb.main.oldversion', '1444412523', '0.1'), - ('repo/obb.mainpatch.current_1619_another-release-key.apk', 'obb.mainpatch.current', '1619', '0.1'), - ('repo/obb.mainpatch.current_1619.apk', 'obb.mainpatch.current', '1619', '0.1'), - ('repo/obb.main.twoversions_1101613.apk', 'obb.main.twoversions', '1101613', '0.1'), - ('repo/obb.main.twoversions_1101615.apk', 'obb.main.twoversions', '1101615', '0.1'), - ('repo/obb.main.twoversions_1101617.apk', 'obb.main.twoversions', '1101617', '0.1'), - ('repo/urzip-; Рахма́, [rɐxˈmanʲɪnəf] سيرجي_رخمانينوف 谢·.apk', 'info.guardianproject.urzip', '100', '0.1'), + ('repo/obb.main.twoversions_1101613.apk', 'obb.main.twoversions', 1101613, '0.1'), + ('org.bitbucket.tickytacky.mirrormirror_1.apk', 'org.bitbucket.tickytacky.mirrormirror', 1, '1.0'), + ('org.bitbucket.tickytacky.mirrormirror_2.apk', 'org.bitbucket.tickytacky.mirrormirror', 2, '1.0.1'), + ('org.bitbucket.tickytacky.mirrormirror_3.apk', 'org.bitbucket.tickytacky.mirrormirror', 3, '1.0.2'), + ('org.bitbucket.tickytacky.mirrormirror_4.apk', 'org.bitbucket.tickytacky.mirrormirror', 4, '1.0.3'), + ('org.dyndns.fules.ck_20.apk', 'org.dyndns.fules.ck', 20, 'v1.6pre2'), + ('urzip.apk', 'info.guardianproject.urzip', 100, '0.1'), + ('urzip-badcert.apk', 'info.guardianproject.urzip', 100, '0.1'), + ('urzip-badsig.apk', 'info.guardianproject.urzip', 100, '0.1'), + ('urzip-release.apk', 'info.guardianproject.urzip', 100, '0.1'), + ('urzip-release-unsigned.apk', 'info.guardianproject.urzip', 100, '0.1'), + ('repo/com.politedroid_3.apk', 'com.politedroid', 3, '1.2'), + ('repo/com.politedroid_4.apk', 'com.politedroid', 4, '1.3'), + ('repo/com.politedroid_5.apk', 'com.politedroid', 5, '1.4'), + ('repo/com.politedroid_6.apk', 'com.politedroid', 6, '1.5'), + ('repo/duplicate.permisssions_9999999.apk', 'duplicate.permisssions', 9999999, ''), + ('repo/info.zwanenburg.caffeinetile_4.apk', 'info.zwanenburg.caffeinetile', 4, '1.3'), + ('repo/obb.main.oldversion_1444412523.apk', 'obb.main.oldversion', 1444412523, '0.1'), + ('repo/obb.mainpatch.current_1619_another-release-key.apk', 'obb.mainpatch.current', 1619, '0.1'), + ('repo/obb.mainpatch.current_1619.apk', 'obb.mainpatch.current', 1619, '0.1'), + ('repo/obb.main.twoversions_1101613.apk', 'obb.main.twoversions', 1101613, '0.1'), + ('repo/obb.main.twoversions_1101615.apk', 'obb.main.twoversions', 1101615, '0.1'), + ('repo/obb.main.twoversions_1101617.apk', 'obb.main.twoversions', 1101617, '0.1'), + ('repo/urzip-; Рахма́, [rɐxˈmanʲɪnəf] سيرجي_رخمانينوف 谢·.apk', 'info.guardianproject.urzip', 100, '0.1'), ] for apkfilename, appid, versionCode, versionName in testcases: a, vc, vn = fdroidserver.common.get_apk_id(apkfilename) @@ -992,7 +992,7 @@ class CommonTest(unittest.TestCase): def test_get_apk_id_api_call(self): self.assertEqual( - ('info.guardianproject.urzip', '100', '0.1'), + ('info.guardianproject.urzip', 100, '0.1'), fdroidserver.common.get_apk_id('urzip.apk'), ) @@ -1089,12 +1089,12 @@ class CommonTest(unittest.TestCase): def test_apk_release_name(self): appid, vercode, sigfp = fdroidserver.common.apk_parse_release_filename('com.serwylo.lexica_905.apk') self.assertEqual(appid, 'com.serwylo.lexica') - self.assertEqual(vercode, '905') + self.assertEqual(vercode, 905) self.assertEqual(sigfp, None) appid, vercode, sigfp = fdroidserver.common.apk_parse_release_filename('com.serwylo.lexica_905_c82e0f6.apk') self.assertEqual(appid, 'com.serwylo.lexica') - self.assertEqual(vercode, '905') + self.assertEqual(vercode, 905) self.assertEqual(sigfp, 'c82e0f6') appid, vercode, sigfp = fdroidserver.common.apk_parse_release_filename('beverly_hills-90210.apk') @@ -1121,7 +1121,7 @@ class CommonTest(unittest.TestCase): ] for path in paths: self.assertTrue(os.path.isfile(path)) - self.assertEqual(('0.94-test', '940', 'org.fdroid.fdroid'), + self.assertEqual(('0.94-test', 940, 'org.fdroid.fdroid'), fdroidserver.common.parse_androidmanifests(paths, app)) app = fdroidserver.metadata.App() @@ -1145,7 +1145,7 @@ class CommonTest(unittest.TestCase): ] for path in paths: self.assertTrue(os.path.isfile(path)) - self.assertEqual(('0.6.9', '23', 'cn.wildfirechat.chat'), + self.assertEqual(('0.6.9', 23, 'cn.wildfirechat.chat'), fdroidserver.common.parse_androidmanifests(paths, app)) app = fdroidserver.metadata.App() @@ -1166,7 +1166,7 @@ class CommonTest(unittest.TestCase): ] for path in paths: self.assertTrue(os.path.isfile(path)) - self.assertEqual(('1.9.0', '170521', 'com.integreight.onesheeld'), + self.assertEqual(('1.9.0', 170521, 'com.integreight.onesheeld'), fdroidserver.common.parse_androidmanifests(paths, app)) app = fdroidserver.metadata.App() @@ -1176,7 +1176,7 @@ class CommonTest(unittest.TestCase): ] for path in paths: self.assertTrue(os.path.isfile(path)) - self.assertEqual(('0.3.10', '29', 'dev.patrickgold.florisboard'), + self.assertEqual(('0.3.10', 29, 'dev.patrickgold.florisboard'), fdroidserver.common.parse_androidmanifests(paths, app)) app = fdroidserver.metadata.App() @@ -1187,7 +1187,7 @@ class CommonTest(unittest.TestCase): ] for path in paths: self.assertTrue(os.path.isfile(path)) - self.assertEqual(('1.8.1', '1_08_01', None), + self.assertEqual(('1.8.1', 10801, None), fdroidserver.common.parse_androidmanifests(paths, app)) def test_parse_androidmanifests_ignore(self): @@ -1215,7 +1215,7 @@ class CommonTest(unittest.TestCase): ] for path in paths: self.assertTrue(os.path.isfile(path)) - self.assertEqual(('0.95-dev', '949', 'org.fdroid.fdroid.dev'), + self.assertEqual(('0.95-dev', 949, 'org.fdroid.fdroid.dev'), fdroidserver.common.parse_androidmanifests(paths, app)) app = fdroidserver.metadata.App() @@ -1228,7 +1228,7 @@ class CommonTest(unittest.TestCase): ] for path in paths: self.assertTrue(os.path.isfile(path)) - self.assertEqual(('1.23.1', '245', 'eu.siacs.conversations'), + self.assertEqual(('1.23.1', 245, 'eu.siacs.conversations'), fdroidserver.common.parse_androidmanifests(paths, app)) app = fdroidserver.metadata.App() @@ -1241,7 +1241,7 @@ class CommonTest(unittest.TestCase): ] for path in paths: self.assertTrue(os.path.isfile(path)) - self.assertEqual(('2.0.0', '20000099', 'com.nextcloud.client'), + self.assertEqual(('2.0.0', 20000099, 'com.nextcloud.client'), fdroidserver.common.parse_androidmanifests(paths, app)) app = fdroidserver.metadata.App() @@ -1254,7 +1254,7 @@ class CommonTest(unittest.TestCase): ] for path in paths: self.assertTrue(os.path.isfile(path)) - self.assertEqual(('20171223', '20171223', 'com.nextcloud.android.beta'), + self.assertEqual(('20171223', 20171223, 'com.nextcloud.android.beta'), fdroidserver.common.parse_androidmanifests(paths, app)) app = fdroidserver.metadata.App() @@ -1267,7 +1267,7 @@ class CommonTest(unittest.TestCase): ] for path in paths: self.assertTrue(os.path.isfile(path)) - self.assertEqual(('1.9.8.1-ose', '197', 'at.bitfire.davdroid'), + self.assertEqual(('1.9.8.1-ose', 197, 'at.bitfire.davdroid'), fdroidserver.common.parse_androidmanifests(paths, app)) app = fdroidserver.metadata.App() @@ -1280,7 +1280,7 @@ class CommonTest(unittest.TestCase): ] for path in paths: self.assertTrue(os.path.isfile(path)) - self.assertEqual(('1.0-libre', '1', 'com.kunzisoft.fdroidtest.applicationidsuffix.libre'), + self.assertEqual(('1.0-libre', 1, 'com.kunzisoft.fdroidtest.applicationidsuffix.libre'), fdroidserver.common.parse_androidmanifests(paths, app)) app = fdroidserver.metadata.App() @@ -1293,7 +1293,7 @@ class CommonTest(unittest.TestCase): ] for path in paths: self.assertTrue(os.path.isfile(path)) - self.assertEqual(('20180430-pro', '20180430', 'com.kunzisoft.fdroidtest.applicationidsuffix.pro'), + self.assertEqual(('20180430-pro', 20180430, 'com.kunzisoft.fdroidtest.applicationidsuffix.pro'), fdroidserver.common.parse_androidmanifests(paths, app)) app = fdroidserver.metadata.App() @@ -1306,7 +1306,7 @@ class CommonTest(unittest.TestCase): ] for path in paths: self.assertTrue(os.path.isfile(path)) - self.assertEqual(('1.0-free', '1', 'com.kunzisoft.fdroidtest.applicationidsuffix'), + self.assertEqual(('1.0-free', 1, 'com.kunzisoft.fdroidtest.applicationidsuffix'), fdroidserver.common.parse_androidmanifests(paths, app)) app = fdroidserver.metadata.App() @@ -1319,7 +1319,7 @@ class CommonTest(unittest.TestCase): ] for path in paths: self.assertTrue(os.path.isfile(path)) - self.assertEqual(('20180430-underscore', '2018_04_30', 'com.kunzisoft.fdroidtest.applicationidsuffix.underscore'), + self.assertEqual(('20180430-underscore', 20180430, 'com.kunzisoft.fdroidtest.applicationidsuffix.underscore'), fdroidserver.common.parse_androidmanifests(paths, app)) app = fdroidserver.metadata.App() @@ -1332,7 +1332,7 @@ class CommonTest(unittest.TestCase): ] for path in paths: self.assertTrue(os.path.isfile(path)) - self.assertEqual(('1.0', '1', 'com.kunzisoft.fdroidtest.applicationidsuffix.underscore_first'), + self.assertEqual(('1.0', 1, 'com.kunzisoft.fdroidtest.applicationidsuffix.underscore_first'), fdroidserver.common.parse_androidmanifests(paths, app)) app = fdroidserver.metadata.App() @@ -1345,7 +1345,7 @@ class CommonTest(unittest.TestCase): ] for path in paths: self.assertTrue(os.path.isfile(path)) - self.assertEqual(('2.5.2-fdroid', '73', 'com.github.jameshnsears.quoteunquote'), + self.assertEqual(('2.5.2-fdroid', 73, 'com.github.jameshnsears.quoteunquote'), fdroidserver.common.parse_androidmanifests(paths, app)) app = fdroidserver.metadata.App() @@ -1358,7 +1358,7 @@ class CommonTest(unittest.TestCase): ] for path in paths: self.assertTrue(os.path.isfile(path)) - self.assertEqual(('1.6.34-fdroid', '105', 'com.jens.automation2'), + self.assertEqual(('1.6.34-fdroid', 105, 'com.jens.automation2'), fdroidserver.common.parse_androidmanifests(paths, app)) app = fdroidserver.metadata.App() @@ -1371,7 +1371,7 @@ class CommonTest(unittest.TestCase): ] for path in paths: self.assertTrue(os.path.isfile(path)) - self.assertEqual(('2021-06-30', '34', 'de.varengold.activeTAN'), + self.assertEqual(('2021-06-30', 34, 'de.varengold.activeTAN'), fdroidserver.common.parse_androidmanifests(paths, app)) def test_get_all_gradle_and_manifests(self): @@ -1598,7 +1598,7 @@ class CommonTest(unittest.TestCase): side_effect=assert_subprocess_call): with tempfile.TemporaryDirectory() as tmpdir, TmpCwd(tmpdir): fdroidserver.common.deploy_build_log_with_rsync( - 'com.example.app', '4711', mocklogcontent) + 'com.example.app', 4711, mocklogcontent) expected_log_path = os.path.join(tmpdir, 'repo', 'com.example.app_4711.log.gz') self.assertTrue(os.path.isfile(expected_log_path)) @@ -2115,7 +2115,7 @@ class CommonTest(unittest.TestCase): fdroidserver.common.read_pkg_args(['org.fdroid.fdroid'], allow_vercodes), ) self.assertNotEqual( - {'com.example': ['123456']}, + {'com.example': [123456]}, fdroidserver.common.read_pkg_args(['com.example:123456'], allow_vercodes), ) @@ -2125,11 +2125,11 @@ class CommonTest(unittest.TestCase): fdroidserver.common.read_pkg_args(['org.fdroid.fdroid'], allow_vercodes), ) self.assertEqual( - {'com.example': ['123456']}, + {'com.example': [123456]}, fdroidserver.common.read_pkg_args(['com.example:123456'], allow_vercodes), ) self.assertEqual( - {'org.debian_kit': ['6']}, + {'org.debian_kit': [6]}, fdroidserver.common.read_pkg_args(['org.debian_kit_6.apk'], allow_vercodes), ) appid_versionCode_pairs = ( @@ -2138,7 +2138,7 @@ class CommonTest(unittest.TestCase): 'com.example:67890', ) self.assertEqual( - {'com.example': ['12345', '67890'], 'org.fdroid.fdroid': ['1']}, + {'com.example': [12345, 67890], 'org.fdroid.fdroid': [1]}, fdroidserver.common.read_pkg_args(appid_versionCode_pairs, allow_vercodes) ) appid_versionCode_pairs = ( @@ -2146,7 +2146,7 @@ class CommonTest(unittest.TestCase): 'org.c_base.c_beam_29.apk', ) self.assertEqual( - {'com.example': ['67890'], 'org.c_base.c_beam': ['29']}, + {'com.example': [67890], 'org.c_base.c_beam': [29]}, fdroidserver.common.read_pkg_args(appid_versionCode_pairs, allow_vercodes), ) diff --git a/tests/import_subcommand.TestCase b/tests/import_subcommand.TestCase index 8b871ee3..307f2bca 100755 --- a/tests/import_subcommand.TestCase +++ b/tests/import_subcommand.TestCase @@ -69,7 +69,7 @@ class ImportTest(unittest.TestCase): 'cn.wildfirechat.chat', 'https://github.com/wildfirechat/android-chat', '0.6.9', - '23', + 23, ), ( 'com.anpmech.launcher', @@ -81,7 +81,7 @@ class ImportTest(unittest.TestCase): 'ut.ewh.audiometrytest', 'https://github.com/ReeceStevens/ut_ewh_audiometer_2014', '1.65', - '14', + 14, ), ) for appid, url, vn, vc in data: diff --git a/tests/index.TestCase b/tests/index.TestCase index 23b0560d..b04d81c0 100755 --- a/tests/index.TestCase +++ b/tests/index.TestCase @@ -318,7 +318,7 @@ class IndexTest(unittest.TestCase): } app = fdroidserver.metadata.parse_metadata(metadatafile) app['icon'] = 'info.zwanenburg.caffeinetile.4.xml' - app['CurrentVersionCode'] = '4' + app['CurrentVersionCode'] = 4 apps = {app.id: app} apk = { 'hash': 'dbbdd7deadb038862f426b71efe4a64df8c3edf25d669e935f349510e16f65db', diff --git a/tests/metadata/dump/com.politedroid.yaml b/tests/metadata/dump/com.politedroid.yaml index 6f83af0a..01ea946e 100644 --- a/tests/metadata/dump/com.politedroid.yaml +++ b/tests/metadata/dump/com.politedroid.yaml @@ -44,7 +44,7 @@ Builds: sudo: '' target: android-10 timeout: null - versionCode: '3' + versionCode: 3 versionName: '1.2' - androidupdate: [] antcommands: [] @@ -78,7 +78,7 @@ Builds: sudo: '' target: android-15 timeout: null - versionCode: '4' + versionCode: 4 versionName: '1.3' - androidupdate: [] antcommands: [] @@ -112,7 +112,7 @@ Builds: sudo: '' target: android-10 timeout: null - versionCode: '5' + versionCode: 5 versionName: '1.4' - androidupdate: [] antcommands: [] @@ -147,13 +147,13 @@ Builds: sudo: echo 'this is just a test' target: null timeout: null - versionCode: '6' + versionCode: 6 versionName: '1.5' Categories: - Time Changelog: '' CurrentVersion: '1.5' -CurrentVersionCode: '6' +CurrentVersionCode: 6 Description: Activates silent mode during calendar events. Disabled: null Donate: null diff --git a/tests/metadata/dump/org.adaway.yaml b/tests/metadata/dump/org.adaway.yaml index 95bca2ce..dd1fcd4f 100644 --- a/tests/metadata/dump/org.adaway.yaml +++ b/tests/metadata/dump/org.adaway.yaml @@ -42,7 +42,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '13' + versionCode: 13 versionName: '1.12' - androidupdate: [] antcommands: [] @@ -78,7 +78,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '16' + versionCode: 16 versionName: '1.15' - androidupdate: [] antcommands: [] @@ -114,7 +114,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '19' + versionCode: 19 versionName: '1.18' - androidupdate: [] antcommands: [] @@ -150,7 +150,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '20' + versionCode: 20 versionName: '1.19' - androidupdate: [] antcommands: [] @@ -186,7 +186,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '21' + versionCode: 21 versionName: '1.20' - androidupdate: [] antcommands: [] @@ -222,7 +222,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '22' + versionCode: 22 versionName: '1.21' - androidupdate: [] antcommands: [] @@ -256,7 +256,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '24' + versionCode: 24 versionName: '1.23' - androidupdate: [] antcommands: [] @@ -291,7 +291,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '25' + versionCode: 25 versionName: '1.24' - androidupdate: [] antcommands: [] @@ -326,7 +326,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '26' + versionCode: 26 versionName: '1.25' - androidupdate: [] antcommands: [] @@ -361,7 +361,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '27' + versionCode: 27 versionName: '1.26' - androidupdate: [] antcommands: [] @@ -396,7 +396,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '28' + versionCode: 28 versionName: '1.27' - androidupdate: [] antcommands: [] @@ -431,7 +431,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '30' + versionCode: 30 versionName: '1.29' - androidupdate: [] antcommands: [] @@ -466,7 +466,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '33' + versionCode: 33 versionName: '1.32' - androidupdate: [] antcommands: [] @@ -500,7 +500,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '34' + versionCode: 34 versionName: '1.33' - androidupdate: [] antcommands: [] @@ -535,7 +535,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '35' + versionCode: 35 versionName: '1.34' - androidupdate: [] antcommands: [] @@ -570,7 +570,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '36' + versionCode: 36 versionName: '1.35' - androidupdate: [] antcommands: [] @@ -605,7 +605,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '37' + versionCode: 37 versionName: '1.36' - androidupdate: [] antcommands: [] @@ -640,7 +640,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '38' + versionCode: 38 versionName: '1.37' - androidupdate: - . @@ -687,7 +687,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '40' + versionCode: 40 versionName: '2.1' - androidupdate: - . @@ -734,7 +734,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '42' + versionCode: 42 versionName: '2.3' - androidupdate: [] antcommands: [] @@ -771,7 +771,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '45' + versionCode: 45 versionName: '2.6' - androidupdate: [] antcommands: [] @@ -808,7 +808,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '46' + versionCode: 46 versionName: '2.7' - androidupdate: [] antcommands: [] @@ -845,7 +845,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '47' + versionCode: 47 versionName: '2.8' - androidupdate: [] antcommands: [] @@ -882,7 +882,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '48' + versionCode: 48 versionName: 2.8.1 - androidupdate: [] antcommands: [] @@ -919,7 +919,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '49' + versionCode: 49 versionName: '2.9' - androidupdate: [] antcommands: [] @@ -956,7 +956,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '50' + versionCode: 50 versionName: 2.9.1 - androidupdate: [] antcommands: [] @@ -993,7 +993,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '51' + versionCode: 51 versionName: 2.9.2 - androidupdate: [] antcommands: [] @@ -1030,14 +1030,14 @@ Builds: sudo: '' target: null timeout: null - versionCode: '52' + versionCode: 52 versionName: '3.0' Categories: - System - Security Changelog: '' CurrentVersion: '3.0' -CurrentVersionCode: '52' +CurrentVersionCode: 52 Description: 'An ad blocker that uses the hosts file. The hosts file contains a list of mappings between hostnames and IP addresses. When diff --git a/tests/metadata/dump/org.smssecure.smssecure.yaml b/tests/metadata/dump/org.smssecure.smssecure.yaml index c30f6c79..c3ad76b6 100644 --- a/tests/metadata/dump/org.smssecure.smssecure.yaml +++ b/tests/metadata/dump/org.smssecure.smssecure.yaml @@ -53,7 +53,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '5' + versionCode: 5 versionName: 0.3.3 - androidupdate: [] antcommands: [] @@ -91,7 +91,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '6' + versionCode: 6 versionName: 0.3.3 - androidupdate: [] antcommands: [] @@ -128,7 +128,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '9' + versionCode: 9 versionName: 0.4.2 - androidupdate: [] antcommands: [] @@ -165,7 +165,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '11' + versionCode: 11 versionName: 0.5.1 - androidupdate: [] antcommands: [] @@ -201,7 +201,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '12' + versionCode: 12 versionName: 0.5.2 - androidupdate: [] antcommands: [] @@ -237,7 +237,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '100' + versionCode: 100 versionName: 0.5.3 - androidupdate: [] antcommands: [] @@ -273,7 +273,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '101' + versionCode: 101 versionName: 0.5.4 - androidupdate: [] antcommands: [] @@ -309,13 +309,13 @@ Builds: sudo: '' target: null timeout: null - versionCode: '102' + versionCode: 102 versionName: 0.6.0 Categories: - Phone & SMS Changelog: '' CurrentVersion: 0.6.0 -CurrentVersionCode: '102' +CurrentVersionCode: 102 Description: 'SMSSecure is an SMS/MMS application that allows you to protect your privacy while communicating with friends. diff --git a/tests/metadata/dump/org.videolan.vlc.yaml b/tests/metadata/dump/org.videolan.vlc.yaml index c6f928e3..652b5c2b 100644 --- a/tests/metadata/dump/org.videolan.vlc.yaml +++ b/tests/metadata/dump/org.videolan.vlc.yaml @@ -44,7 +44,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '110' + versionCode: 110 versionName: 0.0.11-ARMv7 - androidupdate: - . @@ -81,7 +81,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '111' + versionCode: 111 versionName: 0.0.11-ARM - androidupdate: - . @@ -118,7 +118,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '112' + versionCode: 112 versionName: 0.0.11-x86 - androidupdate: - . @@ -155,7 +155,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '113' + versionCode: 113 versionName: 0.0.11-mips - androidupdate: [] antcommands: [] @@ -191,7 +191,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1301' + versionCode: 1301 versionName: 0.1.3-MIPS - androidupdate: [] antcommands: [] @@ -227,7 +227,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1302' + versionCode: 1302 versionName: 0.1.3-x86 - androidupdate: [] antcommands: [] @@ -263,7 +263,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1303' + versionCode: 1303 versionName: 0.1.3-ARM - androidupdate: [] antcommands: [] @@ -299,7 +299,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1304' + versionCode: 1304 versionName: 0.1.3-ARMv7 - androidupdate: [] antcommands: [] @@ -334,7 +334,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '9002' + versionCode: 9002 versionName: 0.9.0 - androidupdate: [] antcommands: [] @@ -369,7 +369,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '9004' + versionCode: 9004 versionName: 0.9.0 - androidupdate: [] antcommands: [] @@ -404,7 +404,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '9102' + versionCode: 9102 versionName: 0.9.1 - androidupdate: [] antcommands: [] @@ -439,7 +439,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '9104' + versionCode: 9104 versionName: 0.9.1 - androidupdate: [] antcommands: [] @@ -474,7 +474,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '9502' + versionCode: 9502 versionName: 0.9.5 - androidupdate: [] antcommands: [] @@ -509,7 +509,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '9504' + versionCode: 9504 versionName: 0.9.5 - androidupdate: [] antcommands: [] @@ -544,7 +544,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '9602' + versionCode: 9602 versionName: 0.9.6 - androidupdate: [] antcommands: [] @@ -579,7 +579,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '9604' + versionCode: 9604 versionName: 0.9.6 - androidupdate: [] antcommands: [] @@ -614,7 +614,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '9702' + versionCode: 9702 versionName: 0.9.7 - androidupdate: [] antcommands: [] @@ -649,7 +649,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '9704' + versionCode: 9704 versionName: 0.9.7 - androidupdate: [] antcommands: [] @@ -684,7 +684,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '9711' + versionCode: 9711 versionName: 0.9.7.1 - androidupdate: [] antcommands: [] @@ -719,7 +719,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '9712' + versionCode: 9712 versionName: 0.9.7.1 - androidupdate: [] antcommands: [] @@ -754,7 +754,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '9714' + versionCode: 9714 versionName: 0.9.7.1 - androidupdate: [] antcommands: [] @@ -789,7 +789,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '9802' + versionCode: 9802 versionName: 0.9.8 - androidupdate: [] antcommands: [] @@ -824,7 +824,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '9803' + versionCode: 9803 versionName: 0.9.8 - androidupdate: [] antcommands: [] @@ -859,7 +859,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '9804' + versionCode: 9804 versionName: 0.9.8 - androidupdate: [] antcommands: [] @@ -894,7 +894,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '9902' + versionCode: 9902 versionName: 0.9.9 - androidupdate: [] antcommands: [] @@ -929,7 +929,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '9903' + versionCode: 9903 versionName: 0.9.9 - androidupdate: [] antcommands: [] @@ -964,7 +964,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '9904' + versionCode: 9904 versionName: 0.9.9 - androidupdate: [] antcommands: [] @@ -999,7 +999,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '10002' + versionCode: 10002 versionName: 0.9.10 - androidupdate: [] antcommands: [] @@ -1034,7 +1034,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '10003' + versionCode: 10003 versionName: 0.9.10 - androidupdate: [] antcommands: [] @@ -1069,7 +1069,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '10004' + versionCode: 10004 versionName: 0.9.10 - androidupdate: [] antcommands: [] @@ -1104,7 +1104,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '10006' + versionCode: 10006 versionName: 1.0.0 - androidupdate: [] antcommands: [] @@ -1139,7 +1139,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '10007' + versionCode: 10007 versionName: 1.0.0 - androidupdate: [] antcommands: [] @@ -1174,7 +1174,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '10008' + versionCode: 10008 versionName: 1.0.0 - androidupdate: [] antcommands: [] @@ -1209,7 +1209,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '10102' + versionCode: 10102 versionName: 1.0.1 - androidupdate: [] antcommands: [] @@ -1244,7 +1244,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '10103' + versionCode: 10103 versionName: 1.0.1 - androidupdate: [] antcommands: [] @@ -1279,7 +1279,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '10104' + versionCode: 10104 versionName: 1.0.1 - androidupdate: [] antcommands: [] @@ -1316,7 +1316,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1010303' + versionCode: 1010303 versionName: 1.1.3 - androidupdate: [] antcommands: [] @@ -1353,7 +1353,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1010304' + versionCode: 1010304 versionName: 1.1.3 - androidupdate: [] antcommands: [] @@ -1390,7 +1390,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1010305' + versionCode: 1010305 versionName: 1.1.3 - androidupdate: [] antcommands: [] @@ -1427,7 +1427,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1010503' + versionCode: 1010503 versionName: 1.1.5 - androidupdate: [] antcommands: [] @@ -1464,7 +1464,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1010504' + versionCode: 1010504 versionName: 1.1.5 - androidupdate: [] antcommands: [] @@ -1501,7 +1501,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1010505' + versionCode: 1010505 versionName: 1.1.5 - androidupdate: [] antcommands: [] @@ -1538,7 +1538,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1010603' + versionCode: 1010603 versionName: 1.1.6 - androidupdate: [] antcommands: [] @@ -1575,7 +1575,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1010604' + versionCode: 1010604 versionName: 1.1.6 - androidupdate: [] antcommands: [] @@ -1612,7 +1612,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1010605' + versionCode: 1010605 versionName: 1.1.6 - androidupdate: [] antcommands: [] @@ -1649,7 +1649,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1020003' + versionCode: 1020003 versionName: 1.2.0 - androidupdate: [] antcommands: [] @@ -1686,7 +1686,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1020004' + versionCode: 1020004 versionName: 1.2.0 - androidupdate: [] antcommands: [] @@ -1723,7 +1723,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1020005' + versionCode: 1020005 versionName: 1.2.0 - androidupdate: [] antcommands: [] @@ -1760,7 +1760,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1020103' + versionCode: 1020103 versionName: 1.2.1 - androidupdate: [] antcommands: [] @@ -1797,7 +1797,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1020104' + versionCode: 1020104 versionName: 1.2.1 - androidupdate: [] antcommands: [] @@ -1834,7 +1834,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1020105' + versionCode: 1020105 versionName: 1.2.1 - androidupdate: [] antcommands: [] @@ -1871,7 +1871,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1020203' + versionCode: 1020203 versionName: 1.2.2 - androidupdate: [] antcommands: [] @@ -1908,7 +1908,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1020204' + versionCode: 1020204 versionName: 1.2.2 - androidupdate: [] antcommands: [] @@ -1945,7 +1945,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1020205' + versionCode: 1020205 versionName: 1.2.2 - androidupdate: [] antcommands: [] @@ -1982,7 +1982,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1020303' + versionCode: 1020303 versionName: 1.2.3 - androidupdate: [] antcommands: [] @@ -2019,7 +2019,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1020304' + versionCode: 1020304 versionName: 1.2.3 - androidupdate: [] antcommands: [] @@ -2056,7 +2056,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1020305' + versionCode: 1020305 versionName: 1.2.3 - androidupdate: [] antcommands: [] @@ -2093,7 +2093,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1020403' + versionCode: 1020403 versionName: 1.2.4 - androidupdate: [] antcommands: [] @@ -2130,7 +2130,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1020404' + versionCode: 1020404 versionName: 1.2.4 - androidupdate: [] antcommands: [] @@ -2167,7 +2167,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1020405' + versionCode: 1020405 versionName: 1.2.4 - androidupdate: [] antcommands: [] @@ -2204,7 +2204,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1020503' + versionCode: 1020503 versionName: 1.2.5 - androidupdate: [] antcommands: [] @@ -2241,7 +2241,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1020504' + versionCode: 1020504 versionName: 1.2.5 - androidupdate: [] antcommands: [] @@ -2278,7 +2278,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1020505' + versionCode: 1020505 versionName: 1.2.5 - androidupdate: [] antcommands: [] @@ -2315,7 +2315,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1030003' + versionCode: 1030003 versionName: 1.2.6 - androidupdate: [] antcommands: [] @@ -2352,7 +2352,7 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1030004' + versionCode: 1030004 versionName: 1.2.6 - androidupdate: [] antcommands: [] @@ -2389,13 +2389,13 @@ Builds: sudo: '' target: null timeout: null - versionCode: '1030005' + versionCode: 1030005 versionName: 1.2.6 Categories: - Multimedia Changelog: '' CurrentVersion: 1.2.6 -CurrentVersionCode: '1030005' +CurrentVersionCode: 1030005 Description: 'Video and audio player that supports a wide range of formats, for both local and remote playback. diff --git a/tests/scanner.TestCase b/tests/scanner.TestCase index b301b9ea..5f5898cb 100755 --- a/tests/scanner.TestCase +++ b/tests/scanner.TestCase @@ -246,7 +246,7 @@ class ScannerTest(unittest.TestCase): build.commit = '1.0' build.output = app.id + '.apk' build.scanignore = ['baz.so', 'foo.aar'] - build.versionCode = '1' + build.versionCode = 1 build.versionName = '1.0' vcs = mock.Mock() diff --git a/tests/update.TestCase b/tests/update.TestCase index 7c669760..5b4e8142 100755 --- a/tests/update.TestCase +++ b/tests/update.TestCase @@ -1427,7 +1427,7 @@ class UpdateTest(unittest.TestCase): 'Builds': None, 'Changelog': '', 'CurrentVersion': '', - 'CurrentVersionCode': '', + 'CurrentVersionCode': None, 'Disabled': '', 'Donate': '', 'FlattrID': '',