intro: List symlinks in installdata (fixes #6734)

pull/6756/head
Daniel Mensinger 5 years ago committed by Jussi Pakkanen
parent ecb076ba00
commit 4ce90bcb08
  1. 11
      mesonbuild/mintro.py
  2. 26
      run_unittests.py

@ -95,6 +95,9 @@ def list_installed(installdata):
for t in installdata.targets:
res[os.path.join(installdata.build_dir, t.fname)] = \
os.path.join(installdata.prefix, t.outdir, os.path.basename(t.fname))
for alias in t.aliases.keys():
res[os.path.join(installdata.build_dir, alias)] = \
os.path.join(installdata.prefix, t.outdir, os.path.basename(alias))
for path, installpath, _ in installdata.data:
res[path] = os.path.join(installdata.prefix, installpath)
for path, installdir, _ in installdata.headers:
@ -154,8 +157,9 @@ def list_targets(builddata: build.Build, installdata, backend: backends.Backend)
# Fast lookup table for installation files
install_lookuptable = {}
for i in installdata.targets:
outname = os.path.join(installdata.prefix, i.outdir, os.path.basename(i.fname))
install_lookuptable[os.path.basename(i.fname)] = str(PurePath(outname))
out = [os.path.join(installdata.prefix, i.outdir, os.path.basename(i.fname))]
out += [os.path.join(installdata.prefix, i.outdir, os.path.basename(x)) for x in i.aliases]
install_lookuptable[os.path.basename(i.fname)] = [str(PurePath(x)) for x in out]
for (idname, target) in builddata.get_targets().items():
if not isinstance(target, build.Target):
@ -174,7 +178,8 @@ def list_targets(builddata: build.Build, installdata, backend: backends.Backend)
if installdata and target.should_install():
t['installed'] = True
t['install_filename'] = [install_lookuptable.get(x, None) for x in target.get_outputs()]
t['install_filename'] = [install_lookuptable.get(x, [None]) for x in target.get_outputs()]
t['install_filename'] = [x for sublist in t['install_filename'] for x in sublist] # flatten the list
else:
t['installed'] = False
tlist.append(t)

@ -1466,6 +1466,7 @@ class BasePlatformTests(unittest.TestCase):
self.framework_test_dir = os.path.join(src_root, 'test cases/frameworks')
self.unit_test_dir = os.path.join(src_root, 'test cases/unit')
self.rewrite_test_dir = os.path.join(src_root, 'test cases/rewrite')
self.linuxlike_test_dir = os.path.join(src_root, 'test cases/linuxlike')
# Misc stuff
self.orig_env = os.environ.copy()
if self.backend is Backend.ninja:
@ -5770,6 +5771,31 @@ class LinuxlikeTests(BasePlatformTests):
self.assertIsInstance(docbook_target, dict)
self.assertEqual(os.path.basename(t['filename'][0]), 'generated-gdbus-doc-' + os.path.basename(t['target_sources'][0]['sources'][0]))
def test_introspect_installed(self):
testdir = os.path.join(self.linuxlike_test_dir, '7 library versions')
self.init(testdir)
install = self.introspect('--installed')
install = {os.path.basename(k): v for k, v in install.items()}
self.assertDictEqual(install, {
'libmodule.so': '/usr/lib/libmodule.so',
'libnoversion.so': '/usr/lib/libnoversion.so',
'libonlysoversion.so': '/usr/lib/libonlysoversion.so',
'libonlysoversion.so.5': '/usr/lib/libonlysoversion.so.5',
'libonlyversion.so': '/usr/lib/libonlyversion.so',
'libonlyversion.so.1': '/usr/lib/libonlyversion.so.1',
'libonlyversion.so.1.4.5': '/usr/lib/libonlyversion.so.1.4.5',
'libsome.so': '/usr/lib/libsome.so',
'libsome.so.0': '/usr/lib/libsome.so.0',
'libsome.so.1.2.3': '/usr/lib/libsome.so.1.2.3',
})
targets = self.introspect('--targets')
for t in targets:
if t['name'] != 'some':
continue
self.assertSetEqual({'/usr/lib/libsome.so', '/usr/lib/libsome.so.0', '/usr/lib/libsome.so.1.2.3'}, set(t['install_filename']))
def test_build_rpath(self):
if is_cygwin():
raise unittest.SkipTest('Windows PE/COFF binaries do not use RPATH')

Loading…
Cancel
Save