Skip to content

Commit be9dea4

Browse files
committed
fixup! fixup! add detection for custom libraries registered by ld.so.conf
1 parent 98cd1c3 commit be9dea4

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

repos/system_upgrade/common/actors/checkldsoconf/libraries/checkldsoconfiguration.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ def _report_custom_ld_so_configuration(summary):
3636
def _is_modified(config_path, package_name):
3737
""" Decide if the configuration file was modified based on the package it belongs to. """
3838
is_modified = False
39-
try:
40-
run(['rpm', '-Va', package_name])
41-
except CalledProcessError as err:
42-
modified_files = err.stdout
43-
for line in modified_files.split('\n'):
44-
line = line.split(' ')
45-
modification_flags, file_path = line[0].strip(), line[-1].strip()
46-
# Note that the condition is relaxed so that files different only
47-
# in the modification timestamp won't be considered as modified.
48-
is_modified |= config_path == file_path and modification_flags.strip('.') != 'T'
39+
result = run(['rpm', '-Va', package_name], checked=False)
40+
if result['exit_code'] == 0:
41+
return is_modified
42+
modified_files = result['stdout']
43+
for line in modified_files.split('\n'):
44+
line = line.split(' ')
45+
modification_flags, file_path = line[0].strip(), line[-1].strip()
46+
# Note that the condition is relaxed so that files different only
47+
# in the modification timestamp won't be considered as modified.
48+
is_modified |= config_path == file_path and modification_flags.strip('.') != 'T'
4949
return is_modified
5050

5151

repos/system_upgrade/common/actors/checkldsoconf/tests/test_checkldsoconfiguration.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ def mocked_read_file(path):
111111
'', False)
112112
])
113113
def test_is_modified(monkeypatch, config_path, package_name, run_result, is_modified):
114-
def mocked_run(command):
114+
def mocked_run(command, checked):
115115
assert package_name in command
116-
if run_result:
117-
raise CalledProcessError("message", command, {'stdout': run_result})
118-
return ''
116+
assert checked is False
117+
exit_code = 1 if run_result else 0
118+
return {'stdout': run_result, 'exit_code': exit_code}
119119

120120
monkeypatch.setattr(checkldsoconfiguration, 'run', mocked_run)
121121

0 commit comments

Comments
 (0)