[libvirt PATCH 222/351] meson: src: add support for installing libvirt conf and augeas files

Pavel Hrdina phrdina at redhat.com
Tue Jul 28 07:24:13 UTC 2020


On Mon, Jul 27, 2020 at 04:56:41PM +0200, Peter Krempa wrote:
> On Thu, Jul 16, 2020 at 11:57:38 +0200, Pavel Hrdina wrote:
> > Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> > ---
> >  src/Makefile.am        |   5 --
> >  src/meson.build        | 103 +++++++++++++++++++++++++++++++++++++++++
> >  src/remote/meson.build |  26 +++++++++++
> >  3 files changed, 129 insertions(+), 5 deletions(-)
> > 
> > diff --git a/src/Makefile.am b/src/Makefile.am
> > index 99bb71e6a03..471ebae2b79 100644
> > --- a/src/Makefile.am
> > +++ b/src/Makefile.am
> > @@ -69,13 +69,8 @@ include storage/Makefile.inc.am
> >  include remote/Makefile.inc.am
> >  
> >  
> > -confdir = $(sysconfdir)/libvirt
> >  conf_DATA += libvirt.conf
> >  
> > -augeasdir = $(datadir)/augeas/lenses
> > -
> > -augeastestdir = $(datadir)/augeas/lenses/tests
> > -
> >  # .libs/libvirt.so is built by libtool as a side-effect of the Makefile
> >  # rule for libvirt.la.  However, checking symbols relies on Linux ELF layout
> >  if WITH_LINUX
> > diff --git a/src/meson.build b/src/meson.build
> > index bb970f10c61..3a44cd9d663 100644
> > --- a/src/meson.build
> > +++ b/src/meson.build
> > @@ -149,6 +149,32 @@ virt_daemons = []
> >  #   * install_dir - installation directory (optional, libexecdir)
> >  virt_helpers = []
> >  
> > +# virt_conf_files:
> > +#   libvirt conf files
> > +virt_conf_files = []
> > +
> > +# virt_aug_files:
> > +#   libvirt aug files
> > +virt_aug_files = []
> > +
> > +# virt_test_aug_files:
> > +#   generate libvirt augeas test files
> > +#   * name - augeas test file name (required)
> > +#   * aug - augeas test file source (required)
> > +#   * conf - conf file (required)
> > +virt_test_aug_files = []
> > +
> > +# virt_daemon_confs:
> > +#   generation libvirt daemon conf files
> > +#   each entry is a dictionary with following items:
> > +#   * name - daemon name (required)
> > +#   * name_uc - daemon name with first letter uppercase (required)
> 
> I've seen that you called some magic inline python to calculate stuff
> somewhere else.
> 
> Can't we do it here too?

Sure we can, I was just following what we have with autotools where we
have both strings as well. I figured that calling

name_uc = run_command(python3_prog, '-c', 'print("{0}".capitalize())'.format(data['name'])).stdout().strip()

would a bit overkill for this.

> > +#   * with_ip - only for libvirtd and virtproxyd (optional, default false)
> > +virt_daemon_confs = []
> > +
> > +virt_aug_dir = datadir / 'augeas' / 'lenses'
> > +virt_test_aug_dir = datadir / 'augeas' / 'lenses' / 'tests'
> > +
> >  
> >  # list subdirectories
> >  
> > @@ -547,3 +573,80 @@ foreach helper : virt_helpers
> >      install_rpath: libdir,
> >    )
> >  endforeach
> > +
> > +
> > +# Generate daemon config, augeas and augeas test files
> > +
> > +install_data(virt_conf_files, install_dir: confdir)
> > +install_data(virt_aug_files, install_dir: virt_aug_dir)
> > +
> > +foreach data : virt_test_aug_files
> > +  custom_target(
> > +    data['name'],
> > +    input: [ data['conf'], data['aug'] ],
> > +    output: data['name'],
> > +    command: [ meson_python_prog, augeas_gentest_prog, '@INPUT@' ],
> > +    capture: true,
> > +    install: true,
> 
> Why do we install test files?

No idea :) but with autotools we install them as well. If we want to
change it I would do it as followup patch once this is merged.

> 
> > +    install_dir: virt_test_aug_dir,
> > +  )
> > +endforeach
> > +
> 
> [...]
> 
> > diff --git a/src/remote/meson.build b/src/remote/meson.build
> > index ee38364868e..6635bcd4cff 100644
> > --- a/src/remote/meson.build
> > +++ b/src/remote/meson.build
> > @@ -63,6 +63,32 @@ foreach name : [ 'remote', 'qemu', 'lxc' ]
> >    )
> >  endforeach
> >  
> > +libvirt_conf_files = [
> > +  [ 'libvirtd.conf.in', 'libvirtd.conf.tmp', 'virtd.conf.tmp' ],
> > +  [ 'libvirtd.aug.in', 'libvirtd.aug.tmp', 'virtd.aug.tmp' ],
> > +  [ 'test_libvirtd.aug.in', 'test_libvirtd.aug.tmp', 'test_virtd.aug.tmp' ],
> > +]
> > +
> > +foreach name : libvirt_conf_files
> > +  tmp = configure_file(
> > +    input: name[0],
> > +    output: name[1],
> 
> Please at least document the fields in the above list, but preferably
> use a dict.

Good point, I'll change it into dictionary.

Thanks

Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200728/7473138c/attachment-0001.sig>


More information about the libvir-list mailing list