Skip to content

Make _add_system_libs reentrant

jcelaya requested to merge jcelaya/cerbero:fix_add_system_libs into master

The method _add_system_libs of ModifyEnvBase is not reentrant, and fails when called a second time. This happens in a CMake-based recipe with use_system_libs = True. It does not happen in Autotools- or Maven-based recipes. The build process fails with the following exception:

Recipe 'foo' failed at the build step 'configure'
Traceback (most recent call last):
  File "../cerbero/build/oven.py", line 166, in _cook_recipe
    loop.run_until_complete(stepfunc(recipe))
  File "/usr/local/lib/python3.6/asyncio/base_events.py", line 484, in run_until_complete
    return future.result()
  File "../cerbero/build/recipe.py", line 54, in wrapped
    await ret
  File "../cerbero/build/build.py", line 167, in call
    self._add_system_libs()
  File "../cerbero/build/build.py", line 325, in _add_system_libs
    self.set_env(var, val)
  File "../cerbero/build/build.py", line 258, in set_env
    self.check_reentrancy()
  File "../cerbero/build/build.py", line 245, in check_reentrancy
    raise RuntimeError('Do not modify the env inside @modify_environment, it will have no effect')
RuntimeError: Do not modify the env inside @modify_environment, it will have no effect

This patch fixes it assuming that, when _old_env is not empty, system lib paths have already been added.

Edited by Nirbheek Chauhan

Merge request reports

Loading