mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-16 16:02:33 +03:00
fix building with yml metadata
This commit is contained in:
parent
54963506a0
commit
75ebb6e8cc
3 changed files with 42 additions and 10 deletions
|
@ -136,8 +136,8 @@ def build_server(app, build, vcs, build_dir, output_dir, log_dir, force):
|
||||||
ftp.mkdir('metadata')
|
ftp.mkdir('metadata')
|
||||||
ftp.mkdir('srclibs')
|
ftp.mkdir('srclibs')
|
||||||
ftp.chdir('metadata')
|
ftp.chdir('metadata')
|
||||||
ftp.put(os.path.join('metadata', app.id + '.txt'),
|
metadatapath = common.metadata_relpath(app.id)
|
||||||
app.id + '.txt')
|
ftp.put(metadatapath, os.path.basename(metadatapath))
|
||||||
# And patches if there are any...
|
# And patches if there are any...
|
||||||
if os.path.exists(os.path.join('metadata', app.id)):
|
if os.path.exists(os.path.join('metadata', app.id)):
|
||||||
send_dir(os.path.join('metadata', app.id))
|
send_dir(os.path.join('metadata', app.id))
|
||||||
|
@ -185,8 +185,8 @@ def build_server(app, build, vcs, build_dir, output_dir, log_dir, force):
|
||||||
send_dir(lib)
|
send_dir(lib)
|
||||||
# Copy the metadata file too...
|
# Copy the metadata file too...
|
||||||
ftp.chdir(homedir + '/srclibs')
|
ftp.chdir(homedir + '/srclibs')
|
||||||
ftp.put(os.path.join('srclibs', name + '.txt'),
|
srclibpath = common.metadata_srclib_relpath(name)
|
||||||
name + '.txt')
|
ftp.put(srclibpath, os.path.basename(srclibpath))
|
||||||
# Copy the main app source code
|
# Copy the main app source code
|
||||||
# (no need if it's a srclib)
|
# (no need if it's a srclib)
|
||||||
if (not basesrclib) and os.path.exists(build_dir):
|
if (not basesrclib) and os.path.exists(build_dir):
|
||||||
|
|
|
@ -397,8 +397,8 @@ def get_local_metadata_files():
|
||||||
|
|
||||||
def read_pkg_args(args, allow_vercodes=False):
|
def read_pkg_args(args, allow_vercodes=False):
|
||||||
"""
|
"""
|
||||||
Given the arguments in the form of multiple appid:[vc] strings, this returns
|
:param args: arguments in the form of multiple appid:[vc] strings
|
||||||
a dictionary with the set of vercodes specified for each package.
|
:returns: a dictionary with the set of vercodes specified for each package
|
||||||
"""
|
"""
|
||||||
|
|
||||||
vercodes = {}
|
vercodes = {}
|
||||||
|
@ -474,6 +474,32 @@ def has_extension(filename, ext):
|
||||||
return ext == f_ext
|
return ext == f_ext
|
||||||
|
|
||||||
|
|
||||||
|
def metadata_srclib_relpath(name):
|
||||||
|
'''
|
||||||
|
:param name: name of the src lib. (eg. 'HttpClient')
|
||||||
|
:returns: relative path for requested srclib (eg. 'srclib/HttpClient.txt')
|
||||||
|
'''
|
||||||
|
global config
|
||||||
|
for ext in config['accepted_formats']:
|
||||||
|
pth = os.path.join('srclibs', name + '.' + ext)
|
||||||
|
if os.path.isfile(pth):
|
||||||
|
return pth
|
||||||
|
raise FDroidException("could not find srclib metadata file for '{}'".format(name))
|
||||||
|
|
||||||
|
|
||||||
|
def metadata_relpath(appid):
|
||||||
|
'''
|
||||||
|
:param appid: an appid. (eg. 'org.fdroid.fdroid')
|
||||||
|
:returns: relative path for requested srclib (eg. 'metadata/org.fdroid.fdroid.txt')
|
||||||
|
'''
|
||||||
|
global config
|
||||||
|
for ext in config['accepted_formats']:
|
||||||
|
pth = os.path.join('metadata', appid + '.' + ext)
|
||||||
|
if os.path.isfile(pth):
|
||||||
|
return pth
|
||||||
|
raise FDroidException("could not find metadata file for '{}'".format(appid))
|
||||||
|
|
||||||
|
|
||||||
publish_name_regex = re.compile(r"^(.+)_([0-9]+)\.(apk|zip)$")
|
publish_name_regex = re.compile(r"^(.+)_([0-9]+)\.(apk|zip)$")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -812,6 +812,12 @@ def post_metadata_parse(app):
|
||||||
if type(v) in (float, int):
|
if type(v) in (float, int):
|
||||||
app[k] = str(v)
|
app[k] = str(v)
|
||||||
|
|
||||||
|
if 'Builds' in app:
|
||||||
|
app['builds'] = app.pop('Builds')
|
||||||
|
|
||||||
|
if 'flavours' in app and app['flavours'] == [True]:
|
||||||
|
app['flavours'] = ['yes']
|
||||||
|
|
||||||
if isinstance(app.Categories, str):
|
if isinstance(app.Categories, str):
|
||||||
app.Categories = [app.Categories]
|
app.Categories = [app.Categories]
|
||||||
elif app.Categories is None:
|
elif app.Categories is None:
|
||||||
|
@ -833,7 +839,8 @@ def post_metadata_parse(app):
|
||||||
build[k] = ['yes']
|
build[k] = ['yes']
|
||||||
else:
|
else:
|
||||||
build[k] = []
|
build[k] = []
|
||||||
elif flagtype(k) == TYPE_STRING and type(v) in (float, int):
|
elif (flagtype(k) == TYPE_STRING or flagtype(k) == TYPE_INT) \
|
||||||
|
and type(v) in (float, int):
|
||||||
build[k] = str(v)
|
build[k] = str(v)
|
||||||
builds.append(build)
|
builds.append(build)
|
||||||
|
|
||||||
|
@ -950,9 +957,8 @@ def parse_json_metadata(mf, app):
|
||||||
|
|
||||||
|
|
||||||
def parse_yaml_metadata(mf, app):
|
def parse_yaml_metadata(mf, app):
|
||||||
|
yamldata = yaml.load(mf, Loader=YamlLoader)
|
||||||
yamlinfo = yaml.load(mf, Loader=YamlLoader)
|
app.update(yamldata)
|
||||||
app.update(yamlinfo)
|
|
||||||
return app
|
return app
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue