1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-20 13:50:12 +01:00

Merge branch 'buildserver-verbose' into 'master'

print build-server output when verbose flag is set

Closes #213

See merge request fdroid/fdroidserver!219
This commit is contained in:
Hans-Christoph Steiner 2017-09-15 09:10:07 +00:00
commit 9cb074cb08

View File

@ -210,23 +210,33 @@ def build_server(app, build, vcs, build_dir, output_dir, log_dir, force):
cmdline += " %s:%s" % (app.id, build.versionCode)
chan.exec_command('bash --login -c "' + cmdline + '"')
# Fetch build process output ...
try:
cmd_stdout = chan.makefile('rb', 1024)
output = bytes()
output += get_android_tools_version_log(build.ndk_path()).encode()
while not chan.exit_status_ready():
while chan.recv_ready():
output += chan.recv(1024)
time.sleep(0.1)
line = cmd_stdout.readline()
if line:
if options.verbose:
logging.debug("buildserver > " + str(line, 'utf-8').rstrip())
output += line
else:
time.sleep(0.05)
for line in cmd_stdout.readlines():
if options.verbose:
logging.debug("buildserver > " + str(line, 'utf-8').rstrip())
output += line
finally:
cmd_stdout.close()
# Check build process exit status ...
logging.info("...getting exit status")
returncode = chan.recv_exit_status()
while True:
get = chan.recv(1024)
if len(get) == 0:
break
output += get
if returncode != 0:
raise BuildException(
"Build.py failed on server for {0}:{1}".format(
app.id, build.versionName), str(output, 'utf-8'))
app.id, build.versionName), None if options.verbose else str(output, 'utf-8'))
# Retreive logs...
toolsversion_log = common.get_toolsversion_logname(app, build)
@ -251,8 +261,8 @@ def build_server(app, build, vcs, build_dir, output_dir, log_dir, force):
ftp.get(tarball, os.path.join(output_dir, tarball))
except Exception:
raise BuildException(
"Build failed for %s:%s - missing output files".format(
app.id, build.versionName), output)
"Build failed for {0}:{1} - missing output files".format(
app.id, build.versionName), None if options.verbose else str(output, 'utf-8'))
ftp.close()
finally: