aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorStéphane Cerveau <scerveau@collabora.com>2021-06-04 16:31:02 +0200
committerXavier Claessens <xclaesse@gmail.com>2021-08-06 15:03:29 -0400
commit2c3a68bc30cf6e08c2e3b77b64718ef3a0e5d78c (patch)
tree0e3ce60d16c9acc01b925c5ede3388178f7a6192 /mesonbuild
parent7e8d5207a7c662beeae41b375e0af5c96f57e7db (diff)
downloadmeson-2c3a68bc30cf6e08c2e3b77b64718ef3a0e5d78c.zip
meson-2c3a68bc30cf6e08c2e3b77b64718ef3a0e5d78c.tar.gz
meson-2c3a68bc30cf6e08c2e3b77b64718ef3a0e5d78c.tar.bz2
install: apply ldconfig at the end of the install
On linux system ldconfig needs to be called to update the ld.so.cache to be able to load libraries from /usr/local/lib/x86_64-linux-gnu on debian based distributions for example.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/minstall.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/mesonbuild/minstall.py b/mesonbuild/minstall.py
index 2a4f68a..7bacc00 100644
--- a/mesonbuild/minstall.py
+++ b/mesonbuild/minstall.py
@@ -240,12 +240,25 @@ def restore_selinux_contexts() -> None:
# If the list of files is empty, do not try to call restorecon.
return
- proc, out, err = Popen_safe(['restorecon', '-F', '-f-', '-0'], (b'\0'.join(os.fsencode(f) for f in selinux_updates) + b'\0').decode())
+ proc, out, err = Popen_safe(['restorecon', '-F', '-f-', '-0'], ('\0'.join(f for f in selinux_updates) + '\0'))
if proc.returncode != 0 :
print('Failed to restore SELinux context of installed files...',
'Standard output:', out,
'Standard error:', err, sep='\n')
+def apply_ldconfig() -> None:
+ '''
+ Apply ldconfig to update the ld.so.cache.
+ '''
+ if not shutil.which('ldconfig'):
+ # If we don't have ldconfig, failure is ignored quietly.
+ return
+
+ proc, out, err = Popen_safe(['ldconfig'])
+ if proc.returncode != 0:
+ print('Failed to apply ldconfig ...',
+ 'Standard output:', out,
+ 'Standard error:', err, sep='\n')
def get_destdir_path(destdir: str, fullprefix: str, path: str) -> str:
if os.path.isabs(path):
@@ -346,6 +359,10 @@ class Installer:
if not self.dry_run:
restore_selinux_contexts()
+ def apply_ldconfig(self, destdir: str) -> None:
+ if not self.dry_run and not destdir:
+ apply_ldconfig()
+
def Popen_safe(self, *args: T.Any, **kwargs: T.Any) -> T.Tuple[int, str, str]:
if not self.dry_run:
p, o, e = Popen_safe(*args, **kwargs)
@@ -520,6 +537,7 @@ class Installer:
self.install_man(d, dm, destdir, fullprefix)
self.install_data(d, dm, destdir, fullprefix)
self.restore_selinux_contexts()
+ self.apply_ldconfig(destdir)
self.run_install_script(d, destdir, fullprefix)
if not self.did_install_something:
self.log('Nothing to install.')