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

use stored metadatapath instead of guessing it

This commit is contained in:
Michael Pöhn 2017-05-16 16:28:24 +02:00
parent 056a28f897
commit cfd3e84250
2 changed files with 4 additions and 30 deletions

View File

@ -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')
metadatapath = common.metadata_relpath(app.id) ftp.put(app.metadatapath, os.path.basename(app.metadatapath))
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')
srclibpath = common.metadata_srclib_relpath(name) ftp.put(os.path.join('srclibs', name + '.txt'),
ftp.put(srclibpath, os.path.basename(srclibpath)) name + '.txt')
# 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):

View File

@ -474,32 +474,6 @@ 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)$")