From ea7fe6b3e0e79ccaefe4e5216ec89893ebdc23fb Mon Sep 17 00:00:00 2001 From: Ciaran Gultnieks Date: Wed, 5 Jan 2011 22:20:57 +0000 Subject: [PATCH] Automatic transfer of specified built apps to repository during update --- README | 6 ++++++ build.py | 2 +- metadata.py | 4 ++++ update.py | 15 ++++++++++++--- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/README b/README index 24be3d70..812311aa 100644 --- a/README +++ b/README @@ -117,6 +117,12 @@ Another example, using extra parameters: Build Version:1.09.03,10903,45,subdir=Timeriffic,oldsdkloc=yes +==Use Built== + +Set this to "Yes" to use built versions of the application for the repository. +Currently, this just triggers update.py to copy the relevant apks and tarballs +from the 'built' directory before updating the repo index. + ==AntiFeatures== This is optional - if present, it contains a comma-separated list of any of diff --git a/build.py b/build.py index 4a6fd12b..62c6a4c4 100644 --- a/build.py +++ b/build.py @@ -174,7 +174,7 @@ for app in apps: #Delete unwanted file... if thisbuild.has_key('rm'): - os.remove(os.path.join(root_dir, thisbuild['rm'])) + os.remove(os.path.join(build_dir, thisbuild['rm'])) #Build the source tarball right before we build the relase... tarname = app['id'] + '_' + thisbuild['vercode'] + '_src' diff --git a/metadata.py b/metadata.py index e8d6feef..4b104105 100644 --- a/metadata.py +++ b/metadata.py @@ -41,6 +41,7 @@ def read_metadata(): thisinfo['repotype'] = '' thisinfo['repo'] = '' thisinfo['builds'] = [] + thisinfo['usebuilt'] = False f = open(metafile, 'r') mode = 0 for line in f.readlines(): @@ -102,6 +103,9 @@ def read_metadata(): pp = p.split('=') thisbuild[pp[0]] = pp[1] thisinfo['builds'].append(thisbuild) + elif field == "Use Built": + if value == "Yes": + thisinfo['usebuilt'] = True else: print "Unrecognised field " + field sys.exit(1) diff --git a/update.py b/update.py index 70dbbc84..a9fb109c 100644 --- a/update.py +++ b/update.py @@ -63,6 +63,18 @@ if (repo_url is None or repo_name is None or print "See config.sample.py for details" sys.exit(1) +# Get all apps... +apps = read_metadata() + +# Copy apks and source tarballs for stuff we've built from source that +# is flagged to be included in the repo... +for app in apps: + if app['usebuilt']: + print "Copying built files for " + app['id'] + src = os.path.join('built', app['id'] + "_*") + for file in glob.glob(src): + shutil.copy(file, 'repo/') + # Gather information about all the apk files in the repo directory... apks = [] for apkfile in glob.glob(os.path.join('repo','*.apk')): @@ -146,9 +158,6 @@ for apkfile in glob.glob(os.path.join('repo','*.apk')): apks.append(thisinfo) -# Get all apps... -apps = read_metadata() - # Some information from the apks needs to be applied up to the application # level. When doing this, we use the info from the most recent version's apk. for app in apps: