[packagekit] packagekit: Branch 'master' - 4 commits

Richard Hughes hughsient at kemper.freedesktop.org
Sun Oct 14 07:20:44 PDT 2007


 backends/yum/pk-backend-yum.c |   12 ++-
 libpackagekit/pk-task-list.c  |   21 -----
 src/pk-engine.c               |  168 +++++++++++++++++-------------------------
 src/pk-main.c                 |    3 
 4 files changed, 81 insertions(+), 123 deletions(-)

New commits:
commit 7d1ed71148babdc645c80bad7abc01b5748bab92
Author: Richard Hughes <richard at hughsie.com>
Date:   Sun Oct 14 15:18:54 2007 +0100

    query actions, groups and filters at daemon startup to make getting the action list an order of magnitude quicker, making all the pk-x tools startup much quicker

diff --git a/src/pk-engine.c b/src/pk-engine.c
index ce00f68..51077e5 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -70,6 +70,9 @@ struct PkEnginePrivate
 	PkTransactionItem	*sync_item;
 	PkPackageList		*updates_cache;
 	PkInhibit		*inhibit;
+	PkEnumList		*actions;
+	PkEnumList		*groups;
+	PkEnumList		*filters;
 };
 
 enum {
@@ -97,6 +100,9 @@ static guint	     signals [PK_ENGINE_LAST_SIGNAL] = { 0, };
 
 G_DEFINE_TYPE (PkEngine, pk_engine, G_TYPE_OBJECT)
 
+/* prototypes */
+static PkBackend *pk_engine_backend_new (PkEngine *engine);
+
 /**
  * pk_engine_error_quark:
  * Return value: Our personal error quark.
@@ -145,10 +151,25 @@ pk_engine_error_get_type (void)
  * pk_engine_use_backend:
  **/
 gboolean
-pk_engine_use_backend (PkEngine *engine, const gchar *backend)
+pk_engine_use_backend (PkEngine *engine, const gchar *backend_name)
 {
-	pk_debug ("trying backend %s", backend);
-	engine->priv->backend = g_strdup (backend);
+	PkBackend *backend;
+	if (engine->priv->backend != NULL) {
+		pk_error ("The backend to use can only be specified once");
+	}
+	pk_debug ("trying backend %s", backend_name);
+	engine->priv->backend = g_strdup (backend_name);
+
+	/* create a new backend so we can get the static stuff */
+	backend = pk_engine_backend_new (engine);
+	if (backend == NULL) {
+		pk_error ("Backend '%s' could not be initialized", engine->priv->backend);
+		return FALSE;
+	}
+	engine->priv->actions = pk_backend_get_actions (backend);
+	engine->priv->groups = pk_backend_get_groups (backend);
+	engine->priv->filters = pk_backend_get_filters (backend);
+	g_object_unref (backend);
 	return TRUE;
 }
 
@@ -629,10 +650,10 @@ pk_engine_repo_detail_cb (PkBackend *backend, const gchar *repo_id,
 }
 
 /**
- * pk_engine_new_backend:
+ * pk_engine_backend_new:
  **/
 static PkBackend *
-pk_engine_new_backend (PkEngine *engine)
+pk_engine_backend_new (PkEngine *engine)
 {
 	PkBackend *backend;
 	gboolean ret;
@@ -647,7 +668,6 @@ pk_engine_new_backend (PkEngine *engine)
 		pk_warning ("Cannot use backend '%s'", engine->priv->backend);
 		return NULL;
 	}
-	pk_debug ("adding backend %p", backend);
 
 	/* connect up signals */
 	g_signal_connect (backend, "transaction-status-changed",
@@ -841,7 +861,7 @@ pk_engine_refresh_cache (PkEngine *engine, const gchar *tid, gboolean force, GEr
 	}
 
 	/* create a new backend */
-	item->backend = pk_engine_new_backend (engine);
+	item->backend = pk_engine_backend_new (engine);
 	if (item->backend == NULL) {
 		g_warning ("Backend not set yet!");
 		return FALSE;
@@ -887,7 +907,7 @@ pk_engine_get_updates (PkEngine *engine, const gchar *tid, GError **error)
 	}
 
 	/* create a new backend */
-	item->backend = pk_engine_new_backend (engine);
+	item->backend = pk_engine_backend_new (engine);
 	if (item->backend == NULL) {
 		g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_INITIALIZE_FAILED,
 			     "Backend '%s' could not be initialized", engine->priv->backend);
@@ -1012,7 +1032,7 @@ pk_engine_search_name (PkEngine *engine, const gchar *tid, const gchar *filter,
 	}
 
 	/* create a new backend */
-	item->backend = pk_engine_new_backend (engine);
+	item->backend = pk_engine_backend_new (engine);
 	if (item->backend == NULL) {
 		g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_INITIALIZE_FAILED,
 			     "Backend '%s' could not be initialized", engine->priv->backend);
@@ -1063,7 +1083,7 @@ pk_engine_search_details (PkEngine *engine, const gchar *tid, const gchar *filte
 	}
 
 	/* create a new backend */
-	item->backend = pk_engine_new_backend (engine);
+	item->backend = pk_engine_backend_new (engine);
 	if (item->backend == NULL) {
 		g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_INITIALIZE_FAILED,
 			     "Backend '%s' could not be initialized", engine->priv->backend);
@@ -1114,7 +1134,7 @@ pk_engine_search_group (PkEngine *engine, const gchar *tid, const gchar *filter,
 	}
 
 	/* create a new backend */
-	item->backend = pk_engine_new_backend (engine);
+	item->backend = pk_engine_backend_new (engine);
 	if (item->backend == NULL) {
 		g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_INITIALIZE_FAILED,
 			     "Backend '%s' could not be initialized", engine->priv->backend);
@@ -1165,7 +1185,7 @@ pk_engine_search_file (PkEngine *engine, const gchar *tid, const gchar *filter,
 	}
 
 	/* create a new backend */
-	item->backend = pk_engine_new_backend (engine);
+	item->backend = pk_engine_backend_new (engine);
 	if (item->backend == NULL) {
 		g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_INITIALIZE_FAILED,
 			     "Backend '%s' could not be initialized", engine->priv->backend);
@@ -1204,7 +1224,7 @@ pk_engine_resolve (PkEngine *engine, const gchar *tid, const gchar *package, GEr
 	}
 
 	/* create a new backend */
-	item->backend = pk_engine_new_backend (engine);
+	item->backend = pk_engine_backend_new (engine);
 	if (item->backend == NULL) {
 		g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_INITIALIZE_FAILED,
 			     "Backend '%s' could not be initialized", engine->priv->backend);
@@ -1251,7 +1271,7 @@ pk_engine_get_depends (PkEngine *engine, const gchar *tid, const gchar *package_
 	}
 
 	/* create a new backend */
-	item->backend = pk_engine_new_backend (engine);
+	item->backend = pk_engine_backend_new (engine);
 	if (item->backend == NULL) {
 		g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_INITIALIZE_FAILED,
 			     "Backend '%s' could not be initialized", engine->priv->backend);
@@ -1298,7 +1318,7 @@ pk_engine_get_requires (PkEngine *engine, const gchar *tid, const gchar *package
 	}
 
 	/* create a new backend */
-	item->backend = pk_engine_new_backend (engine);
+	item->backend = pk_engine_backend_new (engine);
 	if (item->backend == NULL) {
 		g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_INITIALIZE_FAILED,
 			     "Backend '%s' could not be initialized", engine->priv->backend);
@@ -1345,7 +1365,7 @@ pk_engine_get_update_detail (PkEngine *engine, const gchar *tid, const gchar *pa
 	}
 
 	/* create a new backend */
-	item->backend = pk_engine_new_backend (engine);
+	item->backend = pk_engine_backend_new (engine);
 	if (item->backend == NULL) {
 		g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_INITIALIZE_FAILED,
 			     "Backend '%s' could not be initialized", engine->priv->backend);
@@ -1384,7 +1404,7 @@ pk_engine_get_description (PkEngine *engine, const gchar *tid, const gchar *pack
 	}
 
 	/* create a new backend */
-	item->backend = pk_engine_new_backend (engine);
+	item->backend = pk_engine_backend_new (engine);
 	if (item->backend == NULL) {
 		g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_INITIALIZE_FAILED,
 			     "Backend '%s' could not be initialized", engine->priv->backend);
@@ -1440,7 +1460,7 @@ pk_engine_update_system (PkEngine *engine, const gchar *tid, DBusGMethodInvocati
 	}
 
 	/* create a new backend */
-	item->backend = pk_engine_new_backend (engine);
+	item->backend = pk_engine_backend_new (engine);
 	if (item->backend == NULL) {
 		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
 				     "Could not create backend instance");
@@ -1500,7 +1520,7 @@ pk_engine_remove_package (PkEngine *engine, const gchar *tid, const gchar *packa
 	}
 
 	/* create a new backend */
-	item->backend = pk_engine_new_backend (engine);
+	item->backend = pk_engine_backend_new (engine);
 	if (item->backend == NULL) {
 		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
 				     "Could not create backend instance");
@@ -1562,7 +1582,7 @@ pk_engine_install_package (PkEngine *engine, const gchar *tid, const gchar *pack
 	}
 
 	/* create a new backend */
-	item->backend = pk_engine_new_backend (engine);
+	item->backend = pk_engine_backend_new (engine);
 	if (item->backend == NULL) {
 		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
 				     "Could not create backend instance");
@@ -1624,7 +1644,7 @@ pk_engine_install_file (PkEngine *engine, const gchar *tid, const gchar *full_pa
 	}
 
 	/* create a new backend */
-	item->backend = pk_engine_new_backend (engine);
+	item->backend = pk_engine_backend_new (engine);
 	if (item->backend == NULL) {
 		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
 				     "Could not create backend instance");
@@ -1677,7 +1697,7 @@ pk_engine_rollback (PkEngine *engine, const gchar *tid, const gchar *transaction
 	}
 
 	/* create a new backend */
-	item->backend = pk_engine_new_backend (engine);
+	item->backend = pk_engine_backend_new (engine);
 	if (item->backend == NULL) {
 		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
 				     "Could not create backend instance");
@@ -1739,7 +1759,7 @@ pk_engine_update_package (PkEngine *engine, const gchar *tid, const gchar *packa
 	}
 
 	/* create a new backend */
-	item->backend = pk_engine_new_backend (engine);
+	item->backend = pk_engine_backend_new (engine);
 	if (item->backend == NULL) {
 		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
 				     "Could not create backend instance");
@@ -1780,7 +1800,7 @@ pk_engine_get_repo_list (PkEngine *engine, const gchar *tid, GError **error)
 	}
 
 	/* create a new backend */
-	item->backend = pk_engine_new_backend (engine);
+	item->backend = pk_engine_backend_new (engine);
 	if (item->backend == NULL) {
 		g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_INITIALIZE_FAILED,
 			     "Backend '%s' could not be initialized", engine->priv->backend);
@@ -1831,7 +1851,7 @@ pk_engine_repo_enable (PkEngine *engine, const gchar *tid, const gchar *repo_id,
 	}
 
 	/* create a new backend */
-	item->backend = pk_engine_new_backend (engine);
+	item->backend = pk_engine_backend_new (engine);
 	if (item->backend == NULL) {
 		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
 				     "Could not create backend instance");
@@ -1885,7 +1905,7 @@ pk_engine_repo_set_data (PkEngine *engine, const gchar *tid, const gchar *repo_i
 	}
 
 	/* create a new backend */
-	item->backend = pk_engine_new_backend (engine);
+	item->backend = pk_engine_backend_new (engine);
 	if (item->backend == NULL) {
 		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
 				     "Could not create backend instance");
@@ -2129,114 +2149,61 @@ pk_engine_cancel (PkEngine *engine, const gchar *tid, GError **error)
 
 /**
  * pk_engine_get_actions:
- * @engine: This class instance
  **/
 gboolean
 pk_engine_get_actions (PkEngine *engine, gchar **actions, GError **error)
 {
-	PkBackend *backend;
-	PkEnumList *elist;
-
 	g_return_val_if_fail (engine != NULL, FALSE);
 	g_return_val_if_fail (PK_IS_ENGINE (engine), FALSE);
-
-	/* create a new backend */
-	backend = pk_engine_new_backend (engine);
-	if (backend == NULL) {
-		g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_INITIALIZE_FAILED,
-			     "Backend '%s' could not be initialized", engine->priv->backend);
-		return FALSE;
-	}
-
-	elist = pk_backend_get_actions (backend);
-	*actions = pk_enum_list_to_string (elist);
-	g_object_unref (backend);
-	g_object_unref (elist);
-
+	*actions = pk_enum_list_to_string (engine->priv->actions);
 	return TRUE;
 }
 
-
 /**
- * pk_engine_get_backend_detail:
- * @engine: This class instance
+ * pk_engine_get_groups:
  **/
 gboolean
-pk_engine_get_backend_detail (PkEngine *engine, gchar **name, gchar **author, gchar **version, GError **error)
+pk_engine_get_groups (PkEngine *engine, gchar **groups, GError **error)
 {
-	PkBackend *backend;
-
 	g_return_val_if_fail (engine != NULL, FALSE);
 	g_return_val_if_fail (PK_IS_ENGINE (engine), FALSE);
-
-	/* create a new backend */
-	backend = pk_engine_new_backend (engine);
-	if (backend == NULL) {
-		g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_INITIALIZE_FAILED,
-			     "Backend '%s' could not be initialized", engine->priv->backend);
-		return FALSE;
-	}
-
-	pk_backend_get_backend_detail (backend, name, author, version);
-	g_object_unref (backend);
-
+	*groups = pk_enum_list_to_string (engine->priv->groups);
 	return TRUE;
 }
 
 /**
- * pk_engine_get_groups:
- * @engine: This class instance
+ * pk_engine_get_filters:
  **/
 gboolean
-pk_engine_get_groups (PkEngine *engine, gchar **groups, GError **error)
+pk_engine_get_filters (PkEngine *engine, gchar **filters, GError **error)
 {
-	PkBackend *backend;
-	PkEnumList *elist;
-
 	g_return_val_if_fail (engine != NULL, FALSE);
 	g_return_val_if_fail (PK_IS_ENGINE (engine), FALSE);
-
-	/* create a new backend */
-	backend = pk_engine_new_backend (engine);
-	if (backend == NULL) {
-		g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_INITIALIZE_FAILED,
-			     "Backend '%s' could not be initialized", engine->priv->backend);
-		return FALSE;
-	}
-
-	elist = pk_backend_get_groups (backend);
-	*groups = pk_enum_list_to_string (elist);
-	g_object_unref (backend);
-	g_object_unref (elist);
-
+	*filters = pk_enum_list_to_string (engine->priv->filters);
 	return TRUE;
 }
 
 /**
- * pk_engine_get_filters:
- * @engine: This class instance
+ * pk_engine_get_backend_detail:
  **/
 gboolean
-pk_engine_get_filters (PkEngine *engine, gchar **filters, GError **error)
+pk_engine_get_backend_detail (PkEngine *engine, gchar **name, gchar **author, gchar **version, GError **error)
 {
 	PkBackend *backend;
-	PkEnumList *elist;
 
 	g_return_val_if_fail (engine != NULL, FALSE);
 	g_return_val_if_fail (PK_IS_ENGINE (engine), FALSE);
 
 	/* create a new backend */
-	backend = pk_engine_new_backend (engine);
+	backend = pk_engine_backend_new (engine);
 	if (backend == NULL) {
 		g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_INITIALIZE_FAILED,
 			     "Backend '%s' could not be initialized", engine->priv->backend);
 		return FALSE;
 	}
 
-	elist = pk_backend_get_filters (backend);
-	*filters = pk_enum_list_to_string (elist);
+	pk_backend_get_backend_detail (backend, name, author, version);
 	g_object_unref (backend);
-	g_object_unref (elist);
 
 	return TRUE;
 }
@@ -2260,7 +2227,6 @@ pk_engine_transaction_cb (PkTransactionDb *tdb, const gchar *old_tid, const gcha
 
 /**
  * pk_engine_get_seconds_idle:
- * @engine: This class instance
  **/
 guint
 pk_engine_get_seconds_idle (PkEngine *engine)
@@ -2392,7 +2358,6 @@ pk_engine_class_init (PkEngineClass *klass)
 
 /**
  * pk_engine_init:
- * @engine: This class instance
  **/
 static void
 pk_engine_init (PkEngine *engine)
@@ -2461,6 +2426,9 @@ pk_engine_finalize (GObject *object)
 	g_object_unref (engine->priv->inhibit);
 	g_object_unref (engine->priv->transaction_list);
 	g_object_unref (engine->priv->transaction_db);
+	g_object_unref (engine->priv->actions);
+	g_object_unref (engine->priv->groups);
+	g_object_unref (engine->priv->filters);
 
 	if (engine->priv->updates_cache != NULL) {
 		pk_debug ("unreffing updates cache");
diff --git a/src/pk-main.c b/src/pk-main.c
index 952abcb..e34459d 100644
--- a/src/pk-main.c
+++ b/src/pk-main.c
@@ -74,7 +74,8 @@ pk_object_register (DBusGConnection *connection,
 		/* abort as the DBUS method failed */
 		pk_warning ("RequestName failed!");
 		g_clear_error(error);
-		g_set_error(error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_DENIED, "Acquiring D-Bus name %s failed due to security policies on this machine",PK_DBUS_SERVICE);
+		g_set_error(error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_DENIED,
+			    "Acquiring D-Bus name %s failed due to security policies on this machine", PK_DBUS_SERVICE);
 		return FALSE;
 	}
 
commit f546335b761f7c160811c6e5e3f2dd4f960fe98c
Author: Richard Hughes <richard at hughsie.com>
Date:   Sun Oct 14 15:10:51 2007 +0100

    Revert "emit task-list-changed when the dameon connects or disconnects to clean up a crashing daemon"
    
    This reverts commit 2a1b7674fef5b287e653da90db9e46c834cd6abb.

diff --git a/libpackagekit/pk-task-list.c b/libpackagekit/pk-task-list.c
index 43829b7..88ac84f 100644
--- a/libpackagekit/pk-task-list.c
+++ b/libpackagekit/pk-task-list.c
@@ -39,7 +39,6 @@
 #include "pk-common.h"
 #include "pk-task-list.h"
 #include "pk-job-list.h"
-#include "pk-connection.h"
 
 static void     pk_task_list_class_init		(PkTaskListClass *klass);
 static void     pk_task_list_init		(PkTaskList      *task_list);
@@ -49,7 +48,6 @@ static void     pk_task_list_finalize		(GObject         *object);
 
 struct PkTaskListPrivate
 {
-	PkConnection		*pconnection;
 	GPtrArray		*task_list;
 	PkJobList		*job_list;
 };
@@ -293,19 +291,6 @@ pk_task_list_transaction_list_changed_cb (PkJobList *jlist, PkTaskList *tlist)
 }
 
 /**
- * pk_connection_changed_cb:
- **/
-static void
-pk_connection_changed_cb (PkConnection *pconnection, gboolean connected, PkTaskList *tlist)
-{
-	pk_debug ("connected=%i", connected);
-
-	/* if we crashed, then loose all the items in the task list */
-	pk_debug ("emit task-list-changed");
-	g_signal_emit (tlist , signals [PK_TASK_LIST_CHANGED], 0);
-}
-
-/**
  * pk_task_list_class_init:
  **/
 static void
@@ -347,11 +332,6 @@ pk_task_list_init (PkTaskList *tlist)
 	g_signal_connect (tlist->priv->job_list, "transaction-list-changed",
 			  G_CALLBACK (pk_task_list_transaction_list_changed_cb), tlist);
 
-	/* watch for PackageKit on the bus, and try to connect up at start */
-	tlist->priv->pconnection = pk_connection_new ();
-	g_signal_connect (tlist->priv->pconnection, "connection-changed",
-			  G_CALLBACK (pk_connection_changed_cb), tlist);
-
 	/* we maintain a local copy */
 	tlist->priv->task_list = g_ptr_array_new ();
 
@@ -386,7 +366,6 @@ pk_task_list_finalize (GObject *object)
 
 	g_ptr_array_free (tlist->priv->task_list, TRUE);
 	g_object_unref (tlist->priv->job_list);
-	g_object_unref (tlist->priv->pconnection);
 
 	G_OBJECT_CLASS (pk_task_list_parent_class)->finalize (object);
 }
commit 0016dac55168868fb76ddfe9a21883948d33ce0a
Author: Richard Hughes <richard at hughsie.com>
Date:   Sun Oct 14 14:39:11 2007 +0100

    use a better error description when we can't load a PkBackend instance

diff --git a/src/pk-engine.c b/src/pk-engine.c
index 5460922..ce00f68 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -1443,7 +1443,7 @@ pk_engine_update_system (PkEngine *engine, const gchar *tid, DBusGMethodInvocati
 	item->backend = pk_engine_new_backend (engine);
 	if (item->backend == NULL) {
 		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
-				     "Operation not yet supported by backend");
+				     "Could not create backend instance");
 		dbus_g_method_return_error (context, error);
 		return;
 	}
@@ -1503,7 +1503,7 @@ pk_engine_remove_package (PkEngine *engine, const gchar *tid, const gchar *packa
 	item->backend = pk_engine_new_backend (engine);
 	if (item->backend == NULL) {
 		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
-				     "Operation not yet supported by backend");
+				     "Could not create backend instance");
 		dbus_g_method_return_error (context, error);
 		return;
 	}
@@ -1565,7 +1565,7 @@ pk_engine_install_package (PkEngine *engine, const gchar *tid, const gchar *pack
 	item->backend = pk_engine_new_backend (engine);
 	if (item->backend == NULL) {
 		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
-				     "Operation not yet supported by backend");
+				     "Could not create backend instance");
 		dbus_g_method_return_error (context, error);
 		return;
 	}
@@ -1627,7 +1627,7 @@ pk_engine_install_file (PkEngine *engine, const gchar *tid, const gchar *full_pa
 	item->backend = pk_engine_new_backend (engine);
 	if (item->backend == NULL) {
 		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
-				     "Operation not yet supported by backend");
+				     "Could not create backend instance");
 		dbus_g_method_return_error (context, error);
 		return;
 	}
@@ -1680,7 +1680,7 @@ pk_engine_rollback (PkEngine *engine, const gchar *tid, const gchar *transaction
 	item->backend = pk_engine_new_backend (engine);
 	if (item->backend == NULL) {
 		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
-				     "Operation not yet supported by backend");
+				     "Could not create backend instance");
 		dbus_g_method_return_error (context, error);
 		return;
 	}
@@ -1742,7 +1742,7 @@ pk_engine_update_package (PkEngine *engine, const gchar *tid, const gchar *packa
 	item->backend = pk_engine_new_backend (engine);
 	if (item->backend == NULL) {
 		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
-				     "Operation not yet supported by backend");
+				     "Could not create backend instance");
 		dbus_g_method_return_error (context, error);
 		return;
 	}
@@ -1834,7 +1834,7 @@ pk_engine_repo_enable (PkEngine *engine, const gchar *tid, const gchar *repo_id,
 	item->backend = pk_engine_new_backend (engine);
 	if (item->backend == NULL) {
 		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
-				     "Operation not yet supported by backend");
+				     "Could not create backend instance");
 		dbus_g_method_return_error (context, error);
 		return;
 	}
