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

Richard Hughes hughsient at kemper.freedesktop.org
Wed Nov 7 15:34:04 PST 2007


 backends/apt/helpers/aptBackend.py      |    7 +
 backends/apt/helpers/resolve.py         |   20 +++++
 backends/apt/pk-backend-apt.c           |  113 ++------------------------------
 backends/box/pk-backend-box.c           |    4 -
 backends/dummy/pk-backend-dummy.c       |    4 -
 backends/test/pk-backend-test-fail.c    |    4 -
 backends/test/pk-backend-test-succeed.c |    4 -
 backends/yum/helpers/get-depends.py     |    6 +
 backends/yum/helpers/get-requires.py    |    6 +
 backends/yum/helpers/yumBackend.py      |    9 +-
 client/pk-console.c                     |   10 +-
 docs/pk-introduction.xml                |   20 +++++
 libpackagekit/pk-client.c               |   14 ++-
 libpackagekit/pk-client.h               |    6 +
 python/packagekit/backend.py            |   12 ---
 python/packagekit/frontend.py           |   14 +--
 src/pk-backend-internal.h               |    6 +
 src/pk-backend-python.c                 |   28 ++++---
 src/pk-backend-python.h                 |    6 +
 src/pk-backend.c                        |   12 ++-
 src/pk-backend.h                        |    4 -
 src/pk-engine.c                         |   12 +--
 src/pk-engine.h                         |    2 
 src/pk-interface.xml                    |    2 
 24 files changed, 149 insertions(+), 176 deletions(-)

New commits:
commit 218837ada1e1cc573e2d1df2889d4edb60332bb4
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Nov 7 21:59:42 2007 +0000

    fix get_requires to output the right thing. I'm a python legendgit diff woohoogit diff I'm the bestest python dude in the world....

diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 0c12947..3856a20 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -511,7 +511,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         pkg,inst = self._findPackage(package)
         pkgs = self.yumbase.rpmdb.searchRequires(pkg.name)
         for pkg in pkgs:
-            self._show_package(pkg,inst)
+            if inst:
+                self._show_package(pkg,INFO_INSTALLED)
+            else:
+                self._show_package(pkg,INFO_AVAILABLE)
 
     def _is_inst(self,pkg):
         return self.yumbase.rpmdb.installed(po=pkg)
commit e7caa06a37c4ccfddebd3983de2077484ffd232a
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Nov 7 20:09:49 2007 +0000

    add the recursive flag to the YumBackend to make yum work

diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 085acdd..0c12947 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -501,7 +501,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         else:
             return None,False
 
-    def get_requires(self,package):
+    def get_requires(self,package,recursive):
         '''
         Print a list of requires for a given package
         '''
@@ -588,7 +588,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             bestdeps.append(best)
         return unique(bestdeps)
 
-    def get_depends(self,package):
+    def get_depends(self,package,recursive):
         '''
         Print a list of depends for a given package
         '''
commit d638c6a5274af8ef7f2915afc8c3aa8c6e27a1ce
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Nov 7 18:47:11 2007 +0000

    Adds a boolean flag recursive to the GetDepends and GetRequires method.
    
    >From the description in the developer documentation:
    
    GetRequires:
    If recursive is true: This means if gnome-power-manager depends on
    NetworkManager and NetworkManager depends on HAL, then GetRequires on
    HAL should return both gnome-power-manager and NetworkManager.
    
    GetDepends:
    If recursive is true: This means if gnome-power-manager depends on
    NetworkManager and NetworkManager depends on HAL, then GetDepends on
    gnome-power-manager should return both HAL and NetworkManager.
    
    Why does this belong in the backends? Well, I tried doing this with lots
    of recursive calls to GetRequires(package_id) and for gimp it took a
    long time, when in yum took a few seconds. The backend doesn't have to
    do all this IPC, and so can do it much quicker.
    
    If your backend can't do a recursive GetDepends or GetRequires, just
    ignore the flag; anything is better than nothing.

diff --git a/backends/box/pk-backend-box.c b/backends/box/pk-backend-box.c
index 158e386..1906df1 100644
--- a/backends/box/pk-backend-box.c
+++ b/backends/box/pk-backend-box.c
@@ -468,7 +468,7 @@ backend_get_filters (PkBackend *backend, PkEnumList *elist)
  * backend_get_depends:
  */
 static void
