1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-09-17 10:40:12 +02:00

get_release_filename() to handle any file type, not just APKs

In order to support non-APK files that are built by `fdroid build`, this
function that names the file releases needs to be generic.
This commit is contained in:
Hans-Christoph Steiner 2016-10-31 16:51:34 +01:00
parent ab8d51012d
commit 8ecff5bd61
2 changed files with 11 additions and 8 deletions

View File

@ -412,7 +412,7 @@ def build_server(app, build, vcs, build_dir, output_dir, force):
ftp.chdir(homedir + '/tmp')
else:
ftp.chdir(homedir + '/unsigned')
apkfile = common.getapkname(app, build)
apkfile = common.get_release_filename(app, build)
tarball = common.getsrcname(app, build)
try:
ftp.get(apkfile, os.path.join(output_dir, apkfile))
@ -884,7 +884,7 @@ def build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir,
# Copy the unsigned apk to our destination directory for further
# processing (by publish.py)...
dest = os.path.join(output_dir, common.getapkname(app, build))
dest = os.path.join(output_dir, common.get_release_filename(app, build))
shutil.copyfile(src, dest)
# Move the source tarball into the output directory...
@ -912,17 +912,17 @@ def trybuild(app, build, build_dir, output_dir, also_check_dir, srclib_dir, extl
:returns: True if the build was done, False if it wasn't necessary.
"""
dest_apk = common.getapkname(app, build)
dest_file = common.get_release_filename(app, build)
dest = os.path.join(output_dir, dest_apk)
dest_repo = os.path.join(repo_dir, dest_apk)
dest = os.path.join(output_dir, dest_file)
dest_repo = os.path.join(repo_dir, dest_file)
if not test:
if os.path.exists(dest) or os.path.exists(dest_repo):
return False
if also_check_dir:
dest_also = os.path.join(also_check_dir, dest_apk)
dest_also = os.path.join(also_check_dir, dest_file)
if os.path.exists(dest_also):
return False

View File

@ -459,8 +459,11 @@ def apknameinfo(filename):
return result
def getapkname(app, build):
return "%s_%s.apk" % (app.id, build.vercode)
def get_release_filename(app, build):
if build.output:
return "%s_%s.%s" % (app.id, build.vercode, get_file_extension(build.output))
else:
return "%s_%s.apk" % (app.id, build.vercode)
def getsrcname(app, build):