From eab72a312708c37ef4cad5d7c4cb9dd569e54a8e Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Wed, 15 Feb 2012 20:41:03 +0200 Subject: [PATCH 1/4] 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. --- common.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/common.py b/common.py index b020df0a..8fb0f2cd 100644 --- a/common.py +++ b/common.py @@ -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']) From 071642155e4b63ee479167e21e18727b4c876c1c Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Thu, 16 Feb 2012 22:57:54 +0200 Subject: [PATCH 2/4] Replace insertversion/insertvercode with force* variants. --- metadata/com.google.android.diskusage.txt | 2 +- metadata/org.helllabs.android.xmp.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/metadata/com.google.android.diskusage.txt b/metadata/com.google.android.diskusage.txt index fb41d22a..5a2f3015 100644 --- a/metadata/com.google.android.diskusage.txt +++ b/metadata/com.google.android.diskusage.txt @@ -14,7 +14,7 @@ Repo:http://diskusage.googlecode.com/svn/trunk/ Build Version:2.0.4,2004,61,prebuild=mkdir libs && cp extra/system.jar libs/ #Note - version name/code is wrong in the repo - we replace it -Build Version:2.0.5,2005,62,prebuild=mkdir libs && cp extra/system.jar libs/,insertversion=2.0.4,insertvercode=2004 +Build Version:2.0.5,2005,62,prebuild=mkdir libs && cp extra/system.jar libs/,forceversion=yes,forcevercode=yes Build Version:2.1.3,2103,65,prebuild=mkdir libs && cp extra/system.jar libs/ Build Version:3.0alpha2,3001,!repo version incorrect,prebuild=mkdir libs && cp extra/system.jar libs/ Build Version:3.0alpha3,3005,!no source in repo,prebuild=mkdir libs && cp extra/system.jar libs/ diff --git a/metadata/org.helllabs.android.xmp.txt b/metadata/org.helllabs.android.xmp.txt index fed13459..02401be8 100644 --- a/metadata/org.helllabs.android.xmp.txt +++ b/metadata/org.helllabs.android.xmp.txt @@ -17,10 +17,10 @@ Repo Type:git Repo:git://xmp.git.sourceforge.net/gitroot/xmp/xmp # This is one of those projects that put the changelog in the version -# number, so fix that with insertversion. +# number, so fix that with forceversion. Build Version:2.1.0,15,639549fda2111cb800fabe468b4a64bf4ae27003,\ buildjni=yes,subdir=src/android/project,target=android-8,\ -insertversion=2.1.0[^"]* +forceversion=yes Update Check Mode:Market Current Version:2.4.0 From 10567fc0cca2e53e20b4fbfd69dc50109ad65a6f Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Thu, 16 Feb 2012 22:59:24 +0200 Subject: [PATCH 3/4] Remove support for deprecated insertversion/insertvercode No longer occur in metadata. --- common.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/common.py b/common.py index 8fb0f2cd..8043eadd 100644 --- a/common.py +++ b/common.py @@ -736,18 +736,6 @@ def prepare_source(vcs, app, build, build_dir, extlib_dir, sdk_path, ndk_path, j f.write(props) f.close() - # deprecated, use forceversion/forcevercode instead - if build.has_key('insertversion'): - if subprocess.call(['sed','-i','s/' + build['insertversion'] + - '/' + build['version'] +'/g', - 'AndroidManifest.xml'], cwd=root_dir) !=0: - raise BuildException("Failed to amend manifest") - if build.has_key('insertvercode'): - if subprocess.call(['sed','-i','s/' + build['insertvercode'] + - '/' + build['vercode'] +'/g', - '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', From bd6619ee0188e9339f7556da91b334f50445c969 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Thu, 16 Feb 2012 23:04:41 +0200 Subject: [PATCH 4/4] Update docs for forceversion/forcevercode. --- README | 11 +++++++---- fdroid.texi | 14 ++++++++------ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/README b/README index 140b6a0d..baaeaa7a 100644 --- a/README +++ b/README @@ -160,10 +160,13 @@ configuration to the build. These are: AndroidManifest.xml. antcommand=xxx - Specify an alternate ant command (target) instead of the default 'release'. - insertversion=x - If specified, the pattern 'x' in the AndroidManifest.xml is - replaced with the version number for the build. - insertvercode=x - If specified, the pattern 'x' in the AndroidManifest.xml is - replaced with the version code for the build. + forceversion=yes - If specified, the package version in AndroidManifest.xml is + replaced with the version number for the build as specified + in recipe. Useful for cases when upstream repo missed to + update it for specific tag, or to build an arbitrary revision. + forcevercode=yes - If specified, the package vercode in the AndroidManifest.xml is + replaced with the version code for the build. See also + forceversion. update=no By default, 'android update project' is used to generate or update the build.xml file. Specifying update=no bypasses that. diff --git a/fdroid.texi b/fdroid.texi index e3a3e89e..f586de93 100644 --- a/fdroid.texi +++ b/fdroid.texi @@ -364,13 +364,15 @@ the directory that contains AndroidManifest.xml. Specify an alternate ant command (target) instead of the default 'release'. -@item insertversion=x -If specified, the pattern 'x' in the AndroidManifest.xml is replaced -with the version number for the build. +@item forceversion=yes +If specified, the package version in AndroidManifest.xml is replaced +with the version number for the build as specified in recipe. Useful +for cases when upstream repo missed to update it for specific tag, +or to build an arbitrary revision. -@item insertvercode=x -If specified, the pattern 'x' in the AndroidManifest.xml is replaced -with the version code for the build. +@item forcevercode=yes +If specified, the package vercode in the AndroidManifest.xml is replaced +with the version code for the build. See also forceversion. @item update=no By default, 'android update project' is used to generate or update the