Hello community,

here is the log from the commit of package NetworkManager for openSUSE:Factory 
checked in at 2012-06-10 23:22:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/NetworkManager (Old)
 and      /work/SRC/openSUSE:Factory/.NetworkManager.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "NetworkManager", Maintainer is "[email protected]"

Changes:
--------
--- /work/SRC/openSUSE:Factory/NetworkManager/NetworkManager.changes    
2012-06-06 18:02:41.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.NetworkManager.new/NetworkManager.changes       
2012-06-10 23:22:42.000000000 +0200
@@ -1,0 +2,6 @@
+Thu Jun  7 23:42:26 UTC 2012 - [email protected]
+
+- Add nm-ensure-bindings-created-NMClient-object-work.patch to fix
+  "nmcli con" not working (bgo#672812, bnc#766045).
+
+-------------------------------------------------------------------

New:
----
  nm-ensure-bindings-created-NMClient-object-work.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ NetworkManager.spec ++++++
--- /var/tmp/diff_new_pack.z1HUgb/_old  2012-06-10 23:22:43.000000000 +0200
+++ /var/tmp/diff_new_pack.z1HUgb/_new  2012-06-10 23:22:43.000000000 +0200
@@ -47,6 +47,8 @@
 Patch6:         nm-ensure_inited-fixing.patch
 # PATCH-FIX-UPSTREAM nm-ppp-build-error.patch [email protected] -- Fix build 
error with ppp.
 Patch7:         nm-ppp-build-error.patch
+# PATCH-FIX-UPSTREAM nm-ensure-bindings-created-NMClient-object-work.patch 
bnc#766045 bgo#672812 [email protected] -- Fixes "nmcli con" not working 
(patch came from upstream git)
+Patch8:         nm-ensure-bindings-created-NMClient-object-work.patch
 BuildRequires:  fdupes
 BuildRequires:  gobject-introspection-devel
 BuildRequires:  gtk-doc
@@ -189,6 +191,7 @@
 %patch5 -p1
 %patch6 -p1
 %patch7 -p1
+%patch8 -p1
 
 %build
 pppddir=`ls -1d /usr/%_lib/pppd/2*`


++++++ nm-ensure-bindings-created-NMClient-object-work.patch ++++++
>From b48dc05b720d86074fce776512123c7f475d81eb Mon Sep 17 00:00:00 2001
From: Jiří Klimeš <[email protected]>
Date: Tue, 27 Mar 2012 12:38:48 +0000
Subject: libnm-glib: ensure bindings-created NMClient object work (rh #802536)

Most of the stuff was done by 762df85234e7a042a2a5d31053e6cc273ae3e2ec.
But to allow this piece of code:

from gi.repository import NMClient
nmclient = NMClient.Client()
print nmclient.get_active_connections()

we also need to set "dbus-path" property in NMClient constuctor(),
else parent NMObject is not properly constructed.
---
diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c
index 937a1bf..b879206 100644
--- a/libnm-glib/nm-client.c
+++ b/libnm-glib/nm-client.c
@@ -1241,6 +1241,104 @@ nm_client_new_finish (GAsyncResult *result, GError 
**error)
                return g_object_ref (g_simple_async_result_get_op_res_gpointer 
(simple));
 }
 
+/*
+ * Validate D-Bus object path.
+ * The function is copied and adjusted version of
+ * g_variant_serialiser_is_object_path() from glib.
+ * FIXME: The function can be replaced by g_variant_is_object_path()
+ * when we start using GLib >= 2.24
+ */
+static gboolean
+_nm_client_is_object_path (const char *string)
+{
+       gsize i;
+
+       if (!g_utf8_validate (string, -1, NULL))
+               return FALSE;
+
+       /* The path must begin with an ASCII '/' (integer 47) character */
+       if (string[0] != '/')
+               return FALSE;
+
+       for (i = 1; string[i]; i++) {
+               /* Each element must only contain the ASCII characters
+                * "[A-Z][a-z][0-9]_"
+                */
+               if (g_ascii_isalnum (string[i]) || string[i] == '_')
+                       ;
+               /* must consist of elements separated by slash characters. */
+               else if (string[i] == '/') {
+                       /* No element may be the empty string. */
+                       /* Multiple '/' characters cannot occur in sequence. */
+                       if (string[i - 1] == '/')
+                               return FALSE;
+               } else
+                       return FALSE;
+       }
+
+       /* A trailing '/' character is not allowed unless the path is the
+        * root path (a single '/' character).
+        */
+       if (i > 1 && string[i - 1] == '/')
+               return FALSE;
+
+       return TRUE;
+}
+
+/*
+ * constructor() shouldn't be overriden in most cases, rather constructed()
+ * method is preferred and more useful.
+ * But, this serves as a workaround for bindings (use) calling the 
constructor()
+ * directly instead of nm_client_new() function, and neither providing
+ * construction properties. So, we fill "dbus-path" here if it was not 
specified
+ * (was set to default value (NULL)).
+ *
+ * It allows this python code:
+ * from gi.repository import NMClient
+ * nmclient = NMClient.Client()
+ * print nmclient.get_active_connections()
+ *
+ * instead of proper
+ * nmclient = NMClient.Client().new()
+ *
+ * Note:
+ * A nice overview of GObject construction is here:
+ * 
http://blogs.gnome.org/desrt/2012/02/26/a-gentle-introduction-to-gobject-construction
+ * It is much better explanation than the official docs
+ * 
http://developer.gnome.org/gobject/unstable/chapter-gobject.html#gobject-instantiation
+ */
+static GObject*
+constructor (GType type,
+             guint n_construct_params,
+             GObjectConstructParam *construct_params)
+{
+       GObject *object;
+       guint i;
+       const char *dbus_path;
+
+       for (i = 0; i < n_construct_params; i++) {
+               if (strcmp (construct_params[i].pspec->name, 
NM_OBJECT_DBUS_PATH) == 0) {
+                       dbus_path = g_value_get_string 
(construct_params[i].value);
+                       if (dbus_path == NULL) {
+                               g_value_set_static_string 
(construct_params[i].value, NM_DBUS_PATH);
+                       } else {
+                               if (!_nm_client_is_object_path (dbus_path)) {
+                                       g_warning ("Passsed D-Bus object path 
'%s' is invalid; using default '%s' instead",
+                                                   dbus_path, NM_DBUS_PATH);
+                                       g_value_set_static_string 
(construct_params[i].value, NM_DBUS_PATH);
+                               }
+                       }
+                       break;
+               }
+       }
+
+       object = G_OBJECT_CLASS (nm_client_parent_class)->constructor (type,
+                                                                      
n_construct_params,
+                                                                      
construct_params);
+
+       return object;
+}
+
 static void
 constructed (GObject *object)
 {
@@ -1550,6 +1648,7 @@ nm_client_class_init (NMClientClass *client_class)
        g_type_class_add_private (client_class, sizeof (NMClientPrivate));
 
        /* virtual methods */
+       object_class->constructor = constructor;
        object_class->constructed = constructed;
        object_class->set_property = set_property;
        object_class->get_property = get_property;
--
cgit v0.9.0.2-2-gbebe
-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to