diff options
author | Michal Privoznik <mprivozn@redhat.com> | 2023-03-23 11:11:42 +0100 |
---|---|---|
committer | Michal Privoznik <mprivozn@redhat.com> | 2023-04-20 15:30:18 +0200 |
commit | ac7f3667f2dde0dd391048a8417c6d40dae1b99e (patch) | |
tree | 2ff6aa3388e84fc21f6e7ed35252a7f156ebdfc6 | |
parent | 2f4f381871d253e3ec34f32b452c32570459bdde (diff) | |
download | libvirt-ac7f3667f2dde0dd391048a8417c6d40dae1b99e.tar.gz |
meson: Work around configure_file(copy:true) deprecation
In our meson scripts, we use configure_file(copy:true) to copy
files from srcdir into builddir. However, as of meson-0.64.0,
this is deprecated [1] in favor of using:
fs = import('fs')
fs.copyfile(in, out)
Except, the submodule's new method wasn't introduced until
0.64.0. And since we can't bump the minimal meson version we
require, we have to work with both: new and old versions.
Now, the fun part: fs.copyfile() is not a drop in replacement as
it returns different type (a custom_target object). This is
incompatible with places where we store the configure_file()
retval in a variable to process it further.
While we could just replace 'copy:true' with a dummy
'configuration:...' (say 'configuration: configmake_conf') we
can't do that for binary files (like src/fonts/ or src/images/).
Therefore, places where we are not interested in the retval can
be switched to fs.copyfile() and places where we are interested
in the retval will just use a dummy 'configuration:'.
Except, src/network/meson.build. In here we not just copy the
file but also specify alternative install dir and that's not
something that fs.copyfile() can handle. Yet, using 'copy: true'
is viewed wrong [2].
1: https://mesonbuild.com/Release-notes-for-0-64-0.html#fscopyfile-to-replace-configure_filecopy-true
2: https://github.com/mesonbuild/meson/pull/10042
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
-rw-r--r-- | docs/css/meson.build | 6 | ||||
-rw-r--r-- | docs/fonts/meson.build | 6 | ||||
-rw-r--r-- | docs/images/meson.build | 6 | ||||
-rw-r--r-- | docs/js/meson.build | 8 | ||||
-rw-r--r-- | docs/logos/meson.build | 6 | ||||
-rw-r--r-- | docs/meson.build | 6 | ||||
-rw-r--r-- | meson.build | 3 | ||||
-rw-r--r-- | src/locking/meson.build | 8 | ||||
-rw-r--r-- | src/network/meson.build | 2 |
9 files changed, 39 insertions, 12 deletions
diff --git a/docs/css/meson.build b/docs/css/meson.build index 384f6e789f..a2a2ccfb28 100644 --- a/docs/css/meson.build +++ b/docs/css/meson.build @@ -11,7 +11,11 @@ install_data(docs_css_files, install_dir: docs_html_dir / 'css') foreach file : docs_css_files # This hack enables us to view the web pages # from within the uninstalled build tree - configure_file(input: file, output: file, copy: true) + if meson.version().version_compare('>=0.64.0') + fs.copyfile(file) + else + configure_file(input: file, output: file, copy: true) + endif install_web_files += '@0@:@1@'.format(meson.current_source_dir() / file, docs_html_dir / 'css') endforeach diff --git a/docs/fonts/meson.build b/docs/fonts/meson.build index 53a060b972..8f2b1c3d28 100644 --- a/docs/fonts/meson.build +++ b/docs/fonts/meson.build @@ -17,7 +17,11 @@ install_data(fonts, install_dir: docs_html_dir / 'fonts') foreach file : fonts # This hack enables us to view the web pages # from within the uninstalled build tree - configure_file(input: file, output: file, copy: true) + if meson.version().version_compare('>=0.64.0') + fs.copyfile(file) + else + configure_file(input: file, output: file, copy: true) + endif install_web_files += '@0@:@1@'.format(meson.current_source_dir() / file, docs_html_dir / 'fonts') endforeach diff --git a/docs/images/meson.build b/docs/images/meson.build index 3c3cb5cce1..b9ab30fc91 100644 --- a/docs/images/meson.build +++ b/docs/images/meson.build @@ -17,7 +17,11 @@ install_data(docs_image_files, install_dir: docs_html_dir / 'images') foreach file : docs_image_files # This hack enables us to view the web pages # from within the uninstalled build tree - configure_file(input: file, output: file, copy: true) + if meson.version().version_compare('>=0.64.0') + fs.copyfile(file) + else + configure_file(input: file, output: file, copy: true) + endif install_web_files += '@0@:@1@'.format(meson.current_source_dir() / file, docs_html_dir / 'images') endforeach diff --git a/docs/js/meson.build b/docs/js/meson.build index cbf2dc2633..9f77b0d85c 100644 --- a/docs/js/meson.build +++ b/docs/js/meson.build @@ -7,7 +7,11 @@ install_data(docs_js_files, install_dir: docs_html_dir / 'js') foreach file : docs_js_files # This hack enables us to view the web pages # from within the uninstalled build tree - configure_file(input: file, output: file, copy: true) + if meson.version().version_compare('>=0.64.0') + fs.copyfile(file) + else + configure_file(input: file, output: file, copy: true) + endif - install_web_files += '@0@:@1@'.format(meson.current_source_dir() / file, docs_html_dir / 'js') + install_web_files += '@0@:@1@'.format(meson.current_source_dir() / file, docs_html_dir / 'js') endforeach diff --git a/docs/logos/meson.build b/docs/logos/meson.build index c65fcdd8ed..c3f4c9f522 100644 --- a/docs/logos/meson.build +++ b/docs/logos/meson.build @@ -25,7 +25,11 @@ install_data(docs_logo_files, install_dir: docs_html_dir / 'logos') foreach file : docs_logo_files # This hack enables us to view the web pages # from within the uninstalled build tree - configure_file(input: file, output: file, copy: true) + if meson.version().version_compare('>=0.64.0') + fs.copyfile(file) + else + configure_file(input: file, output: file, copy: true) + endif install_web_files += '@0@:@1@'.format(meson.current_source_dir() / file, docs_html_dir / 'logos') endforeach diff --git a/docs/meson.build b/docs/meson.build index 769efe7b6a..4945340a1e 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -342,7 +342,11 @@ subdir('manpages') foreach file : docs_assets # This hack enables us to view the web pages # from within the uninstalled build tree - configure_file(input: file, output: file, copy: true) + if meson.version().version_compare('>=0.64.0') + fs.copyfile(file) + else + configure_file(input: file, output: file, copy: true) + endif install_web_files += '@0@:@1@'.format(meson.current_source_dir() / file, docs_html_dir) endforeach diff --git a/meson.build b/meson.build index de087666f5..d35d5e076b 100644 --- a/meson.build +++ b/meson.build @@ -11,6 +11,9 @@ project( ], ) +if meson.version().version_compare('>=0.64.0') + fs = import('fs') +endif # figure out if we are building from git diff --git a/src/locking/meson.build b/src/locking/meson.build index 72f7780438..57764b0da6 100644 --- a/src/locking/meson.build +++ b/src/locking/meson.build @@ -174,7 +174,7 @@ if conf.has('WITH_LIBVIRTD') qemu_lockd_conf = configure_file( input: 'lockd.conf', output: 'qemu-lockd.conf', - copy: true, + configuration: configmake_conf, ) virt_conf_files += qemu_lockd_conf virt_test_aug_files += { @@ -191,7 +191,7 @@ if conf.has('WITH_LIBVIRTD') libxl_lockd_conf = configure_file( input: 'lockd.conf', output: 'libxl-lockd.conf', - copy: true, + configuration: configmake_conf, ) virt_conf_files += libxl_lockd_conf endif @@ -203,7 +203,7 @@ if conf.has('WITH_LIBVIRTD') qemu_sanlock_conf = configure_file( input: 'sanlock.conf', output: 'qemu-sanlock.conf', - copy: true, + configuration: configmake_conf, ) virt_conf_files += qemu_sanlock_conf virt_test_aug_files += { @@ -220,7 +220,7 @@ if conf.has('WITH_LIBVIRTD') libxl_sanlock_conf = configure_file( input: 'sanlock.conf', output: 'libxl-sanlock.conf', - copy: true, + configuration: configmake_conf, ) virt_conf_files += libxl_sanlock_conf endif diff --git a/src/network/meson.build b/src/network/meson.build index d266bb225a..0888d1beac 100644 --- a/src/network/meson.build +++ b/src/network/meson.build @@ -84,7 +84,7 @@ if conf.has('WITH_NETWORK') configure_file( input: 'default.xml.in', output: '@BASENAME@', - copy: true, + configuration: configmake_conf, install: true, install_dir: confdir / 'qemu' / 'networks', ) |