@@ -1888,7 +1888,7 @@ pk_engine_repo_set_data (PkEngine *engine, const gchar *tid, const gchar *repo_i
 	item->backend = pk_engine_new_backend (engine);
 	if (item->backend == NULL) {
 		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
-				     "Operation not yet supported by backend");
+				     "Could not create backend instance");
 		dbus_g_method_return_error (context, error);
 		return;
 	}
commit 7c63f0f58c1005fa79f34d66e88b88cc22dd1319
Author: Richard Hughes <richard at hughsie.com>
Date:   Sun Oct 14 14:36:40 2007 +0100

    yum has resolve - use it

diff --git a/backends/yum/pk-backend-yum.c b/backends/yum/pk-backend-yum.c
index 71cba29..307546a 100644
--- a/backends/yum/pk-backend-yum.c
+++ b/backends/yum/pk-backend-yum.c
@@ -227,6 +227,16 @@ backend_update_system (PkBackend *backend)
 	pk_backend_spawn_helper (backend, "update-system.py", NULL);
 }
 
+/**
+ * backend_resolve:
+ */
+static void
+backend_resolve (PkBackend *backend, const gchar *package_id)
+{
+	g_return_if_fail (backend != NULL);
+	pk_backend_spawn_helper (backend, "resolve.py", NULL);
+}
+
 PK_BACKEND_OPTIONS (
 	"YUM",					/* description */
 	"0.0.1",				/* version */
@@ -245,7 +255,7 @@ PK_BACKEND_OPTIONS (
 	NULL,					/* install_file */
 	backend_refresh_cache,			/* refresh_cache */
 	backend_remove_package,			/* remove_package */
-	NULL,					/* resolve */
+	backend_resolve,			/* resolve */
 	NULL,					/* rollback */
 	backend_search_details,			/* search_details */
 	backend_search_file,			/* search_file */



More information about the PackageKit mailing list