Some more auto-building stuff

This commit is contained in:
Ciaran Gultnieks 2010-11-12 18:22:06 +00:00
parent 4681eff0ca
commit ef071e0f6a
6 changed files with 124 additions and 62 deletions

View file

@ -60,9 +60,13 @@ for app in apps:
# Get the source code... # Get the source code...
if app['repotype'] == 'git': 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" print "Git clone failed"
sys.exit(1) 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: else:
print "Invalid repo type " + app['repotype'] + " in " + app['id'] print "Invalid repo type " + app['repotype'] + " in " + app['id']
sys.exit(1) sys.exit(1)
@ -71,42 +75,57 @@ for app in apps:
print "Building version " + thisbuild['version'] 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 app['repotype'] == 'git':
if subprocess.call(['git','checkout',thisbuild['commit']], if subprocess.call(['git', 'checkout', thisbuild['commit']],
cwd=build_dir) != 0: cwd=build_dir) != 0:
print "Git checkout failed" print "Git checkout failed"
sys.exit(1) 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: else:
print "Invalid repo type " + app['repotype'] print "Invalid repo type " + app['repotype']
sys.exit(1) sys.exit(1)
# Generate (or update) the ant build file, build.xml... # Generate (or update) the ant build file, build.xml...
if subprocess.call(['android','update','project','-p','.'], parms = ['android','update','project','-p','.']
cwd=build_dir) != 0: 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" print "Failed to update project"
sys.exit(1) sys.exit(1)
# If the app has ant set up to sign the release, we need to switch # If the app has ant set up to sign the release, we need to switch
# that off, because we want the unsigned apk... # 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/#/', if subprocess.call(['sed','-i','s/^key.store/#/',
'build.properties'], cwd=build_dir) !=0: 'build.properties'], cwd=build_dir) !=0:
print "Failed to amend build.properties" print "Failed to amend build.properties"
sys.exit(1) sys.exit(1)
# Build the release... # Build the release...
p = subprocess.Popen(['ant','release'], cwd=build_dir, p = subprocess.Popen(['ant','release'], cwd=root_dir,
stdout=subprocess.PIPE) stdout=subprocess.PIPE)
output = p.communicate()[0] output = p.communicate()[0]
print output
if p.returncode != 0: if p.returncode != 0:
print output
print "Build failed" print "Build failed"
sys.exit(1) sys.exit(1)
# Find the apk name in the output... # Find the apk name in the output...
src = re.match(r".*^.*Creating (\S+) for release.*$.*", output, src = re.match(r".*^.*Creating (\S+) for release.*$.*", output,
re.S|re.M).group(1) 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 # By way of a sanity check, make sure the version and version
# code in our new apk match what we expect... # code in our new apk match what we expect...

View file

@ -42,62 +42,70 @@ def read_metadata():
f = open(metafile, 'r') f = open(metafile, 'r')
mode = 0 mode = 0
for line in f.readlines(): for line in f.readlines():
line = line.rstrip('\r\n') if not line.startswith("#"):
if len(line) == 0: line = line.rstrip('\r\n')
pass if len(line) == 0:
elif mode == 0: pass
index = line.find(':') elif mode == 0:
if index == -1: index = line.find(':')
print "Invalid metadata in " + metafile + " at:" + line if index == -1:
sys.exit(1) print "Invalid metadata in " + metafile + " at:" + line
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) sys.exit(1)
thisbuild = {} field = line[:index]
thisbuild['version'] = parts[0] value = line[index+1:]
thisbuild['vercode'] = parts[1] if field == 'Description':
thisbuild['commit'] = parts[2] mode = 1
thisinfo['builds'].append(thisbuild) elif field == 'Summary':
else: thisinfo['summary'] = value
print "Unrecognised field " + field elif field == 'Source Code':
sys.exit(1) thisinfo['source'] = value
elif mode == 1: elif field == 'License':
if line == '.': thisinfo['license'] = value
mode = 0 elif field == 'Web Site':
else: thisinfo['web'] = value
if len(line) == 0: elif field == 'Issue Tracker':
thisinfo['description'] += '\n\n' 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: else:
if (not thisinfo['description'].endswith('\n') and print "Unrecognised field " + field
len(thisinfo['description']) > 0): sys.exit(1)
thisinfo['description'] += ' ' elif mode == 1:
thisinfo['description'] += line 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: if len(thisinfo['description']) == 0:
thisinfo['description'] = 'No description available' thisinfo['description'] = 'No description available'

View 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 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 spent studying, or greatly increase the amount you learn. AnkiDroid is the Android
port of Anki, and is compatible with Anki data. port of Anki, and is compatible with Anki data.
.
Market Version:0.4.2 Market Version:0.4.2
Market Version Code:12 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

View file

@ -5,5 +5,14 @@ Issue Tracker:
Summary:Client for Libre.fm Summary:Client for Libre.fm
Description: Description:
A streaming radio player client for Libre.fm. A streaming radio player client for Libre.fm.
.
Market Version:1.4 Market Version:1.4
Market Version Code: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

View file

@ -8,3 +8,11 @@ An SSH client.
. .
Market Version:1.7.1 Market Version:1.7.1
Market Version Code:323 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

View file

@ -7,5 +7,15 @@ Description:
An FTP server allowing remote access to files on your SD card (or any files on the An FTP server allowing remote access to files on your SD card (or any files on the
device, optionally, if you have root access). device, optionally, if you have root access).
. .
Market Version:1.24 Market Version:1.24
Market Version Code:17 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