Skip to content

Commit eca99c8

Browse files
Get rid of system binary support (#4189)
This feature isn't used.
1 parent 8374e0c commit eca99c8

File tree

2 files changed

+3
-80
lines changed

2 files changed

+3
-80
lines changed

src/clusterfuzz/_internal/build_management/build_manager.py

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,7 @@ def set_env_var(name, value):
285285
if not absolute_file_path and filename == app_name:
286286
absolute_file_path = os.path.join(root, filename)
287287
app_directory = os.path.dirname(absolute_file_path)
288-
289-
# We don't want to change the state of system binaries.
290-
if not environment.get_value('SYSTEM_BINARY_DIR'):
291-
os.chmod(absolute_file_path, 0o750)
288+
os.chmod(absolute_file_path, 0o750)
292289

293290
set_env_var(app_path, absolute_file_path)
294291
set_env_var('APP_DIR', app_directory)
@@ -895,27 +892,6 @@ def setup(self):
895892
return True
896893

897894

898-
class SystemBuild(Build):
899-
"""System binary."""
900-
901-
def __init__(self, system_binary_directory):
902-
super().__init__(None, 1)
903-
self._build_dir = system_binary_directory
904-
905-
@property
906-
def build_dir(self):
907-
return self._build_dir
908-
909-
def setup(self):
910-
"""Set up a build that we assume is already installed on the system."""
911-
self._pre_setup()
912-
self._setup_application_path()
913-
return True
914-
915-
def delete(self):
916-
raise BuildManagerError('Cannot delete system build.')
917-
918-
919895
def _sort_build_urls_by_revision(build_urls, bucket_path, reverse):
920896
"""Return a sorted list of build url by revision."""
921897
base_url = os.path.dirname(bucket_path)
@@ -1315,28 +1291,13 @@ def setup_custom_binary(target_weights=None):
13151291
return None
13161292

13171293

1318-
def setup_system_binary():
1319-
"""Set up a build that we assume is already installed on the system."""
1320-
system_binary_directory = environment.get_value('SYSTEM_BINARY_DIR', '')
1321-
build = SystemBuild(system_binary_directory)
1322-
if build.setup():
1323-
return build
1324-
1325-
return None
1326-
1327-
13281294
def setup_build(revision=0, target_weights=None):
13291295
"""Set up a custom or regular build based on revision."""
13301296
# For custom binaries we always use the latest version. Revision is ignored.
13311297
custom_binary = environment.get_value('CUSTOM_BINARY')
13321298
if custom_binary:
13331299
return setup_custom_binary(target_weights=target_weights)
13341300

1335-
# In this case, we assume the build is already installed on the system.
1336-
system_binary = environment.get_value('SYSTEM_BINARY_DIR')
1337-
if system_binary:
1338-
return setup_system_binary()
1339-
13401301
fuzz_target_build_bucket_path = get_bucket_path(
13411302
'FUZZ_TARGET_BUILD_BUCKET_PATH')
13421303

@@ -1366,10 +1327,8 @@ def setup_build(revision=0, target_weights=None):
13661327

13671328

13681329
def is_custom_binary():
1369-
"""Determine if this is a custom or preinstalled system binary."""
1370-
return bool(
1371-
environment.get_value('CUSTOM_BINARY') or
1372-
environment.get_value('SYSTEM_BINARY_DIR'))
1330+
"""Determine if this is a custom binary."""
1331+
return bool(environment.get_value('CUSTOM_BINARY'))
13731332

13741333

13751334
def has_symbolized_builds():

src/clusterfuzz/_internal/tests/core/build_management/build_manager_test.py

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,42 +1101,6 @@ def test_delete(self):
11011101
self.assertTrue(os.path.isdir('/builds/job_custom'))
11021102

11031103

1104-
class SystemBuildTest(fake_filesystem_unittest.TestCase):
1105-
"""Tests for system build setup."""
1106-
1107-
def setUp(self):
1108-
"""Setup for system build test."""
1109-
test_utils.set_up_pyfakefs(self)
1110-
1111-
test_helpers.patch(self, [
1112-
'clusterfuzz._internal.system.shell.clear_temp_directory',
1113-
])
1114-
1115-
test_helpers.patch_environ(self)
1116-
1117-
os.environ['BUILDS_DIR'] = '/builds'
1118-
os.environ['FAIL_RETRIES'] = '1'
1119-
os.environ['APP_NAME'] = FAKE_APP_NAME
1120-
os.environ['SYSTEM_BINARY_DIR'] = '/system_binary'
1121-
_mock_unpack_build(
1122-
build_manager.SystemBuild('/'), None, '/system_binary', None)
1123-
1124-
def test_setup(self):
1125-
"""Test setting up a system binary."""
1126-
self.assertIsNotNone(build_manager.setup_system_binary())
1127-
1128-
self.assertEqual(os.environ['APP_REVISION'], '1')
1129-
self.assertEqual(os.environ['APP_PATH'], '/system_binary/app')
1130-
self.assertEqual(os.environ['APP_DIR'], '/system_binary')
1131-
self.assertEqual(os.environ['BUILD_DIR'], '/system_binary')
1132-
1133-
def test_delete(self):
1134-
"""Test deleting this build."""
1135-
build = build_manager.setup_system_binary()
1136-
with self.assertRaises(build_manager.BuildManagerError):
1137-
build.delete()
1138-
1139-
11401104
@mock.patch(
11411105
'clusterfuzz._internal.build_management.build_manager.MAX_EVICTED_BUILDS',
11421106
3)

0 commit comments

Comments
 (0)