From 752f6a4ba2c16c03b392512ff4f66d28e3a5bffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20P=C3=B6hn?= Date: Tue, 19 Jun 2018 15:18:13 +0200 Subject: [PATCH] applied review suggestions for deploying (build) logs --- examples/config.py | 10 +++++----- fdroidserver/common.py | 24 ++++++++++++------------ tests/common.TestCase | 6 +++--- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/examples/config.py b/examples/config.py index 5942aaef..dab12df1 100644 --- a/examples/config.py +++ b/examples/config.py @@ -163,12 +163,12 @@ The repository of older versions of applications from the main demo repository. # 'bar.info:/var/www/fdroid', # } -# Uncomment this option if you want to publish build logs to your repository -# server(s). Logs get published to all servers configured in 'serverwebroot'. -# This feature only supports publishing logs from build-jobs running -# inside a buildserver VM. +# 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. # -# publish_build_logs = True +# deploy_process_logs = True # The full URL to a git remote repository. You can include # multiple servers to mirror to by wrapping the whole thing in {} or [], and diff --git a/fdroidserver/common.py b/fdroidserver/common.py index ae2d2e48..4584a433 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -101,7 +101,7 @@ default_config = { 'per_app_repos': False, 'make_current_version_link': True, 'current_version_name_source': 'Name', - 'publish_build_logs': False, + 'deploy_process_logs': False, 'update_stats': False, 'stats_ignore': [], 'stats_server': None, @@ -3072,8 +3072,8 @@ def local_rsync(options, fromdir, todir): raise FDroidException() -def publish_build_log_with_rsync(appid, vercode, log_content, - timestamp=int(time.time())): +def deploy_build_log_with_rsync(appid, vercode, log_content, + timestamp=int(time.time())): """Upload build log of one individual app build to an fdroid repository. :param appid: package name for dientifying to which app this log belongs. @@ -3084,18 +3084,18 @@ def publish_build_log_with_rsync(appid, vercode, log_content, :param timestamp: timestamp for avoiding logfile name collisions. """ - # check if publishing logs is enabled in config - if not config.get('publish_build_logs', False): - logging.debug('skip publishing full build logs: not enabled in config') + # check if deploying logs is enabled in config + if not config.get('deploy_process_logs', False): + logging.debug(_('skip deploying full build logs: not enabled in config')) return if not log_content: - logging.warning('skip publishing full build logs: log content is empty') + 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 '{}' is not a unix timestamp" - .format(timestamp)) + raise ValueError(_("supplied timestamp value '{timestamp}' is not a unix timestamp" + .format(timestamp=timestamp))) with tempfile.TemporaryDirectory() as tmpdir: # gzip compress log file @@ -3127,13 +3127,13 @@ def publish_build_log_with_rsync(appid, vercode, log_content, cmd += ['-e', 'ssh -oBatchMode=yes -oIdentitiesOnly=yes -i ' + config['identity_file']] cmd += [log_gz_path, dest_path] - # TODO: also publish signature file if present + # TODO: also deploy signature file if present retcode = subprocess.call(cmd) if retcode: - logging.warning("failded publishing build logs to '{}'".format(webroot)) + logging.warning(_("failed deploying build logs to '{path}'").format(path=webroot)) else: - logging.info("published build logs to '{}'".format(webroot)) + logging.info(_("deployeded build logs to '{path}'").format(path=webroot)) def get_per_app_repos(): diff --git a/tests/common.TestCase b/tests/common.TestCase index 42e7d8d6..f5db4f3f 100755 --- a/tests/common.TestCase +++ b/tests/common.TestCase @@ -791,7 +791,7 @@ class CommonTest(unittest.TestCase): with self.assertRaises(SyntaxError): fdroidserver.common.calculate_math_string('1-1 # no comment') - def test_publish_build_log_with_rsync_with_id_file(self): + def test_deploy_build_log_with_rsync_with_id_file(self): mocklogcontent = bytes(textwrap.dedent("""\ build started @@ -806,7 +806,7 @@ class CommonTest(unittest.TestCase): fdroidserver.common.config['serverwebroot'] = [ 'example.com:/var/www/fdroid/repo/', 'example.com:/var/www/fdroid/archive/'] - fdroidserver.common.config['publish_build_logs'] = True + fdroidserver.common.config['deploy_process_logs'] = True fdroidserver.common.config['identity_file'] = 'ssh/id_rsa' assert_subprocess_call_iteration = 0 @@ -848,7 +848,7 @@ class CommonTest(unittest.TestCase): with mock.patch('subprocess.call', side_effect=assert_subprocess_call): - fdroidserver.common.publish_build_log_with_rsync( + fdroidserver.common.deploy_build_log_with_rsync( 'com.example.app', '4711', mocklogcontent, 1.1)