Skip to content

Commit

Permalink
Fix lint issues. (#4125)
Browse files Browse the repository at this point in the history
Encountered when drafting PR #4124. The tree was in a bad state, this
fixes some of it.

---------

Co-authored-by: Oliver Chang <oliverchang@users.noreply.github.com>
Co-authored-by: Oliver Chang <ochang@google.com>
  • Loading branch information
3 people authored Jul 29, 2024
1 parent b5203e4 commit 6accf16
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/clusterfuzz/_internal/base/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,11 @@ def get_application_id():

return app_id


def get_clusterfuzz_release():
return os.getenv('CLUSTERFUZZ_RELEASE', 'prod')


def _get_manifest_release_suffix(release):
suffix = ''
if sys.version_info.major == 3:
Expand All @@ -251,7 +253,7 @@ def _get_deployment_zip_release_suffix(release):
def get_platform_deployment_filename(platform, release):
"""Return the platform deployment filename."""
# Expects linux, macos or windows.
base_filename = platform
base_filename = platform
release_filename_suffix = _get_deployment_zip_release_suffix(release)
return f'{base_filename}{release_filename_suffix}.zip'

Expand Down
22 changes: 14 additions & 8 deletions src/clusterfuzz/_internal/bot/tasks/update_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ def get_source_url():
'Windows': 'windows',
'Darwin': 'macos'
}
platform_name= platform_mappings[platform_name]
return _deployment_file_url(utils.get_platform_deployment_filename(platform_name, release))
platform_name = platform_mappings[platform_name]
return _deployment_file_url(
utils.get_platform_deployment_filename(platform_name, release))


def get_source_manifest_url():
Expand Down Expand Up @@ -151,14 +152,18 @@ def get_newer_source_revision():
logs.info('No manifest found. Forcing an update.')
return source_version

logs.info(f'Local source code version: {local_source_version}, on release {utils.get_clusterfuzz_release()}.')
logs.info(f'Remote source code version: {source_version}, on release {utils.get_clusterfuzz_release()}.')
logs.info(f'Local source code version: {local_source_version}, ' +
f'on release {utils.get_clusterfuzz_release()}.')
logs.info(f'Remote source code version: {source_version}, ' +
f'on release {utils.get_clusterfuzz_release()}.')
if local_source_version >= source_version:
logs.info('Remote souce code <= local source code. No update.')
# No source code update found. Source code is current, bail out.
return None

logs.info(f'New source code: {source_version} (updated from {local_source_version}, on release {utils.get_clusterfuzz_release()})')
logs.info(f'New source code: {source_version} ' +
f'(updated from {local_source_version}, ' +
f'on release {utils.get_clusterfuzz_release()})')
return source_version


Expand Down Expand Up @@ -223,8 +228,8 @@ def update_source_code():

real_path = os.path.realpath(absolute_filepath)
if real_path != absolute_filepath:
logs.info(f'Mismatch between absolute and real filepath. ' +
'Not adding on normalized set: {real_path}')
logs.info('Mismatch between absolute and real filepath. '
f'Not adding on normalized set: {real_path}')
continue

normalized_file_set.add(absolute_filepath)
Expand Down Expand Up @@ -274,7 +279,8 @@ def update_source_code():
source_version = utils.read_data_from_file(
local_manifest_path, eval_data=False).decode('utf-8').strip()
os.remove(temp_archive)
logs.info(f'Source code updated to {source_version} (release = {utils.get_clusterfuzz_release()}).')
logs.info(f'Source code updated to {source_version} ' +
f'(release = {utils.get_clusterfuzz_release()}).')


def update_tests_if_needed():
Expand Down

0 comments on commit 6accf16

Please sign in to comment.