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

Richard Hughes hughsient at kemper.freedesktop.org
Tue Sep 4 15:49:10 PDT 2007


 helpers/BACKENDS  |    2 -
 src/pk-engine.c   |   46 ++++++++++++++++++++++-----------------------
 src/pk-task-box.c |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++---
 3 files changed, 76 insertions(+), 27 deletions(-)

New commits:
diff-tree d38b6b5cd1e1d5b165bba7d88c27ff04ef0411c9 (from 549376b8f31b219fe5ee0296cad53728e9a893aa)
Author: Grzegorz Dabrowski <gdx at o2.pl>
Date:   Tue Sep 4 21:02:47 2007 +0000

    implemented PK_TASK_ACTION_GET_DESCRIPTION for box backend

diff --git a/helpers/BACKENDS b/helpers/BACKENDS
index a433868..ce6f38c 100644
--- a/helpers/BACKENDS
+++ b/helpers/BACKENDS
@@ -10,5 +10,5 @@ update-system   |           |   X   |   
 install         |           |   X   |       |       |
 remove          |           |   X   |       |       |
 get-deps        |           |   X   |       |       |
-get-description |     X     |       |   X   |       |
+get-description |     X     |       |   X   |   X   |
 search-file     |           |       |       |   X   |
diff --git a/src/pk-task-box.c b/src/pk-task-box.c
index d0858a0..d78c09b 100644
--- a/src/pk-task-box.c
+++ b/src/pk-task-box.c
@@ -134,7 +134,7 @@ pk_task_get_actions (void)
 				        PK_TASK_ACTION_SEARCH_FILE,
 				        /*PK_TASK_ACTION_GET_DEPENDS,*/
 				        /*PK_TASK_ACTION_GET_REQUIRES,*/
-				        /*PK_TASK_ACTION_GET_DESCRIPTION,*/
+				        PK_TASK_ACTION_GET_DESCRIPTION,
 				        0);
 	return actions;
 }
@@ -296,6 +296,26 @@ find_packages (PkTask *task, const gchar
 	return TRUE;
 }
 
