mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-09-17 10:40:12 +02:00
Merge branch 'status-json-fixes' into 'master'
Status json fixes Closes #741 and #742 See merge request fdroid/fdroidserver!717
This commit is contained in:
commit
7b8d358833
@ -324,6 +324,10 @@ def transform_first_char(string, method):
|
|||||||
return method(string[0]) + string[1:]
|
return method(string[0]) + string[1:]
|
||||||
|
|
||||||
|
|
||||||
|
def add_failed_builds_entry(failed_builds, appid, build, entry):
|
||||||
|
failed_builds.append([appid, int(build.versionCode), str(entry)])
|
||||||
|
|
||||||
|
|
||||||
def get_metadata_from_apk(app, build, apkfile):
|
def get_metadata_from_apk(app, build, apkfile):
|
||||||
"""get the required metadata from the built APK
|
"""get the required metadata from the built APK
|
||||||
|
|
||||||
@ -1031,9 +1035,9 @@ def main():
|
|||||||
site.login(config['wiki_user'], config['wiki_password'])
|
site.login(config['wiki_user'], config['wiki_password'])
|
||||||
|
|
||||||
# Build applications...
|
# Build applications...
|
||||||
failed_apps = {}
|
failed_builds = []
|
||||||
build_succeeded = []
|
build_succeeded = []
|
||||||
status_output['failedBuilds'] = failed_apps
|
status_output['failedBuilds'] = failed_builds
|
||||||
status_output['successfulBuilds'] = build_succeeded
|
status_output['successfulBuilds'] = build_succeeded
|
||||||
# Only build for 36 hours, then stop gracefully.
|
# Only build for 36 hours, then stop gracefully.
|
||||||
endtime = time.time() + 36 * 60 * 60
|
endtime = time.time() + 36 * 60 * 60
|
||||||
@ -1156,7 +1160,7 @@ def main():
|
|||||||
if options.stop:
|
if options.stop:
|
||||||
logging.debug("Error encoutered, stopping by user request.")
|
logging.debug("Error encoutered, stopping by user request.")
|
||||||
common.force_exit(1)
|
common.force_exit(1)
|
||||||
failed_apps[appid] = vcse
|
add_failed_builds_entry(failed_builds, appid, build, vcse)
|
||||||
wikilog = str(vcse)
|
wikilog = str(vcse)
|
||||||
except FDroidException as e:
|
except FDroidException as e:
|
||||||
with open(os.path.join(log_dir, appid + '.log'), 'a+') as f:
|
with open(os.path.join(log_dir, appid + '.log'), 'a+') as f:
|
||||||
@ -1171,7 +1175,7 @@ def main():
|
|||||||
if options.stop:
|
if options.stop:
|
||||||
logging.debug("Error encoutered, stopping by user request.")
|
logging.debug("Error encoutered, stopping by user request.")
|
||||||
common.force_exit(1)
|
common.force_exit(1)
|
||||||
failed_apps[appid] = e
|
add_failed_builds_entry(failed_builds, appid, build, e)
|
||||||
wikilog = e.get_wikitext()
|
wikilog = e.get_wikitext()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error("Could not build app %s due to unknown error: %s" % (
|
logging.error("Could not build app %s due to unknown error: %s" % (
|
||||||
@ -1179,7 +1183,7 @@ def main():
|
|||||||
if options.stop:
|
if options.stop:
|
||||||
logging.debug("Error encoutered, stopping by user request.")
|
logging.debug("Error encoutered, stopping by user request.")
|
||||||
common.force_exit(1)
|
common.force_exit(1)
|
||||||
failed_apps[appid] = e
|
add_failed_builds_entry(failed_builds, appid, build, e)
|
||||||
wikilog = str(e)
|
wikilog = str(e)
|
||||||
|
|
||||||
if options.wiki and wikilog:
|
if options.wiki and wikilog:
|
||||||
@ -1220,16 +1224,16 @@ def main():
|
|||||||
logging.info("success: %s" % (app.id))
|
logging.info("success: %s" % (app.id))
|
||||||
|
|
||||||
if not options.verbose:
|
if not options.verbose:
|
||||||
for fa in failed_apps:
|
for fb in failed_builds:
|
||||||
logging.info("Build for app %s failed:\n%s" % (fa, failed_apps[fa]))
|
logging.info('Build for app {}:{} failed:\n{}'.format(*fb))
|
||||||
|
|
||||||
logging.info(_("Finished"))
|
logging.info(_("Finished"))
|
||||||
if len(build_succeeded) > 0:
|
if len(build_succeeded) > 0:
|
||||||
logging.info(ngettext("{} build succeeded",
|
logging.info(ngettext("{} build succeeded",
|
||||||
"{} builds succeeded", len(build_succeeded)).format(len(build_succeeded)))
|
"{} builds succeeded", len(build_succeeded)).format(len(build_succeeded)))
|
||||||
if len(failed_apps) > 0:
|
if len(failed_builds) > 0:
|
||||||
logging.info(ngettext("{} build failed",
|
logging.info(ngettext("{} build failed",
|
||||||
"{} builds failed", len(failed_apps)).format(len(failed_apps)))
|
"{} builds failed", len(failed_builds)).format(len(failed_builds)))
|
||||||
|
|
||||||
if options.wiki:
|
if options.wiki:
|
||||||
wiki_page_path = 'build_' + time.strftime('%s', start_timestamp)
|
wiki_page_path = 'build_' + time.strftime('%s', start_timestamp)
|
||||||
@ -1265,13 +1269,13 @@ def main():
|
|||||||
if m:
|
if m:
|
||||||
txt += "* guest RAM: %s MB\n" % m.group(1)
|
txt += "* guest RAM: %s MB\n" % m.group(1)
|
||||||
txt += "* successful builds: %d\n" % len(build_succeeded)
|
txt += "* successful builds: %d\n" % len(build_succeeded)
|
||||||
txt += "* failed builds: %d\n" % len(failed_apps)
|
txt += "* failed builds: %d\n" % len(failed_builds)
|
||||||
txt += "\n\n"
|
txt += "\n\n"
|
||||||
newpage.save(txt, summary='Run log')
|
newpage.save(txt, summary='Run log')
|
||||||
newpage = site.Pages['build']
|
newpage = site.Pages['build']
|
||||||
newpage.save('#REDIRECT [[' + wiki_page_path + ']]', summary='Update redirect')
|
newpage.save('#REDIRECT [[' + wiki_page_path + ']]', summary='Update redirect')
|
||||||
|
|
||||||
common.write_status_json(status_output, options.pretty)
|
common.write_status_json(status_output)
|
||||||
|
|
||||||
# hack to ensure this exits, even is some threads are still running
|
# hack to ensure this exits, even is some threads are still running
|
||||||
common.force_exit()
|
common.force_exit()
|
||||||
|
Loading…
Reference in New Issue
Block a user