chiark / gitweb /
Some more auto-building stuff
authorCiaran Gultnieks <ciaran@ciarang.com>
Fri, 12 Nov 2010 18:22:06 +0000 (18:22 +0000)
committerCiaran Gultnieks <ciaran@ciarang.com>
Fri, 12 Nov 2010 18:22:06 +0000 (18:22 +0000)
build.py
metadata.py
metadata/com.ichi2.anki.txt
metadata/fm.libre.droid.txt
metadata/org.connectbot.txt
metadata/org.swiftp.txt

index d89ed1f6308511f3ee28356ff7da9750bad8e872..a2338bc53195e76906dae18a1fa84018bb69128a 100644 (file)
--- a/build.py
+++ b/build.py
@@ -60,9 +60,13 @@ for app in apps:
 
         # Get the source code...
         if app['repotype'] == 'git':
-            if subprocess.call(['git','clone',app['repo'],build_dir]) != 0:
+            if subprocess.call(['git', 'clone',app['repo'], build_dir]) != 0:
                 print "Git clone failed"
                 sys.exit(1)
+        elif app['repotype'] == 'svn':
+            if subprocess.call(['svn', 'checkout', app['repo'], build_dir]) != 0:
+                print "Svn checkout failed"
+                sys.exit(1)
         else:
             print "Invalid repo type " + app['repotype'] + " in " + app['id']
             sys.exit(1)
@@ -71,42 +75,57 @@ for app in apps:
 
             print "Building version " + thisbuild['version']
 
+            # Optionally, the actual app source can be in a subdirectory...
+            if thisbuild.has_key('subdir'):
+                root_dir = os.path.join(build_dir, thisbuild['subdir'])
+            else:
+                root_dir = build_dir
+
             if app['repotype'] == 'git':
-                if subprocess.call(['git','checkout',thisbuild['commit']],
+                if subprocess.call(['git', 'checkout', thisbuild['commit']],
                         cwd=build_dir) != 0:
                     print "Git checkout failed"
                     sys.exit(1)
+            elif app['repotype'] == 'svn':
+                if subprocess.call(['svn', 'update', '-r', thisbuild['commit']],
+                        cwd=build_dir) != 0:
+                    print "Svn update failed"
+                    sys.exit(1)
             else:
                 print "Invalid repo type " + app['repotype']
                 sys.exit(1)
 
             # Generate (or update) the ant build file, build.xml...
-            if subprocess.call(['android','update','project','-p','.'],
-                    cwd=build_dir) != 0:
+            parms = ['android','update','project','-p','.']
+            parms.append('--subprojects')
+            if thisbuild.has_key('target'):
+                parms.append('-t')
+                parms.append(thisbuild['target'])
+            if subprocess.call(parms, cwd=root_dir) != 0:
                 print "Failed to update project"
                 sys.exit(1)
 
             # If the app has ant set up to sign the release, we need to switch
             # that off, because we want the unsigned apk...
-            if os.path.exists(os.path.join(build_dir, 'build.properties')):
+            if os.path.exists(os.path.join(root_dir, 'build.properties')):
                 if subprocess.call(['sed','-i','s/^key.store/#/',
                     'build.properties'], cwd=build_dir) !=0:
                     print "Failed to amend build.properties"
                     sys.exit(1)
 
             # Build the release...
-            p = subprocess.Popen(['ant','release'], cwd=build_dir, 
+            p = subprocess.Popen(['ant','release'], cwd=root_dir, 
                     stdout=subprocess.PIPE)
             output = p.communicate()[0]
-            print output
             if p.returncode != 0:
+                print output
                 print "Build failed"
                 sys.exit(1)
 
             # Find the apk name in the output...
             src = re.match(r".*^.*Creating (\S+) for release.*$.*", output,
                     re.S|re.M).group(1)
-            src = os.path.join(os.path.join(build_dir, 'bin'), src)
+            src = os.path.join(os.path.join(root_dir, 'bin'), src)
 
             # By way of a sanity check, make sure the version and version
             # code in our new apk match what we expect...
index e7ebf41f0becd52f4d9e33de28a8d1e2b39a75e6..08a7c9b5bb041d604b505355b6414d8d53061021 100644 (file)
@@ -42,62 +42,70 @@ def read_metadata():
         f = open(metafile, 'r')
         mode = 0
         for line in f.readlines():
-            line = line.rstrip('\r\n')
-            if len(line) == 0:
-                pass
-            elif mode == 0:
-                index = line.find(':')
-                if index == -1:
-                    print "Invalid metadata in " + metafile + " at:" + line
-                    sys.exit(1)
-                field = line[:index]
-                value = line[index+1:]
-                if field == 'Description':
-                    mode = 1
-                elif field == 'Summary':
-                    thisinfo['summary'] = value
-                elif field == 'Source Code':
-                    thisinfo['source'] = value
-                elif field == 'License':
-                    thisinfo['license'] = value
-                elif field == 'Web Site':
-                    thisinfo['web'] = value
-                elif field == 'Issue Tracker':
-                    thisinfo['tracker'] = value
-                elif field == 'Disabled':
-                    thisinfo['disabled'] = value
-                elif field == 'Market Version':
-                    thisinfo['marketversion'] = value
-                elif field == 'Market Version Code':
-                    thisinfo['marketvercode'] = value
-                elif field == 'Repo Type':
-                    thisinfo['repotype'] = value
-                elif field == 'Repo':
-                    thisinfo['repo'] = value
-                elif field == 'Build Version':
-                    parts = value.split(",")
-                    if len(parts) != 3:
-                        print "Invalid build format: " + value
+            if not line.startswith("#"):
+                line = line.rstrip('\r\n')
+                if len(line) == 0:
+                    pass
+                elif mode == 0:
+                    index = line.find(':')
+                    if index == -1:
+                        print "Invalid metadata in " + metafile + " at:" + line
                         sys.exit(1)
-                    thisbuild = {}
-                    thisbuild['version'] = parts[0]
-                    thisbuild['vercode'] = parts[1]
-                    thisbuild['commit'] = parts[2]
-                    thisinfo['builds'].append(thisbuild)
-                else:
-                    print "Unrecognised field " + field
-                    sys.exit(1)
-            elif mode == 1:
-                if line == '.':
-                    mode = 0
-                else:
-                    if len(line) == 0:
-                        thisinfo['description'] += '\n\n'
+                    field = line[:index]
+                    value = line[index+1:]
+                    if field == 'Description':
+                        mode = 1
+                    elif field == 'Summary':
+                        thisinfo['summary'] = value
+                    elif field == 'Source Code':
+                        thisinfo['source'] = value
+                    elif field == 'License':
+                        thisinfo['license'] = value
+                    elif field == 'Web Site':
+                        thisinfo['web'] = value
+                    elif field == 'Issue Tracker':
+                        thisinfo['tracker'] = value
+                    elif field == 'Disabled':
+                        thisinfo['disabled'] = value
+                    elif field == 'Market Version':
+                        thisinfo['marketversion'] = value
+                    elif field == 'Market Version Code':
+                        thisinfo['marketvercode'] = value
+                    elif field == 'Repo Type':
+                        thisinfo['repotype'] = value
+                    elif field == 'Repo':
+                        thisinfo['repo'] = value
+                    elif field == 'Build Version':
+                        parts = value.split(",")
+                        if len(parts) < 3:
+                            print "Invalid build format: " + value
+                            sys.exit(1)
+                        thisbuild = {}
+                        thisbuild['version'] = parts[0]
+                        thisbuild['vercode'] = parts[1]
+                        thisbuild['commit'] = parts[2]
+                        for p in parts[3:]:
+                            pp = p.split('=')
+                            thisbuild[pp[0]] = pp[1]
+                        thisinfo['builds'].append(thisbuild)
                     else:
-                        if (not thisinfo['description'].endswith('\n') and
-                            len(thisinfo['description']) > 0):
-                            thisinfo['description'] += ' '
-                        thisinfo['description'] += line
+                        print "Unrecognised field " + field
+                        sys.exit(1)
+                elif mode == 1:
+                    if line == '.':
+                        mode = 0
+                    else:
+                        if len(line) == 0:
+                            thisinfo['description'] += '\n\n'
+                        else:
+                            if (not thisinfo['description'].endswith('\n') and
+                                len(thisinfo['description']) > 0):
+                                thisinfo['description'] += ' '
+                            thisinfo['description'] += line
+
+        if mode == 1:
+            print "Description not terminated"
+            sys.exit(1)
         if len(thisinfo['description']) == 0:
             thisinfo['description'] = 'No description available'
 
index 908ec6915c8bdd1c330d6874a6ab40b34d82a48c..f1260e10f6766b768803876ca4cd9bd886cbbae0 100644 (file)
@@ -8,5 +8,13 @@ Anki is a program which makes remembering things easy. Because it is a lot more
 efficient than traditional study methods, you can either greatly decrease your time
 spent studying, or greatly increase the amount you learn. AnkiDroid is the Android
 port of Anki, and is compatible with Anki data.
+.
+
 Market Version:0.4.2
 Market Version Code:12
+
+Repo Type:git
+Repo:git://github.com/nicolas-raoul/Anki-Android.git
+
+Build Version:0.4.2,12,v0.4.2
+
index a0001bb7def0320b37cd8a6eeeb3b6e226ab3c5e..076d6a5ecbb5cc9567bfb19e32f00ddb93411a72 100644 (file)
@@ -5,5 +5,14 @@ Issue Tracker:
 Summary:Client for Libre.fm
 Description:
 A streaming radio player client for Libre.fm.
+.
+
 Market Version:1.4
 Market Version Code:4
+
+Repo Type:git
+Repo:git://gitorious.org/foocorp/gnu-fm.git
+
+Build Version:1.4,4,926fde6d208190a1fffef12a47bb231f908125e8,subdir=clients/libredroid
+Build Version:1.2,3,4ebfcf224745ca443a308463721e4f8001293f15,subdir=clients/libredroid
+
index decaf84d09c8b5e8cb84e7c73187a64a1609cdfe..b3bf474a7c1e450b6c8531fbe25288801ec7df32 100644 (file)
@@ -8,3 +8,11 @@ An SSH client.
 .
 Market Version:1.7.1
 Market Version Code:323
+Repo Type:git
+Repo:git://github.com/kruton/connectbot.git
+
+Build Version:1.7.1,323,19fbcefef5251cdfac97
+
+#Can't build this version with SDK tools r7 due to build.xml issues
+#Build Version:1.7.0,314,5fbae7cc763edf1056c4
+
index b6da13412f47928d4972d48714e4d749358ac8c2..ae1f049f14e339de1d051219f4ad2570b3821258 100644 (file)
@@ -7,5 +7,15 @@ Description:
 An FTP server allowing remote access to files on your SD card (or any files on the
 device, optionally, if you have root access).
 .
+
 Market Version:1.24
 Market Version Code:17
+Repo Type:svn
+Repo:http://swiftp.googlecode.com/svn/trunk/
+
+#Can't build this version - see http://code.google.com/p/swiftp/issues/detail?id=128
+#Build Version:1.24,17,69,target=android-3
+
+#Can't build this version - res/values/strings.xml:117: error: Apostrophe not preceded by \
+#Build Version:1.23,15,66,target=android-3
+