]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: Test installation fixes
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 4 May 2024 13:08:02 +0000 (15:08 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 5 May 2024 12:49:21 +0000 (14:49 +0200)
Let's use the new follow_symlinks flag instead on newer meson to.
We also switch back to copying symlinks instead of following them
and add an exclude for 25-default.link which becomes dangling when
installed and recreate it manually instead.

test/meson.build

index 95136c7e02857e5e6a72c561ef96b4b27b28e05e..161f24dc0bc0d7d4225acba0e7bf767466fa46ae 100644 (file)
@@ -24,21 +24,29 @@ if install_tests
                 'testsuite-63.units',
                 'testsuite-80.units',
         ]
-                # install_subdir() does not handle symlinks correctly which causes a very ugly warning when
-                # installing, so if rsync is available we use that instead. TODO: switch to the new option
-                # 'follow_symlinks' once we require Meson 1.3.0 or greater, see:
-                # https://github.com/mesonbuild/meson/commit/0af126fec798d6dbb0d1ad52168cc1f3f1758acd
-                if rsync.found()
-                        rsync_r = rsync.full_path() + ' -rLpt --exclude .gitattributes -- "@0@" "${DESTDIR:-}@1@"'
+                # install_subdir() before meson 1.3.0 does not handle symlinks correctly (it follows them
+                # instead of copying the symlink) so we use rsync instead.
+                if meson.version().version_compare('<1.3.0')
+                        if not rsync.found()
+                                error('rsync is required to install the integration test data')
+                        endif
+
+                        rsync_r = rsync.full_path() + ' -rlpt --exclude .gitattributes --exclude 25-default.link -- "@0@" "${DESTDIR:-}@1@"'
                         meson.add_install_script(sh, '-c',
                                                  rsync_r.format(meson.current_source_dir() / subdir, testdata_dir))
                 else
                         install_subdir(subdir,
-                                       exclude_files : '.gitattributes',
-                                       install_dir : testdata_dir)
+                                       exclude_files : ['.gitattributes', '25-default.link'],
+                                       install_dir : testdata_dir,
+                                       follow_symlinks : false)
                 endif
         endforeach
 
+        # test-network/conf/25-default.link is a local symlink that becomes dangling when installed, so we
+        # exclude it and create the correct symlink here.
+        meson.add_install_script(sh, '-c', ln_s.format(networkdir / '99-default.link',
+                                                       testdata_dir / 'test-network/conf/25-default.link'))
+
         install_data(kbd_model_map,
                      install_dir : testdata_dir + '/test-keymap-util')