+static GList*
+find_package_by_id (PkPackageId *pi)
+{
+	sqlite3 *db = NULL;
+	GList *list;
+
+	db = box_db_open("/");
+	box_db_attach_repo(db, "/", "core");
+	box_db_repos_init(db);
+
+	// only one element is returned
+	list = box_db_repos_packages_search_by_data(db, pi->name, pi->version);
+	if (list == NULL)
+		return NULL;
+
+	box_db_detach_repo(db, "core");
+	box_db_close(db);
+
+	return list;
+}
 
 /**
  * pk_task_search_name:
@@ -393,6 +413,10 @@ pk_task_get_requires (PkTask *task, cons
 gboolean
 pk_task_get_description (PkTask *task, const gchar *package_id)
 {
+	PkPackageId *pi;
+	PackageSearch *ps;
+	GList *list;
+
 	g_return_val_if_fail (task != NULL, FALSE);
 	g_return_val_if_fail (PK_IS_TASK (task), FALSE);
 
@@ -400,8 +424,33 @@ pk_task_get_description (PkTask *task, c
 		return FALSE;
 	}
 
+	pi = pk_package_id_new_from_string (package_id);
+
+	if (pi == NULL)
+	{
+		pk_task_error_code (task, PK_TASK_ERROR_CODE_PACKAGE_ID_INVALID, "invalid package id");
+		pk_task_finished (task, PK_TASK_EXIT_FAILED);
+		return TRUE;
+	}
+
+	list = find_package_by_id (pi);
+	ps = (PackageSearch*) list->data;
+
+	if (list == NULL)
+	{
+		pk_task_error_code (task, PK_TASK_ERROR_CODE_PACKAGE_ID_INVALID, "cannot find package by id");
+		pk_task_finished (task, PK_TASK_EXIT_FAILED);
+		return TRUE;
+	}
+
+
 	pk_task_set_job_role (task, PK_TASK_ROLE_QUERY, package_id);
-	pk_task_not_implemented_yet (task, "GetDescription");
+	pk_task_description (task, pi->name, PK_TASK_GROUP_OTHER, ps->description, "");
+
+	pk_package_id_free (pi);
+	box_db_repos_package_list_free (list);
+
+	pk_task_finished (task, PK_TASK_EXIT_SUCCESS);
 	return TRUE;
 }
 
diff-tree 549376b8f31b219fe5ee0296cad53728e9a893aa (from parents)
Merge: 3e4d834f242b0e26e3ff42b22aebcee12e0f4139 12d456cd0f42bbf002f15944730892e14e03a8a8
Author: Grzegorz Dabrowski <gdx at o2.pl>
Date:   Tue Sep 4 20:56:38 2007 +0000

    Merge branch 'master' of ssh://kaliber@hughsient.no-ip.org/srv/git/PackageKit

diff-tree 3e4d834f242b0e26e3ff42b22aebcee12e0f4139 (from 25a0c0c9e29ac2e44737998346b81316847f8043)
Author: Grzegorz Dabrowski <gdx at o2.pl>
Date:   Tue Sep 4 19:51:28 2007 +0000

    set correct repository name instead of empty string

diff --git a/src/pk-task-box.c b/src/pk-task-box.c
index 459cb75..d0858a0 100644
--- a/src/pk-task-box.c
+++ b/src/pk-task-box.c
@@ -72,7 +72,7 @@ add_packages_from_list (PkTask *task, GL
 
 	for (li = list; li != NULL; li = li->next) {
 		package = (PackageSearch*)li->data;
-		pkg_string = pk_package_id_build(package->package, package->version, package->arch, "");
+		pkg_string = pk_package_id_build(package->package, package->version, package->arch, package->reponame);
 
 		pk_task_package (task, package->installed, pkg_string, package->description);
 
diff-tree 12d456cd0f42bbf002f15944730892e14e03a8a8 (from 1fe19bdb1342d43b6cbf5bb581c6c484a993ed58)
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Sep 4 19:42:13 2007 +0100

    make sparse clean

diff --git a/src/pk-engine.c b/src/pk-engine.c
index 6842dcb..5c126b6 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -243,7 +243,7 @@ pk_engine_job_status_changed_cb (PkTask 
 	g_return_if_fail (PK_IS_ENGINE (engine));
 
 	map = pk_get_map_from_task (engine, task);
-	if (map == FALSE) {
+	if (map == NULL) {
 		pk_warning ("could not find task");
 		return;
 	}
@@ -266,7 +266,7 @@ pk_engine_percentage_changed_cb (PkTask 
 	g_return_if_fail (PK_IS_ENGINE (engine));
 
 	map = pk_get_map_from_task (engine, task);
-	if (map == FALSE) {
+	if (map == NULL) {
 		pk_warning ("could not find task");
 		return;
 	}
@@ -287,7 +287,7 @@ pk_engine_sub_percentage_changed_cb (PkT
 	g_return_if_fail (PK_IS_ENGINE (engine));
 
 	map = pk_get_map_from_task (engine, task);
-	if (map == FALSE) {
+	if (map == NULL) {
 		pk_warning ("could not find task");
 		return;
 	}
@@ -308,7 +308,7 @@ pk_engine_no_percentage_updates_cb (PkTa
 	g_return_if_fail (PK_IS_ENGINE (engine));
 
 	map = pk_get_map_from_task (engine, task);
-	if (map == FALSE) {
+	if (map == NULL) {
 		pk_warning ("could not find task");
 		return;
 	}
@@ -329,7 +329,7 @@ pk_engine_package_cb (PkTask *task, guin
 	g_return_if_fail (PK_IS_ENGINE (engine));
 
 	map = pk_get_map_from_task (engine, task);
-	if (map == FALSE) {
+	if (map == NULL) {
 		pk_warning ("could not find task");
 		return;
 	}
@@ -351,7 +351,7 @@ pk_engine_error_code_cb (PkTask *task, P
 	g_return_if_fail (PK_IS_ENGINE (engine));
 
 	map = pk_get_map_from_task (engine, task);
-	if (map == FALSE) {
+	if (map == NULL) {
 		pk_warning ("could not find task");
 		return;
 	}
@@ -374,7 +374,7 @@ pk_engine_require_restart_cb (PkTask *ta
 	g_return_if_fail (PK_IS_ENGINE (engine));
 
 	map = pk_get_map_from_task (engine, task);
-	if (map == FALSE) {
+	if (map == NULL) {
 		pk_warning ("could not find task");
 		return;
 	}
@@ -398,7 +398,7 @@ pk_engine_description_cb (PkTask *task, 
 	g_return_if_fail (PK_IS_ENGINE (engine));
 
 	map = pk_get_map_from_task (engine, task);
-	if (map == FALSE) {
+	if (map == NULL) {
 		pk_warning ("could not find task");
 		return;
 	}
@@ -422,7 +422,7 @@ pk_engine_finished_cb (PkTask *task, PkT
 	g_return_if_fail (PK_IS_ENGINE (engine));
 
 	map = pk_get_map_from_task (engine, task);
-	if (map == FALSE) {
+	if (map == NULL) {
 		pk_warning ("could not find task");
 		return;
 	}
@@ -458,7 +458,7 @@ pk_engine_allow_interrupt_cb (PkTask *ta
 	g_return_if_fail (PK_IS_ENGINE (engine));
 
 	map = pk_get_map_from_task (engine, task);
-	if (map == FALSE) {
+	if (map == NULL) {
 		pk_warning ("could not find task");
 		return;
 	}
@@ -658,7 +658,7 @@ pk_engine_refresh_cache (PkEngine *engin
 	}
 	pk_engine_add_task (engine, task);
 	map = pk_get_map_from_task (engine, task);
-	if (map == FALSE) {
+	if (map == NULL) {
 		pk_warning ("could not find task");
 		return FALSE;
 	}
@@ -691,7 +691,7 @@ pk_engine_get_updates (PkEngine *engine,
 	}
 	pk_engine_add_task (engine, task);
 	map = pk_get_map_from_task (engine, task);
-	if (map == FALSE) {
+	if (map == NULL) {
 		pk_warning ("could not find task");
 		return FALSE;
 	}
@@ -789,7 +789,7 @@ pk_engine_search_name (PkEngine *engine,
 	}
 	pk_engine_add_task (engine, task);
 	map = pk_get_map_from_task (engine, task);
-	if (map == FALSE) {
+	if (map == NULL) {
 		pk_warning ("could not find task");
 		return FALSE;
 	}
@@ -835,7 +835,7 @@ pk_engine_search_details (PkEngine *engi
 	}
 	pk_engine_add_task (engine, task);
 	map = pk_get_map_from_task (engine, task);
-	if (map == FALSE) {
+	if (map == NULL) {
 		pk_warning ("could not find task");
 		return FALSE;
 	}
@@ -881,7 +881,7 @@ pk_engine_search_group (PkEngine *engine
 	}
 	pk_engine_add_task (engine, task);
 	map = pk_get_map_from_task (engine, task);
-	if (map == FALSE) {
+	if (map == NULL) {
 		pk_warning ("could not find task");
 		return FALSE;
 	}
@@ -927,7 +927,7 @@ pk_engine_search_file (PkEngine *engine,
 	}
 	pk_engine_add_task (engine, task);
 	map = pk_get_map_from_task (engine, task);
-	if (map == FALSE) {
+	if (map == NULL) {
 		pk_warning ("could not find task");
 		return FALSE;
 	}
@@ -969,7 +969,7 @@ pk_engine_get_depends (PkEngine *engine,
 	}
 	pk_engine_add_task (engine, task);
 	map = pk_get_map_from_task (engine, task);
-	if (map == FALSE) {
+	if (map == NULL) {
 		pk_warning ("could not find task");
 		return FALSE;
 	}
@@ -1011,7 +1011,7 @@ pk_engine_get_requires (PkEngine *engine
 	}
 	pk_engine_add_task (engine, task);
 	map = pk_get_map_from_task (engine, task);
-	if (map == FALSE) {
+	if (map == NULL) {
 		pk_warning ("could not find task");
 		return FALSE;
 	}
@@ -1045,7 +1045,7 @@ pk_engine_get_description (PkEngine *eng
 	}
 	pk_engine_add_task (engine, task);
 	map = pk_get_map_from_task (engine, task);
-	if (map == FALSE) {
+	if (map == NULL) {
 		pk_warning ("could not find task");
 		return FALSE;
 	}
@@ -1105,7 +1105,7 @@ pk_engine_update_system (PkEngine *engin
 	pk_engine_add_task (engine, task);
 
 	map = pk_get_map_from_task (engine, task);
-	if (map == FALSE) {
+	if (map == NULL) {
 		pk_warning ("could not find task");
 		return;
 	}
@@ -1156,7 +1156,7 @@ pk_engine_remove_package (PkEngine *engi
 	pk_engine_add_task (engine, task);
 
 	map = pk_get_map_from_task (engine, task);
-	if (map == FALSE) {
+	if (map == NULL) {
 		pk_warning ("could not find task");
 		return;
 	}
@@ -1209,7 +1209,7 @@ pk_engine_install_package (PkEngine *eng
 	pk_engine_add_task (engine, task);
 
 	map = pk_get_map_from_task (engine, task);
-	if (map == FALSE) {
+	if (map == NULL) {
 		pk_warning ("could not find task");
 		return;
 	}
@@ -1262,7 +1262,7 @@ pk_engine_update_package (PkEngine *engi
 	pk_engine_add_task (engine, task);
 
 	map = pk_get_map_from_task (engine, task);
-	if (map == FALSE) {
+	if (map == NULL) {
 		pk_warning ("could not find task");
 		return;
 	}



More information about the PackageKit mailing list