[libvirt] [designer PATCH 0/6] Various fixes

Including making it build again. Pino Toscano (6): Fix typo in autogen.sh Bump libvirt-config & libvirt-gobject requirements to 0.1.9 Add missing break in gvir_designer_domain_add_graphics Use g_list_free_full Update .gitignore Switch away from osinfo_entity_get_param_value .gitignore | 64 ++++++++++++---------- autogen.sh | 4 +- configure.ac | 4 +- examples/virt-designer.c | 15 ++--- libvirt-designer/libvirt-designer-domain.c | 11 ++-- 5 files changed, 49 insertions(+), 49 deletions(-) -- 2.17.2

Mention the right project name. Signed-off-by: Pino Toscano <ptoscano@redhat.com> --- autogen.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autogen.sh b/autogen.sh index 72ce2c0..59fa0c7 100755 --- a/autogen.sh +++ b/autogen.sh @@ -12,7 +12,7 @@ DIE=0 (autoconf --version) < /dev/null > /dev/null 2>&1 || { echo - echo "You must have autoconf installed to compile virt-viewer." + echo "You must have autoconf installed to compile libvirt-designer." echo "Download the appropriate package for your distribution," echo "or see http://www.gnu.org/software/autoconf" DIE=1 @@ -21,7 +21,7 @@ DIE=0 (automake --version) < /dev/null > /dev/null 2>&1 || { echo DIE=1 - echo "You must have automake installed to compile virt-viewer." + echo "You must have automake installed to compile libvirt-designer." echo "Download the appropriate package for your distribution," echo "or see http://www.gnu.org/software/automake" } -- 2.17.2

On Thu, Dec 20, 2018 at 10:23:47AM +0100, Pino Toscano wrote:
Mention the right project name.
Signed-off-by: Pino Toscano <ptoscano@redhat.com> --- autogen.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> 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 :|

This version bumps the glib version required to >= 2.36.0, so using these more recent versions we can assume a more recent glib too. Signed-off-by: Pino Toscano <ptoscano@redhat.com> --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index db99eae..70c7dd4 100644 --- a/configure.ac +++ b/configure.ac @@ -11,8 +11,8 @@ AC_CANONICAL_HOST AM_SILENT_RULES([yes]) LIBOSINFO_REQUIRED=0.2.7 -LIBVIRT_GCONFIG_REQUIRED=0.1.7 -LIBVIRT_GOBJECT_REQUIRED=0.1.3 +LIBVIRT_GCONFIG_REQUIRED=0.1.9 +LIBVIRT_GOBJECT_REQUIRED=0.1.9 GOBJECT_INTROSPECTION_REQUIRED=0.10.8 AC_SUBST(LIBOSINFO_REQUIRED) -- 2.17.2

On Thu, Dec 20, 2018 at 10:23:48AM +0100, Pino Toscano wrote:
This version bumps the glib version required to >= 2.36.0, so using these more recent versions we can assume a more recent glib too.
Signed-off-by: Pino Toscano <ptoscano@redhat.com> --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> 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 :|

For a GVIR_DESIGNER_DOMAIN_GRAPHICS_DESKTOP graphics type, do not fallback on the code handling GVIR_DESIGNER_DOMAIN_GRAPHICS_RDP. Signed-off-by: Pino Toscano <ptoscano@redhat.com> --- libvirt-designer/libvirt-designer-domain.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libvirt-designer/libvirt-designer-domain.c b/libvirt-designer/libvirt-designer-domain.c index adca733..cd9349f 100644 --- a/libvirt-designer/libvirt-designer-domain.c +++ b/libvirt-designer/libvirt-designer-domain.c @@ -543,6 +543,8 @@ gvir_designer_domain_add_graphics(GVirDesignerDomain *design, graphics = gvir_designer_domain_create_graphics_desktop(design, error); if (graphics == NULL) return NULL; + + break; } case GVIR_DESIGNER_DOMAIN_GRAPHICS_RDP: { -- 2.17.2

On Thu, Dec 20, 2018 at 10:23:49AM +0100, Pino Toscano wrote:
For a GVIR_DESIGNER_DOMAIN_GRAPHICS_DESKTOP graphics type, do not fallback on the code handling GVIR_DESIGNER_DOMAIN_GRAPHICS_RDP.
Presumably new GCC warned about this one ?
Signed-off-by: Pino Toscano <ptoscano@redhat.com> --- libvirt-designer/libvirt-designer-domain.c | 2 ++ 1 file changed, 2 insertions(+)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
diff --git a/libvirt-designer/libvirt-designer-domain.c b/libvirt-designer/libvirt-designer-domain.c index adca733..cd9349f 100644 --- a/libvirt-designer/libvirt-designer-domain.c +++ b/libvirt-designer/libvirt-designer-domain.c @@ -543,6 +543,8 @@ gvir_designer_domain_add_graphics(GVirDesignerDomain *design, graphics = gvir_designer_domain_create_graphics_desktop(design, error); if (graphics == NULL) return NULL; + + break; }
case GVIR_DESIGNER_DOMAIN_GRAPHICS_RDP: { -- 2.17.2
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
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 :|

Use g_list_free_full instead of g_list_foreach + g_list_free, so the lists are cleared with a single call. This also avoids cast-function-type warnings because of the different signature of GFunc and g_object_unref. Signed-off-by: Pino Toscano <ptoscano@redhat.com> --- libvirt-designer/libvirt-designer-domain.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libvirt-designer/libvirt-designer-domain.c b/libvirt-designer/libvirt-designer-domain.c index cd9349f..9ca6832 100644 --- a/libvirt-designer/libvirt-designer-domain.c +++ b/libvirt-designer/libvirt-designer-domain.c @@ -993,8 +993,7 @@ gvir_designer_domain_get_guest(GVirDesignerDomain *design, tmp = tmp->next; } - g_list_foreach(guests, (GFunc)g_object_unref, NULL); - g_list_free(guests); + g_list_free_full(guests, g_object_unref); return ret; } @@ -1031,8 +1030,7 @@ gvir_designer_domain_get_guest_full(GVirDesignerDomain *design, } cleanup: - g_list_foreach(guests, (GFunc)g_object_unref, NULL); - g_list_free(guests); + g_list_free_full(guests, g_object_unref); return ret; } @@ -1150,8 +1148,7 @@ gvir_designer_domain_best_guest_domain(GVirConfigCapabilitiesGuestArch *arch, gvir_config_capabilities_guest_arch_get_name(arch)); cleanup: - g_list_foreach(domains, (GFunc)g_object_unref, NULL); - g_list_free(domains); + g_list_free_full(domains, g_object_unref); return ret; } -- 2.17.2

