]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: src: generate logrotate files
authorPavel Hrdina <phrdina@redhat.com>
Mon, 27 Jul 2020 07:06:59 +0000 (09:06 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 3 Aug 2020 07:27:05 +0000 (09:27 +0200)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
src/Makefile.am
src/remote/Makefile.inc.am
src/remote/meson.build

index 9ad50ca1a954608de5aed0595453d4207d34ffe8..7008b6388bf3e481566beea65dd3ec3bb72ec54b 100644 (file)
@@ -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-%)
 
index 287dad426cb63e3957aeba761cf6960fc845eb32..8fbe8425b3bb007e16164e0eb80973edec3b782d 100644 (file)
@@ -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
index 5fef1a477c8b4e23b78fe99d6047ccc69f4fc258..c8b1f8f30654bf6f13d3f5cd8aac9668167ebe65 100644 (file)
@@ -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