1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-19 21:30:10 +01:00

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.
This commit is contained in:
Hans-Christoph Steiner 2016-11-23 15:01:23 +01:00
parent b91cdffe17
commit ce3efe4168
7 changed files with 5 additions and 225 deletions

View File

@ -240,8 +240,7 @@ The repository of older versions of applications from the main demo repository.
# build_server_always = True # build_server_always = True
# By default, fdroid will use YAML .yml and the custom .txt metadata formats. It # 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 # is also possible to have metadata in JSON by adding 'json'.
# 'xml'.
# accepted_formats = ['txt', 'yml'] # accepted_formats = ['txt', 'yml']
# Limit in number of characters that fields can take up # Limit in number of characters that fields can take up

View File

@ -35,9 +35,6 @@ except ImportError:
from yaml import Loader from yaml import Loader
YamlLoader = Loader YamlLoader = Loader
# use the C implementation when available
import xml.etree.cElementTree as ElementTree
import fdroidserver.common import fdroidserver.common
srclibs = None srclibs = None
@ -804,10 +801,8 @@ def read_metadata(xref=True, check_vcs=[]):
for metadatapath in sorted(glob.glob(os.path.join('metadata', '*.txt')) for metadatapath in sorted(glob.glob(os.path.join('metadata', '*.txt'))
+ glob.glob(os.path.join('metadata', '*.json')) + glob.glob(os.path.join('metadata', '*.json'))
+ glob.glob(os.path.join('metadata', '*.xml'))
+ glob.glob(os.path.join('metadata', '*.yml')) + glob.glob(os.path.join('metadata', '*.yml'))
+ glob.glob('.fdroid.json') + glob.glob('.fdroid.json')
+ glob.glob('.fdroid.xml')
+ glob.glob('.fdroid.yml')): + glob.glob('.fdroid.yml')):
packageName, _ = fdroidserver.common.get_extension(os.path.basename(metadatapath)) packageName, _ = fdroidserver.common.get_extension(os.path.basename(metadatapath))
if packageName in apps: if packageName in apps:
@ -987,8 +982,6 @@ def parse_metadata(metadatapath, check_vcs=False):
parse_txt_metadata(mf, app) parse_txt_metadata(mf, app)
elif ext == 'json': elif ext == 'json':
parse_json_metadata(mf, app) parse_json_metadata(mf, app)
elif ext == 'xml':
parse_xml_metadata(mf, app)
elif ext == 'yml': elif ext == 'yml':
parse_yaml_metadata(mf, app) parse_yaml_metadata(mf, app)
else: else:
@ -1032,38 +1025,6 @@ def parse_json_metadata(mf, app):
return 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 <resources/>')
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 <xsd:element type="xsd:boolean> in a schema
if not isinstance(app.RequiresRoot, bool):
app.RequiresRoot = app.RequiresRoot == 'true'
return app
def parse_yaml_metadata(mf, app): def parse_yaml_metadata(mf, app):
yamlinfo = yaml.load(mf, Loader=YamlLoader) yamlinfo = yaml.load(mf, Loader=YamlLoader)

View File

@ -33,11 +33,11 @@ class MetadataTest(unittest.TestCase):
config = dict() config = dict()
config['sdk_path'] = '/opt/android-sdk' config['sdk_path'] = '/opt/android-sdk'
config['ndk_paths'] = dict() config['ndk_paths'] = dict()
config['accepted_formats'] = ['json', 'txt', 'xml', 'yml'] config['accepted_formats'] = ['json', 'txt', 'yml']
fdroidserver.common.config = config fdroidserver.common.config = config
apps = fdroidserver.metadata.read_metadata(xref=True) apps = fdroidserver.metadata.read_metadata(xref=True)
for appid in ('org.smssecure.smssecure', 'org.adaway', 'net.osmand.plus', 'org.videolan.vlc'): for appid in ('org.smssecure.smssecure', 'org.adaway', 'org.videolan.vlc'):
app = apps[appid] app = apps[appid]
savepath = os.path.join('metadata', appid + '.pickle') savepath = os.path.join('metadata', appid + '.pickle')
frommeta = app.field_dict() frommeta = app.field_dict()

View File

