From c6193d9ee9212a922cfacdac5ea4877e3413fc4d Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Thu, 23 Jul 2020 12:41:32 +0200 Subject: [PATCH] meson: src: install empty directories Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa Reviewed-by: Neal Gompa --- scripts/meson-install-dirs.py | 9 +++++++++ scripts/meson.build | 1 + src/Makefile.am | 9 --------- src/libxl/Makefile.inc.am | 16 ---------------- src/libxl/meson.build | 6 ++++++ src/locking/Makefile.inc.am | 24 ------------------------ src/locking/meson.build | 12 ++++++++++++ src/lxc/Makefile.inc.am | 17 ----------------- src/lxc/meson.build | 6 ++++++ src/meson.build | 19 +++++++++++++++++++ src/network/Makefile.inc.am | 5 ----- src/network/meson.build | 6 ++++++ src/qemu/Makefile.inc.am | 29 ----------------------------- src/qemu/meson.build | 10 ++++++++++ src/remote/Makefile.inc.am | 13 ------------- src/remote/meson.build | 4 ++++ 16 files changed, 73 insertions(+), 113 deletions(-) create mode 100644 scripts/meson-install-dirs.py diff --git a/scripts/meson-install-dirs.py b/scripts/meson-install-dirs.py new file mode 100644 index 0000000000..14ec6b93e8 --- /dev/null +++ b/scripts/meson-install-dirs.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python3 + +import os +import sys + +destdir = os.environ.get('DESTDIR', os.sep) + +for dirname in sys.argv[1:]: + os.makedirs(os.path.join(destdir, dirname.strip(os.sep)), exist_ok=True) diff --git a/scripts/meson.build b/scripts/meson.build index 93ac4aa2cd..bd641236a2 100644 --- a/scripts/meson.build +++ b/scripts/meson.build @@ -20,6 +20,7 @@ scripts = [ 'hyperv_wmi_generator.py', 'meson-gen-def.py', 'meson-gen-sym.py', + 'meson-install-dirs.py', 'meson-python.sh', 'mock-noinline.py', 'prohibit-duplicate-header.py', diff --git a/src/Makefile.am b/src/Makefile.am index 9865b2d28e..9ad50ca1a9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -234,15 +234,6 @@ endif WITH_LIBVIRTD install-data-local: $(INSTALL_DATA_LOCAL) \ $(INSTALL_DATA_DIRS:%=install-data-%) - $(MKDIR_P) "$(DESTDIR)$(localstatedir)/cache/libvirt" - $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/images" - $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/filesystems" - $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/boot" uninstall-local: $(UNINSTALL_LOCAL) \ $(INSTALL_DATA_DIRS:%=uninstall-data-%) - rmdir "$(DESTDIR)$(localstatedir)/cache/libvirt" ||: - rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/images" ||: - rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/filesystems" ||: - rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/boot" ||: - rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt" ||: diff --git a/src/libxl/Makefile.inc.am b/src/libxl/Makefile.inc.am index 0031adb2ef..5af19c8351 100644 --- a/src/libxl/Makefile.inc.am +++ b/src/libxl/Makefile.inc.am @@ -2,19 +2,3 @@ DRIVER_SOURCE_FILES += $(addprefix $(srcdir)/,$(LIBXL_DRIVER_SOURCES)) STATEFUL_DRIVER_SOURCE_FILES += $(addprefix $(srcdir)/,$(LIBXL_DRIVER_SOURCES)) - -if WITH_LIBXL - -INSTALL_DATA_DIRS += libxl - -install-data-libxl: - $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/libxl" - $(MKDIR_P) "$(DESTDIR)$(runstatedir)/libvirt/libxl" - $(MKDIR_P) "$(DESTDIR)$(localstatedir)/log/libvirt/libxl" - -uninstall-data-libxl: - rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/libxl" ||: - rmdir "$(DESTDIR)$(runstatedir)/libvirt/libxl" ||: - rmdir "$(DESTDIR)$(localstatedir)/log/libvirt/libxl" ||: - -endif WITH_LIBXL diff --git a/src/libxl/meson.build b/src/libxl/meson.build index 5c1a533cef..da4f29f906 100644 --- a/src/libxl/meson.build +++ b/src/libxl/meson.build @@ -76,4 +76,10 @@ if conf.has('WITH_LIBXL') 'name': 'virtxend', 'file': files('virtxend.sysconf'), } + + virt_install_dirs += [ + localstatedir / 'lib' / 'libvirt' / 'libxl', + runstatedir / 'libvirt' / 'libxl', + localstatedir / 'log' / 'libvirt' / 'libxl', + ] endif diff --git a/src/locking/Makefile.inc.am b/src/locking/Makefile.inc.am index 02ce2fa7a7..285e73a6bf 100644 --- a/src/locking/Makefile.inc.am +++ b/src/locking/Makefile.inc.am @@ -1,27 +1,3 @@ # vim: filetype=automake RPC_PROBE_FILES += $(srcdir)/locking/lock_protocol.x - -INSTALL_DATA_DIRS += locking - -install-data-locking: - $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/lockd" - $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/lockd/files" - $(MKDIR_P) "$(DESTDIR)$(runstatedir)/libvirt/lockd" -if WITH_SANLOCK - $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/sanlock" -endif WITH_SANLOCK - -uninstall-data-locking: - rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/lockd/files" ||: - rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/lockd" ||: - rmdir "$(DESTDIR)$(runstatedir)/libvirt/lockd" ||: -if WITH_SANLOCK - rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/sanlock" ||: -endif WITH_SANLOCK -endif WITH_LIBVIRTD - -.PHONY: \ - install-data-locking \ - uninstall-data-locking \ - $(NULL) diff --git a/src/locking/meson.build b/src/locking/meson.build index 1d42682d60..dbff78ca1b 100644 --- a/src/locking/meson.build +++ b/src/locking/meson.build @@ -225,4 +225,16 @@ if conf.has('WITH_LIBVIRTD') 'aug': files('test_virtlockd.aug.in'), 'conf': files('virtlockd.conf'), } + + virt_install_dirs += [ + localstatedir / 'lib' / 'libvirt' / 'lockd', + localstatedir / 'lib' / 'libvirt' / 'lockd' / 'files', + runstatedir / 'libvirt' / 'lockd', + ] + + if conf.has('WITH_SANLOCK') + virt_install_dirs += [ + localstatedir / 'lib' / 'libvirt' / 'sanlock', + ] + endif endif diff --git a/src/lxc/Makefile.inc.am b/src/lxc/Makefile.inc.am index f65b1cdf6b..7f312975d6 100644 --- a/src/lxc/Makefile.inc.am +++ b/src/lxc/Makefile.inc.am @@ -15,21 +15,4 @@ if WITH_DTRACE_PROBES RPC_PROBE_FILES += $(srcdir)/lxc/lxc_monitor_protocol.x endif -INSTALL_DATA_DIRS += lxc - -install-data-lxc: - $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/lxc" - $(MKDIR_P) "$(DESTDIR)$(runstatedir)/libvirt/lxc" - $(MKDIR_P) "$(DESTDIR)$(localstatedir)/log/libvirt/lxc" - -uninstall-data-lxc: - rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/lxc" ||: - rmdir "$(DESTDIR)$(runstatedir)/libvirt/lxc" ||: - rmdir "$(DESTDIR)$(localstatedir)/log/libvirt/lxc" ||: - endif WITH_LXC - -.PHONY: \ - install-data-lxc \ - uninstall-data-lxc \ - $(NULL) diff --git a/src/lxc/meson.build b/src/lxc/meson.build index c8a5a9db9b..1684cbec8a 100644 --- a/src/lxc/meson.build +++ b/src/lxc/meson.build @@ -159,4 +159,10 @@ if conf.has('WITH_LXC') 'name': 'virtlxcd', 'file': files('virtlxcd.sysconf'), } + + virt_install_dirs += [ + localstatedir / 'lib' / 'libvirt' / 'lxc', + runstatedir / 'libvirt' / 'lxc', + localstatedir / 'log' / 'libvirt' / 'lxc', + ] endif diff --git a/src/meson.build b/src/meson.build index 58687b331a..93bca01dda 100644 --- a/src/meson.build +++ b/src/meson.build @@ -211,6 +211,10 @@ openrc_init_files = [] # * file - source sysconf file (required) sysconf_files = [] +# virt_install_dirs: +# list of directories to create during installation +virt_install_dirs = [] + # list subdirectories @@ -800,3 +804,18 @@ foreach sysconf : sysconf_files rename: [ sysconf['name'] ], ) endforeach + + +# Install empty directories + +virt_install_dirs += [ + localstatedir / 'cache' / 'libvirt', + localstatedir / 'lib' / 'libvirt' / 'images', + localstatedir / 'lib' / 'libvirt' / 'filesystems', + localstatedir / 'lib' / 'libvirt' / 'boot', +] + +meson.add_install_script( + meson_python_prog.path(), python3_prog.path(), meson_install_dirs_prog.path(), + virt_install_dirs, +) diff --git a/src/network/Makefile.inc.am b/src/network/Makefile.inc.am index 2202903870..8482f924a1 100644 --- a/src/network/Makefile.inc.am +++ b/src/network/Makefile.inc.am @@ -10,9 +10,6 @@ INSTALL_DATA_DIRS += network UUID=$(shell uuidgen 2>/dev/null) install-data-network: - $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/network" - $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/dnsmasq" - $(MKDIR_P) "$(DESTDIR)$(runstatedir)/libvirt/network" $(MKDIR_P) "$(DESTDIR)$(confdir)/qemu/networks/autostart" $(INSTALL_DATA) $(srcdir)/network/default.xml \ $(DESTDIR)$(confdir)/qemu/networks/default.xml @@ -38,8 +35,6 @@ uninstall-data-network: rm -f $(DESTDIR)$(confdir)/qemu/networks/default.xml rmdir "$(DESTDIR)$(confdir)/qemu/networks/autostart" || : rmdir "$(DESTDIR)$(confdir)/qemu/networks" || : - rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/network" ||: - rmdir "$(DESTDIR)$(runstatedir)/libvirt/network" ||: if WITH_FIREWALLD_ZONE rm -f $(DESTDIR)$(prefix)/lib/firewalld/zones/libvirt.xml endif WITH_FIREWALLD_ZONE diff --git a/src/network/meson.build b/src/network/meson.build index 1b2536cfab..cc8739e53c 100644 --- a/src/network/meson.build +++ b/src/network/meson.build @@ -76,4 +76,10 @@ if conf.has('WITH_NETWORK') 'name': 'virtnetworkd', 'file': files('virtnetworkd.sysconf'), } + + virt_install_dirs += [ + localstatedir / 'lib' / 'libvirt' / 'network', + localstatedir / 'lib' / 'libvirt' / 'dnsmasq', + runstatedir / 'libvirt' / 'network', + ] endif diff --git a/src/qemu/Makefile.inc.am b/src/qemu/Makefile.inc.am index 6d1e9e7814..f665cb1f13 100644 --- a/src/qemu/Makefile.inc.am +++ b/src/qemu/Makefile.inc.am @@ -2,32 +2,3 @@ DRIVER_SOURCE_FILES += $(addprefix $(srcdir)/,$(QEMU_DRIVER_SOURCES)) STATEFUL_DRIVER_SOURCE_FILES += $(addprefix $(srcdir)/,$(QEMU_DRIVER_SOURCES)) - -if WITH_QEMU - -INSTALL_DATA_DIRS += qemu - -install-data-qemu: - $(MKDIR_P) -m 0751 "$(DESTDIR)$(localstatedir)/lib/libvirt/qemu" - $(MKDIR_P) "$(DESTDIR)$(runstatedir)/libvirt/qemu" - $(MKDIR_P) "$(DESTDIR)$(localstatedir)/cache/libvirt/qemu" - $(MKDIR_P) "$(DESTDIR)$(localstatedir)/log/libvirt/qemu" - $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/swtpm" - $(MKDIR_P) "$(DESTDIR)$(runstatedir)/libvirt/qemu/swtpm" - $(MKDIR_P) "$(DESTDIR)$(localstatedir)/log/swtpm/libvirt/qemu" - -uninstall-data-qemu: - rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/qemu" ||: - rmdir "$(DESTDIR)$(runstatedir)/libvirt/qemu" ||: - rmdir "$(DESTDIR)$(localstatedir)/cache/libvirt/qemu" ||: - rmdir "$(DESTDIR)$(localstatedir)/log/libvirt/qemu" ||: - rmdir "$(DESTDIR)$(localstatedir)/lib/libvirt/swtpm" - rmdir "$(DESTDIR)$(runstatedir)/libvirt/qemu/swtpm" ||: - rmdir "$(DESTDIR)$(localstatedir)/log/swtpm/libvirt/qemu" ||: - -endif WITH_QEMU - -.PHONY: \ - install-data-qemu \ - uninstall-data-qemu \ - $(NULL) diff --git a/src/qemu/meson.build b/src/qemu/meson.build index 8f8a8d6f54..fd0f25c84d 100644 --- a/src/qemu/meson.build +++ b/src/qemu/meson.build @@ -160,4 +160,14 @@ if conf.has('WITH_QEMU') 'name': 'virtqemud', 'file': files('virtqemud.sysconf'), } + + virt_install_dirs += [ + localstatedir / 'lib' / 'libvirt' / 'qemu', + runstatedir / 'libvirt' / 'qemu', + localstatedir / 'cache' / 'libvirt' / 'qemu', + localstatedir / 'log' / 'libvirt' / 'qemu', + localstatedir / 'lib' / 'libvirt' / 'swtpm', + runstatedir / 'libvirt' / 'qemu' / 'swtpm', + localstatedir / 'log' / 'swtpm' / 'libvirt' / 'qemu', + ] endif diff --git a/src/remote/Makefile.inc.am b/src/remote/Makefile.inc.am index 14c7a8e414..287dad426c 100644 --- a/src/remote/Makefile.inc.am +++ b/src/remote/Makefile.inc.am @@ -9,14 +9,6 @@ LOGROTATE_FILES_IN += \ if WITH_LIBVIRTD -INSTALL_DATA_DIRS += remote - -install-data-remote: - $(MKDIR_P) "$(DESTDIR)$(localstatedir)/log/libvirt" - -uninstall-data-remote: - rmdir "$(DESTDIR)$(localstatedir)/log/libvirt" ||: - if WITH_SYSCTL # Use $(prefix)/lib rather than $(libdir), since man sysctl.d insists on # /usr/lib/sysctl.d/ even when libdir is /usr/lib64 @@ -60,11 +52,6 @@ endif WITH_POLKIT endif WITH_LIBVIRTD -.PHONY: \ - install-data-remote \ - uninstall-data-remote \ - $(NULL) - # This is needed for clients too, so can't wrap in # the WITH_LIBVIRTD conditional if WITH_SASL diff --git a/src/remote/meson.build b/src/remote/meson.build index d7473eaeec..5fef1a477c 100644 --- a/src/remote/meson.build +++ b/src/remote/meson.build @@ -209,6 +209,10 @@ if conf.has('WITH_REMOTE') 'name': 'virtproxyd', 'file': files('virtproxyd.sysconf'), } + + virt_install_dirs += [ + localstatedir / 'log' / 'libvirt', + ] endif endif