Fix broken enable_lz4diff flag
When enable_lz4diff=true, we need to inject lz4.so from target_files to
delta_generator, this is done by setting LD_PRELOAD.
We used to rely on brillo_update_payload for setting LD_PRELOAD,
since brillo_update_payload is removed, in aosp/2726801, we
need to do this in python
Test: th
Bug: 382199131
Change-Id: I3696363408cf990d816011c0b034c3fc94f14943
diff --git a/tools/releasetools/ota_utils.py b/tools/releasetools/ota_utils.py
index 81b53dc..852d62b 100644
--- a/tools/releasetools/ota_utils.py
+++ b/tools/releasetools/ota_utils.py
@@ -845,16 +845,16 @@
self.is_partial_update = is_partial_update
self.spl_downgrade = spl_downgrade
- def _Run(self, cmd): # pylint: disable=no-self-use
+ def _Run(self, cmd, **kwargs): # pylint: disable=no-self-use
# Don't pipe (buffer) the output if verbose is set. Let
# brillo_update_payload write to stdout/stderr directly, so its progress can
# be monitored.
if OPTIONS.verbose:
- common.RunAndCheckOutput(cmd, stdout=None, stderr=None)
+ common.RunAndCheckOutput(cmd, stdout=None, stderr=None, **kwargs)
else:
- common.RunAndCheckOutput(cmd)
+ common.RunAndCheckOutput(cmd, **kwargs)
- def Generate(self, target_file, source_file=None, additional_args=None):
+ def Generate(self, target_file, source_file=None, additional_args=None, **kwargs):
"""Generates a payload from the given target-files zip(s).
Args:
@@ -863,6 +863,7 @@
generating a full OTA.
additional_args: A list of additional args that should be passed to
delta_generator binary; or None.
+ kwargs: Any additional args to pass to subprocess.Popen
"""
if additional_args is None:
additional_args = []
@@ -918,7 +919,7 @@
if self.is_partial_update:
cmd.extend(["--is_partial_update=true"])
cmd.extend(additional_args)
- self._Run(cmd)
+ self._Run(cmd, **kwargs)
self.payload_file = payload_file
self.payload_properties = None