meson: src: generate logrotate files

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
This commit is contained in:
Pavel Hrdina 2020-07-27 09:06:59 +02:00
parent c6193d9ee9
commit d8c05d2f3c
3 changed files with 23 additions and 37 deletions

View 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-%)

View 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

View 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