import common
import metadata
-from common import FDroidException, BuildException, VCSException, FDroidPopen, SilentPopen
+from common import FDroidException, BuildException, VCSException, FDroidPopen, SdkToolsPopen
try:
import paramiko
if os.path.isdir(vd):
# Vagrant 1.2 (and maybe 1.1?) it's a directory tree...
with open(os.path.join(vd, 'machines', 'default',
- 'virtualbox', 'id')) as vf:
+ 'virtualbox', 'id')) as vf:
id = vf.read()
return id
else:
return True
# Vagrant 1.2 - the directory can exist, but the id can be missing...
if not os.path.exists(os.path.join(vd, 'machines', 'default',
- 'virtualbox', 'id')):
+ 'virtualbox', 'id')):
return False
return True
ftp.put(os.path.join(serverpath, 'common.py'), 'common.py')
ftp.put(os.path.join(serverpath, 'metadata.py'), 'metadata.py')
ftp.put(os.path.join(serverpath, '..', 'buildserver',
- 'config.buildserver.py'), 'config.py')
+ 'config.buildserver.py'), 'config.py')
ftp.chmod('config.py', 0o600)
# Copy over the ID (head commit hash) of the fdroidserver in use...
tarball.add(build_dir, tarname, exclude=tarexc)
tarball.close()
- if onserver:
- manifest = os.path.join(root_dir, 'AndroidManifest.xml')
- if os.path.exists(manifest):
- homedir = os.path.expanduser('~')
- with open(os.path.join(homedir, 'buildserverid'), 'r') as f:
- buildserverid = f.read()
- with open(os.path.join(homedir, 'fdroidserverid'), 'r') as f:
- fdroidserverid = f.read()
- with open(manifest, 'r') as f:
- manifestcontent = f.read()
- manifestcontent = manifestcontent.replace('</manifest>',
- '<fdroid buildserverid="'
- + buildserverid + '"'
- + ' fdroidserverid="'
- + fdroidserverid + '"'
- + '/></manifest>')
- with open(manifest, 'w') as f:
- f.write(manifestcontent)
-
# Run a build command if one is required...
if thisbuild['build']:
logging.info("Running 'build' commands in %s" % root_dir)
elif thisbuild['type'] == 'gradle':
logging.info("Building Gradle project...")
- flavours = thisbuild['gradle'].split(',')
-
- if len(flavours) == 1 and flavours[0] in ['main', 'yes', '']:
- flavours[0] = ''
+ flavours = thisbuild['gradle']
+ if flavours == ['yes']:
+ flavours = []
commands = [config['gradle']]
if thisbuild['preassemble']:
- commands += thisbuild['preassemble'].split()
+ commands += thisbuild['preassemble']
flavours_cmd = ''.join(flavours)
if flavours_cmd:
elif thisbuild['type'] == 'ant':
logging.info("Building Ant project...")
cmd = ['ant']
- if thisbuild['antcommand']:
- cmd += [thisbuild['antcommand']]
+ if thisbuild['antcommands']:
+ cmd += thisbuild['antcommands']
else:
cmd += ['release']
p = FDroidPopen(cmd, cwd=root_dir)
if not os.path.exists(src):
raise BuildException("Unsigned apk is not at expected location of " + src)
- p = SilentPopen([config['aapt'], 'dump', 'badging', src])
+ p = SdkToolsPopen(['aapt', 'dump', 'badging', src], output=False)
vercode = None
version = None
str(thisbuild['vercode']))
)
+ # Add information for 'fdroid verify' to be able to reproduce the build
+ # environment.
+ if onserver:
+ metadir = os.path.join(tmp_dir, 'META-INF')
+ if not os.path.exists(metadir):
+ os.mkdir(metadir)
+ homedir = os.path.expanduser('~')
+ for fn in ['buildserverid', 'fdroidserverid']:
+ shutil.copyfile(os.path.join(homedir, fn),
+ os.path.join(metadir, fn))
+ subprocess.call(['jar', 'uf', os.path.abspath(src),
+ 'META-INF/' + fn], cwd=tmp_dir)
+
# Copy the unsigned apk to our destination directory for further
# processing (by publish.py)...
dest = os.path.join(output_dir, common.getapkname(app, thisbuild))
if os.path.exists(dest_also):
return False
- if thisbuild['disable']:
+ if thisbuild['disable'] and not options.force:
return False
logging.info("Building version %s (%s) of %s" % (
if options.latest:
for app in apps.itervalues():
for build in reversed(app['builds']):
- if build['disable']:
+ if build['disable'] and not options.force:
continue
app['builds'] = [build]
break