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