From: Hans-Christoph Steiner Date: Wed, 23 Nov 2016 14:01:23 +0000 (+0100) Subject: remove support for XML app metadata, its broken X-Git-Tag: 0.8~141^2~2 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=ce3efe4168afc99176b5227dc48e8d7fa114095d;p=fdroidserver.git remove support for XML app metadata, its broken JSON and YAML are very closely related, so supporting both of them is basically almost no extra work. Both are also closely related to how Python works with dicts and pickles. XML is a very different beast, and its not popular for this kind of thing anyway, so just purge it. --- diff --git a/examples/config.py b/examples/config.py index 4181037e..9ccdc5c9 100644 --- a/examples/config.py +++ b/examples/config.py @@ -240,8 +240,7 @@ The repository of older versions of applications from the main demo repository. # build_server_always = True # By default, fdroid will use YAML .yml and the custom .txt metadata formats. It -# is also possible to have metadata in JSON and XML by adding 'json' and -# 'xml'. +# is also possible to have metadata in JSON by adding 'json'. # accepted_formats = ['txt', 'yml'] # Limit in number of characters that fields can take up diff --git a/fdroidserver/metadata.py b/fdroidserver/metadata.py index 212128f3..2d2a5bf1 100644 --- a/fdroidserver/metadata.py +++ b/fdroidserver/metadata.py @@ -35,9 +35,6 @@ except ImportError: from yaml import Loader YamlLoader = Loader -# use the C implementation when available -import xml.etree.cElementTree as ElementTree - import fdroidserver.common srclibs = None @@ -804,10 +801,8 @@ def read_metadata(xref=True, check_vcs=[]): for metadatapath in sorted(glob.glob(os.path.join('metadata', '*.txt')) + glob.glob(os.path.join('metadata', '*.json')) - + glob.glob(os.path.join('metadata', '*.xml')) + glob.glob(os.path.join('metadata', '*.yml')) + glob.glob('.fdroid.json') - + glob.glob('.fdroid.xml') + glob.glob('.fdroid.yml')): packageName, _ = fdroidserver.common.get_extension(os.path.basename(metadatapath)) if packageName in apps: @@ -987,8 +982,6 @@ def parse_metadata(metadatapath, check_vcs=False): parse_txt_metadata(mf, app) elif ext == 'json': parse_json_metadata(mf, app) - elif ext == 'xml': - parse_xml_metadata(mf, app) elif ext == 'yml': parse_yaml_metadata(mf, app) else: @@ -1032,38 +1025,6 @@ def parse_json_metadata(mf, app): return app -def parse_xml_metadata(mf, app): - - tree = ElementTree.ElementTree(file=mf) - root = tree.getroot() - - if root.tag != 'resources': - warn_or_exception('resources file does not have root element ') - - for child in root: - if child.tag != 'builds': - # builds does not have name="" attrib - name = child.attrib['name'] - - if child.tag == 'string': - app.set_field(name, child.text) - elif child.tag == 'string-array': - for item in child: - app.append_field(name, item.text) - elif child.tag == 'builds': - for b in child: - build = Build() - for key in b: - build.set_flag(key.tag, key.text) - app.builds.append(build) - - # TODO handle this using - - - - Tracking - NonFreeNet - - - - Navigation - - - GPLv3 - http://osmand.net - https://github.com/osmandapp/Osmand - https://github.com/osmandapp/Osmand/issues - https://code.google.com/p/osmand/#Please_support_the_project - - OsmAnd~ - Offline/online maps and navigation - Osmand~'s features can be extended by enabling the plugins via the settings, -which include online maps from many sources, tracking, OpenStreetMap (OSM) editing and -accessibility enhancements. - -Map data of both vector and raster types can be stored on the phone memory -card for offline usage, and navigation by default uses offline methods. Map -data packages for many territories can be downloaded from within the app and -there is a desktop program available on the website as well for creating your -own. - -Anti-Features: Tracking - It will send your device and application specs to an -Analytics server upon downloading the list of maps you can download. - -[https://osmandapp.github.io/changes.html Changelog] - - - git - https://github.com/mvdan/OsmAnd-submodules - - - - - - - - 182 - 1.8.2 - 76ada6c8a08afe69acb755503373ac36328ef665 - android/OsmAnd - true - bin/OsmAnd-release-unsigned.apk - sed -i 's/"OsmAnd+"/"OsmAnd~"/g' build.xml - ./old-ndk-build.sh && ant -Dsdk.dir="$ANDROID_SDK" -Dndk.dir="$ANDROID_NDK" -DBLACKBERRY_BUILD=false -DBUILD_SUFFIX= -DAPK_NUMBER_VERSION=182 "-DFEATURES=+play_market +gps_status -parking_plugin -blackberry -amazon -route_nav" -DCLEAN_CPP=false -DPACKAGE_TO_BUILT=net.osmand.plus -DAPK_VERSION=1.8.2 -Dnet.osmand.plus= -Dbuild.version=1.8.2 -Dbuild.version.code=182 -Dnativeoff=false "-DversionFeatures=+play_market +gps_status -parking_plugin -blackberry -amazon -route_nav" clean release - no - - - - 1.8.3 - 183 - 1.8.3 - android/OsmAnd - true - bin/OsmAnd-release-unsigned.apk - ../../build - no - - - - 1.9.4 - 196 - 1.9.4 - android/OsmAnd - true - bin/OsmAnd-release-unsigned.apk - ../../build - no - r10d - - - - 1.9.5 - 197 - 1.9.5 - android/OsmAnd - true - bin/OsmAnd-release-unsigned.apk - ../../build - no - r10d - - - - - -No UCMs apply because git never contains actual releases, only pre-releses. - -The build instructions have been moved to a script in the root of the repo, -'build'. This way it can be updated along with the submodules. - - - None - None - 1.9.5 - 197 - - \ No newline at end of file diff --git a/tests/run-tests b/tests/run-tests index 354e6782..fd58024a 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -163,7 +163,7 @@ $fdroid init cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $REPOROOT/ cp -a $WORKSPACE/tests/gnupghome $GNUPGHOME chmod 0700 $GNUPGHOME -echo "accepted_formats = ['json', 'txt', 'xml', 'yml']" >> config.py +echo "accepted_formats = ['json', 'txt', 'yml']" >> config.py echo "install_list = 'org.adaway'" >> config.py echo "uninstall_list = {'com.android.vending', 'com.facebook.orca',}" >> config.py echo "gpghome = '$GNUPGHOME'" >> config.py diff --git a/tests/update.TestCase b/tests/update.TestCase index 25e59a83..12adce75 100755 --- a/tests/update.TestCase +++ b/tests/update.TestCase @@ -91,7 +91,7 @@ class UpdateTest(unittest.TestCase): config = dict() fdroidserver.common.fill_config_defaults(config) config['ndk_paths'] = dict() - config['accepted_formats'] = ['json', 'txt', 'xml', 'yml'] + config['accepted_formats'] = ['json', 'txt', 'yml'] fdroidserver.common.config = config fdroidserver.update.config = config