From d2570a493e768c2fb0ef98a0897d79f985df80ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20P=C3=B6hn?= Date: Thu, 16 Mar 2017 09:23:28 +0100 Subject: [PATCH] metadata output-lines now substitute $$VERSION$$/etc. --- fdroidserver/build.py | 3 ++- fdroidserver/common.py | 11 ++++++++--- tests/metadata/fake.ota.update.txt | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/fdroidserver/build.py b/fdroidserver/build.py index 00a20cf6..a90f532e 100644 --- a/fdroidserver/build.py +++ b/fdroidserver/build.py @@ -859,7 +859,8 @@ def build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir, re.S | re.M).group(1) src = os.path.join(bindir, src) elif omethod == 'raw': - globpath = os.path.join(root_dir, build.output) + output_path = common.replace_build_vars(build.output, build) + globpath = os.path.join(root_dir, output_path) apks = glob.glob(globpath) if len(apks) > 1: raise BuildException('Multiple apks match %s' % globpath, '\n'.join(apks)) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index b8a506a5..e18cad48 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -1917,15 +1917,20 @@ def set_FDroidPopen_env(build=None): env[n] = build.ndk_path() +def replace_build_vars(cmd, build): + cmd = cmd.replace('$$COMMIT$$', build.commit) + cmd = cmd.replace('$$VERSION$$', build.versionName) + cmd = cmd.replace('$$VERCODE$$', build.versionCode) + return cmd + + def replace_config_vars(cmd, build): cmd = cmd.replace('$$SDK$$', config['sdk_path']) cmd = cmd.replace('$$NDK$$', build.ndk_path()) cmd = cmd.replace('$$MVN3$$', config['mvn3']) cmd = cmd.replace('$$QT$$', config['qt_sdk_path'] or '') if build is not None: - cmd = cmd.replace('$$COMMIT$$', build.commit) - cmd = cmd.replace('$$VERSION$$', build.versionName) - cmd = cmd.replace('$$VERCODE$$', build.versionCode) + cmd = replace_build_vars(cmd, build) return cmd diff --git a/tests/metadata/fake.ota.update.txt b/tests/metadata/fake.ota.update.txt index 264ba833..165da014 100644 --- a/tests/metadata/fake.ota.update.txt +++ b/tests/metadata/fake.ota.update.txt @@ -33,7 +33,7 @@ Repo:https://gitlab.com/fdroid/privileged-extension.git Build:0.2.1,2000 commit=0.2.1 - output=app/build/distributions/FDroidPrivilegedExtensionFromBinaries-0.2.1.zip + output=app/build/distributions/FDroidPrivilegedExtensionFromBinaries-$$VERSION$$.zip build=gradle assembleUpdateZipFromBinariesDebug Auto Update Mode:Version %v