-backend_get_depends (PkBackend *backend, const gchar *package_id)
+backend_get_depends (PkBackend *backend, const gchar *package_id, gboolean recursive)
 {
 	ThreadData *data = g_new0(ThreadData, 1);
 
@@ -526,7 +526,7 @@ backend_get_files (PkBackend *backend, const gchar *package_id)
  * backend_get_requires:
  */
 static void
-backend_get_requires (PkBackend *backend, const gchar *package_id)
+backend_get_requires (PkBackend *backend, const gchar *package_id, gboolean recursive)
 {
 	ThreadData *data = g_new0(ThreadData, 1);
 
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index 9fa785e..b837d43 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -86,7 +86,7 @@ backend_cancel (PkBackend *backend)
  * backend_get_depends:
  */
 static void
-backend_get_depends (PkBackend *backend, const gchar *package_id)
+backend_get_depends (PkBackend *backend, const gchar *package_id, gboolean recursive)
 {
 	g_return_if_fail (backend != NULL);
 	pk_backend_package (backend, PK_INFO_ENUM_INSTALLED,
@@ -132,7 +132,7 @@ backend_get_files (PkBackend *backend, const gchar *package_id)
  * backend_get_requires:
  */
 static void
-backend_get_requires (PkBackend *backend, const gchar *package_id)
+backend_get_requires (PkBackend *backend, const gchar *package_id, gboolean recursive)
 {
 	g_return_if_fail (backend != NULL);
 	pk_backend_package (backend, PK_INFO_ENUM_INSTALLED,
diff --git a/backends/test/pk-backend-test-fail.c b/backends/test/pk-backend-test-fail.c
index 1ae9fb9..49ce16e 100644
--- a/backends/test/pk-backend-test-fail.c
+++ b/backends/test/pk-backend-test-fail.c
@@ -88,7 +88,7 @@ backend_cancel (PkBackend *backend)
  * backend_get_depends:
  */
 static void
-backend_get_depends (PkBackend *backend, const gchar *package_id)
+backend_get_depends (PkBackend *backend, const gchar *package_id, gboolean recursive)
 {
 	g_return_if_fail (backend != NULL);
 	pk_backend_finished (backend);
@@ -118,7 +118,7 @@ backend_get_files (PkBackend *backend, const gchar *package_id)
  * backend_get_requires:
  */
 static void
-backend_get_requires (PkBackend *backend, const gchar *package_id)
+backend_get_requires (PkBackend *backend, const gchar *package_id, gboolean recursive)
 {
 	g_return_if_fail (backend != NULL);
 	pk_backend_finished (backend);
diff --git a/backends/test/pk-backend-test-succeed.c b/backends/test/pk-backend-test-succeed.c
index 5fb9175..f8e1c70 100644
--- a/backends/test/pk-backend-test-succeed.c
+++ b/backends/test/pk-backend-test-succeed.c
@@ -84,7 +84,7 @@ backend_cancel (PkBackend *backend)
  * backend_get_depends:
  */
 static void
-backend_get_depends (PkBackend *backend, const gchar *package_id)
+backend_get_depends (PkBackend *backend, const gchar *package_id, gboolean recursive)
 {
 	g_return_if_fail (backend != NULL);
 	pk_backend_finished (backend);
@@ -114,7 +114,7 @@ backend_get_files (PkBackend *backend, const gchar *package_id)
  * backend_get_requires:
  */
 static void
-backend_get_requires (PkBackend *backend, const gchar *package_id)
+backend_get_requires (PkBackend *backend, const gchar *package_id, gboolean recursive)
 {
 	g_return_if_fail (backend != NULL);
 	pk_backend_finished (backend);
diff --git a/backends/yum/helpers/get-depends.py b/backends/yum/helpers/get-depends.py
index ce1100e..5ef5ac9 100755
--- a/backends/yum/helpers/get-depends.py
+++ b/backends/yum/helpers/get-depends.py
@@ -12,7 +12,9 @@
 import sys
 
 from yumBackend import PackageKitYumBackend
-package=sys.argv[1]
+package = sys.argv[1]
+recursive = sys.argv[2]
+
 backend = PackageKitYumBackend(sys.argv[1:])
-backend.get_depends(package)
+backend.get_depends(package, recursive)
 sys.exit(0)
diff --git a/backends/yum/helpers/get-requires.py b/backends/yum/helpers/get-requires.py
index 443a841..1f1bc75 100755
--- a/backends/yum/helpers/get-requires.py
+++ b/backends/yum/helpers/get-requires.py
@@ -12,7 +12,9 @@
 import sys
 
 from yumBackend import PackageKitYumBackend
-package=sys.argv[1]
+package = sys.argv[1]
+recursive = sys.argv[2]
+
 backend = PackageKitYumBackend(sys.argv[1:])
-backend.get_requires(package)
+backend.get_requires(package, recursive)
 sys.exit(0)
diff --git a/client/pk-console.c b/client/pk-console.c
index e594e55..745d4da 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -497,7 +497,7 @@ pk_console_update_package (PkClient *client, const gchar *package)
  * pk_console_get_requires:
  **/
 static gboolean
-pk_console_get_requires(PkClient *client, const gchar *package)
+pk_console_get_requires (PkClient *client, const gchar *package)
 {
 	gboolean ret;
 	gchar *package_id;
@@ -506,7 +506,7 @@ pk_console_get_requires(PkClient *client, const gchar *package)
 		g_print ("Could not find a package with that name to get requires\n");
 		return FALSE;
 	}
-	ret = pk_client_get_requires (client, package_id);
+	ret = pk_client_get_requires (client, package_id, TRUE);
 	g_free (package_id);
 	return ret;
 }
@@ -515,7 +515,7 @@ pk_console_get_requires(PkClient *client, const gchar *package)
  * pk_console_get_depends:
  **/
 static gboolean
-pk_console_get_depends(PkClient *client, const gchar *package)
+pk_console_get_depends (PkClient *client, const gchar *package)
 {
 	gboolean ret;
 	gchar *package_id;
@@ -524,7 +524,7 @@ pk_console_get_depends(PkClient *client, const gchar *package)
 		g_print ("Could not find a package with that name to get depends\n");
 		return FALSE;
 	}
-	ret = pk_client_get_depends (client, package_id);
+	ret = pk_client_get_depends (client, package_id, FALSE);
 	g_free (package_id);
 	return ret;
 }
@@ -533,7 +533,7 @@ pk_console_get_depends(PkClient *client, const gchar *package)
  * pk_console_get_description:
  **/
 static gboolean
-pk_console_get_description(PkClient *client, const gchar *package)
+pk_console_get_description (PkClient *client, const gchar *package)
 {
 	gboolean ret;
 	gchar *package_id;
diff --git a/docs/pk-introduction.xml b/docs/pk-introduction.xml
index 8253d76..f59aab8 100644
--- a/docs/pk-introduction.xml
+++ b/docs/pk-introduction.xml
@@ -920,6 +920,16 @@
               <entry><literal>package_id</literal></entry>
               <entry>A single, valid, package ID.</entry>
             </row>
+            <row>
+              <entry><literal>recursive</literal></entry>
+              <entry>
+                Either "yes" or "no". If yes then the requirements should be
+                returned for all packages returned.
+                This means if gnome-power-manager depends on NetworkManager
+                and NetworkManager depends on HAL, then GetDepends on
+                gnome-power-manager should return both HAL and NetworkManager.
+              </entry>
+            </row>
           </tbody>
         </tgroup>
       </informaltable>
@@ -1033,6 +1043,16 @@
               <entry><literal>package_id</literal></entry>
               <entry>A single, valid, package ID.</entry>
             </row>
+            <row>
+              <entry><literal>recursive</literal></entry>
+              <entry>
+                Either "yes" or "no". If yes then the requirements should be
+                returned for all packages returned.
+                This means if gnome-power-manager depends on NetworkManager
+                and NetworkManager depends on HAL, then GetRequires on
+                HAL should return both gnome-power-manager and NetworkManager.
+              </entry>
+            </row>
           </tbody>
         </tgroup>
       </informaltable>
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index f5dddd3..e4a2003 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -1158,7 +1158,7 @@ pk_client_search_file (PkClient *client, const gchar *filter, const gchar *searc
  * pk_client_get_depends:
  **/
 gboolean
-pk_client_get_depends (PkClient *client, const gchar *package)
+pk_client_get_depends (PkClient *client, const gchar *package, gboolean recursive)
 {
 	gboolean ret;
 	GError *error;
@@ -1175,11 +1175,13 @@ pk_client_get_depends (PkClient *client, const gchar *package)
 	/* save this so we can re-issue it */
 	client->priv->role = PK_ROLE_ENUM_GET_DEPENDS;
 	client->priv->xcached_package_id = g_strdup (package);
+	client->priv->xcached_force = recursive;
 
 	error = NULL;
 	ret = dbus_g_proxy_call (client->priv->proxy, "GetDepends", &error,
 				 G_TYPE_STRING, client->priv->tid,
 				 G_TYPE_STRING, package,
+				 G_TYPE_BOOLEAN, recursive,
 				 G_TYPE_INVALID,
 				 G_TYPE_INVALID);
 	if (error != NULL) {
@@ -1201,7 +1203,7 @@ pk_client_get_depends (PkClient *client, const gchar *package)
  * pk_client_get_requires:
  **/
 gboolean
-pk_client_get_requires (PkClient *client, const gchar *package)
+pk_client_get_requires (PkClient *client, const gchar *package, gboolean recursive)
 {
 	gboolean ret;
 	GError *error;
@@ -1218,11 +1220,13 @@ pk_client_get_requires (PkClient *client, const gchar *package)
 	/* save this so we can re-issue it */
 	client->priv->role = PK_ROLE_ENUM_GET_REQUIRES;
 	client->priv->xcached_package_id = g_strdup (package);
+	client->priv->xcached_force = recursive;
 
 	error = NULL;
 	ret = dbus_g_proxy_call (client->priv->proxy, "GetRequires", &error,
 				 G_TYPE_STRING, client->priv->tid,
 				 G_TYPE_STRING, package,
+				 G_TYPE_BOOLEAN, recursive,
 				 G_TYPE_INVALID,
 				 G_TYPE_INVALID);
 	if (error != NULL) {
@@ -2209,7 +2213,8 @@ pk_client_requeue (PkClient *client)
 
 	/* do the correct action with the cached parameters */
 	if (client->priv->role == PK_ROLE_ENUM_GET_DEPENDS) {
-		pk_client_get_depends (client, client->priv->xcached_package_id);
+		pk_client_get_depends (client, client->priv->xcached_package_id,
+				       client->priv->xcached_force);
 	} else if (client->priv->role == PK_ROLE_ENUM_GET_UPDATE_DETAIL) {
 		pk_client_get_update_detail (client, client->priv->xcached_package_id);
 	} else if (client->priv->role == PK_ROLE_ENUM_RESOLVE) {
@@ -2222,7 +2227,8 @@ pk_client_requeue (PkClient *client)
 	} else if (client->priv->role == PK_ROLE_ENUM_GET_FILES) {
 		pk_client_get_files (client, client->priv->xcached_package_id);
 	} else if (client->priv->role == PK_ROLE_ENUM_GET_REQUIRES) {
-		pk_client_get_requires (client, client->priv->xcached_package_id);
+		pk_client_get_requires (client, client->priv->xcached_package_id,
+					client->priv->xcached_force);
 	} else if (client->priv->role == PK_ROLE_ENUM_GET_UPDATES) {
 		pk_client_get_updates (client);
 	} else if (client->priv->role == PK_ROLE_ENUM_SEARCH_DETAILS) {
diff --git a/libpackagekit/pk-client.h b/libpackagekit/pk-client.h
index 130d1fc..e5c1cbe 100644
--- a/libpackagekit/pk-client.h
+++ b/libpackagekit/pk-client.h
@@ -96,11 +96,13 @@ gboolean	 pk_client_search_file			(PkClient	*client,
 							 const gchar	*filter,
 							 const gchar	*search);
 gboolean	 pk_client_get_depends			(PkClient	*client,
-							 const gchar	*package_id);
+							 const gchar	*package_id,
+							 gboolean	 recursive);
 gboolean	 pk_client_get_update_detail		(PkClient	*client,
 							 const gchar	*package_id);
 gboolean	 pk_client_get_requires			(PkClient	*client,
-							 const gchar	*package_id);
+							 const gchar	*package_id,
+							 gboolean	 recursive);
 gboolean	 pk_client_get_description		(PkClient	*client,
 							 const gchar	*package_id);
 gboolean	 pk_client_get_files			(PkClient	*client,
diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index 05225ca..23223bd 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -219,14 +219,14 @@ class PackageKitBaseBackend:
         '''
         self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
 
-    def get_depends(self,package):
+    def get_depends(self,package,recursive):
         '''
         Implement the {backend}-get-depends functionality
         Needed to be implemented in a sub class
         '''
         self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
 
-    def get_requires(self,package):
+    def get_requires(self,package,recursive):
         '''
         Implement the {backend}-get-requires functionality
         Needed to be implemented in a sub class
diff --git a/python/packagekit/frontend.py b/python/packagekit/frontend.py
index 45e6707..93c30fd 100644
--- a/python/packagekit/frontend.py
+++ b/python/packagekit/frontend.py
@@ -300,12 +300,12 @@ class PackageKit:
 
 	@dbusException
 	@job_id
-	def GetRequires(self,package_id):
+	def GetRequires(self,package_id,recursive):
 		"""
 		Lists package dependancies?
 		(description is a guess, since this not doesn't seem to work for me)
 		"""
-		return self.pk_iface.GetRequires(self.tid(),package_id)
+		return self.pk_iface.GetRequires(self.tid(),package_id,recursive)
 
 	@dbusException
 	@job_id
diff --git a/src/pk-backend-internal.h b/src/pk-backend-internal.h
index cd83a77..168c597 100644
--- a/src/pk-backend-internal.h
+++ b/src/pk-backend-internal.h
@@ -68,7 +68,8 @@ const gchar	*pk_backend_get_name			(PkBackend	*backend);
 gboolean	 pk_backend_cancel			(PkBackend	*backend,
 							 gchar		**error_text);
 gboolean	 pk_backend_get_depends			(PkBackend	*backend,
-							 const gchar	*package_id);
+							 const gchar	*package_id,
+							 gboolean	 recursive);
 gboolean	 pk_backend_get_update_detail		(PkBackend	*backend,
 							 const gchar	*package_id);
 gboolean	 pk_backend_get_description		(PkBackend	*backend,
@@ -76,7 +77,8 @@ gboolean	 pk_backend_get_description		(PkBackend	*backend,
 gboolean	 pk_backend_get_files 			(PkBackend	*backend,
 							 const gchar	*package_id);
 gboolean	 pk_backend_get_requires		(PkBackend	*backend,
-							 const gchar	*package_id);
+							 const gchar	*package_id,
+							 gboolean	 recursive);
 gboolean	 pk_backend_get_updates			(PkBackend	*backend);
 gboolean	 pk_backend_install_package		(PkBackend	*backend,
 							 const gchar	*package_id);
diff --git a/src/pk-backend-python.c b/src/pk-backend-python.c
index e9aa646..0de1c6c 100644
--- a/src/pk-backend-python.c
+++ b/src/pk-backend-python.c
@@ -24,6 +24,18 @@
 /**
  * pk_backend_python_cancel:
  */
+static const gchar *
+pk_backend_bool_to_text (gboolean value)
+{
+	if (value == TRUE) {
+		return "yes";
+	}
+	return "no";
+}
+
+/**
+ * pk_backend_python_cancel:
+ */
 void
 pk_backend_python_cancel (PkBackend *backend)
 {
@@ -36,10 +48,10 @@ pk_backend_python_cancel (PkBackend *backend)
  * pk_backend_python_get_depends:
  */
 void
-pk_backend_python_get_depends (PkBackend *backend, const gchar *package_id)
+pk_backend_python_get_depends (PkBackend *backend, const gchar *package_id, gboolean recursive)
 {
 	g_return_if_fail (backend != NULL);
-	pk_backend_spawn_helper (backend, "get-depends.py", package_id, NULL);
+	pk_backend_spawn_helper (backend, "get-depends.py", package_id, pk_backend_bool_to_text (recursive), NULL);
 }
 
 /**
@@ -66,10 +78,10 @@ pk_backend_python_get_files (PkBackend *backend, const gchar *package_id)
  * pk_backend_python_get_requires:
  */
 void
-pk_backend_python_get_requires (PkBackend *backend, const gchar *package_id)
+pk_backend_python_get_requires (PkBackend *backend, const gchar *package_id, gboolean recursive)
 {
 	g_return_if_fail (backend != NULL);
-	pk_backend_spawn_helper (backend, "get-requires.py", package_id, NULL);
+	pk_backend_spawn_helper (backend, "get-requires.py", package_id, pk_backend_bool_to_text (recursive), NULL);
 }
 
 /**
@@ -141,13 +153,7 @@ void
 pk_backend_python_remove_package (PkBackend *backend, const gchar *package_id, gboolean allow_deps)
 {
 	g_return_if_fail (backend != NULL);
-	const gchar *deps;
-	if (allow_deps == TRUE) {
-		deps = "yes";
-	} else {
-		deps = "no";
-	}
-	pk_backend_spawn_helper (backend, "remove.py", deps, package_id, NULL);
+	pk_backend_spawn_helper (backend, "remove.py", pk_backend_bool_to_text (allow_deps), package_id, NULL);
 }
 
 /**
diff --git a/src/pk-backend-python.h b/src/pk-backend-python.h
index 61f7183..5a6d7df 100644
--- a/src/pk-backend-python.h
+++ b/src/pk-backend-python.h
@@ -29,7 +29,8 @@ G_BEGIN_DECLS
 void	pk_backend_python_cancel		(PkBackend	*backend);
 
 void	pk_backend_python_get_depends		(PkBackend	*backend,
-						 const gchar	*package_id);
+						 const gchar	*package_id,
+						 gboolean	 recursive);
 
 void	pk_backend_python_get_description	(PkBackend	*backend,
 						 const gchar	*package_id);
@@ -38,7 +39,8 @@ void	pk_backend_python_get_files		(PkBackend	*backend,
 						 const gchar	*package_id);
 
 void	pk_backend_python_get_requires		(PkBackend	*backend,
-						 const gchar	*package_id);
+						 const gchar	*package_id,
+						 gboolean	 recursive);
 
 void	pk_backend_python_get_update_detail	(PkBackend	*backend,
 						 const gchar	*package_id);
diff --git a/src/pk-backend.c b/src/pk-backend.c
index bee1f79..067880d 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -1188,7 +1188,8 @@ pk_backend_set_running (PkBackend *backend)
 	/* do the correct action with the cached parameters */
 	if (backend->priv->role == PK_ROLE_ENUM_GET_DEPENDS) {
 		backend->desc->get_depends (backend,
-					    backend->priv->xcached_package_id);
+					    backend->priv->xcached_package_id,
+					    backend->priv->xcached_force);
 	} else if (backend->priv->role == PK_ROLE_ENUM_GET_UPDATE_DETAIL) {
 		backend->desc->get_update_detail (backend,
 						  backend->priv->xcached_package_id);
@@ -1205,7 +1206,8 @@ pk_backend_set_running (PkBackend *backend)
 					  backend->priv->xcached_package_id);
 	} else if (backend->priv->role == PK_ROLE_ENUM_GET_REQUIRES) {
 		backend->desc->get_requires (backend,
-					     backend->priv->xcached_package_id);
+					     backend->priv->xcached_package_id,
+					     backend->priv->xcached_force);
 	} else if (backend->priv->role == PK_ROLE_ENUM_GET_UPDATES) {
 		backend->desc->get_updates (backend);
 	} else if (backend->priv->role == PK_ROLE_ENUM_SEARCH_DETAILS) {
@@ -1279,7 +1281,7 @@ pk_backend_run (PkBackend *backend)
  * pk_backend_get_depends:
  */
 gboolean
-pk_backend_get_depends (PkBackend *backend, const gchar *package_id)
+pk_backend_get_depends (PkBackend *backend, const gchar *package_id, gboolean recursive)
 {
 	g_return_val_if_fail (backend != NULL, FALSE);
 	if (backend->desc->get_depends == NULL) {
@@ -1287,6 +1289,7 @@ pk_backend_get_depends (PkBackend *backend, const gchar *package_id)
 		return FALSE;
 	}
 	backend->priv->xcached_package_id = g_strdup (package_id);
+	backend->priv->xcached_force = recursive;
 	pk_backend_set_role (backend, PK_ROLE_ENUM_GET_DEPENDS);
 	return TRUE;
 }
@@ -1343,7 +1346,7 @@ pk_backend_get_files (PkBackend *backend, const gchar *package_id)
  * pk_backend_get_requires:
  */
 gboolean
-pk_backend_get_requires (PkBackend *backend, const gchar *package_id)
+pk_backend_get_requires (PkBackend *backend, const gchar *package_id, gboolean recursive)
 {
 	g_return_val_if_fail (backend != NULL, FALSE);
 	if (backend->desc->get_requires == NULL) {
@@ -1351,6 +1354,7 @@ pk_backend_get_requires (PkBackend *backend, const gchar *package_id)
 		return FALSE;
 	}
 	backend->priv->xcached_package_id = g_strdup (package_id);
+	backend->priv->xcached_force = recursive;
 	pk_backend_set_role (backend, PK_ROLE_ENUM_GET_REQUIRES);
 	return TRUE;
 }
diff --git a/src/pk-backend.h b/src/pk-backend.h
index 76dd496..d1e99ca 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -123,10 +123,10 @@ struct _PkBackendDesc {
 	void		(*get_groups)		(PkBackend *backend, PkEnumList *elist);
 	void		(*get_filters)		(PkBackend *backend, PkEnumList *elist);
 	void		(*cancel)		(PkBackend *backend);
-	void		(*get_depends)		(PkBackend *backend, const gchar *package_id);
+	void		(*get_depends)		(PkBackend *backend, const gchar *package_id, gboolean recursive);
 	void		(*get_description)	(PkBackend *backend, const gchar *package_id);
 	void		(*get_files)	        (PkBackend *backend, const gchar *package_id);
-	void		(*get_requires)		(PkBackend *backend, const gchar *package_id);
+	void		(*get_requires)		(PkBackend *backend, const gchar *package_id, gboolean recursive);
 	void		(*get_update_detail)	(PkBackend *backend, const gchar *package_id);
 	void		(*get_updates)		(PkBackend *backend);
 	void		(*install_package)	(PkBackend *backend, const gchar *package_id);
diff --git a/src/pk-engine.c b/src/pk-engine.c
index d79703c..48a52a0 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -1268,7 +1268,7 @@ pk_engine_resolve (PkEngine *engine, const gchar *tid, const gchar *filter, cons
  * pk_engine_get_depends:
  **/
 gboolean
-pk_engine_get_depends (PkEngine *engine, const gchar *tid, const gchar *package_id, GError **error)
+pk_engine_get_depends (PkEngine *engine, const gchar *tid, const gchar *package_id, gboolean recursive, GError **error)
 {
 	gboolean ret;
 	PkTransactionItem *item;
@@ -1276,7 +1276,7 @@ pk_engine_get_depends (PkEngine *engine, const gchar *tid, const gchar *package_
 	g_return_val_if_fail (engine != NULL, FALSE);
 	g_return_val_if_fail (PK_IS_ENGINE (engine), FALSE);
 
-	pk_debug ("GetDepends method called: %s, %s", tid, package_id);
+	pk_debug ("GetDepends method called: %s, %s, %i", tid, package_id, recursive);
 
 	/* find pre-requested transaction id */
 	item = pk_transaction_list_get_from_tid (engine->priv->transaction_list, tid);
@@ -1310,7 +1310,7 @@ pk_engine_get_depends (PkEngine *engine, const gchar *tid, const gchar *package_
 		return FALSE;
 	}
 
-	ret = pk_backend_get_depends (item->backend, package_id);
+	ret = pk_backend_get_depends (item->backend, package_id, recursive);
 	if (ret == FALSE) {
 		g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
 			     "Operation not yet supported by backend");
@@ -1325,7 +1325,7 @@ pk_engine_get_depends (PkEngine *engine, const gchar *tid, const gchar *package_
  * pk_engine_get_requires:
  **/
 gboolean
-pk_engine_get_requires (PkEngine *engine, const gchar *tid, const gchar *package_id, GError **error)
+pk_engine_get_requires (PkEngine *engine, const gchar *tid, const gchar *package_id, gboolean recursive, GError **error)
 {
 	gboolean ret;
 	PkTransactionItem *item;
@@ -1333,7 +1333,7 @@ pk_engine_get_requires (PkEngine *engine, const gchar *tid, const gchar *package
 	g_return_val_if_fail (engine != NULL, FALSE);
 	g_return_val_if_fail (PK_IS_ENGINE (engine), FALSE);
 
-	pk_debug ("GetRequires method called: %s, %s", tid, package_id);
+	pk_debug ("GetRequires method called: %s, %s, %i", tid, package_id, recursive);
 
 	/* find pre-requested transaction id */
 	item = pk_transaction_list_get_from_tid (engine->priv->transaction_list, tid);
@@ -1367,7 +1367,7 @@ pk_engine_get_requires (PkEngine *engine, const gchar *tid, const gchar *package
 		return FALSE;
 	}
 
-	ret = pk_backend_get_requires (item->backend, package_id);
+	ret = pk_backend_get_requires (item->backend, package_id, recursive);
 	if (ret == FALSE) {
 		g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
 			     "Operation not yet supported by backend");
diff --git a/src/pk-engine.h b/src/pk-engine.h
index 0f3995e..26a166a 100644
--- a/src/pk-engine.h
+++ b/src/pk-engine.h
@@ -106,6 +106,7 @@ gboolean	 pk_engine_search_file			(PkEngine	*engine,
 gboolean	 pk_engine_get_depends			(PkEngine	*engine,
 							 const gchar	*tid,
 							 const gchar	*package_id,
+							 gboolean	 recursive,
 							 GError		**error);
 gboolean	 pk_engine_get_update_detail		(PkEngine	*engine,
 							 const gchar	*tid,
@@ -114,6 +115,7 @@ gboolean	 pk_engine_get_update_detail		(PkEngine	*engine,
 gboolean	 pk_engine_get_requires			(PkEngine	*engine,
 							 const gchar	*tid,
 							 const gchar	*package_id,
+							 gboolean	 recursive,
 							 GError		**error);
 gboolean	 pk_engine_get_description		(PkEngine	*engine,
 							 const gchar	*tid,
diff --git a/src/pk-interface.xml b/src/pk-interface.xml
index fbcf830..8734fdd 100644
--- a/src/pk-interface.xml
+++ b/src/pk-interface.xml
@@ -50,10 +50,12 @@
     <method name="GetDepends">
       <arg type="s" name="tid" direction="in"/>
       <arg type="s" name="package_id" direction="in"/>
+      <arg type="b" name="recursive" direction="in"/>
     </method>
     <method name="GetRequires">
       <arg type="s" name="tid" direction="in"/>
       <arg type="s" name="package_id" direction="in"/>
+      <arg type="b" name="recursive" direction="in"/>
     </method>
     <method name="GetUpdateDetail">
       <arg type="s" name="tid" direction="in"/>
commit 9741c3add7718813352c431384cb933956cc4e13
Author: Tom Parker <palfrey at tevp.net>
Date:   Wed Nov 7 18:32:34 2007 +0100

    Add resolve action to apt backend

diff --git a/backends/apt/helpers/aptBackend.py b/backends/apt/helpers/aptBackend.py
index 314b826..269dc6e 100644
--- a/backends/apt/helpers/aptBackend.py
+++ b/backends/apt/helpers/aptBackend.py
@@ -282,6 +282,13 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         description = re.sub('\s+', ' ', pkg.description).strip()
         self.description(package, 'unknown', pkg.group, description, '', 0, '')
 
+    def resolve(self, name):
+        '''
+        Implement the {backend}-resolve functionality
+        '''
+        pkg = Package(self._apt_cache[name], self)
+        self._emit_package(pkg)
+
     ### Helpers ###
     def _emit_package(self, package):
         id = self.get_package_id(package.name,
diff --git a/backends/apt/helpers/resolve.py b/backends/apt/helpers/resolve.py
new file mode 100755
index 0000000..aac34df
--- /dev/null
+++ b/backends/apt/helpers/resolve.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2007 Richard Hughes <richard at hughsie.com>
+#
+# Licensed under the GNU General Public License Version 2
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+import sys
+
+from aptBackend import PackageKitAptBackend
+filters = sys.argv[1]
+name=sys.argv[2]
+backend = PackageKitAptBackend(sys.argv[2:])
+backend.resolve(name)
+backend.unLock()
+sys.exit(0)
diff --git a/backends/apt/pk-backend-apt.c b/backends/apt/pk-backend-apt.c
index 659de32..484717d 100644
--- a/backends/apt/pk-backend-apt.c
+++ b/backends/apt/pk-backend-apt.c
@@ -123,7 +123,7 @@ PK_BACKEND_OPTIONS (
 	NULL,					/* install_file */
 	pk_backend_python_refresh_cache,			/* refresh_cache */
 	pk_backend_python_remove_package,			/* remove_package */
-	NULL,					/* resolve */
+	pk_backend_python_resolve,					/* resolve */
 	NULL,					/* rollback */
 	backend_search_details,			/* search_details */
 	NULL,					/* search_file */
commit e6a8f316988fefdefbc47c1d953bac815dde9800
Author: Tom Parker <palfrey at tevp.net>
Date:   Wed Nov 7 18:31:36 2007 +0100

    Replace various functions in apt backend with pk-python ones

diff --git a/backends/apt/pk-backend-apt.c b/backends/apt/pk-backend-apt.c
index 513d0e4..659de32 100644
--- a/backends/apt/pk-backend-apt.c
+++ b/backends/apt/pk-backend-apt.c
@@ -23,6 +23,7 @@
 #include <glib.h>
 #include <string.h>
 #include <pk-backend.h>
+#include <pk-backend-python.h>
 
 /**
  * backend_get_groups:
@@ -71,65 +72,6 @@ backend_get_description (PkBackend *backend, const gchar *package_id)
 }
 
 /**
- * backend_get_updates:
- */
-static void
-backend_get_updates (PkBackend *backend)
-{
-	g_return_if_fail (backend != NULL);
-	pk_backend_allow_interrupt (backend, TRUE);
-	pk_backend_spawn_helper (backend, "get-updates.py", NULL);
-}
-
-/**
- * backend_install_package:
- */
-static void
-backend_install_package (PkBackend *backend, const gchar *package_id)
-{
-	g_return_if_fail (backend != NULL);
-	/* check network state */
-	if (pk_backend_network_is_online (backend) == FALSE) {
-		pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot install when offline");
-		pk_backend_finished (backend);
-		return;
-	}
-	pk_backend_spawn_helper (backend, "install.py", package_id, NULL);
-}
-
-/**
- * backend_refresh_cache:
- */
-static void
-backend_refresh_cache (PkBackend *backend, gboolean force)
-{
-	g_return_if_fail (backend != NULL);
-	/* check network state */
-	if (pk_backend_network_is_online (backend) == FALSE) {
-		pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot refresh cache when offline");
-		pk_backend_finished (backend);
-		return;
-	}
-	pk_backend_spawn_helper (backend, "refresh-cache.py", NULL);
-}
-
-/**
- * backend_remove_package:
- */
-static void
-backend_remove_package (PkBackend *backend, const gchar *package_id, gboolean allow_deps)
-{
-	g_return_if_fail (backend != NULL);
-	const gchar *deps;
-	if (allow_deps == TRUE) {
-		deps = "yes";
-	} else {
-		deps = "no";
-	}
-	pk_backend_spawn_helper (backend, "remove.py", deps, package_id, NULL);
-}
-
-/**
  * backend_search_details:
  */
 
@@ -163,45 +105,6 @@ backend_search_group (PkBackend *backend, const gchar *filter, const gchar *sear
 	pk_backend_spawn_helper (backend, "search-group.py", filter, search, NULL);
 }
 
-/**
-  * backend_update_package:
- */
-static void
-backend_update_package (PkBackend *backend, const gchar *package_id)
-{
-	g_return_if_fail (backend != NULL);
-	/* check network state */
-	if (pk_backend_network_is_online (backend) == FALSE) {
-		pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot update when offline");
-		pk_backend_finished (backend);
-		return;
-	}
-	pk_backend_spawn_helper (backend, "update.py", package_id, NULL);
-}
-
-/**
- * backend_update_system:
- */
-static void
-backend_update_system (PkBackend *backend)
-{
-	g_return_if_fail (backend != NULL);
-	pk_backend_spawn_helper (backend, "update-system.py", NULL);
-}
-
-/**
- * backend_get_depends:
- */
-/**
-static void
-backend_get_depends (PkBackend *backend, const gchar *package_id)
-{
-	g_return_if_fail (backend != NULL);
-	pk_backend_allow_interrupt (backend, TRUE);
-	pk_backend_spawn_helper (backend, "get-depends.py", package_id, NULL);
-}
- */
-
 PK_BACKEND_OPTIONS (
 	"Apt",				/* description */
 	"Ali Sabil <ali.sabil at gmail.com>",	/* author */
@@ -215,19 +118,19 @@ PK_BACKEND_OPTIONS (
 	NULL,					/* get_files */
 	NULL,					/* get_requires */
 	NULL,					/* get_update_detail */
-	backend_get_updates,			/* get_updates */
-	backend_install_package,		/* install_package */
+	pk_backend_python_get_updates,			/* get_updates */
+	pk_backend_python_install_package,		/* install_package */
 	NULL,					/* install_file */
-	backend_refresh_cache,			/* refresh_cache */
-	backend_remove_package,			/* remove_package */
+	pk_backend_python_refresh_cache,			/* refresh_cache */
+	pk_backend_python_remove_package,			/* remove_package */
 	NULL,					/* resolve */
 	NULL,					/* rollback */
 	backend_search_details,			/* search_details */
 	NULL,					/* search_file */
 	backend_search_group,			/* search_group */
 	backend_search_name,			/* search_name */
-	backend_update_package,			/* update_package */
-	backend_update_system,			/* update_system */
+	pk_backend_python_update_package,			/* update_package */
+	pk_backend_python_update_system,			/* update_system */
 	NULL,					/* get_repo_list */
 	NULL,					/* repo_enable */
 	NULL					/* repo_set_data */
commit 614147649a97f9a17a436a1f87786027e375e2d7
Author: Tom Parker <palfrey at tevp.net>
Date:   Wed Nov 7 12:39:07 2007 +0100

    Fix python bugs caught by pychecker

diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index ed35542..05225ca 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -318,7 +318,6 @@ class PackageKitBaseBackend:
         '''
         self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
 
-
     def get_repo_list(self):
         '''
         Implement the {backend}-get-repo-list functionality
@@ -326,13 +325,6 @@ class PackageKitBaseBackend:
         '''
         self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
 
-    def get_update_detail(self,package):
-        '''
-        Implement the {backend}-get-update_detail functionality
-        Needed to be implemented in a sub class
-        '''
-        self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
-
 class PackagekitProgress:
     '''
     Progress class there controls the total progress of a transaction
diff --git a/python/packagekit/frontend.py b/python/packagekit/frontend.py
index f79403a..45e6707 100644
--- a/python/packagekit/frontend.py
+++ b/python/packagekit/frontend.py
@@ -25,9 +25,6 @@ import gobject
 from enums import PackageKitEnum
 
 class PackageKitException(Exception):
-	def __init__(self):
-		Exception.__init__(self)
-
 	def __init__(self,e=None):
 		Exception.__init__(self)
 		if e == None:
@@ -143,9 +140,11 @@ class PackageKit:
 			):
 		pass
 
-	def Percentage(self,
+	def ProgressChanged(self,
 			jid,        # Job ID
-			progress    # 0.0 - 100.0
+			percent,    # 0.0 - 100.0
+			elapsed,	# time
+			remaining	# time
 			):
 		pass
 
commit 5fb22645be870cc95570f6ca74c86745c94ed75b
Author: Tom Parker <palfrey at tevp.net>
Date:   Wed Nov 7 12:30:48 2007 +0100

    Don't need to import types in packagekit.frontend

diff --git a/python/packagekit/frontend.py b/python/packagekit/frontend.py
index b5f4bff..f79403a 100644
--- a/python/packagekit/frontend.py
+++ b/python/packagekit/frontend.py
@@ -19,7 +19,6 @@
 #    Tom Parker <palfrey at tevp.net>
 #    Robin Norwood <rnorwood at redhat.com>
 
-from types import *
 import dbus
 from dbus.mainloop.glib import DBusGMainLoop
 import gobject



More information about the PackageKit mailing list