Merge branch 'master' into logging

Conflicts:
	fdroidserver/build.py
This commit is contained in:
Daniel Martí 2014-01-29 13:57:57 +01:00
commit 72fa1891bf
6 changed files with 41 additions and 25 deletions

View file

@ -345,7 +345,8 @@ def build_server(app, thisbuild, vcs, build_dir, output_dir, force):
tarball = common.getsrcname(app,thisbuild)
try:
ftp.get(apkfile, os.path.join(output_dir, apkfile))
ftp.get(tarball, os.path.join(output_dir, tarball))
if not options.notarball:
ftp.get(tarball, os.path.join(output_dir, tarball))
except:
raise BuildException("Build failed for %s:%s - missing output files" % (app['id'], thisbuild['version']), output)
ftp.close()
@ -428,14 +429,15 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
raise BuildException("Can't build due to " +
str(len(buildprobs)) + " scanned problems")
# Build the source tarball right before we build the release...
logging.info("Creating source tarball...")
tarname = common.getsrcname(app,thisbuild)
tarball = tarfile.open(os.path.join(tmp_dir, tarname), "w:gz")
def tarexc(f):
return any(f.endswith(s) for s in ['.svn', '.git', '.hg', '.bzr'])
tarball.add(build_dir, tarname, exclude=tarexc)
tarball.close()
if not options.notarball:
# Build the source tarball right before we build the release...
logging.info("Creating source tarball...")
tarname = common.getsrcname(app,thisbuild)
tarball = tarfile.open(os.path.join(tmp_dir, tarname), "w:gz")
def tarexc(f):
return any(f.endswith(s) for s in ['.svn', '.git', '.hg', '.bzr'])
tarball.add(build_dir, tarname, exclude=tarexc)
tarball.close()
# Run a build command if one is required...
if 'build' in thisbuild:
@ -588,7 +590,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
p = FDroidPopen(commands, cwd=gradle_dir)
else:
elif thisbuild['type'] == 'ant':
logging.info("Building Ant project...")
cmd = ['ant']
if 'antcommand' in thisbuild:
@ -599,7 +601,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
bindir = os.path.join(root_dir, 'bin')
if p.returncode != 0:
if p is not None and p.returncode != 0:
raise BuildException("Build failed for %s:%s" % (app['id'], thisbuild['version']), p.stdout)
logging.info("Successfully built version " + thisbuild['version'] + ' of ' + app['id'])
@ -636,6 +638,9 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
src = re.match(r".*^.*Creating (.+) for release.*$.*", stdout_apk,
re.S|re.M).group(1)
src = os.path.join(bindir, src)
elif thisbuild['type'] == 'raw':
src = os.path.join(root_dir, thisbuild['output'])
src = os.path.normpath(src)
# Make sure it's not debuggable...
if common.isApkDebuggable(src, config):
@ -701,7 +706,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
shutil.copyfile(src, dest)
# Move the source tarball into the output directory...
if output_dir != tmp_dir:
if output_dir != tmp_dir and not options.notarball:
shutil.move(os.path.join(tmp_dir, tarname),
os.path.join(output_dir, tarname))
@ -773,6 +778,8 @@ def parse_commandline():
help="Reset and create a brand new build server, even if the existing one appears to be ok.")
parser.add_option("--on-server", dest="onserver", action="store_true", default=False,
help="Specify that we're running on the build server")
parser.add_option("--no-tarball", dest="notarball", action="store_true", default=False,
help="Don't create a source tarball, useful when testing a build")
parser.add_option("-f", "--force", action="store_true", default=False,
help="Force build of disabled apps, and carries on regardless of scan problems. Only allowed in test mode.")
parser.add_option("-a", "--all", action="store_true", default=False,

View file

@ -333,20 +333,18 @@ class vcs_git(vcs):
def initsubmodules(self):
self.checkrepo()
if subprocess.call(['git', 'submodule', 'init'],
cwd=self.local) != 0:
raise VCSException("Git submodule init failed")
if subprocess.call(['git', 'submodule', 'update'],
cwd=self.local) != 0:
raise VCSException("Git submodule update failed")
if subprocess.call(['git', 'submodule', 'foreach',
if subprocess.call(['git', 'submodule', 'foreach', '--recursive',
'git', 'reset', '--hard'],
cwd=self.local) != 0:
raise VCSException("Git submodule reset failed")
if subprocess.call(['git', 'submodule', 'foreach',
if subprocess.call(['git', 'submodule', 'foreach', '--recursive',
'git', 'clean', '-dffx'],
cwd=self.local) != 0:
raise VCSException("Git submodule clean failed")
if subprocess.call(['git', 'submodule', 'update',
'--init', '--force', '--recursive'],
cwd=self.local) != 0:
raise VCSException("Git submodule update failed")
def gettags(self):
self.checkrepo()

View file

@ -471,6 +471,8 @@ def parse_metadata(metafile):
for t in ['maven', 'gradle', 'kivy']:
if build.get(t, 'no') != 'no':
return t
if 'output' in build:
return 'raw'
return 'ant'
thisinfo = {}
@ -699,7 +701,7 @@ def write_metadata(dest, app):
# This defines the preferred order for the build items - as in the
# manual, they're roughly in order of application.
keyorder = ['disable', 'commit', 'subdir', 'submodules', 'init',
'gradle', 'maven', 'oldsdkloc', 'target',
'gradle', 'maven', 'output', 'oldsdkloc', 'target',
'update', 'encoding', 'forceversion', 'forcevercode', 'rm',
'fixtrans', 'fixapos', 'extlibs', 'srclibs', 'patch',
'prebuild', 'scanignore', 'scandelete', 'build', 'buildjni',