From bf25b4ca03adc967936ca405fdced8a4af0dfe72 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 9 Dec 2020 16:01:21 +0100 Subject: [PATCH] eliminate app.builds everywhere, it should be app['Builds'] The .txt format was the last place where the lowercase "builds" was used, this converts references everywhere to be "Builds". This makes it possible to load metadata YAML files with any YAML parser, then have it possible to use fdroidserver methods on that data, like metadata.write_metadata(). The test files in tests/metadata/dump/*.yaml were manually edited by cutting the builds: block and putting it the sort order for Builds: so the contents should be unchanged. ``` sed -i \ -e 's/app\.builds/app.get('Builds', \[\])/g' \ -e "s/app\.get(Builds, \[\]) =/app\['Builds'] =/g" \ -e "s/app\.get(Builds, \[\]) =/app\['Builds'] =/g" \ -e "s/app\.get(Builds, \[\])/app.get('Builds', \[\])/g" \ -e "s/app\.get('Builds', \[\])\.append/app\['Builds'\].append/g" \ -e "s/app\['builds'\]/app.get('Builds', [])/g" \ */*.* ``` --- fdroidserver/build.py | 8 +- fdroidserver/checkupdates.py | 8 +- fdroidserver/common.py | 10 +- fdroidserver/import.py | 2 +- fdroidserver/index.py | 6 +- fdroidserver/lint.py | 14 +-- fdroidserver/metadata.py | 26 ++-- fdroidserver/rewritemeta.py | 4 +- fdroidserver/scanner.py | 6 +- fdroidserver/update.py | 22 ++-- tests/checkupdates.TestCase | 8 +- tests/common.TestCase | 18 +-- tests/metadata.TestCase | 22 ++-- tests/metadata/dump/com.politedroid.yaml | 66 +++++------ tests/metadata/dump/org.adaway.yaml | 112 +++++++++--------- .../dump/org.smssecure.smssecure.yaml | 106 ++++++++--------- tests/metadata/dump/org.videolan.vlc.yaml | 110 ++++++++--------- tests/update.TestCase | 6 +- 18 files changed, 275 insertions(+), 279 deletions(-) diff --git a/fdroidserver/build.py b/fdroidserver/build.py index ea5e1420..6b35afac 100644 --- a/fdroidserver/build.py +++ b/fdroidserver/build.py @@ -1017,7 +1017,7 @@ def main(): apps = common.read_app_args(options.appid, allapps, True) for appid, app in list(apps.items()): - if (app.Disabled and not options.force) or not app.RepoType or not app.builds: + if (app.get('Disabled') and not options.force) or not app.get('RepoType') or not app.get('Builds', []): del apps[appid] if not apps: @@ -1038,10 +1038,10 @@ def main(): if options.latest: for app in apps.values(): - for build in reversed(app.builds): + for build in reversed(app.get('Builds', [])): if build.disable and not options.force: continue - app.builds = [build] + app['Builds'] = [build] break if options.wiki: @@ -1062,7 +1062,7 @@ def main(): first = True - for build in app.builds: + for build in app.get('Builds', []): if time.time() > endtime: max_build_time_reached = True break diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index 604f4e1a..fe9b63d8 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -221,8 +221,8 @@ def check_repomanifest(app, branch=None): vcs.gotorevision(None) last_build = metadata.Build() - if len(app.builds) > 0: - last_build = app.builds[-1] + if len(app.get('Builds', [])) > 0: + last_build = app.get('Builds', [])[-1] try_init_submodules(app, last_build, vcs) @@ -506,7 +506,7 @@ def checkupdates_app(app): gotcur = False latest = None - for build in app.builds: + for build in app.get('Builds', []): if int(build.versionCode) >= int(app.CurrentVersionCode): gotcur = True if not latest or int(build.versionCode) > int(latest.versionCode): @@ -524,7 +524,7 @@ def checkupdates_app(app): commit = pattern.replace('%v', app.CurrentVersion) commit = commit.replace('%c', newbuild.versionCode) newbuild.commit = commit - app.builds.append(newbuild) + app['Builds'].append(newbuild) name = _getappname(app) ver = _getcvname(app) commitmsg = "Update %s to %s" % (name, ver) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 090ba1e4..4aebe275 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -641,10 +641,10 @@ def read_app_args(appid_versionCode_pairs, allapps, allow_vercodes=False): vc = vercodes[appid] if not vc: continue - app.builds = [b for b in app.builds if b.versionCode in vc] - if len(app.builds) != len(vercodes[appid]): + app['Builds'] = [b for b in app.get('Builds', []) if b.versionCode in vc] + if len(app.get('Builds', [])) != len(vercodes[appid]): error = True - allvcs = [b.versionCode for b in app.builds] + allvcs = [b.versionCode for b in app.get('Builds', [])] for v in vercodes[appid]: if v not in allvcs: logging.critical(_("No such versionCode {versionCode} for app {appid}") @@ -1538,8 +1538,8 @@ def parse_androidmanifests(paths, app): flavour = None temp_app_id = None temp_version_name = None - if app.builds and 'gradle' in app.builds[-1] and app.builds[-1].gradle: - flavour = app.builds[-1].gradle[-1] + if len(app.get('Builds', [])) > 0 and 'gradle' in app['Builds'][-1] and app['Builds'][-1].gradle: + flavour = app['Builds'][-1].gradle[-1] if path.endswith('.gradle') or path.endswith('.gradle.kts'): with open(path, 'r') as f: diff --git a/fdroidserver/import.py b/fdroidserver/import.py index 48af3b9c..7c608e58 100644 --- a/fdroidserver/import.py +++ b/fdroidserver/import.py @@ -238,7 +238,7 @@ def main(): metadata.post_metadata_parse(app) - app.builds.append(build) + app['Builds'].append(build) if write_local_file: metadata.write_metadata('.fdroid.yml', app) diff --git a/fdroidserver/index.py b/fdroidserver/index.py index aae0eb05..565a1c1e 100644 --- a/fdroidserver/index.py +++ b/fdroidserver/index.py @@ -158,7 +158,7 @@ def make_v1(apps, packages, repodir, repodict, requestsdict, fdroid_signing_key_ for k, v in sorted(appdict.items()): if not v: continue - if k in ('builds', 'comments', 'metadatapath', + if k in ('Builds', 'comments', 'metadatapath', 'ArchivePolicy', 'AutoUpdateMode', 'MaintainerNotes', 'Provides', 'Repo', 'RepoType', 'RequiresRoot', 'UpdateCheckData', 'UpdateCheckIgnore', 'UpdateCheckMode', @@ -201,7 +201,7 @@ def make_v1(apps, packages, repodir, repodict, requestsdict, fdroid_signing_key_ if not package.get('versionName'): app = apps[packageName] versionCodeStr = str(package['versionCode']) # TODO build.versionCode should be int! - for build in app['builds']: + for build in app.get('Builds', []): if build['versionCode'] == versionCodeStr: versionName = build.get('versionName') logging.info(_('Overriding blank versionName in {apkfilename} from metadata: {version}') @@ -477,7 +477,7 @@ 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.builds: + for build in app.get('Builds', []): if build['versionCode'] == versionCodeStr and 'versionName' in build: versionName = build['versionName'] break diff --git a/fdroidserver/lint.py b/fdroidserver/lint.py index b5acc9ad..61916e71 100644 --- a/fdroidserver/lint.py +++ b/fdroidserver/lint.py @@ -234,7 +234,7 @@ def check_vercode_operation(app): def check_ucm_tags(app): - lastbuild = get_lastbuild(app.builds) + lastbuild = get_lastbuild(app.get('Builds', [])) if (lastbuild is not None and lastbuild.commit and app.UpdateCheckMode == 'RepoManifest' @@ -389,7 +389,7 @@ def check_bulleted_lists(app): def check_builds(app): supported_flags = set(metadata.build_flags) # needed for YAML and JSON - for build in app.builds: + for build in app.get('Builds', []): if build.disable: if build.disable.startswith('Generated by import.py'): yield _("Build generated by `fdroid import` - remove disable line once ready") @@ -424,7 +424,7 @@ def check_files_dir(app): files.add(name) used = {'signatures', } - for build in app.builds: + for build in app.get('Builds', []): for fname in build.patch: if fname not in files: yield _("Unknown file '{filename}' in build '{versionName}'")\ @@ -466,7 +466,7 @@ def check_extlib_dir(apps): used = set() for app in apps: - for build in app.builds: + for build in app.get('Builds', []): for path in build.extlibs: if path not in unused_extlib_files: yield _("{appid}: Unknown extlib {path} in build '{versionName}'")\ @@ -494,7 +494,7 @@ def check_app_field_types(app): t = metadata.fieldtype(field) if v is None: continue - elif field == 'builds': + elif field == 'Builds': if not isinstance(v, list): yield(_("{appid}: {field} must be a '{type}', but it is a '{fieldtype}'!") .format(appid=app.id, field=field, @@ -544,7 +544,7 @@ def check_current_version_code(app): if cv is not None and int(cv) == 0: return - builds = app.get('builds') + builds = app.get('Builds') active_builds = 0 min_versionCode = None if builds: @@ -617,7 +617,7 @@ def main(): # run yamllint on srclib metadata srclibs = set() - for build in app.builds: + for build in app.get('Builds', []): for srclib in build.srclibs: srclibs.add(srclib) for srclib in srclibs: diff --git a/fdroidserver/metadata.py b/fdroidserver/metadata.py index b4b0ab26..6af19c1f 100644 --- a/fdroidserver/metadata.py +++ b/fdroidserver/metadata.py @@ -158,7 +158,7 @@ class App(dict): self.id = None self.metadatapath = None - self.builds = [] + self.Builds = [] self.comments = {} self.added = None self.lastUpdated = None @@ -179,8 +179,8 @@ class App(dict): raise AttributeError("No such attribute: " + name) def get_last_build(self): - if len(self.builds) > 0: - return self.builds[-1] + if len(self.Builds) > 0: + return self.Builds[-1] else: return Build() @@ -633,9 +633,6 @@ def post_metadata_parse(app): if type(v) in (float, int): app[k] = str(v) - if 'Builds' in app: - app['builds'] = app.pop('Builds') - if 'flavours' in app and app['flavours'] == [True]: app['flavours'] = 'yes' @@ -664,8 +661,8 @@ def post_metadata_parse(app): _bool_allowed = ('maven', 'buildozer') builds = [] - if 'builds' in app: - for build in app['builds']: + if 'Builds' in app: + for build in app.get('Builds', []): if not isinstance(build, Build): build = Build(build) for k, v in build.items(): @@ -693,7 +690,7 @@ def post_metadata_parse(app): build[k] = str(v) builds.append(build) - app.builds = sorted_builds(builds) + app['Builds'] = sorted_builds(builds) # Parse metadata for a single application. @@ -710,8 +707,6 @@ def post_metadata_parse(app): # # Known keys not originating from the metadata are: # -# 'builds' - a list of dictionaries containing build information -# for each defined build # 'comments' - a list of comments from the metadata file. Each is # a list of the form [field, comment] where field is # the name of the field it preceded in the metadata @@ -771,8 +766,8 @@ def parse_metadata(metadatapath, check_vcs=False, refresh=True): post_metadata_parse(app) if not app.id: - if app.builds: - build = app.builds[-1] + if app.get('Builds'): + build = app['Builds'][-1] if build.subdir: root_dir = build.subdir else: @@ -925,9 +920,8 @@ def write_yaml(mf, app): insert_newline = True else: if app.get(field) or field == 'Builds': - # .txt called it 'builds' internally, everywhere else its 'Builds' if field == 'Builds': - if app.get('builds'): + if app.get('Builds'): cm.update({field: _builds_to_yaml(app)}) elif field == 'CurrentVersionCode': cm.update({field: _field_to_yaml(TYPE_INT, getattr(app, field))}) @@ -945,7 +939,7 @@ def write_yaml(mf, app): def _builds_to_yaml(app): builds = ruamel.yaml.comments.CommentedSeq() - for build in app.builds: + for build in app.get('Builds', []): b = ruamel.yaml.comments.CommentedMap() for field in build_flags: value = getattr(build, field) diff --git a/fdroidserver/rewritemeta.py b/fdroidserver/rewritemeta.py index 94439b97..66ddf98a 100644 --- a/fdroidserver/rewritemeta.py +++ b/fdroidserver/rewritemeta.py @@ -78,7 +78,7 @@ def main(): continue newbuilds = [] - for build in app.builds: + for build in app.get('Builds', []): new = metadata.Build() for k in metadata.build_flags: v = build[k] @@ -86,7 +86,7 @@ def main(): continue new[k] = v newbuilds.append(new) - app.builds = newbuilds + app['Builds'] = newbuilds # rewrite to temporary file before overwriting existsing # file in case there's a bug in write_metadata diff --git a/fdroidserver/scanner.py b/fdroidserver/scanner.py index 8230831e..fca0c124 100644 --- a/fdroidserver/scanner.py +++ b/fdroidserver/scanner.py @@ -420,7 +420,7 @@ def main(): else: build_dir = os.path.join('build', appid) - if app.builds: + if app.get('Builds'): logging.info(_("Processing {appid}").format(appid=appid)) # Set up vcs interface and make sure we have the latest code... vcs = common.getvcs(app.RepoType, app.Repo, build_dir) @@ -434,9 +434,9 @@ def main(): logging.warning(_('Scanner found {count} problems in {appid}:') .format(count=count, appid=appid)) probcount += count - app.builds = [] + app['Builds'] = [] - for build in app.builds: + for build in app.get('Builds', []): json_per_build = DEFAULT_JSON_PER_BUILD json_per_appid[build.versionCode] = json_per_build diff --git a/fdroidserver/update.py b/fdroidserver/update.py index 7261256f..9e79cc8d 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -157,9 +157,8 @@ def status_update_json(apps, apks): for apk in apks: if apk['packageName'] == appid: apklist.append(apk) - builds = app.get('builds', []) validapks = 0 - for build in builds: + for build in app.get('Builds', []): if not build.get('disable'): builtit = False for apk in apklist: @@ -252,7 +251,7 @@ def update_wiki(apps, apks): gotcurrentver = True apklist.append(apk) # Include ones we can't build, as a special case... - for build in app.builds: + for build in app.get('Builds', []): if build.disable: if build.versionCode == app.CurrentVersionCode: cantupdate = True @@ -411,7 +410,7 @@ def delete_disabled_builds(apps, apkcache, repodirs): :param repodirs: the repo directories to process """ for appid, app in apps.items(): - for build in app['builds']: + for build in app.get('Builds', []): if not build.disable: continue apkfilename = common.get_release_filename(app, build) @@ -742,7 +741,7 @@ def translate_per_build_anti_features(apps, apks): antiFeatures = dict() for packageName, app in apps.items(): d = dict() - for build in app['builds']: + for build in app.get('Builds', []): afl = build.get('antifeatures') if afl: d[int(build.versionCode)] = afl @@ -1022,8 +1021,8 @@ def copy_triple_t_store_metadata(apps): if os.path.exists(p): gradle_subdirs.add(p) flavors = set() - if app.builds: - flavors = app.builds[0].gradle + if app.get('Builds'): + flavors = app['Builds'][0].gradle for flavor in flavors: if flavor not in ('yes', 'no'): p = os.path.join('build', packageName, gradle_path, 'src', flavor, 'play') @@ -1148,9 +1147,12 @@ def insert_localized_app_metadata(apps): # flavours specified in build receipt build_flavours = "" - if apps[packageName] and 'builds' in apps[packageName] and len(apps[packageName].builds) > 0\ - and 'gradle' in apps[packageName].builds[-1]: - build_flavours = apps[packageName].builds[-1].gradle + if ( + apps[packageName] + and len(apps[packageName].get('Builds', [])) > 0 + and 'gradle' in apps[packageName]['Builds'][-1] + ): + build_flavours = apps[packageName]['Builds'][-1]['gradle'] if len(segments) >= 5 and segments[4] == "fastlane" and segments[3] not in build_flavours: logging.debug("ignoring due to wrong flavour") diff --git a/tests/checkupdates.TestCase b/tests/checkupdates.TestCase index 7772dfa5..0fff202d 100755 --- a/tests/checkupdates.TestCase +++ b/tests/checkupdates.TestCase @@ -49,13 +49,13 @@ class CheckupdatesTest(unittest.TestCase): build = fdroidserver.metadata.Build() build.versionCode = app.CurrentVersionCode build.versionName = app.CurrentVersion - app.builds.append(build) + app['Builds'].append(build) with mock.patch('fdroidserver.checkupdates.check_http', lambda app: ('1.1.9', 10109)): with mock.patch('fdroidserver.metadata.write_metadata', mock.Mock()): with mock.patch('subprocess.call', lambda cmd: 0): fdroidserver.checkupdates.checkupdates_app(app) - build = app.builds[-1] + build = app['Builds'][-1] self.assertEqual(build.versionName, '1.1.9') self.assertEqual(build.commit, '1.1.9') @@ -75,13 +75,13 @@ class CheckupdatesTest(unittest.TestCase): build = fdroidserver.metadata.Build() build.versionCode = app.CurrentVersionCode build.versionName = app.CurrentVersion - app.builds.append(build) + app['Builds'].append(build) with mock.patch('fdroidserver.checkupdates.check_http', lambda app: ('1.1.9', 10109)): with mock.patch('fdroidserver.metadata.write_metadata', mock.Mock()): with mock.patch('subprocess.call', lambda cmd: 0): fdroidserver.checkupdates.checkupdates_app(app) - build = app.builds[-1] + build = app['Builds'][-1] self.assertEqual(build.versionName, '1.1.9.10109-fdroid') self.assertEqual(build.commit, 'v1.1.9_10109') diff --git a/tests/common.TestCase b/tests/common.TestCase index 90e109ae..253f8037 100755 --- a/tests/common.TestCase +++ b/tests/common.TestCase @@ -943,7 +943,7 @@ class CommonTest(unittest.TestCase): app = fdroidserver.metadata.App() build = fdroidserver.metadata.Build() build.gradle = ['devVersion'] - app.builds = [build] + app['Builds'] = [build] app.id = 'org.fdroid.fdroid.dev' paths = [ os.path.join('source-files', 'fdroid', 'fdroidclient', 'AndroidManifest.xml'), @@ -957,7 +957,7 @@ class CommonTest(unittest.TestCase): app = fdroidserver.metadata.App() build = fdroidserver.metadata.Build() build.gradle = ['free'] - app.builds = [build] + app['Builds'] = [build] app.id = 'eu.siacs.conversations' paths = [ os.path.join('source-files', 'eu.siacs.conversations', 'build.gradle'), @@ -970,7 +970,7 @@ class CommonTest(unittest.TestCase): app = fdroidserver.metadata.App() build = fdroidserver.metadata.Build() build.gradle = ['generic'] - app.builds = [build] + app['Builds'] = [build] app.id = 'com.nextcloud.client' paths = [ os.path.join('source-files', 'com.nextcloud.client', 'build.gradle'), @@ -983,7 +983,7 @@ class CommonTest(unittest.TestCase): app = fdroidserver.metadata.App() build = fdroidserver.metadata.Build() build.gradle = ['versionDev'] - app.builds = [build] + app['Builds'] = [build] app.id = 'com.nextcloud.android.beta' paths = [ os.path.join('source-files', 'com.nextcloud.client', 'build.gradle'), @@ -996,7 +996,7 @@ class CommonTest(unittest.TestCase): app = fdroidserver.metadata.App() build = fdroidserver.metadata.Build() build.gradle = ['standard'] - app.builds = [build] + app['Builds'] = [build] app.id = 'at.bitfire.davdroid' paths = [ os.path.join('source-files', 'at.bitfire.davdroid', 'build.gradle'), @@ -1009,7 +1009,7 @@ class CommonTest(unittest.TestCase): app = fdroidserver.metadata.App() build = fdroidserver.metadata.Build() build.gradle = ['libre'] - app.builds = [build] + app['Builds'] = [build] app.id = 'com.kunzisoft.fdroidtest.applicationidsuffix.libre' paths = [ os.path.join('source-files', 'com.kunzisoft.testcase', 'build.gradle'), @@ -1022,7 +1022,7 @@ class CommonTest(unittest.TestCase): app = fdroidserver.metadata.App() build = fdroidserver.metadata.Build() build.gradle = ['pro'] - app.builds = [build] + app['Builds'] = [build] app.id = 'com.kunzisoft.fdroidtest.applicationidsuffix.pro' paths = [ os.path.join('source-files', 'com.kunzisoft.testcase', 'build.gradle'), @@ -1035,7 +1035,7 @@ class CommonTest(unittest.TestCase): app = fdroidserver.metadata.App() build = fdroidserver.metadata.Build() build.gradle = ['free'] - app.builds = [build] + app['Builds'] = [build] app.id = 'com.kunzisoft.fdroidtest.applicationidsuffix' paths = [ os.path.join('source-files', 'com.kunzisoft.testcase', 'build.gradle'), @@ -1048,7 +1048,7 @@ class CommonTest(unittest.TestCase): app = fdroidserver.metadata.App() build = fdroidserver.metadata.Build() build.gradle = ['underscore'] - app.builds = [build] + app['Builds'] = [build] app.id = 'com.kunzisoft.fdroidtest.applicationidsuffix.underscore' paths = [ os.path.join('source-files', 'com.kunzisoft.testcase', 'build.gradle'), diff --git a/tests/metadata.TestCase b/tests/metadata.TestCase index f2c85331..45353c08 100755 --- a/tests/metadata.TestCase +++ b/tests/metadata.TestCase @@ -316,7 +316,7 @@ class MetadataTest(unittest.TestCase): build.disable = 'Generated by import.py ...' build.commit = 'Unknown' build.gradle = [True] - app.builds = [build] + app['Builds'] = [build] fdroidserver.metadata.write_yaml(mf, app) @@ -464,7 +464,7 @@ class MetadataTest(unittest.TestCase): mf = io.StringIO() app = fdroidserver.metadata.App() app.Categories = ['None'] - app.builds = [] + app['Builds'] = [] build = fdroidserver.metadata.Build() build.versionCode = 102030 build.versionName = 'v1.2.3' @@ -472,7 +472,7 @@ class MetadataTest(unittest.TestCase): build.init = "sed -i -e 'g/what/ever/' /some/file" build.prebuild = "sed -i 'd/that wrong config/' gradle.properties" build.build = "./gradlew compile" - app.builds.append(build) + app['Builds'].append(build) fdroidserver.metadata.write_yaml(mf, app) mf.seek(0) self.assertEqual(mf.read(), textwrap.dedent("""\ @@ -496,7 +496,7 @@ class MetadataTest(unittest.TestCase): mf = io.StringIO() app = fdroidserver.metadata.App() app.Categories = ['None'] - app.builds = [] + app['Builds'] = [] build = fdroidserver.metadata.Build() build.versionCode = 102030 build.versionName = 'v1.2.3' @@ -504,7 +504,7 @@ class MetadataTest(unittest.TestCase): build.init = ["sed -i -e 'g/what/ever/' /some/file"] build.prebuild = ["sed -i 'd/that wrong config/' gradle.properties"] build.build = ["./gradlew compile"] - app.builds.append(build) + app['Builds'].append(build) fdroidserver.metadata.write_yaml(mf, app) mf.seek(0) self.assertEqual(mf.read(), textwrap.dedent("""\ @@ -528,7 +528,7 @@ class MetadataTest(unittest.TestCase): mf = io.StringIO() app = fdroidserver.metadata.App() app.Categories = ['None'] - app.builds = [] + app['Builds'] = [] build = fdroidserver.metadata.Build() build.versionCode = 102030 build.versionName = 'v1.2.3' @@ -542,7 +542,7 @@ class MetadataTest(unittest.TestCase): build.build = ["./gradlew someSpecialTask", "sed -i 'd/that wrong config/' gradle.properties", "./gradlew compile"] - app.builds.append(build) + app['Builds'].append(build) fdroidserver.metadata.write_yaml(mf, app) mf.seek(0) self.assertEqual(mf.read(), textwrap.dedent("""\ @@ -576,7 +576,7 @@ class MetadataTest(unittest.TestCase): mf = io.StringIO() app = fdroidserver.metadata.App() app.Categories = ['None'] - app.builds = [] + app['Builds'] = [] build = fdroidserver.metadata.Build() build.versionCode = 102030 build.versionName = 'v1.2.3' @@ -584,7 +584,7 @@ class MetadataTest(unittest.TestCase): build.init = "bash generate_some_file.sh && sed -i -e 'g/what/ever/' /some/file" build.prebuild = "npm something && echo 'important setting' >> /a/file" build.build = "./gradlew someSpecialTask && sed -i 'd/that wrong config/' gradle.properties && ./gradlew compile" - app.builds.append(build) + app['Builds'].append(build) fdroidserver.metadata.write_yaml(mf, app) mf.seek(0) self.assertEqual(mf.read(), textwrap.dedent("""\ @@ -619,12 +619,12 @@ class MetadataTest(unittest.TestCase): app = fdroidserver.metadata.App() app.Categories = ['None'] app.Provides = 'this.is.deprecated' - app.builds = [] + app['Builds'] = [] build = fdroidserver.metadata.Build() build.versionCode = 102030 build.versionName = 'v1.2.3' build.gradle = ['yes'] - app.builds.append(build) + app['Builds'].append(build) fdroidserver.metadata.write_yaml(mf, app) mf.seek(0) self.assertEqual(mf.read(), textwrap.dedent("""\ diff --git a/tests/metadata/dump/com.politedroid.yaml b/tests/metadata/dump/com.politedroid.yaml index 1fe59448..28c089ad 100644 --- a/tests/metadata/dump/com.politedroid.yaml +++ b/tests/metadata/dump/com.politedroid.yaml @@ -7,39 +7,7 @@ AutoName: Polite Droid AutoUpdateMode: Version v%v Binaries: null Bitcoin: null -Categories: -- Time -Changelog: '' -CurrentVersion: '1.5' -CurrentVersionCode: '6' -Description: Activates silent mode during calendar events. -Disabled: null -Donate: null -FlattrID: null -IssueTracker: https://github.com/miguelvps/PoliteDroid/issues -Liberapay: null -LiberapayID: null -License: GPL-3.0-only -Litecoin: null -MaintainerNotes: '' -Name: null -NoSourceSince: '1.5' -OpenCollective: null -Provides: null -Repo: https://github.com/miguelvps/PoliteDroid.git -RepoType: git -RequiresRoot: false -SourceCode: https://github.com/miguelvps/PoliteDroid -Summary: Calendar tool -Translation: '' -UpdateCheckData: null -UpdateCheckIgnore: null -UpdateCheckMode: Tags -UpdateCheckName: null -VercodeOperation: null -WebSite: '' -added: null -builds: +Builds: - androidupdate: [] antcommands: [] antifeatures: @@ -180,6 +148,38 @@ builds: timeout: null versionCode: '6' versionName: '1.5' +Categories: +- Time +Changelog: '' +CurrentVersion: '1.5' +CurrentVersionCode: '6' +Description: Activates silent mode during calendar events. +Disabled: null +Donate: null +FlattrID: null +IssueTracker: https://github.com/miguelvps/PoliteDroid/issues +Liberapay: null +LiberapayID: null +License: GPL-3.0-only +Litecoin: null +MaintainerNotes: '' +Name: null +NoSourceSince: '1.5' +OpenCollective: null +Provides: null +Repo: https://github.com/miguelvps/PoliteDroid.git +RepoType: git +RequiresRoot: false +SourceCode: https://github.com/miguelvps/PoliteDroid +Summary: Calendar tool +Translation: '' +UpdateCheckData: null +UpdateCheckIgnore: null +UpdateCheckMode: Tags +UpdateCheckName: null +VercodeOperation: null +WebSite: '' +added: null comments: {} id: com.politedroid lastUpdated: null diff --git a/tests/metadata/dump/org.adaway.yaml b/tests/metadata/dump/org.adaway.yaml index 4732ad01..b5cca8cd 100644 --- a/tests/metadata/dump/org.adaway.yaml +++ b/tests/metadata/dump/org.adaway.yaml @@ -7,62 +7,7 @@ AutoName: AdAway AutoUpdateMode: Version v%v Binaries: null Bitcoin: null -Categories: -- System -- Security -Changelog: '' -CurrentVersion: '3.0' -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 - - an app requests an ad, that request is directed to 127.0.0.1 which does - - nothing. There are options to run a web server - - to respond to blocked hostnames and to direct requests to the IP - - address of your choosing. You can download hosts files from the - - app but it is possible to use your own and to add certain sites - - to the white- and black-lists. - - - [https://github.com/dschuermann/ad-away/raw/HEAD/CHANGELOG Changelog] - - - Requires root: Yes. The hosts files is located in /system which is normally - - read-only.' -Disabled: null -Donate: http://sufficientlysecure.org/index.php/adaway -FlattrID: '369138' -IssueTracker: https://github.com/dschuermann/ad-away/issues -Liberapay: null -LiberapayID: '1234567890' -License: GPL-3.0-only -Litecoin: null -MaintainerNotes: '' -Name: null -NoSourceSince: '' -OpenCollective: null -Provides: null -Repo: https://github.com/dschuermann/ad-away.git -RepoType: git -RequiresRoot: false -SourceCode: https://github.com/dschuermann/ad-away -Summary: Block advertisements -Translation: https://www.transifex.com/dominikschuermann/adaway -UpdateCheckData: null -UpdateCheckIgnore: null -UpdateCheckMode: Tags -UpdateCheckName: null -VercodeOperation: null -WebSite: http://sufficientlysecure.org/index.php/adaway -added: null -builds: +Builds: - androidupdate: [] antcommands: [] antifeatures: [] @@ -1086,6 +1031,61 @@ builds: timeout: null versionCode: '52' versionName: '3.0' +Categories: +- System +- Security +Changelog: '' +CurrentVersion: '3.0' +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 + + an app requests an ad, that request is directed to 127.0.0.1 which does + + nothing. There are options to run a web server + + to respond to blocked hostnames and to direct requests to the IP + + address of your choosing. You can download hosts files from the + + app but it is possible to use your own and to add certain sites + + to the white- and black-lists. + + + [https://github.com/dschuermann/ad-away/raw/HEAD/CHANGELOG Changelog] + + + Requires root: Yes. The hosts files is located in /system which is normally + + read-only.' +Disabled: null +Donate: http://sufficientlysecure.org/index.php/adaway +FlattrID: '369138' +IssueTracker: https://github.com/dschuermann/ad-away/issues +Liberapay: null +LiberapayID: '1234567890' +License: GPL-3.0-only +Litecoin: null +MaintainerNotes: '' +Name: null +NoSourceSince: '' +OpenCollective: null +Provides: null +Repo: https://github.com/dschuermann/ad-away.git +RepoType: git +RequiresRoot: false +SourceCode: https://github.com/dschuermann/ad-away +Summary: Block advertisements +Translation: https://www.transifex.com/dominikschuermann/adaway +UpdateCheckData: null +UpdateCheckIgnore: null +UpdateCheckMode: Tags +UpdateCheckName: null +VercodeOperation: null +WebSite: http://sufficientlysecure.org/index.php/adaway +added: null comments: {} id: org.adaway lastUpdated: null diff --git a/tests/metadata/dump/org.smssecure.smssecure.yaml b/tests/metadata/dump/org.smssecure.smssecure.yaml index 9587ce57..4af66030 100644 --- a/tests/metadata/dump/org.smssecure.smssecure.yaml +++ b/tests/metadata/dump/org.smssecure.smssecure.yaml @@ -7,59 +7,7 @@ AutoName: SMSSecure AutoUpdateMode: Version v%v Binaries: null Bitcoin: null -Categories: -- Phone & SMS -Changelog: '' -CurrentVersion: 0.6.0 -CurrentVersionCode: '102' -Description: 'SMSSecure is an SMS/MMS application that allows you to protect your - privacy while communicating with friends. - - Using SMSSecure, you can send SMS messages and share media or attachments with complete - privacy. - - - * Easy. SMSSecure works like any other SMS application. There''s nothing to sign - up for and no new service your friends need to join. - - * Reliable. SMSSecure communicates using encrypted SMS messages. No servers or internet - connection required. - - * Private. SMSSecure uses the TextSecure encryption protocol to provide privacy - for every message, every time. - - * Safe. All messages are encrypted locally, so if your phone is lost or stolen, - your messages are protected. - - * Open Source. SMSSecure is Free and Open Source, enabling anyone to verify its - security by auditing the code.' -Disabled: null -Donate: null -FlattrID: null -IssueTracker: https://github.com/SMSSecure/SMSSecure/issues -Liberapay: null -LiberapayID: null -License: GPL-3.0-only -Litecoin: null -MaintainerNotes: '' -Name: null -NoSourceSince: '' -OpenCollective: null -Provides: null -Repo: https://github.com/SMSSecure/SMSSecure -RepoType: git -RequiresRoot: false -SourceCode: https://github.com/SMSSecure/SMSSecure -Summary: Send encrypted text messages (SMS) -Translation: https://www.transifex.com/silence/silence -UpdateCheckData: null -UpdateCheckIgnore: null -UpdateCheckMode: Tags -UpdateCheckName: null -VercodeOperation: null -WebSite: http://www.smssecure.org -added: null -builds: +Builds: - androidupdate: [] antcommands: [] antifeatures: [] @@ -362,6 +310,58 @@ builds: timeout: null versionCode: '102' versionName: 0.6.0 +Categories: +- Phone & SMS +Changelog: '' +CurrentVersion: 0.6.0 +CurrentVersionCode: '102' +Description: 'SMSSecure is an SMS/MMS application that allows you to protect your + privacy while communicating with friends. + + Using SMSSecure, you can send SMS messages and share media or attachments with complete + privacy. + + + * Easy. SMSSecure works like any other SMS application. There''s nothing to sign + up for and no new service your friends need to join. + + * Reliable. SMSSecure communicates using encrypted SMS messages. No servers or internet + connection required. + + * Private. SMSSecure uses the TextSecure encryption protocol to provide privacy + for every message, every time. + + * Safe. All messages are encrypted locally, so if your phone is lost or stolen, + your messages are protected. + + * Open Source. SMSSecure is Free and Open Source, enabling anyone to verify its + security by auditing the code.' +Disabled: null +Donate: null +FlattrID: null +IssueTracker: https://github.com/SMSSecure/SMSSecure/issues +Liberapay: null +LiberapayID: null +License: GPL-3.0-only +Litecoin: null +MaintainerNotes: '' +Name: null +NoSourceSince: '' +OpenCollective: null +Provides: null +Repo: https://github.com/SMSSecure/SMSSecure +RepoType: git +RequiresRoot: false +SourceCode: https://github.com/SMSSecure/SMSSecure +Summary: Send encrypted text messages (SMS) +Translation: https://www.transifex.com/silence/silence +UpdateCheckData: null +UpdateCheckIgnore: null +UpdateCheckMode: Tags +UpdateCheckName: null +VercodeOperation: null +WebSite: http://www.smssecure.org +added: null comments: {} id: org.smssecure.smssecure lastUpdated: null diff --git a/tests/metadata/dump/org.videolan.vlc.yaml b/tests/metadata/dump/org.videolan.vlc.yaml index 39d628d4..89e60be7 100644 --- a/tests/metadata/dump/org.videolan.vlc.yaml +++ b/tests/metadata/dump/org.videolan.vlc.yaml @@ -7,61 +7,7 @@ AutoName: VLC AutoUpdateMode: None Binaries: null Bitcoin: null -Categories: -- Multimedia -Changelog: '' -CurrentVersion: 1.2.6 -CurrentVersionCode: '1030005' -Description: 'Video and audio player that supports a wide range of formats, - - for both local and remote playback. - - - [http://git.videolan.org/?p=vlc-ports/android.git;a=blob_plain;f=NEWS NEWS] - - ' -Disabled: null -Donate: http://www.videolan.org/contribute.html#money -FlattrID: null -IssueTracker: http://www.videolan.org/support/index.html#bugs -Liberapay: null -LiberapayID: null -License: GPL-3.0-only -Litecoin: null -MaintainerNotes: 'Instructions and dependencies here: http://wiki.videolan.org/AndroidCompile - - see http://buildbot.videolan.org/builders/ for version code scheme - - The VLC srclib commit can be found out from TESTED_HASH value in compile.sh - - - On new releases remove the updatecheck and force the CV to the last working - - build. This will make sure users don''t get notified about the update until - - the final build from the BS has been reviewed and tested. Once done, undo - - those changes. - - ' -Name: null -NoSourceSince: '' -OpenCollective: null -Provides: null -Repo: git://git.videolan.org/vlc-ports/android.git -RepoType: git -RequiresRoot: false -SourceCode: http://git.videolan.org/?p=vlc-ports/android.git;a=summary -Summary: Media player -Translation: '' -UpdateCheckData: null -UpdateCheckIgnore: null -UpdateCheckMode: Tags -UpdateCheckName: null -VercodeOperation: '%c + 5' -WebSite: http://www.videolan.org/vlc/download-android.html -added: null -builds: +Builds: - androidupdate: - . - ../java-libs/SlidingMenu @@ -2444,6 +2390,60 @@ builds: timeout: null versionCode: '1030005' versionName: 1.2.6 +Categories: +- Multimedia +Changelog: '' +CurrentVersion: 1.2.6 +CurrentVersionCode: '1030005' +Description: 'Video and audio player that supports a wide range of formats, + + for both local and remote playback. + + + [http://git.videolan.org/?p=vlc-ports/android.git;a=blob_plain;f=NEWS NEWS] + + ' +Disabled: null +Donate: http://www.videolan.org/contribute.html#money +FlattrID: null +IssueTracker: http://www.videolan.org/support/index.html#bugs +Liberapay: null +LiberapayID: null +License: GPL-3.0-only +Litecoin: null +MaintainerNotes: 'Instructions and dependencies here: http://wiki.videolan.org/AndroidCompile + + see http://buildbot.videolan.org/builders/ for version code scheme + + The VLC srclib commit can be found out from TESTED_HASH value in compile.sh + + + On new releases remove the updatecheck and force the CV to the last working + + build. This will make sure users don''t get notified about the update until + + the final build from the BS has been reviewed and tested. Once done, undo + + those changes. + + ' +Name: null +NoSourceSince: '' +OpenCollective: null +Provides: null +Repo: git://git.videolan.org/vlc-ports/android.git +RepoType: git +RequiresRoot: false +SourceCode: http://git.videolan.org/?p=vlc-ports/android.git;a=summary +Summary: Media player +Translation: '' +UpdateCheckData: null +UpdateCheckIgnore: null +UpdateCheckMode: Tags +UpdateCheckName: null +VercodeOperation: '%c + 5' +WebSite: http://www.videolan.org/vlc/download-android.html +added: null comments: {} id: org.videolan.vlc lastUpdated: null diff --git a/tests/update.TestCase b/tests/update.TestCase index f8760600..4593f770 100755 --- a/tests/update.TestCase +++ b/tests/update.TestCase @@ -116,15 +116,15 @@ class UpdateTest(unittest.TestCase): buildnextcloudclient = fdroidserver.metadata.Build() buildnextcloudclient.gradle = ['generic'] - apps['com.nextcloud.client']['builds'] = [buildnextcloudclient] + apps['com.nextcloud.client']['Builds'] = [buildnextcloudclient] buildnextclouddevclient = fdroidserver.metadata.Build() buildnextclouddevclient.gradle = ['versionDev'] - apps['com.nextcloud.client.dev']['builds'] = [buildnextclouddevclient] + apps['com.nextcloud.client.dev']['Builds'] = [buildnextclouddevclient] build_conversations = fdroidserver.metadata.Build() build_conversations.gradle = ['free'] - apps['eu.siacs.conversations']['builds'] = [build_conversations] + apps['eu.siacs.conversations']['Builds'] = [build_conversations] fdroidserver.update.insert_localized_app_metadata(apps)