ftp.chdir('/home/vagrant/tmp')
else:
ftp.chdir('/home/vagrant/unsigned')
- apkfile = app['id'] + '_' + thisbuild['vercode'] + '.apk'
- tarball = app['id'] + '_' + thisbuild['vercode'] + '_src' + '.tar.gz'
+ apkfile = common.getapkname(app,thisbuild)
+ tarball = common.getsrcname(app,thisbuild)
try:
ftp.get(apkfile, os.path.join(output_dir, apkfile))
ftp.get(tarball, os.path.join(output_dir, tarball))
# Build the source tarball right before we build the release...
print "Creating source tarball..."
- tarname = app['id'] + '_' + thisbuild['vercode'] + '_src'
- tarball = tarfile.open(os.path.join(tmp_dir,
- tarname + '.tar.gz'), "w:gz")
+ tarname = common.getsrcname(app,thisbuild)
+ tarball = tarfile.open(os.path.join(tmp_dir, tarname), "w:gz")
def tarexc(f):
for vcs_dir in ['.svn', '.git', '.hg', '.bzr']:
if f.endswith(vcs_dir):
# Copy the unsigned apk to our destination directory for further
# processing (by publish.py)...
- dest = os.path.join(output_dir, app['id'] + '_' +
- thisbuild['vercode'] + '.apk')
+ dest = common.getapkname(app,thisbuild)
shutil.copyfile(src, dest)
# Move the source tarball into the output directory...
if output_dir != tmp_dir:
- tarfilename = tarname + '.tar.gz'
- shutil.move(os.path.join(tmp_dir, tarfilename),
- os.path.join(output_dir, tarfilename))
+ shutil.move(os.path.join(tmp_dir, tarname),
+ os.path.join(output_dir, tarname))
def trybuild(app, thisbuild, build_dir, output_dir, also_check_dir, srclib_dir, extlib_dir,
Returns True if the build was done, False if it wasn't necessary.
"""
- dest = os.path.join(output_dir, app['id'] + '_' +
- thisbuild['vercode'] + '.apk')
- dest_repo = os.path.join(repo_dir, app['id'] + '_' +
- thisbuild['vercode'] + '.apk')
+ dest_apk = common.getapkname(app,thisbuild)
+
+ dest = os.path.join(output_dir, dest_apk)
+ dest_repo = os.path.join(repo_dir, dest_apk)
if os.path.exists(dest) or (not test and os.path.exists(dest_repo)):
return False
if also_check_dir and not test:
- dest_also = os.path.join(also_check_dir, app['id'] + '_' +
- thisbuild['vercode'] + '.apk')
+ dest_also = os.path.join(also_check_dir, dest_apk)
if os.path.exists(dest_also):
return False
thisbuild = {}
thisbuild['origlines'] = lines
thisbuild['version'] = parts[0]
- thisbuild['vercode'] = parts[1]
+ ver = parts[1].split('-')
+ if len(ver) == 1:
+ thisbuild['vercode'] = parts[1]
+ thisbuild['subvercode'] = None
+ elif len(ver) == 2:
+ thisbuild['vercode'] = ver[0]
+ thisbuild['subvercode'] = ver[1]
+ else:
+ raise MetaDataException("Invalid version code for build in " + metafile.name)
try:
testvercode = int(thisbuild['vercode'])
+ testsubvercode = int(thisbuild['subvercode'])
except:
raise MetaDataException("Invalid version code for build in " + metafile.name)
thisbuild['commit'] = parts[2]
return thisinfo
+def getvercode(build):
+ if build['subvercode'] is None:
+ return build['vercode']
+ return "%s-%s" % (build['vercode'], build['subvercode'])
+
+def getapkname(app, build):
+ return "%s_%s.apk" % (app['id'], getvercode(build))
+
+def getsrcname(app, build):
+ return "%s_%s_src.tar.gz" % (app['id'], getvercode(build))
+
# Write a metadata file.
#
# 'dest' - The path to the output file
writefield('Repo Type')
writefield('Repo')
mf.write('\n')
+ keystoignore = ['version', 'vercode', 'subvercode', 'commit']
for build in app['builds']:
writecomments('build:' + build['version'])
mf.write('Build Version:')
# Keeping the original formatting if we loaded it from a file...
mf.write('\\\n'.join(build['origlines']) + '\n')
else:
- mf.write(build['version'] + ',' + build['vercode'] + ',' +
- build['commit'])
+ mf.write("%s,%s,%s" % (
+ build['version'],
+ getvercode(build),
+ build['commit']))
for key,value in build.iteritems():
- if key not in ['version', 'vercode', 'commit']:
+ if key not in keystoignore:
mf.write(',' + key + '=' + value)
mf.write('\n')
if len(app['builds']) > 0: