<p>Alejandro Leal has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-gsm-tester/+/24272">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">util: adds the feature to force the rpath when patching files.<br><br>Adds a function that allows to patch the rpath of a binary with the option '--force-rpath'.<br><br>Change-Id: I2d4a105d4843c0d31d6b5d8f8d4195247b290aec<br>---<br>M src/osmo_gsm_tester/core/remote.py<br>M src/osmo_gsm_tester/core/util.py<br>2 files changed, 24 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/72/24272/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/osmo_gsm_tester/core/remote.py b/src/osmo_gsm_tester/core/remote.py</span><br><span>index fb446a6..95750f5 100644</span><br><span>--- a/src/osmo_gsm_tester/core/remote.py</span><br><span>+++ b/src/osmo_gsm_tester/core/remote.py</span><br><span>@@ -203,3 +203,17 @@</span><br><span>             self.dbg('Using specific patchelf from %s', patchelf_bin)</span><br><span> </span><br><span>         self.run_remote_sync('patchelf', (patchelf_bin, '--set-rpath', paths, binary_path))</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    def change_elf_force_rpath(self, binary_path, paths):</span><br><span style="color: hsl(120, 100%, 40%);">+        '''</span><br><span style="color: hsl(120, 100%, 40%);">+        Change RPATH field in ELF executable binary forcing the rpath.</span><br><span style="color: hsl(120, 100%, 40%);">+        This feature can be used to tell the loader to load the trial libraries, as</span><br><span style="color: hsl(120, 100%, 40%);">+        LD_LIBRARY_PATH is disabled for paths with modified capabilities.</span><br><span style="color: hsl(120, 100%, 40%);">+        '''</span><br><span style="color: hsl(120, 100%, 40%);">+        patchelf_bin = self.remote_env.get('PATCHELF_BIN', None)</span><br><span style="color: hsl(120, 100%, 40%);">+        if not patchelf_bin:</span><br><span style="color: hsl(120, 100%, 40%);">+            patchelf_bin = 'patchelf'</span><br><span style="color: hsl(120, 100%, 40%);">+        else:</span><br><span style="color: hsl(120, 100%, 40%);">+            self.dbg('Using specific patchelf from %s', patchelf_bin)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        self.run_remote_sync('patchelf', (patchelf_bin, '--force-rpath --set-rpath', paths, binary_path))</span><br><span>diff --git a/src/osmo_gsm_tester/core/util.py b/src/osmo_gsm_tester/core/util.py</span><br><span>index 691b489..32baf33 100644</span><br><span>--- a/src/osmo_gsm_tester/core/util.py</span><br><span>+++ b/src/osmo_gsm_tester/core/util.py</span><br><span>@@ -56,6 +56,16 @@</span><br><span>     proc = Process('patchelf', run_dir, ['patchelf', '--set-rpath', paths, binary])</span><br><span>     proc.launch_sync()</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+def change_elf_force_rpath(binary, paths, run_dir):</span><br><span style="color: hsl(120, 100%, 40%);">+    '''</span><br><span style="color: hsl(120, 100%, 40%);">+    Change RPATH field in ELF executable binary forcing the rpath.</span><br><span style="color: hsl(120, 100%, 40%);">+    This feature can be used to tell the loaded to load the trial libraries, as</span><br><span style="color: hsl(120, 100%, 40%);">+    LD_LIBRARY_PATH is disabled for paths with modified capabilities.</span><br><span style="color: hsl(120, 100%, 40%);">+    '''</span><br><span style="color: hsl(120, 100%, 40%);">+    from .process import Process</span><br><span style="color: hsl(120, 100%, 40%);">+    proc = Process('patchelf', run_dir, ['patchelf', '--force-rpath --set-rpath', paths, binary])</span><br><span style="color: hsl(120, 100%, 40%);">+    proc.launch_sync()</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> def ip_to_iface(ip):</span><br><span>     try:</span><br><span>         for iface in os.listdir('/sys/class/net'):</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-gsm-tester/+/24272">change 24272</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-gsm-tester/+/24272"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-gsm-tester </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I2d4a105d4843c0d31d6b5d8f8d4195247b290aec </div>
<div style="display:none"> Gerrit-Change-Number: 24272 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Alejandro Leal <alejandro.leal@srs.io> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>