[packagekit] [PATCH] Bug #12883, PackageKit has a hard dependency on libnm_glib

Patrick Ohearn pat at ge3k.net
Mon Oct 22 05:01:00 PDT 2007


On Mon, 2007-10-22 at 14:25 +0300, S.Çağlar Onur wrote:
> Hi;
> 
> While trying/playing to integrate our package manager (PiSi) into PackageKit i realize it has strict dep. to NetworkManager which is not available for Pardus.
> And according to [1]  it is not desired also so here is the quick patch to remove that dependency from PackageKit. 
> 
> diff --git a/configure.ac b/configure.ac
> index 6af5641..c8a51fe 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -89,10 +89,15 @@ PKG_CHECK_MODULES(DBUS, \
>  AC_SUBST(DBUS_CFLAGS)
>  AC_SUBST(DBUS_LIBS)
>  
> -PKG_CHECK_MODULES(LIBNM, \
> - libnm_glib >= $LIBNM_REQUIRED)
> -AC_SUBST(LIBNM_CFLAGS)
> -AC_SUBST(LIBNM_LIBS)
> +PKG_CHECK_MODULES(NM, dbus-glib-1, NM_SUPPORT="yes", NM_SUPPORT="no")
> +AC_CHECK_HEADER(NetworkManager/NetworkManager.h, [ nm_header="yes" ] )
> +if test "x$NM_SUPPORT" = "xyes" -a "x$nm_header" = "xyes"; then 
> +    AC_DEFINE(NM_SUPPORT, 1, [network manager available])
> +else
> +    NM_SUPPORT=no
> +fi
> +
> +AM_CONDITIONAL(NM_SUPPORT, test x$NM_SUPPORT = xyes)
>  
>  dnl ---------------------------------------------------------------------------
>  dnl - Is docbook2man available?
> diff --git a/libpackagekit/pk-network.c b/libpackagekit/pk-network.c
> index cb12231..6779765 100644
> --- a/libpackagekit/pk-network.c
> +++ b/libpackagekit/pk-network.c
> @@ -19,6 +19,8 @@
>   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
>   */
>  
> +#ifdef NM_SUPPORT /* NetworkManager support */
> +
>  #include "config.h"
>  
>  #include <stdlib.h>
> @@ -166,3 +168,4 @@ pk_network_new (void)
>  	}
>  	return PK_NETWORK (pk_network_object);
>  }
> +#endif /* NetworkManager support */
> diff --git a/src/pk-backend.c b/src/pk-backend.c
> index 171879e..92f1b2d 100644
> --- a/src/pk-backend.c
> +++ b/src/pk-backend.c
> @@ -39,7 +39,9 @@
>  #include <gmodule.h>
>  #include <pk-package-id.h>
>  #include <pk-enum.h>
> +#ifdef NM_SUPPORT
>  #include <pk-network.h>
> +#endif 
>  
>  #include "pk-debug.h"
>  #include "pk-backend-internal.h"
> @@ -76,7 +78,9 @@ struct _PkBackendPrivate
>  	gboolean		 during_initialize;
>  	gboolean		 assigned;
>  	gboolean		 set_error;
> +#ifdef NM_SUPPORT
>  	PkNetwork		*network;
> +#endif
>  	PkInhibit		*inhibit;
>  	/* needed for gui coldplugging */
>  	guint			 last_percentage;
> @@ -1618,7 +1622,11 @@ pk_backend_get_runtime (PkBackend *backend)
>  gboolean
>  pk_backend_network_is_online (PkBackend *backend)
>  {
> +#ifdef NM_SUPPORT
>  	return pk_network_is_online (backend->priv->network);
> +#else
> +	return TRUE;
> +#endif
>  }
>  
>  /**
> @@ -1661,7 +1669,10 @@ pk_backend_finalize (GObject *object)
>  	pk_inhibit_remove (backend->priv->inhibit, backend);
>  	g_object_unref (backend->priv->inhibit);
>  
> +#ifdef NM_SUPPORT
>  	g_object_unref (backend->priv->network);
> +#endif
> +
>  	g_object_unref (backend->priv->thread_list);
>  
>  	G_OBJECT_CLASS (pk_backend_parent_class)->finalize (object);
> @@ -1789,7 +1800,9 @@ pk_backend_init (PkBackend *backend)
>  	backend->priv->status = PK_STATUS_ENUM_UNKNOWN;
>  	backend->priv->exit = PK_EXIT_ENUM_SUCCESS;
>  	backend->priv->inhibit = pk_inhibit_new ();
> +#ifdef NM_SUPPORT
>  	backend->priv->network = pk_network_new ();
> +#endif
>  	backend->priv->thread_list = pk_thread_list_new ();
>  }
>  
> diff --git a/src/pk-engine.c b/src/pk-engine.c
> index 540c89b..72fc664 100644
> --- a/src/pk-engine.c
> +++ b/src/pk-engine.c
> @@ -41,7 +41,9 @@
>  
>  #include <pk-debug.h>
>  #include <pk-common.h>
> +#ifdef NM_SUPPORT
>  #include <pk-network.h>
> +#endif
>  #include <pk-package-list.h>
>  #include <pk-enum.h>
>  
> @@ -68,7 +70,9 @@ struct PkEnginePrivate
>  	PkTransactionItem	*sync_item;
>  	PkPackageList		*updates_cache;
>  	PkInhibit		*inhibit;
> +#ifdef NM_SUPPORT
>  	PkNetwork		*network;
> +#endif
>  	PkSecurity		*security;
>  	PkEnumList		*actions;
>  	PkEnumList		*groups;
> @@ -2468,8 +2472,10 @@ pk_engine_init (PkEngine *engine)
>  	/* we save a cache of the latest update lists sowe can do cached responses */
>  	engine->priv->updates_cache = NULL;
>  
> +#ifdef NM_SUPPORT
>  	/* we dont need this, just don't keep creating and destroying it */
>  	engine->priv->network = pk_network_new ();
> +#endif
>  
>  	/* we need an auth framework */
>  	engine->priv->security = pk_security_new ();
> @@ -2513,7 +2519,9 @@ pk_engine_finalize (GObject *object)
>  	g_object_unref (engine->priv->actions);
>  	g_object_unref (engine->priv->groups);
>  	g_object_unref (engine->priv->filters);
> +#ifdef NM_SUPPORT
>  	g_object_unref (engine->priv->network);
> +#endif
>  	g_object_unref (engine->priv->security);
>  
>  	if (engine->priv->updates_cache != NULL) {
> 
> 
> 
> [1] https://bugs.freedesktop.org/show_bug.cgi?id=12883
God people are fast around here, thanks a lot mate :)
-- 
Email: pat at ge3k.net
Jabber: pat at ge3k.net
Site: http://ge3k.net
PGP Key: 66A612C6
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/packagekit/attachments/20071022/7e4949bd/attachment-0004.pgp>


More information about the PackageKit mailing list