chiark / gitweb /
Automatic transfer of specified built apps to repository during update
authorCiaran Gultnieks <ciaran@ciarang.com>
Wed, 5 Jan 2011 22:20:57 +0000 (22:20 +0000)
committerCiaran Gultnieks <ciaran@ciarang.com>
Wed, 5 Jan 2011 22:20:57 +0000 (22:20 +0000)
README
build.py
metadata.py
update.py

diff --git a/README b/README
index 24be3d705ab86768933d1c773ab59cb00d68d79a..812311aac6623170432eb2c07a02cb4772bb3f2e 100644 (file)
--- 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
index 4a6fd12b78369188e733babf402a75559f393928..62c6a4c41cb3f169f496e707493390e819998048 100644 (file)
--- 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'
index e8d6feefaf61ecd003db4ba20de06ca12463b42b..4b104105708d8445d66299da52f88c0a0da197d7 100644 (file)
@@ -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)
index 70dbbc84c88c2619c0971116593619ff0823c309..a9fb109c40538eae874c2f74d5e4a13f14f36073 100644 (file)
--- 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: