1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-14 19:10:11 +01:00

post correct build tool versions to wiki

This commit is contained in:
Michael Pöhn 2017-03-21 23:51:15 +01:00
parent 71ff1d6257
commit bb49123118
2 changed files with 48 additions and 10 deletions

View File

@ -243,8 +243,16 @@ def release_vm():
# Note that 'force' here also implies test mode. # Note that 'force' here also implies test mode.
def build_server(app, build, vcs, build_dir, output_dir, force): def build_server(app, build, vcs, build_dir, output_dir, log_dir, force):
"""Do a build on the build server.""" """Do a build on the builder vm.
:param app: app metadata dict
:param build:
:param vcs: version control system controller object
:param build_dir: local source-code checkout of app
:param output_dir: target folder for the build result
:param force:
"""
global buildserverid global buildserverid
@ -417,6 +425,15 @@ def build_server(app, build, vcs, build_dir, output_dir, force):
"Build.py failed on server for {0}:{1}".format( "Build.py failed on server for {0}:{1}".format(
app.id, build.versionName), str(output, 'utf-8')) app.id, build.versionName), str(output, 'utf-8'))
# Retreive logs...
toolsversion_log = common.get_toolsversion_logname(app, build)
try:
ftp.chdir(os.path.join(homedir, log_dir))
ftp.get(toolsversion_log, os.path.join(log_dir, toolsversion_log))
logging.debug('retrieved %s', toolsversion_log)
except:
logging.warn('could not get %s from builder vm.' % (toolsversion_log))
# Retrieve the built files... # Retrieve the built files...
logging.info("Retrieving build output...") logging.info("Retrieving build output...")
if force: if force:
@ -513,7 +530,7 @@ def get_metadata_from_apk(app, build, apkfile):
return vercode, version return vercode, version
def build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir, tmp_dir, force, onserver, refresh): def build_local(app, build, vcs, build_dir, output_dir, log_dir, srclib_dir, extlib_dir, tmp_dir, force, onserver, refresh):
"""Do a build locally.""" """Do a build locally."""
ndk_path = build.ndk_path() ndk_path = build.ndk_path()
@ -532,6 +549,14 @@ def build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir,
common.set_FDroidPopen_env(build) common.set_FDroidPopen_env(build)
# create ..._toolsversion.log when running in builder vm
if onserver:
log_path = os.path.join(log_dir,
common.get_toolsversion_logname(app, build))
with open(log_path, 'w') as f:
f.write('== Installed Android Tools ==\n\n')
f.write(get_android_tools_version_log(build.ndk_path()))
# Prepare the source code... # Prepare the source code...
root_dir, srclibpaths = common.prepare_source(vcs, app, build, root_dir, srclibpaths = common.prepare_source(vcs, app, build,
build_dir, srclib_dir, build_dir, srclib_dir,
@ -914,8 +939,9 @@ def build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir,
os.path.join(output_dir, tarname)) os.path.join(output_dir, tarname))
def trybuild(app, build, build_dir, output_dir, also_check_dir, srclib_dir, extlib_dir, def trybuild(app, build, build_dir, output_dir, log_dir, also_check_dir,
tmp_dir, repo_dir, vcs, test, server, force, onserver, refresh): srclib_dir, extlib_dir, tmp_dir, repo_dir, vcs, test,
server, force, onserver, refresh):
""" """
Build a particular version of an application, if it needs building. Build a particular version of an application, if it needs building.
@ -958,9 +984,9 @@ def trybuild(app, build, build_dir, output_dir, also_check_dir, srclib_dir, extl
# grabbing the source now. # grabbing the source now.
vcs.gotorevision(build.commit) vcs.gotorevision(build.commit)
build_server(app, build, vcs, build_dir, output_dir, force) build_server(app, build, vcs, build_dir, output_dir, log_dir, force)
else: else:
build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir, tmp_dir, force, onserver, refresh) build_local(app, build, vcs, build_dir, output_dir, log_dir, srclib_dir, extlib_dir, tmp_dir, force, onserver, refresh)
return True return True
@ -1151,8 +1177,10 @@ def main():
for build in app.builds: for build in app.builds:
wikilog = None wikilog = None
tools_version_log = '== Installed Android Tools ==\n\n' tools_version_log = ''
tools_version_log += get_android_tools_version_log(build.ndk_path()) if not options.onserver:
tools_version_log = '== Installed Android Tools ==\n\n'
tools_version_log += get_android_tools_version_log(build.ndk_path())
try: try:
# For the first build of a particular app, we need to set up # For the first build of a particular app, we need to set up
@ -1163,11 +1191,17 @@ def main():
first = False first = False
logging.debug("Checking " + build.versionName) logging.debug("Checking " + build.versionName)
if trybuild(app, build, build_dir, output_dir, if trybuild(app, build, build_dir, output_dir, log_dir,
also_check_dir, srclib_dir, extlib_dir, also_check_dir, srclib_dir, extlib_dir,
tmp_dir, repo_dir, vcs, options.test, tmp_dir, repo_dir, vcs, options.test,
options.server, options.force, options.server, options.force,
options.onserver, options.refresh): options.onserver, options.refresh):
toolslog = os.path.join(log_dir,
common.get_toolsversion_logname(app, build))
if not options.onserver and os.path.exists(toolslog):
with open(toolslog, 'r') as f:
tools_version_log = ''.join(f.readlines())
os.remove(toolslog)
if app.Binaries is not None: if app.Binaries is not None:
# This is an app where we build from source, and # This is an app where we build from source, and

View File

@ -552,6 +552,10 @@ def get_release_filename(app, build):
return "%s_%s.apk" % (app.id, build.versionCode) return "%s_%s.apk" % (app.id, build.versionCode)
def get_toolsversion_logname(app, build):
return "%s_%s_toolsversion.log" % (app.id, build.versionCode)
def getsrcname(app, build): def getsrcname(app, build):
return "%s_%s_src.tar.gz" % (app.id, build.versionCode) return "%s_%s_src.tar.gz" % (app.id, build.versionCode)