@ -1,180 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="AntiFeatures">
<item>Tracking</item>
<item>NonFreeNet</item>
</string-array>
<string-array name="Categories">
<item>Navigation</item>
</string-array>
<string name="License">GPLv3</string>
<string name="Web Site">http://osmand.net</string>
<string name="Source Code">https://github.com/osmandapp/Osmand</string>
<string name="Issue Tracker">https://github.com/osmandapp/Osmand/issues</string>
<string name="Donate">https://code.google.com/p/osmand/#Please_support_the_project</string>
<string name="Name">OsmAnd~</string>
<string name="Summary">Offline/online maps and navigation</string>
<string name="Description">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]
</string>
<string name="Repo Type">git</string>
<string name="Repo">https://github.com/mvdan/OsmAnd-submodules</string>
<!-- <string name="Repo">https://github.com/osmandapp/Osmand</string/ -->
<!--
# Old builds with the old repo
#Build:0.6.5,34
# commit=v0.6.5
# subdir=OsmAnd
# encoding=utf-8
# prebuild=mkdir assets && \
# mkdir raw
#
#Build:0.6.6,36
# commit=v0.6.6_2
# subdir=OsmAnd
# encoding=utf-8
# prebuild=mkdir raw
#
#Build:0.6.7,37
# commit=v0.6.7
# subdir=OsmAnd
# encoding=utf-8
# patch=code37.patch
# prebuild=mkdir raw
#
#Build:0.6.8,39
# commit=v0.6.8
# subdir=OsmAnd
# encoding=utf-8
# prebuild=mkdir raw
#
#Build:0.6.8',41
# disable=No corresponding source for whatever this is
# commit=unknown - see disabled
#
#Build:0.6.9,42
# commit=v0.6.9
# subdir=OsmAnd
# encoding=utf-8
# prebuild=mkdir raw
#
#Build:0.6.9',43
# disable=No corresponding source for whatever this is
# commit=unknown - see disabled
#
#Build:0.8.1,65
# commit=d62472532d8
# subdir=OsmAnd
# target=android-8
# init=rm -f build.xml
# encoding=utf-8
# forceversion=yes
# prebuild=cd ../DataExtractionOSM && \
# ant compile build && \
# cd ../OsmAnd/ && \
# cp ../DataExtractionOSM/build/OsmAndMapCreator.jar libs/ && \
# zip -d libs/OsmAndMapCreator.jar net/osmand/LogUtil.class && \
# cp -r ../DataExtractionOSM/build/lib/ libs/
# buildjni=no
#
#Build:0.8.2,71
# commit=50a4733475cd
# subdir=OsmAnd
# submodules=yes
# target=android-8
# init=rm -f build.xml
# encoding=utf-8
# forceversion=yes
# forcevercode=yes
# prebuild=cd ../DataExtractionOSM && \
# ant compile build && \
# cd ../OsmAnd/ && \
# sed -i 's/app_version">[^<]*/app_version">0.8.2-fdroid/' res/values/no_translate.xml && \
# cp ../DataExtractionOSM/build/OsmAndMapCreator.jar libs/ && \
# zip -d libs/OsmAndMapCreator.jar net/osmand/LogUtil.class && \
# cp -r ../DataExtractionOSM/build/lib/ libs/
# buildjni=yes
-->
<builds>
<build>
<versionCode>182</versionCode>
<versionName>1.8.2</versionName>
<commit>76ada6c8a08afe69acb755503373ac36328ef665</commit>
<subdir>android/OsmAnd</subdir>
<submodules>true</submodules>
<output>bin/OsmAnd-release-unsigned.apk</output>
<prebuild>sed -i 's/"OsmAnd+"/"OsmAnd~"/g' build.xml</prebuild>
<build>./old-ndk-build.sh &amp;&amp; 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</build>
<buildjni>no</buildjni>
</build>
<build>
<versionName>1.8.3</versionName>
<versionCode>183</versionCode>
<commit>1.8.3</commit>
<subdir>android/OsmAnd</subdir>
<submodules>true</submodules>
<output>bin/OsmAnd-release-unsigned.apk</output>
<build>../../build</build>
<buildjni>no</buildjni>
</build>
<build>
<versionName>1.9.4</versionName>
<versionCode>196</versionCode>
<commit>1.9.4</commit>
<subdir>android/OsmAnd</subdir>
<submodules>true</submodules>
<output>bin/OsmAnd-release-unsigned.apk</output>
<build>../../build</build>
<buildjni>no</buildjni>
<ndk>r10d</ndk>
</build>
<build>
<versionName>1.9.5</versionName>
<versionCode>197</versionCode>
<commit>1.9.5</commit>
<subdir>android/OsmAnd</subdir>
<submodules>true</submodules>
<output>bin/OsmAnd-release-unsigned.apk</output>
<build>../../build</build>
<buildjni>no</buildjni>
<ndk>r10d</ndk>
</build>
</builds>
<string name="Maintainer Notes">
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.
</string>
<string name="Auto Update Mode">None</string>
<string name="Update Check Mode">None</string>
<string name="Current Version">1.9.5</string>
<string name="Current Version Code">197</string>
</resources>

View File

@ -163,7 +163,7 @@ $fdroid init
cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $REPOROOT/ cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $REPOROOT/
cp -a $WORKSPACE/tests/gnupghome $GNUPGHOME cp -a $WORKSPACE/tests/gnupghome $GNUPGHOME
chmod 0700 $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 "install_list = 'org.adaway'" >> config.py
echo "uninstall_list = {'com.android.vending', 'com.facebook.orca',}" >> config.py echo "uninstall_list = {'com.android.vending', 'com.facebook.orca',}" >> config.py
echo "gpghome = '$GNUPGHOME'" >> config.py echo "gpghome = '$GNUPGHOME'" >> config.py

View File

@ -91,7 +91,7 @@ class UpdateTest(unittest.TestCase):
config = dict() config = dict()
fdroidserver.common.fill_config_defaults(config) fdroidserver.common.fill_config_defaults(config)
config['ndk_paths'] = dict() config['ndk_paths'] = dict()
config['accepted_formats'] = ['json', 'txt', 'xml', 'yml'] config['accepted_formats'] = ['json', 'txt', 'yml']
fdroidserver.common.config = config fdroidserver.common.config = config
fdroidserver.update.config = config fdroidserver.update.config = config