Skip to content

Commit

Permalink
Fix for issue mesonbuild#4499, multiple entries per file in install-l…
Browse files Browse the repository at this point in the history
…og.txt
  • Loading branch information
Orlando Wingbrant authored and jpakkane committed Oct 23, 2019
1 parent ae9723a commit 9ee9a1e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
1 change: 0 additions & 1 deletion mesonbuild/minstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ def do_copydir(self, data, src_dir, dst_dir, exclude, install_mode):
# FIXME: what about symlinks?
self.do_copyfile(abs_src, abs_dst)
set_mode(abs_dst, install_mode, data.install_umask)
append_to_log(self.lf, abs_dst)

def do_install(self, datafilename):
with open(datafilename, 'rb') as ifile:
Expand Down
27 changes: 27 additions & 0 deletions run_unittests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1975,6 +1975,33 @@ def test_install_introspection_multiple_outputs(self):
self.assertPathListEqual(intro[2]['install_filename'], ['/usr/include/first.h', None])
self.assertPathListEqual(intro[3]['install_filename'], [None, '/usr/bin/second.sh'])

def test_install_log_content(self):
'''
Tests that the install-log.txt is consistent with the installed files and directories.
Specifically checks that the log file only contains one entry per file/directory.
https://github.com/mesonbuild/meson/issues/4499
'''
testdir = os.path.join(self.common_test_dir, '62 install subdir')
self.init(testdir)
self.install()
installpath = Path(self.installdir)
# Find installed files and directories
expected = {installpath: 0}
for name in installpath.rglob('*'):
expected[name] = 0
# Find logged files and directories
with Path(self.builddir, 'meson-logs', 'install-log.txt').open() as f:
logged = list(map(lambda l: Path(l.strip()),
filter(lambda l: not l.startswith('#'),
f.readlines())))
for name in logged:
self.assertTrue(name in expected, 'Log contains extra entry {}'.format(name))
expected[name] += 1

for name, count in expected.items():
self.assertGreater(count, 0, 'Log is missing entry for {}'.format(name))
self.assertLess(count, 2, 'Log has multiple entries for {}'.format(name))

def test_uninstall(self):
exename = os.path.join(self.installdir, 'usr/bin/prog' + exe_suffix)
testdir = os.path.join(self.common_test_dir, '8 install')
Expand Down

0 comments on commit 9ee9a1e

Please sign in to comment.