On Thu, Dec 20, 2018 at 10:23:50AM +0100, Pino Toscano wrote:
Use g_list_free_full instead of g_list_foreach + g_list_free, so the lists are cleared with a single call. This also avoids cast-function-type warnings because of the different signature of GFunc and g_object_unref.
Signed-off-by: Pino Toscano <ptoscano@redhat.com> --- libvirt-designer/libvirt-designer-domain.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> 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 :|

- move general glob patterns to the top, adding entries for generated files no matter their location - tie path-specific entries with a leading '/' - add mssing entries - sort all the sections Signed-off-by: Pino Toscano <ptoscano@redhat.com> --- .gitignore | 64 +++++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/.gitignore b/.gitignore index 09e15a5..6187fda 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,22 @@ -/INSTALL +*.gir +*.la +*.lo +*.log +*.o +*.trs +*.typelib +*.vapi +*~ + +.deps/ +.libs/ Makefile Makefile.in + +/AUTHORS +/ChangeLog +/INSTALL +/README /aclocal.m4 /autom4te.cache/ /build-aux/compile @@ -10,48 +26,38 @@ Makefile.in /build-aux/install-sh /build-aux/ltmain.sh /build-aux/missing +/build-aux/test-driver /config.h /config.h.in -/config.log /config.status /configure +/docs/*-decl-list.txt +/docs/*-decl.txt +/docs/*-overrides.txt +/docs/*-sections.txt +/docs/*-undeclared.txt +/docs/*-undocumented.txt +/docs/*-unused.txt +/docs/*.args +/docs/*.hierarchy +/docs/*.interfaces +/docs/*.prerequisites +/docs/*.signals +/docs/*.stamp +/docs/*.types +/docs/html/ +/docs/xml/ +/examples/*.1 /examples/virt-designer /libtool /libvirt-designer-1.0.pc /libvirt-designer.spec -.deps/ -.libs/ -/libvirt-designer/LibvirtDesigner-1.0.gir -/libvirt-designer/LibvirtDesigner-1.0.typelib -/libvirt-designer/libvirt-designer-1.0.la /libvirt-designer/libvirt-designer-enum-types.c /libvirt-designer/libvirt-designer-enum-types.h /libvirt-designer/test-designer-domain -*~ -*.o -*.lo /m4/libtool.m4 /m4/ltoptions.m4 /m4/ltsugar.m4 /m4/ltversion.m4 /m4/lt~obsolete.m4 /stamp-h1 -docs/xml/ -docs/html/ -docs/*.stamp -docs/*-decl-list.txt -docs/*-decl.txt -docs/*-overrides.txt -docs/*-sections.txt -docs/*-undeclared.txt -docs/*-undocumented.txt -docs/*-unused.txt -docs/*.args -docs/*.hierarchy -docs/*.interfaces -docs/*.prerequisites -docs/*.signals -docs/*.types -examples/*.1 -AUTHORS -ChangeLog -- 2.17.2

On Thu, Dec 20, 2018 at 10:23:51AM +0100, Pino Toscano wrote:
- move general glob patterns to the top, adding entries for generated files no matter their location - tie path-specific entries with a leading '/' - add mssing entries - sort all the sections
Signed-off-by: Pino Toscano <ptoscano@redhat.com> --- .gitignore | 64 +++++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 29 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> 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 :|

While osinfo_entity_get_param_value is certainly not deprecated, make use of the direct methods to get the needed properties. Signed-off-by: Pino Toscano <ptoscano@redhat.com> --- examples/virt-designer.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/examples/virt-designer.c b/examples/virt-designer.c index f134b98..eab744e 100644 --- a/examples/virt-designer.c +++ b/examples/virt-designer.c @@ -86,10 +86,8 @@ load_osinfo(void) static gint entity_compare(gconstpointer a, gconstpointer b) { - const gchar *id_a = osinfo_entity_get_param_value(OSINFO_ENTITY(a), - OSINFO_ENTITY_PROP_ID); - const gchar *id_b = osinfo_entity_get_param_value(OSINFO_ENTITY(b), - OSINFO_ENTITY_PROP_ID); + const gchar *id_a = osinfo_entity_get_id(OSINFO_ENTITY(a)); + const gchar *id_b = osinfo_entity_get_id(OSINFO_ENTITY(b)); return g_strcmp0(id_a, id_b); } @@ -117,8 +115,7 @@ print_oses(const gchar *option_name, oses = g_list_sort(oses, entity_compare); for (os_iter = oses; os_iter; os_iter = os_iter->next) { OsinfoOs *os = OSINFO_OS(os_iter->data); - const char *id = osinfo_entity_get_param_value(OSINFO_ENTITY(os), - OSINFO_ENTITY_PROP_ID); + const char *id = osinfo_entity_get_id(OSINFO_ENTITY(os)); printf("%s\n", id); } @@ -158,8 +155,7 @@ print_platforms(const gchar *option_name, platforms = g_list_sort(platforms, entity_compare); for (platform_iter = platforms; platform_iter; platform_iter = platform_iter->next) { OsinfoPlatform *platform = OSINFO_PLATFORM(platform_iter->data); - const char *id = osinfo_entity_get_param_value(OSINFO_ENTITY(platform), - OSINFO_ENTITY_PROP_ID); + const char *id = osinfo_entity_get_id(OSINFO_ENTITY(platform)); printf("%s\n", id); } @@ -372,8 +368,7 @@ find_entity_by_short_id(OsinfoList *ent_list, list = osinfo_list_get_elements(ent_list); for (list_iterator = list; list_iterator; list_iterator = list_iterator->next) { - const char *id = osinfo_entity_get_param_value(list_iterator->data, - OSINFO_PRODUCT_PROP_SHORT_ID); + const char *id = osinfo_product_get_short_id(OSINFO_PRODUCT(list_iterator->data)); if (!g_strcmp0(id, short_id)) { ret = list_iterator->data; -- 2.17.2

On Thu, Dec 20, 2018 at 10:23:52AM +0100, Pino Toscano wrote:
While osinfo_entity_get_param_value is certainly not deprecated, make use of the direct methods to get the needed properties.
Signed-off-by: Pino Toscano <ptoscano@redhat.com> --- examples/virt-designer.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> 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 :|

On Thu, Dec 20, 2018 at 10:23:46AM +0100, Pino Toscano wrote:
Including making it build again.
Would be good to get it added to the CI system too if you're intereted in doing that
Pino Toscano (6): Fix typo in autogen.sh Bump libvirt-config & libvirt-gobject requirements to 0.1.9 Add missing break in gvir_designer_domain_add_graphics Use g_list_free_full Update .gitignore Switch away from osinfo_entity_get_param_value
.gitignore | 64 ++++++++++++---------- autogen.sh | 4 +- configure.ac | 4 +- examples/virt-designer.c | 15 ++--- libvirt-designer/libvirt-designer-domain.c | 11 ++-- 5 files changed, 49 insertions(+), 49 deletions(-)
-- 2.17.2
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
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 :|
participants (2)
-
Daniel P. Berrangé
-
Pino Toscano