mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-02 09:10:11 +02:00
deploy build logs: no timestamps
This commit is contained in:
parent
f30983368c
commit
2c87b5e6f9
@ -173,8 +173,8 @@ The repository of older versions of applications from the main demo repository.
|
||||
|
||||
# Uncomment this option if you want to logs of builds and other processes to
|
||||
# your repository server(s). Logs get published to all servers configured in
|
||||
# 'serverwebroot'. For builds, only logs from build-jobs running inside a
|
||||
# buildserver VM are supported.
|
||||
# 'serverwebroot'. The name scheme is: .../repo/$APPID_$VERCODE.log.gz
|
||||
# Only logs from build-jobs running inside a buildserver VM are supported.
|
||||
#
|
||||
# deploy_process_logs = True
|
||||
|
||||
|
@ -3232,8 +3232,7 @@ def local_rsync(options, fromdir, todir):
|
||||
raise FDroidException()
|
||||
|
||||
|
||||
def deploy_build_log_with_rsync(appid, vercode, log_content,
|
||||
timestamp=int(time.time())):
|
||||
def deploy_build_log_with_rsync(appid, vercode, log_content):
|
||||
"""Upload build log of one individual app build to an fdroid repository.
|
||||
|
||||
:param appid: package name for dientifying to which app this log belongs.
|
||||
@ -3241,7 +3240,6 @@ def deploy_build_log_with_rsync(appid, vercode, log_content,
|
||||
:param log_content: Content of the log which is about to be posted.
|
||||
Should be either a string or bytes. (bytes will
|
||||
be decoded as 'utf-8')
|
||||
:param timestamp: timestamp for avoiding logfile name collisions.
|
||||
"""
|
||||
|
||||
# check if deploying logs is enabled in config
|
||||
@ -3253,16 +3251,11 @@ def deploy_build_log_with_rsync(appid, vercode, log_content,
|
||||
logging.warning(_('skip deploying full build logs: log content is empty'))
|
||||
return
|
||||
|
||||
if not (isinstance(timestamp, int) or isinstance(timestamp, float)):
|
||||
raise ValueError(_("supplied timestamp value '{timestamp}' is not a unix timestamp"
|
||||
.format(timestamp=timestamp)))
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
# gzip compress log file
|
||||
log_gz_path = os.path.join(
|
||||
tmpdir, '{pkg}_{ver}_{ts}.log.gz'.format(pkg=appid,
|
||||
ver=vercode,
|
||||
ts=int(timestamp)))
|
||||
tmpdir, '{pkg}_{ver}.log.gz'.format(pkg=appid,
|
||||
ver=vercode))
|
||||
with gzip.open(log_gz_path, 'wb') as f:
|
||||
if isinstance(log_content, str):
|
||||
f.write(bytes(log_content, 'utf-8'))
|
||||
|
@ -971,7 +971,7 @@ class CommonTest(unittest.TestCase):
|
||||
cmd[6],
|
||||
'example.com:/var/www/fdroid/repo/'],
|
||||
cmd)
|
||||
self.assertTrue(cmd[6].endswith('/com.example.app_4711_1.log.gz'))
|
||||
self.assertTrue(cmd[6].endswith('/com.example.app_4711.log.gz'))
|
||||
with gzip.open(cmd[6], 'r') as f:
|
||||
self.assertTrue(f.read(), mocklogcontent)
|
||||
elif assert_subprocess_call_iteration == 1:
|
||||
@ -984,7 +984,7 @@ class CommonTest(unittest.TestCase):
|
||||
cmd[6],
|
||||
'example.com:/var/www/fbot/repo/'],
|
||||
cmd)
|
||||
self.assertTrue(cmd[6].endswith('/com.example.app_4711_1.log.gz'))
|
||||
self.assertTrue(cmd[6].endswith('/com.example.app_4711.log.gz'))
|
||||
with gzip.open(cmd[6], 'r') as f:
|
||||
self.assertTrue(f.read(), mocklogcontent)
|
||||
else:
|
||||
@ -996,7 +996,7 @@ class CommonTest(unittest.TestCase):
|
||||
with mock.patch('subprocess.call',
|
||||
side_effect=assert_subprocess_call):
|
||||
fdroidserver.common.deploy_build_log_with_rsync(
|
||||
'com.example.app', '4711', mocklogcontent, 1.1)
|
||||
'com.example.app', '4711', mocklogcontent)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
Reference in New Issue
Block a user