[PATCH 5/6] docs: Distribute the XMLs with ACL permission flags for APIs

Daniel P. Berrangé berrange at redhat.com
Mon Feb 20 17:05:31 UTC 2023


On Mon, Feb 20, 2023 at 11:47:08AM +0100, Peter Krempa wrote:
> Similarly to the API XML we can distribute the ACL permissions for the
> APIs so that users who are potentially interested into the data don't
> have to scrape our web.

IMHO if we want to expose this to apps, we should be including
the info directly in the API files we already ship, rather than
exporting something new.

> 
> Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> ---
>  docs/meson.build       | 27 +++++++++++++++++++++++++++
>  libvirt.spec.in        |  3 +++
>  src/access/meson.build | 17 -----------------
>  3 files changed, 30 insertions(+), 17 deletions(-)

Note the current API XMLs are reported by 'pkg-config' but these
new XML files are not reported, so this change is not complete
in that regard


> diff --git a/docs/meson.build b/docs/meson.build
> index a90c59866a..08bf75e329 100644
> --- a/docs/meson.build
> +++ b/docs/meson.build
> @@ -168,6 +168,33 @@ docs_lxc_api_xml = docs_api_generated[1]
>  docs_qemu_api_xml = docs_api_generated[2]
>  docs_admin_api_xml = docs_api_generated[3]
> 
> +access_gen_xml = []
> +
> +foreach name : [ 'remote', 'qemu', 'lxc' ]
> +  if name == 'remote'
> +    xml_file = 'libvirt_access.xml'
> +  else
> +    xml_file = 'libvirt_access_ at 0@.xml'.format(name)
> +  endif
> +  protocol_file = remote_path / '@0 at _protocol.x'.format(name)
> +
> +  access_gen_xml += custom_target(
> +    xml_file,
> +    input: protocol_file,
> +    output: xml_file,
> +    capture: true,
> +    command: [
> +      gendispatch_prog, '--mode=aclapi', name, name.to_upper(), '@INPUT@',
> +    ],
> +    install: true,
> +    install_dir: pkgdatadir / 'api',
> +  )
> +endforeach
> +
> +docs_acl_xml = access_gen_xml[0]
> +docs_acl_qemu_xml = access_gen_xml[1]
> +docs_acl_lxc_xml = access_gen_xml[2]
> +
>  docs_programs_groups = [
>    { 'name': 'rst2html5', 'prog': [ 'rst2html5', 'rst2html5.py', 'rst2html5-3' ] },
>    { 'name': 'rst2man', 'prog': [ 'rst2man', 'rst2man.py', 'rst2man-3' ] },
> diff --git a/libvirt.spec.in b/libvirt.spec.in
> index e795b98d48..df625a0db4 100644
> --- a/libvirt.spec.in
> +++ b/libvirt.spec.in
> @@ -2333,6 +2333,9 @@ exit 0
>  %{_datadir}/libvirt/api/libvirt-admin-api.xml
>  %{_datadir}/libvirt/api/libvirt-qemu-api.xml
>  %{_datadir}/libvirt/api/libvirt-lxc-api.xml
> +%{_datadir}/libvirt/api/libvirt_access.xml
> +%{_datadir}/libvirt/api/libvirt_access_qemu.xml
> +%{_datadir}/libvirt/api/libvirt_access_lxc.xml
> 
>  %if %{with_mingw}
>  %files -n mingw32-libvirt -f mingw32-libvirt.lang
> diff --git a/src/access/meson.build b/src/access/meson.build
> index 0b12581dc1..842f37a4b6 100644
> --- a/src/access/meson.build
> +++ b/src/access/meson.build
> @@ -16,19 +16,16 @@ remote_path = meson.project_source_root() / 'src' / 'remote'
>  access_gen_headers = []
>  access_gen_sources = []
>  access_gen_sym = []
> -access_gen_xml = []
> 
>  foreach name : [ 'remote', 'qemu', 'lxc' ]
>    if name == 'remote'
>      header_file = 'viraccessapicheck.h'
>      source_file = 'viraccessapicheck.c'
>      syms_file = 'libvirt_access.syms'
> -    xml_file = 'libvirt_access.xml'
>    else
>      header_file = 'viraccessapicheck at 0@.h'.format(name)
>      source_file = 'viraccessapicheck at 0@.c'.format(name)
>      syms_file = 'libvirt_access_ at 0@.syms'.format(name)
> -    xml_file = 'libvirt_access_ at 0@.xml'.format(name)
>    endif
>    protocol_file = remote_path / '@0 at _protocol.x'.format(name)
> 
> @@ -62,22 +59,8 @@ foreach name : [ 'remote', 'qemu', 'lxc' ]
>        gendispatch_prog, '--mode=aclsym', name, name.to_upper(), '@INPUT@',
>      ]
>    )
> -
> -  access_gen_xml += custom_target(
> -    xml_file,
> -    input: protocol_file,
> -    output: xml_file,
> -    capture: true,
> -    command: [
> -      gendispatch_prog, '--mode=aclapi', name, name.to_upper(), '@INPUT@',
> -    ],
> -  )
>  endforeach
> 
> -docs_acl_xml = access_gen_xml[0]
> -docs_acl_qemu_xml = access_gen_xml[1]
> -docs_acl_lxc_xml = access_gen_xml[2]
> -
>  if conf.has('WITH_POLKIT')
>    access_sources += access_polkit_sources
> 
> -- 
> 2.39.2
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


More information about the libvir-list mailing list