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

build: log the start time of the current build session

Since `fdroid build --all` can run a long time, knowing when that command
was started will be very useful information for figuring out what the build
server is doing.
This commit is contained in:
Hans-Christoph Steiner 2018-01-03 12:16:20 +01:00
parent 9793e57302
commit 444ae95380

View File

@ -288,6 +288,10 @@ def force_gradle_build_tools(build_dir, build_tools):
path) path)
def _get_build_timestamp():
return time.strftime("%Y-%m-%d %H:%M:%SZ", time.gmtime())
def transform_first_char(string, method): def transform_first_char(string, method):
"""Uses method() on the first character of string.""" """Uses method() on the first character of string."""
if len(string) == 0: if len(string) == 0:
@ -1055,6 +1059,7 @@ def parse_commandline():
options = None options = None
config = None config = None
buildserverid = None buildserverid = None
starttime = _get_build_timestamp()
def main(): def main():
@ -1174,6 +1179,7 @@ def main():
for build in app.builds: for build in app.builds:
wikilog = None wikilog = None
build_starttime = _get_build_timestamp()
tools_version_log = '' tools_version_log = ''
if not options.onserver: if not options.onserver:
tools_version_log = get_android_tools_version_log(build.ndk_path()) tools_version_log = get_android_tools_version_log(build.ndk_path())
@ -1270,7 +1276,7 @@ def main():
f.write('versionCode: %s\nversionName: %s\ncommit: %s\n' % f.write('versionCode: %s\nversionName: %s\ncommit: %s\n' %
(build.versionCode, build.versionName, build.commit)) (build.versionCode, build.versionName, build.commit))
f.write('Build completed at ' f.write('Build completed at '
+ time.strftime("%Y-%m-%d %H:%M:%SZ", time.gmtime()) + '\n') + _get_build_timestamp() + '\n')
f.write('\n' + tools_version_log + '\n') f.write('\n' + tools_version_log + '\n')
f.write(str(e)) f.write(str(e))
logging.error("Could not build app %s: %s" % (appid, e)) logging.error("Could not build app %s: %s" % (appid, e))
@ -1295,7 +1301,9 @@ def main():
newpage = site.Pages[lastbuildpage] newpage = site.Pages[lastbuildpage]
with open(os.path.join('tmp', 'fdroidserverid')) as fp: with open(os.path.join('tmp', 'fdroidserverid')) as fp:
fdroidserverid = fp.read().rstrip() fdroidserverid = fp.read().rstrip()
txt = "* build completed at " + time.strftime("%Y-%m-%d %H:%M:%SZ", time.gmtime()) + '\n' \ txt = "* build session started at " + starttime + '\n' \
+ "* this build started at " + build_starttime + '\n' \
+ "* this build completed at " + _get_build_timestamp() + '\n' \
+ '* fdroidserverid: [https://gitlab.com/fdroid/fdroidserver/commit/' \ + '* fdroidserverid: [https://gitlab.com/fdroid/fdroidserver/commit/' \
+ fdroidserverid + ' ' + fdroidserverid + ']\n\n' + fdroidserverid + ' ' + fdroidserverid + ']\n\n'
if options.onserver: if options.onserver: