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

Add forceversion/forcevercode options to replace insertversion/insertvercode.

Unlike insertversion/insertvercode which accept pattern for old version/code,
which yet need to be prepared, then tested, and with that still named
confusingly, forceversion/forcevercode are boolean-style parameters which,
if specified for build, replace whatever version/code specified in
AndroidManifest.xml with the values from recipe.
This commit is contained in:
Paul Sokolovsky 2012-02-15 20:41:03 +02:00
parent 9ed02069b8
commit eab72a3127

View File

@ -736,7 +736,7 @@ def prepare_source(vcs, app, build, build_dir, extlib_dir, sdk_path, ndk_path, j
f.write(props)
f.close()
# Insert version code and number into the manifest if necessary...
# deprecated, use forceversion/forcevercode instead
if build.has_key('insertversion'):
if subprocess.call(['sed','-i','s/' + build['insertversion'] +
'/' + build['version'] +'/g',
@ -748,6 +748,18 @@ def prepare_source(vcs, app, build, build_dir, extlib_dir, sdk_path, ndk_path, j
'AndroidManifest.xml'], cwd=root_dir) !=0:
raise BuildException("Failed to amend manifest")
# Insert version code and number into the manifest if necessary...
if build.has_key('forceversion'):
if subprocess.call(['sed','-r','-i',
's/android:versionName="[^"]+"/android:versionName="' + build['version'] + '"/g',
'AndroidManifest.xml'], cwd=root_dir) !=0:
raise BuildException("Failed to amend manifest")
if build.has_key('forcevercode'):
if subprocess.call(['sed','-r','-i',
's/android:versionCode="[^"]+"/android:versionCode="' + build['vercode'] + '"/g',
'AndroidManifest.xml'], cwd=root_dir) !=0:
raise BuildException("Failed to amend manifest")
# Delete unwanted file...
if build.has_key('rm'):
dest = os.path.join(build_dir, build['rm'])