[PATCH 5/6] meson: install $localstatedir/run for qga

marcandre.lureau@redhat.com posted 6 patches 5 years, 5 months ago
[PATCH 5/6] meson: install $localstatedir/run for qga
Posted by marcandre.lureau@redhat.com 5 years, 5 months ago
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 Makefile        | 10 +---------
 qga/meson.build |  2 ++
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index dc3c20dd5e..9a9e7c0301 100644
--- a/Makefile
+++ b/Makefile
@@ -232,17 +232,9 @@ distclean: clean ninja-distclean
 install-datadir:
 	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)"
 
-install-localstatedir:
-ifdef CONFIG_POSIX
-ifeq ($(CONFIG_GUEST_AGENT),y)
-	$(INSTALL_DIR) "$(DESTDIR)$(qemu_localstatedir)"/run
-endif
-endif
-
-
 # Needed by "meson install"
 export DESTDIR
-install: all install-datadir install-localstatedir
+install: all install-datadir
 	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
 
 ifdef CONFIG_WIN32
diff --git a/qga/meson.build b/qga/meson.build
index 3f28f74b52..e5c5778a3e 100644
--- a/qga/meson.build
+++ b/qga/meson.build
@@ -82,6 +82,8 @@ if targetos == 'windows'
     all_qga += [qga_msi]
     alias_target('msi', qga_msi)
   endif
+else
+  install_subdir('run', install_dir: get_option('localstatedir'))
 endif
 
 alias_target('qemu-ga', all_qga)
-- 
2.26.2


Re: [PATCH 5/6] meson: install $localstatedir/run for qga
Posted by Paolo Bonzini 5 years, 5 months ago
On 26/08/20 15:06, marcandre.lureau@redhat.com wrote:
> diff --git a/qga/meson.build b/qga/meson.build
> index 3f28f74b52..e5c5778a3e 100644
> --- a/qga/meson.build
> +++ b/qga/meson.build
> @@ -82,6 +82,8 @@ if targetos == 'windows'
>      all_qga += [qga_msi]
>      alias_target('msi', qga_msi)
>    endif
> +else
> +  install_subdir('run', install_dir: get_option('localstatedir'))
>  endif

This doesn't work if /var/run exists and is a symlink:

Installing subdir /home/pbonzini/ff/run to /home/pbonzini/ff/build/test/var/local/run
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/mesonbuild/mesonmain.py", line 131, in run
    return options.run_func(options)
  File "/usr/lib/python3.8/site-packages/mesonbuild/minstall.py", line 538, in run
    installer.do_install(datafilename)
  File "/usr/lib/python3.8/site-packages/mesonbuild/minstall.py", line 357, in do_install
    self.install_subdirs(d) # Must be first, because it needs to delete the old subtree.
  File "/usr/lib/python3.8/site-packages/mesonbuild/minstall.py", line 383, in install_subdirs
    d.dirmaker.makedirs(full_dst_dir, exist_ok=True)
  File "/usr/lib/python3.8/site-packages/mesonbuild/minstall.py", line 60, in makedirs
    os.makedirs(path, exist_ok=exist_ok)
  File "/usr/lib64/python3.8/os.py", line 223, in makedirs
    mkdir(name, mode)
FileExistsError: [Errno 17] File exists: '/home/pbonzini/ff/build/test/var/local/run'

Since DESTDIR is not available, there isn't really a good way to do
this check.  We can:

- keep the makefile

- use an install script

- create it in qemu-ga just like on win32

Probably the last one is the best.

Paolo


Re: [PATCH 5/6] meson: install $localstatedir/run for qga
Posted by Paolo Bonzini 5 years, 5 months ago
On 30/08/20 11:44, Paolo Bonzini wrote:
> This doesn't work if /var/run exists and is a symlink:
> 
> Installing subdir /home/pbonzini/ff/run to /home/pbonzini/ff/build/test/var/local/run
> Traceback (most recent call last):
>   File "/usr/lib/python3.8/site-packages/mesonbuild/mesonmain.py", line 131, in run
>     return options.run_func(options)
>   File "/usr/lib/python3.8/site-packages/mesonbuild/minstall.py", line 538, in run
>     installer.do_install(datafilename)
>   File "/usr/lib/python3.8/site-packages/mesonbuild/minstall.py", line 357, in do_install
>     self.install_subdirs(d) # Must be first, because it needs to delete the old subtree.
>   File "/usr/lib/python3.8/site-packages/mesonbuild/minstall.py", line 383, in install_subdirs
>     d.dirmaker.makedirs(full_dst_dir, exist_ok=True)
>   File "/usr/lib/python3.8/site-packages/mesonbuild/minstall.py", line 60, in makedirs
>     os.makedirs(path, exist_ok=exist_ok)
>   File "/usr/lib64/python3.8/os.py", line 223, in makedirs
>     mkdir(name, mode)
> FileExistsError: [Errno 17] File exists: '/home/pbonzini/ff/build/test/var/local/run'

Nevermind, it works in 0.55.1.  I'll do a few more tests just to be
sure, but I've queued the series.

Paolo