From d8c05d2f3c85fa68a440f25fc95d8e4b754409b5 Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Mon, 27 Jul 2020 09:06:59 +0200 Subject: [PATCH] meson: src: generate logrotate files Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa Reviewed-by: Neal Gompa --- src/Makefile.am | 30 ------------------------------ src/remote/Makefile.inc.am | 7 ------- src/remote/meson.build | 23 +++++++++++++++++++++++ 3 files changed, 23 insertions(+), 37 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 9ad50ca1a9..7008b6388b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -34,7 +34,6 @@ if WITH_DTRACE_PROBES tapset_DATA = endif WITH_DTRACE_PROBES RPC_PROBE_FILES = -LOGROTATE_FILES_IN = include security/Makefile.inc.am include access/Makefile.inc.am @@ -203,35 +202,6 @@ libvirt_functions.stp: $(RPC_PROBE_FILES) $(top_srcdir)/scripts/gensystemtap.py endif WITH_DTRACE_PROBES -LOGROTATE_FILES := $(LOGROTATE_FILES_IN:remote/%.in=%) - -BUILT_SOURCES += $(LOGROTATE_FILES) - -%.logrotate: remote/%.logrotate.in - $(AM_V_GEN)sed \ - -e 's|[@]localstatedir[@]|$(localstatedir)|g' \ - < $< > $@-t && \ - mv $@-t $@ - -if WITH_LIBVIRTD -install-logrotate: $(LOGROTATE_FILES) - $(MKDIR_P) $(DESTDIR)$(sysconfdir)/logrotate.d/ - for f in $(LOGROTATE_FILES) ; \ - do \ - tgt=`echo $$f | sed -e 's/.logrotate//'`; \ - $(INSTALL_DATA) $$f \ - $(DESTDIR)$(sysconfdir)/logrotate.d/$$tgt; \ - done - -uninstall-logrotate: - rm -f $(LOGROTATE_FILES:%.logrotate=$(DESTDIR)$(sysconfdir)/logrotate.d/%) - rmdir $(DESTDIR)$(sysconfdir)/logrotate.d || : - -INSTALL_DATA_LOCAL += install-logrotate -UNINSTALL_LOCAL += uninstall-logrotate -endif WITH_LIBVIRTD - - install-data-local: $(INSTALL_DATA_LOCAL) \ $(INSTALL_DATA_DIRS:%=install-data-%) diff --git a/src/remote/Makefile.inc.am b/src/remote/Makefile.inc.am index 287dad426c..8fbe8425b3 100644 --- a/src/remote/Makefile.inc.am +++ b/src/remote/Makefile.inc.am @@ -1,12 +1,5 @@ # vim: filetype=automake -LOGROTATE_FILES_IN += \ - remote/libvirtd.qemu.logrotate.in \ - remote/libvirtd.lxc.logrotate.in \ - remote/libvirtd.libxl.logrotate.in \ - remote/libvirtd.logrotate.in \ - $(NULL) - if WITH_LIBVIRTD if WITH_SYSCTL diff --git a/src/remote/meson.build b/src/remote/meson.build index 5fef1a477c..c8b1f8f306 100644 --- a/src/remote/meson.build +++ b/src/remote/meson.build @@ -118,6 +118,13 @@ libvirtd_socket_unit_files = [ libvirtd_socket_conflicts = ' '.join(libvirtd_socket_unit_files) +logrotate_files = [ + 'libvirtd.qemu', + 'libvirtd.lxc', + 'libvirtd.libxl', + 'libvirtd', +] + if conf.has('WITH_REMOTE') remote_driver_lib = static_library( 'virt_remote_driver', @@ -213,6 +220,22 @@ if conf.has('WITH_REMOTE') virt_install_dirs += [ localstatedir / 'log' / 'libvirt', ] + + logrotate_conf = configuration_data() + logrotate_conf.set('localstatedir', localstatedir) + + foreach name : logrotate_files + log_file = configure_file( + input: '@0@.logrotate.in'.format(name), + output: '@0@.logrotate'.format(name), + configuration: logrotate_conf, + ) + install_data( + log_file, + install_dir: sysconfdir / 'logrotate.d', + rename: [ name ], + ) + endforeach endif endif -- 2.47.2