[libvirt-designer] Add recent upstream patches to reflect changes in set of libosinfo deprecated functions

Michal Privoznik mprivozn at fedoraproject.org
Mon Feb 18 12:50:30 UTC 2013


commit 96184a6494c73961043430b8860ec969fdf25bff
Author: Michal Privoznik <mprivozn at redhat.com>
Date:   Mon Feb 18 12:09:57 2013 +0100

    Add recent upstream patches to reflect changes in set of libosinfo deprecated functions

 0001-virtxml-Make-global-var-local.patch           |   34 +++++++++++
 ...ml-Switch-to-use-osinfo_db_identify_media.patch |   60 +++++++++++++++++++
 0003-virtxml-Fix-various-memory-leaks.patch        |   63 ++++++++++++++++++++
 ...rrors-loading-the-Osinfo-DB-are-not-fatal.patch |   38 ++++++++++++
 libvirt-designer.spec                              |   12 ++++
 5 files changed, 207 insertions(+), 0 deletions(-)
---
diff --git a/0001-virtxml-Make-global-var-local.patch b/0001-virtxml-Make-global-var-local.patch
new file mode 100644
index 0000000..10226d0
--- /dev/null
+++ b/0001-virtxml-Make-global-var-local.patch
@@ -0,0 +1,34 @@
+From 14fc3e91673cdc29550017c5bf7d929cf81f7398 Mon Sep 17 00:00:00 2001
+From: Christophe Fergeau <cfergeau at redhat.com>
+Date: Sun, 30 Dec 2012 14:01:11 +0100
+Subject: [PATCH 1/4] virtxml: Make global var local
+
+OsinfoLoader is declared as a global variable in virtxml.c but
+is only used in one function, so it can be made local.
+---
+ examples/virtxml.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/examples/virtxml.c b/examples/virtxml.c
+index 2918ee0..18b0456 100644
+--- a/examples/virtxml.c
++++ b/examples/virtxml.c
+@@ -35,7 +35,6 @@
+ 
+ GList *disk_str_list = NULL;
+ GList *iface_str_list = NULL;
+-OsinfoLoader *loader = NULL;
+ OsinfoDb *db = NULL;
+ 
+ #define print_error(...) \
+@@ -65,6 +64,7 @@ load_osinfo(void)
+ {
+     GError *err = NULL;
+     gboolean ret = FALSE;
++    OsinfoLoader *loader = NULL;
+ 
+     loader = osinfo_loader_new();
+     osinfo_loader_process_default_path(loader, &err);
+-- 
+1.8.1.2
+
diff --git a/0002-virtxml-Switch-to-use-osinfo_db_identify_media.patch b/0002-virtxml-Switch-to-use-osinfo_db_identify_media.patch
new file mode 100644
index 0000000..613885d
--- /dev/null
+++ b/0002-virtxml-Switch-to-use-osinfo_db_identify_media.patch
@@ -0,0 +1,60 @@
+From 2780e7690176c8dee53f457f9b54ba6fc8fb3be5 Mon Sep 17 00:00:00 2001
+From: Christophe Fergeau <cfergeau at redhat.com>
+Date: Sun, 30 Dec 2012 14:04:06 +0100
+Subject: [PATCH 2/4] virtxml: Switch to use osinfo_db_identify_media
+
+virtxml is using osinfo_db_guess_os_from_media for that which
+is deprecated.
+---
+ configure.ac       |  2 +-
+ examples/virtxml.c | 11 ++++-------
+ 2 files changed, 5 insertions(+), 8 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index f6937c9..a9c5c34 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -10,7 +10,7 @@ AC_CANONICAL_HOST
+ 
+ AM_SILENT_RULES([yes])
+ 
+-LIBOSINFO_REQUIRED=0.0.5
++LIBOSINFO_REQUIRED=0.2.3
+ LIBVIRT_GCONFIG_REQUIRED=0.0.9
+ LIBVIRT_GOBJECT_REQUIRED=0.1.3
+ GOBJECT_INTROSPECTION_REQUIRED=0.10.8
+diff --git a/examples/virtxml.c b/examples/virtxml.c
+index 18b0456..d719e5f 100644
+--- a/examples/virtxml.c
++++ b/examples/virtxml.c
+@@ -364,7 +364,6 @@ guess_os_from_disk(GList *disk_list)
+         char *path = (char *) list_it->data;
+         char *sep = strchr(path, ',');
+         OsinfoMedia *media = NULL;
+-        OsinfoMedia *matched_media = NULL;
+ 
+         if (sep)
+             path = g_strndup(path, sep-path);
+@@ -373,15 +372,13 @@ guess_os_from_disk(GList *disk_list)
+         if (!media)
+             continue;
+ 
+-        ret = osinfo_db_guess_os_from_media(db, media, &matched_media);
++        if (osinfo_db_identify_media(db, media)) {
++            g_object_get(G_OBJECT(media), "os", &ret, NULL);
++            break;
++        }
+ 
+         if (sep)
+             g_free(path);
+-
+-        if (ret) {
+-            g_object_ref(ret);
+-            break;
+-        }
+     }
+ 
+     return ret;
+-- 
+1.8.1.2
+
diff --git a/0003-virtxml-Fix-various-memory-leaks.patch b/0003-virtxml-Fix-various-memory-leaks.patch
new file mode 100644
index 0000000..624e082
--- /dev/null
+++ b/0003-virtxml-Fix-various-memory-leaks.patch
@@ -0,0 +1,63 @@
+From 7f16a0713763a0580f7762eec670a82c2d687937 Mon Sep 17 00:00:00 2001
+From: Christophe Fergeau <cfergeau at redhat.com>
+Date: Sun, 30 Dec 2012 14:05:28 +0100
+Subject: [PATCH 3/4] virtxml: Fix various memory leaks
+
+All memory was not cleaned up properly upon exit, and a string
+could be leaked from guess_os_from_disk when we issue a
+continue/break early during the loop iteration.
+---
+ examples/virtxml.c | 17 ++++++++++++++---
+ 1 file changed, 14 insertions(+), 3 deletions(-)
+
+diff --git a/examples/virtxml.c b/examples/virtxml.c
+index d719e5f..e577911 100644
+--- a/examples/virtxml.c
++++ b/examples/virtxml.c
+@@ -369,6 +369,10 @@ guess_os_from_disk(GList *disk_list)
+             path = g_strndup(path, sep-path);
+ 
+         media = osinfo_media_create_from_location(path, NULL, NULL);
++
++        if (sep)
++            g_free(path);
++
+         if (!media)
+             continue;
+ 
+@@ -376,9 +380,6 @@ guess_os_from_disk(GList *disk_list)
+             g_object_get(G_OBJECT(media), "os", &ret, NULL);
+             break;
+         }
+-
+-        if (sep)
+-            g_free(path);
+     }
+ 
+     return ret;
+@@ -595,12 +596,22 @@ main(int argc, char *argv[])
+     xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(config));
+ 
+     g_printf("%s\n", xml);
++    g_free(xml);
+ 
+     ret = EXIT_SUCCESS;
+ 
+ cleanup:
++    if (os)
++        g_object_unref(G_OBJECT(os));
++    if (platform)
++        g_object_unref(G_OBJECT(platform));
++    if (caps)
++        g_object_unref(G_OBJECT(caps));
++    if (domain)
++        g_object_unref(G_OBJECT(domain));
+     if (conn)
+         gvir_connection_close(conn);
++
+     return ret;
+ }
+ 
+-- 
+1.8.1.2
+
diff --git a/0004-virtxml-Errors-loading-the-Osinfo-DB-are-not-fatal.patch b/0004-virtxml-Errors-loading-the-Osinfo-DB-are-not-fatal.patch
new file mode 100644
index 0000000..d462ea4
--- /dev/null
+++ b/0004-virtxml-Errors-loading-the-Osinfo-DB-are-not-fatal.patch
@@ -0,0 +1,38 @@
+From 86b2507736a864c2766554b099b53829ecaafeb5 Mon Sep 17 00:00:00 2001
+From: Christophe Fergeau <cfergeau at redhat.com>
+Date: Sun, 30 Dec 2012 14:07:53 +0100
+Subject: [PATCH 4/4] virtxml: Errors loading the Osinfo DB are not fatal
+
+An error will be reported even if loading partially worked (for
+example when the system DB could be loaded, but the user DB failed
+to load). Since the code will still work correctly even if the DB
+could not be loaded at all, we can ignore the error when DB loading
+failed. (code still works but virtxml cannot do a lot of useful stuff
+as it needs an OS and an hypervisor).
+---
+ examples/virtxml.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/examples/virtxml.c b/examples/virtxml.c
+index e577911..09f49cf 100644
+--- a/examples/virtxml.c
++++ b/examples/virtxml.c
+@@ -70,14 +70,13 @@ load_osinfo(void)
+     osinfo_loader_process_default_path(loader, &err);
+     if (err) {
+         print_error("Unable to load default libosinfo DB: %s", err->message);
+-        goto cleanup;
++        g_clear_error(&err);
+     }
+ 
+     db = osinfo_loader_get_db(loader);
+     g_object_ref(db);
+     ret = TRUE;
+ 
+-cleanup:
+     g_object_unref(loader);
+     return ret;
+ }
+-- 
+1.8.1.2
+
diff --git a/libvirt-designer.spec b/libvirt-designer.spec
index 32c0f63..9557684 100644
--- a/libvirt-designer.spec
+++ b/libvirt-designer.spec
@@ -23,6 +23,11 @@ BuildRequires: gobject-introspection-devel
 %endif
 BuildRequires: libosinfo-devel >= 0.0.5
 
+Patch1: 0001-virtxml-Make-global-var-local.patch
+Patch2: 0002-virtxml-Switch-to-use-osinfo_db_identify_media.patch
+Patch3: 0003-virtxml-Fix-various-memory-leaks.patch
+Patch4: 0004-virtxml-Errors-loading-the-Osinfo-DB-are-not-fatal.patch
+
 %package libs
 Group: Development/Libraries
 Summary: Libvirt configuration designer libraries
@@ -55,6 +60,10 @@ documentation like API and exported symbols description.
 
 %prep
 %setup -q
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
 
 %build
 
@@ -109,6 +118,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_datadir}/gtk-doc/html/libvirt-designer
 
 %changelog
+* Mon Feb 18 2013 Michal Privoznik <mprivozn at redhat.com> 0.0.1-6
+- add recent patches to reflect libosinfo changes in set of deprecated functions
+
 * Thu Feb 14 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.0.1-5
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
 


More information about the scm-commits mailing list