[PackageKit-commit] packagekit: Branch 'master' - 18 commits

Richard Hughes hughsient at kemper.freedesktop.org
Thu Apr 10 19:09:51 PDT 2008


 backends/alpm/pk-backend-alpm.c          |    1 
 backends/apt/helpers/aptBackend.py       |   13 +
 backends/apt/pk-backend-apt.c            |    1 
 backends/apt2/aptDBUSBackend.py          |   16 +-
 backends/apt2/pk-backend-apt2.c          |    1 
 backends/box/pk-backend-box.c            |    1 
 backends/conary/helpers/conaryBackend.py |    6 
 backends/conary/pk-backend-conary.c      |    1 
 backends/dummy/pk-backend-dummy.c        |   15 ++
 backends/opkg/pk-backend-opkg.c          |    1 
 backends/pisi/helpers/pisiBackend.py     |   10 -
 backends/pisi/pk-backend-pisi.c          |    1 
 backends/poldek/pk-backend-poldek.c      |    9 +
 backends/smart/pk-backend-smart.c        |    1 
 backends/test/pk-backend-test-dbus.c     |    1 
 backends/test/pk-backend-test-fail.c     |    1 
 backends/test/pk-backend-test-nop.c      |    1 
 backends/test/pk-backend-test-spawn.c    |    1 
 backends/test/pk-backend-test-succeed.c  |   11 +
 backends/test/pk-backend-test-thread.c   |    1 
 backends/yum/helpers/yumBackend.py       |   48 ++++---
 backends/yum/pk-backend-yum.c            |    1 
 backends/yum2/pk-backend-yum2.c          |    1 
 backends/zypp/pk-backend-zypp.cpp        |   73 ++++-------
 backends/zypp/zypp-utils.cpp             |   28 ++--
 backends/zypp/zypp-utils.h               |    4 
 client/pk-console.c                      |   30 ++--
 client/pk-import-desktop.c               |    2 
 client/pk-import-specspo.c               |    2 
 contrib/pk-completion.bash               |    1 
 docs/html/img/pk-repo.png                |binary
 docs/html/pk-faq.html                    |   15 ++
 docs/spec/pk-methods.xml                 |   38 +++++
 libpackagekit/pk-client.c                |  204 +++++++++++++++++++++----------
 libpackagekit/pk-client.h                |   24 ++-
 libpackagekit/pk-enum.c                  |  119 ++++++++++++++++--
 libpackagekit/pk-enum.h                  |   94 +++++++-------
 libpackagekit/pk-task-list.c             |    2 
 python/packagekit/backend.py             |    7 +
 python/packagekit/daemonBackend.py       |   17 ++
 src/pk-backend-dbus.c                    |   29 ++++
 src/pk-backend-dbus.h                    |    2 
 src/pk-backend.h                         |    5 
 src/pk-engine.c                          |    3 
 src/pk-interface-transaction.xml         |    5 
 src/pk-transaction-db.c                  |    6 
 src/pk-transaction.c                     |   65 +++++++++
 src/pk-transaction.h                     |    5 
 tools/add-method.sh                      |    2 
 49 files changed, 671 insertions(+), 254 deletions(-)

New commits:
commit d713327f425a2216102f63831d6959d8a7338561
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Apr 11 03:05:16 2008 +0100

    add a GetPackages method so we can get package lists without a search term

diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c
index c6283ad..7ec5e40 100644
--- a/backends/alpm/pk-backend-alpm.c
+++ b/backends/alpm/pk-backend-alpm.c
@@ -799,6 +799,7 @@ PK_BACKEND_OPTIONS (
  	NULL,						/* get_depends */
 	NULL,						/* get_description */
 	NULL,						/* get_files */
+	NULL,						/* get_packages */
 	backend_get_repo_list,				/* get_repo_list */
 	NULL,						/* get_requires */
 	NULL,						/* get_update_detail */
diff --git a/backends/apt/pk-backend-apt.c b/backends/apt/pk-backend-apt.c
index 6d8a65f..cb9170a 100644
--- a/backends/apt/pk-backend-apt.c
+++ b/backends/apt/pk-backend-apt.c
@@ -253,6 +253,7 @@ PK_BACKEND_OPTIONS (
 	backend_get_depends,			/* get_depends */
 	backend_get_description,		/* get_description */
 	NULL,					/* get_files */
+	NULL,					/* get_packages */
 	backend_get_repo_list,			/* get_repo_list */
 	NULL,					/* get_requires */
 	backend_get_update_detail,		/* get_update_detail */
diff --git a/backends/apt2/pk-backend-apt2.c b/backends/apt2/pk-backend-apt2.c
index bae9444..0814405 100644
--- a/backends/apt2/pk-backend-apt2.c
+++ b/backends/apt2/pk-backend-apt2.c
@@ -234,6 +234,7 @@ PK_BACKEND_OPTIONS (
 	NULL,					/* get_depends */
 	backend_get_description,	        /* get_description */
 	NULL,					/* get_files */
+	NULL,					/* get_packages */
 	NULL,					/* get_repo_list */
 	NULL,					/* get_requires */
 	NULL,					/* get_update_detail */
diff --git a/backends/box/pk-backend-box.c b/backends/box/pk-backend-box.c
index 193028c..72c228d 100644
--- a/backends/box/pk-backend-box.c
+++ b/backends/box/pk-backend-box.c
@@ -861,6 +861,7 @@ PK_BACKEND_OPTIONS (
 	backend_get_depends,			/* get_depends */
 	backend_get_description,		/* get_description */
 	backend_get_files,			/* get_files */
+	NULL,					/* get_packages */
 	backend_get_repo_list,			/* get_repo_list */
 	backend_get_requires,			/* get_requires */
 	NULL,					/* get_update_detail */
diff --git a/backends/conary/pk-backend-conary.c b/backends/conary/pk-backend-conary.c
index 563a053..4f00684 100644
--- a/backends/conary/pk-backend-conary.c
+++ b/backends/conary/pk-backend-conary.c
@@ -399,6 +399,7 @@ PK_BACKEND_OPTIONS (
 	NULL,					/* get_depends */
 	backend_get_description,		/* get_description */
 	backend_get_files,			/* get_files */
+	NULL,					/* get_packages */
 	NULL,					/* get_repo_list */
 	NULL,					/* get_requires */
 	backend_get_update_detail,              /* get_update_detail */
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index 0320927..c681ff0 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -749,6 +749,20 @@ backend_what_provides (PkBackend *backend, const gchar *filter, PkProvidesEnum p
 	pk_backend_finished (backend);
 }
 
+/**
+ * backend_get_packages:
+ */
+static void
+backend_get_packages (PkBackend *backend, const gchar *filter)
+{
+	g_return_if_fail (backend != NULL);
+	pk_backend_set_status (backend, PK_STATUS_ENUM_REQUEST);
+	pk_backend_package (backend, PK_INFO_ENUM_INSTALLED,
+			    "update1;2.19.1-4.fc8;i386;fedora",
+			    "The first update");
+	pk_backend_finished (backend);
+}
+
 PK_BACKEND_OPTIONS (
 	"Dummy",				/* description */
 	"Richard Hughes <richard at hughsie.com>",	/* author */
@@ -760,6 +774,7 @@ PK_BACKEND_OPTIONS (
 	backend_get_depends,			/* get_depends */
 	backend_get_description,		/* get_description */
 	backend_get_files,			/* get_files */
+	backend_get_packages,			/* get_packages */
 	backend_get_repo_list,			/* get_repo_list */
 	backend_get_requires,			/* get_requires */
 	backend_get_update_detail,		/* get_update_detail */
diff --git a/backends/opkg/pk-backend-opkg.c b/backends/opkg/pk-backend-opkg.c
index 15bce61..78ac73d 100644
--- a/backends/opkg/pk-backend-opkg.c
+++ b/backends/opkg/pk-backend-opkg.c
@@ -1063,6 +1063,7 @@ PK_BACKEND_OPTIONS (
 	backend_get_depends,			/* get_depends */
 	backend_get_description,		/* get_description */
 	NULL,					/* get_files */
+	NULL,					/* get_packages */
 	NULL,					/* get_repo_list */
 	NULL,					/* get_requires */
 	NULL,					/* get_update_detail */
diff --git a/backends/pisi/pk-backend-pisi.c b/backends/pisi/pk-backend-pisi.c
index 3ccc6a5..9fcde95 100644
--- a/backends/pisi/pk-backend-pisi.c
+++ b/backends/pisi/pk-backend-pisi.c
@@ -367,6 +367,7 @@ PK_BACKEND_OPTIONS (
 	backend_get_depends,			/* get_depends */
 	backend_get_description,		/* get_description */
 	backend_get_files,			/* get_files */
+	NULL,					/* get_packages */
 	backend_get_repo_list,			/* get_repo_list */
 	backend_get_requires,			/* get_requires */
 	NULL,					/* get_update_detail */
diff --git a/backends/poldek/pk-backend-poldek.c b/backends/poldek/pk-backend-poldek.c
index 079884d..442ae56 100644
--- a/backends/poldek/pk-backend-poldek.c
+++ b/backends/poldek/pk-backend-poldek.c
@@ -2007,6 +2007,7 @@ PK_BACKEND_OPTIONS (
 	backend_get_depends,				/* get_depends */
 	backend_get_description,			/* get_description */
 	backend_get_files,				/* get_files */
+	NULL,						/* get_packages */
 	backend_get_repo_list,				/* get_repo_list */
 	backend_get_requires,				/* get_requires */
 	backend_get_update_detail,			/* get_update_detail */
diff --git a/backends/smart/pk-backend-smart.c b/backends/smart/pk-backend-smart.c
index f0d3a01..af0a83a 100644
--- a/backends/smart/pk-backend-smart.c
+++ b/backends/smart/pk-backend-smart.c
@@ -268,6 +268,7 @@ PK_BACKEND_OPTIONS (
 	backend_get_depends,				/* get_depends */
 	backend_get_description,			/* get_description */
 	backend_get_files,				/* get_files */
+	NULL,						/* get_packages */
 	backend_get_repo_list,				/* get_repo_list */
 	NULL,						/* get_requires */
 	NULL,						/* get_update_detail */
diff --git a/backends/test/pk-backend-test-dbus.c b/backends/test/pk-backend-test-dbus.c
index 626536a..a1e1a53 100644
--- a/backends/test/pk-backend-test-dbus.c
+++ b/backends/test/pk-backend-test-dbus.c
@@ -89,6 +89,7 @@ PK_BACKEND_OPTIONS (
 	NULL,					/* get_depends */
 	NULL,					/* get_description */
 	NULL,					/* get_files */
+	NULL,					/* get_packages */
 	NULL,					/* get_repo_list */
 	NULL,					/* get_requires */
 	NULL,					/* get_update_detail */
diff --git a/backends/test/pk-backend-test-fail.c b/backends/test/pk-backend-test-fail.c
index dc4fb45..0c91c27 100644
--- a/backends/test/pk-backend-test-fail.c
+++ b/backends/test/pk-backend-test-fail.c
@@ -281,6 +281,7 @@ PK_BACKEND_OPTIONS (
 	backend_get_depends,			/* get_depends */
 	backend_get_description,		/* get_description */
 	backend_get_files,			/* get_files */
+	NULL,					/* get_packages */
 	NULL,					/* get_repo_list */
 	backend_get_requires,			/* get_requires */
 	backend_get_update_detail,		/* get_update_detail */
diff --git a/backends/test/pk-backend-test-nop.c b/backends/test/pk-backend-test-nop.c
index 60ad50c..d642095 100644
--- a/backends/test/pk-backend-test-nop.c
+++ b/backends/test/pk-backend-test-nop.c
@@ -34,6 +34,7 @@ PK_BACKEND_OPTIONS (
 	NULL,					/* get_depends */
 	NULL,					/* get_description */
 	NULL,					/* get_files */
+	NULL,					/* get_packages */
 	NULL,					/* get_repo_list */
 	NULL,					/* get_requires */
 	NULL,					/* get_update_detail */
diff --git a/backends/test/pk-backend-test-spawn.c b/backends/test/pk-backend-test-spawn.c
index 5c12fcf..5dc8f66 100644
--- a/backends/test/pk-backend-test-spawn.c
+++ b/backends/test/pk-backend-test-spawn.c
@@ -75,6 +75,7 @@ PK_BACKEND_OPTIONS (
 	NULL,					/* get_depends */
 	NULL,					/* get_description */
 	NULL,					/* get_files */
+	NULL,					/* get_packages */
 	NULL,					/* get_repo_list */
 	NULL,					/* get_requires */
 	NULL,					/* get_update_detail */
diff --git a/backends/test/pk-backend-test-succeed.c b/backends/test/pk-backend-test-succeed.c
index c1153ad..df971c2 100644
--- a/backends/test/pk-backend-test-succeed.c
+++ b/backends/test/pk-backend-test-succeed.c
@@ -336,6 +336,16 @@ backend_what_provides (PkBackend *backend, const gchar *filter, PkProvidesEnum p
 	pk_backend_finished (backend);
 }
 
+/**
+ * backend_get_packages:
+ */
+static void
+backend_get_packages (PkBackend *backend, const gchar *filter)
+{
+	g_return_if_fail (backend != NULL);
+	pk_backend_finished (backend);
+}
+
 PK_BACKEND_OPTIONS (
 	"Test Succeed",				/* description */
 	"Richard Hughes <richard at hughsie.com>",	/* author */
@@ -347,6 +357,7 @@ PK_BACKEND_OPTIONS (
 	backend_get_depends,			/* get_depends */
 	backend_get_description,		/* get_description */
 	backend_get_files,			/* get_files */
+	backend_get_packages,			/* get_packages */
 	backend_get_repo_list,			/* get_repo_list */
 	backend_get_requires,			/* get_requires */
 	backend_get_update_detail,		/* get_update_detail */
diff --git a/backends/test/pk-backend-test-thread.c b/backends/test/pk-backend-test-thread.c
index 88b18bb..0a8b4c1 100644
--- a/backends/test/pk-backend-test-thread.c
+++ b/backends/test/pk-backend-test-thread.c
@@ -142,6 +142,7 @@ PK_BACKEND_OPTIONS (
 	NULL,					/* get_depends */
 	NULL,					/* get_description */
 	NULL,					/* get_files */
+	NULL,					/* get_packages */
 	NULL,					/* get_repo_list */
 	NULL,					/* get_requires */
 	NULL,					/* get_update_detail */
diff --git a/backends/yum/pk-backend-yum.c b/backends/yum/pk-backend-yum.c
index 969d8df..aa3f853 100644
--- a/backends/yum/pk-backend-yum.c
+++ b/backends/yum/pk-backend-yum.c
@@ -418,6 +418,7 @@ PK_BACKEND_OPTIONS (
 	backend_get_depends,			/* get_depends */
 	backend_get_description,		/* get_description */
 	backend_get_files,			/* get_files */
+	NULL,					/* get_packages */
 	backend_get_repo_list,			/* get_repo_list */
 	backend_get_requires,			/* get_requires */
 	backend_get_update_detail,		/* get_update_detail */
diff --git a/backends/yum2/pk-backend-yum2.c b/backends/yum2/pk-backend-yum2.c
index 4530095..bdd4766 100644
--- a/backends/yum2/pk-backend-yum2.c
+++ b/backends/yum2/pk-backend-yum2.c
@@ -380,6 +380,7 @@ PK_BACKEND_OPTIONS (
 	backend_get_depends,			/* get_depends */
 	backend_get_description,		/* get_description */
 	backend_get_files,			/* get_files */
+	NULL,					/* get_packages */
 	backend_get_repo_list,			/* get_repo_list */
 	backend_get_requires,			/* get_requires */
 	backend_get_update_detail,		/* get_update_detail */
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 0a578d5..1eaedf8 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -1778,6 +1778,7 @@ extern "C" PK_BACKEND_OPTIONS (
 	backend_get_depends,			/* get_depends */
 	backend_get_description,		/* get_description */
 	backend_get_files,			/* get_files */
+	NULL,					/* get_packages */
 	backend_get_repo_list,			/* get_repo_list */
 	backend_get_requires,			/* get_requires */
 	backend_get_update_detail,		/* get_update_detail */
diff --git a/client/pk-console.c b/client/pk-console.c
index ed0ba0b..4b0bca4 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -991,6 +991,8 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], GError **
 			}
 		} else if (strcmp (value, "updates") == 0) {
 			ret = pk_client_get_updates (client, PK_FILTER_ENUM_BASENAME, error);
+		} else if (strcmp (value, "packages") == 0) {
+			ret = pk_client_get_packages (client, PK_FILTER_ENUM_INSTALLED, error);
 		} else if (strcmp (value, "actions") == 0) {
 			elist = pk_control_get_actions (control);
 			pk_enum_list_print (elist);
diff --git a/contrib/pk-completion.bash b/contrib/pk-completion.bash
index b12298f..b4f5f23 100755
--- a/contrib/pk-completion.bash
+++ b/contrib/pk-completion.bash
@@ -87,6 +87,7 @@ _pkcon_get ()
             depends
             requires
             provides
+            packages
             description
             files
             updatedetail
diff --git a/docs/html/pk-faq.html b/docs/html/pk-faq.html
index 5193ef6..91ffc76 100644
--- a/docs/html/pk-faq.html
+++ b/docs/html/pk-faq.html
@@ -405,6 +405,21 @@
 <td><img src="img/status-bad.png" alt="[no]"/></td><!-- yum2 -->
 <td><img src="img/status-good.png" alt="[yes]"/></td><!-- zypp -->
 </tr>
+<tr>
+<td><b>GetFiles</b></td>
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- apt -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- apt2 -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- alpm -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- box -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- conary -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- opkg -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- pisi -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- poldek -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- smart -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- yum -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- yum2 -->
+<td><img src="img/status-good.png" alt="[no]"/></td><!-- zypp -->
+</tr>
 </table>
 
 <h4>Filters</h4>
diff --git a/docs/spec/pk-methods.xml b/docs/spec/pk-methods.xml
index 2ed1b22..c75d5e6 100644
--- a/docs/spec/pk-methods.xml
+++ b/docs/spec/pk-methods.xml
@@ -7,6 +7,42 @@
     Methods used by the backends are as follows:
   </para>
 
+  <sect1 id="methods-get-packages">
+    <title>Get Packages</title>
+    <para>
+      The arguments are:
+    </para>
+    <informaltable>
+      <tgroup cols="2">
+        <thead>
+          <row>
+            <entry>Option</entry>
+            <entry>Description</entry>
+          </row>
+        </thead>
+        <tbody>
+          <row>
+            <entry><literal>filter</literal></entry>
+            <entry>
+              A correct filter, e.g. <literal>none</literal> or
+              <literal>installed;~devel</literal>
+            </entry>
+          </row>
+        </tbody>
+      </tgroup>
+    </informaltable>
+    <para>
+      This method typically emits
+      <literal>Progress</literal>,
+      <literal>Error</literal> and
+      <literal>Package</literal>.
+    </para>
+    <para>
+      <literal>Package</literal> enumerated types should be
+      <literal>available</literal> or <literal>installed</literal>.
+    </para>
+  </sect1>
+
   <sect1 id="methods-search-name">
     <title>Search Name</title>
     <para>
@@ -39,7 +75,7 @@
       Do not refresh the package cache. This should be fast.
     </para>
     <para>
-      Always emit <literal>installed</literal> before
+      Try to emit <literal>installed</literal> before
       <literal>available</literal> packages first, as it allows the client
       program to perform the GUI filtering and matching whilst the daemon is
       running the transaction.
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index 846b703..656c43a 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -1387,6 +1387,58 @@ pk_client_get_depends (PkClient *client, PkFilterEnum filters, const gchar *pack
 }
 
 /**
+ * pk_client_get_packages:
+ * @client: a valid #PkClient instance
+ * @filters: a %PkFilterEnum such as %PK_FILTER_ENUM_GUI | %PK_FILTER_ENUM_FREE or %PK_FILTER_ENUM_NONE
+ * @error: a %GError to put the error code and message in, or %NULL
+ *
+ * Get the list of packages from the backend
+ *
+ * Return value: %TRUE if the daemon queued the transaction
+ **/
+gboolean
+pk_client_get_packages (PkClient *client, PkFilterEnum filters, GError **error)
+{
+	gboolean ret;
+	gchar *filter_text;
+
+	g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
+	g_return_val_if_fail (filters != 0, FALSE);
+
+	/* get and set a new ID */
+	ret = pk_client_allocate_transaction_id (client, error);
+	if (!ret) {
+		return FALSE;
+	}
+
+	/* save this so we can re-issue it */
+	client->priv->role = PK_ROLE_ENUM_GET_PACKAGES;
+	client->priv->cached_filters = filters;
+
+	/* check to see if we have a valid proxy */
+	if (client->priv->proxy == NULL) {
+		pk_client_error_set (error, PK_CLIENT_ERROR_NO_TID, "No proxy for transaction");
+		return FALSE;
+	}
+	filter_text = pk_filter_enums_to_text (filters);
+	ret = dbus_g_proxy_call (client->priv->proxy, "GetPackages", error,
+				 G_TYPE_STRING, filter_text,
+				 G_TYPE_INVALID, G_TYPE_INVALID);
+	g_free (filter_text);
+	if (ret) {
+		/* allow clients to respond in the status changed callback */
+		pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
+
+		/* spin until finished */
+		if (client->priv->synchronous) {
+			g_main_loop_run (client->priv->loop);
+		}
+	}
+	pk_client_error_fixup (error);
+	return ret;
+}
+
+/**
  * pk_client_get_requires:
  * @client: a valid #PkClient instance
  * @filters: a %PkFilterEnum such as %PK_FILTER_ENUM_GUI | %PK_FILTER_ENUM_FREE or %PK_FILTER_ENUM_NONE
diff --git a/libpackagekit/pk-client.h b/libpackagekit/pk-client.h
index e90a553..307a08c 100644
--- a/libpackagekit/pk-client.h
+++ b/libpackagekit/pk-client.h
@@ -227,6 +227,10 @@ gboolean	 pk_client_get_depends			(PkClient	*client,
 							 gboolean	 recursive,
 							 GError		**error)
 							 G_GNUC_WARN_UNUSED_RESULT;
+gboolean	 pk_client_get_packages			(PkClient	*client,
+							 PkFilterEnum	 filters,
+							 GError		**error)
+							 G_GNUC_WARN_UNUSED_RESULT;
 gboolean	 pk_client_get_update_detail		(PkClient	*client,
 							 const gchar	*package_id,
 							 GError		**error)
diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index fa83c58..eab463d 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -76,29 +76,30 @@ static PkEnumMatch enum_status[] = {
 static PkEnumMatch enum_role[] = {
 	{PK_ROLE_ENUM_UNKNOWN,			"unknown"},	/* fall though value */
 	{PK_ROLE_ENUM_CANCEL,			"cancel"},
-	{PK_ROLE_ENUM_RESOLVE,			"resolve"},
-	{PK_ROLE_ENUM_ROLLBACK,			"rollback"},
 	{PK_ROLE_ENUM_GET_DEPENDS,		"get-depends"},
-	{PK_ROLE_ENUM_GET_UPDATE_DETAIL,	"get-update-detail"},
 	{PK_ROLE_ENUM_GET_DESCRIPTION,		"get-description"},
 	{PK_ROLE_ENUM_GET_FILES,		"get-files"},
+	{PK_ROLE_ENUM_GET_PACKAGES,		"get-packages"},
+	{PK_ROLE_ENUM_GET_REPO_LIST,		"get-repo-list"},
 	{PK_ROLE_ENUM_GET_REQUIRES,		"get-requires"},
+	{PK_ROLE_ENUM_GET_UPDATE_DETAIL,	"get-update-detail"},
 	{PK_ROLE_ENUM_GET_UPDATES,		"get-updates"},
+	{PK_ROLE_ENUM_INSTALL_FILE,		"install-file"},
+	{PK_ROLE_ENUM_INSTALL_PACKAGE,		"install-package"},
+	{PK_ROLE_ENUM_INSTALL_SIGNATURE,	"install-signature"},
+	{PK_ROLE_ENUM_REFRESH_CACHE,		"refresh-cache"},
+	{PK_ROLE_ENUM_REMOVE_PACKAGE,		"remove-package"},
+	{PK_ROLE_ENUM_REPO_ENABLE,		"repo-enable"},
+	{PK_ROLE_ENUM_REPO_SET_DATA,		"repo-set-data"},
+	{PK_ROLE_ENUM_RESOLVE,			"resolve"},
+	{PK_ROLE_ENUM_ROLLBACK,			"rollback"},
 	{PK_ROLE_ENUM_SEARCH_DETAILS,		"search-details"},
 	{PK_ROLE_ENUM_SEARCH_FILE,		"search-file"},
 	{PK_ROLE_ENUM_SEARCH_GROUP,		"search-group"},
 	{PK_ROLE_ENUM_SEARCH_NAME,		"search-name"},
-	{PK_ROLE_ENUM_REFRESH_CACHE,		"refresh-cache"},
-	{PK_ROLE_ENUM_REMOVE_PACKAGE,		"remove-package"},
-	{PK_ROLE_ENUM_INSTALL_PACKAGE,		"install-package"},
-	{PK_ROLE_ENUM_INSTALL_SIGNATURE,	"install-signature"},
-	{PK_ROLE_ENUM_INSTALL_FILE,		"install-file"},
+	{PK_ROLE_ENUM_SERVICE_PACK,		"service-pack"},
 	{PK_ROLE_ENUM_UPDATE_PACKAGES,		"update-package"},
 	{PK_ROLE_ENUM_UPDATE_SYSTEM,		"update-system"},
-	{PK_ROLE_ENUM_GET_REPO_LIST,		"get-repo-list"},
-	{PK_ROLE_ENUM_REPO_ENABLE,		"repo-enable"},
-	{PK_ROLE_ENUM_REPO_SET_DATA,		"repo-set-data"},
-	{PK_ROLE_ENUM_SERVICE_PACK,		"service-pack"},
 	{PK_ROLE_ENUM_WHAT_PROVIDES,		"what-provides"},
 	{0, NULL}
 };
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index b2e36f8..bce00df 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -51,31 +51,32 @@ typedef struct {
  **/
 typedef enum {
 	PK_ROLE_ENUM_CANCEL			= 1 << 0,
-	PK_ROLE_ENUM_RESOLVE			= 1 << 1,
-	PK_ROLE_ENUM_ROLLBACK			= 1 << 2,
-	PK_ROLE_ENUM_GET_DEPENDS		= 1 << 3,
-	PK_ROLE_ENUM_GET_UPDATE_DETAIL		= 1 << 4,
-	PK_ROLE_ENUM_GET_DESCRIPTION		= 1 << 5,
-	PK_ROLE_ENUM_GET_FILES			= 1 << 6,
-	PK_ROLE_ENUM_GET_REQUIRES		= 1 << 7,
+	PK_ROLE_ENUM_GET_DEPENDS		= 1 << 1,
+	PK_ROLE_ENUM_GET_DESCRIPTION		= 1 << 2,
+	PK_ROLE_ENUM_GET_FILES			= 1 << 3,
+	PK_ROLE_ENUM_GET_PACKAGES		= 1 << 4,
+	PK_ROLE_ENUM_GET_REPO_LIST		= 1 << 5,
+	PK_ROLE_ENUM_GET_REQUIRES		= 1 << 6,
+	PK_ROLE_ENUM_GET_UPDATE_DETAIL		= 1 << 7,
 	PK_ROLE_ENUM_GET_UPDATES		= 1 << 8,
-	PK_ROLE_ENUM_SEARCH_DETAILS		= 1 << 9,
-	PK_ROLE_ENUM_SEARCH_FILE		= 1 << 10,
-	PK_ROLE_ENUM_SEARCH_GROUP		= 1 << 11,
-	PK_ROLE_ENUM_SEARCH_NAME		= 1 << 12,
-	PK_ROLE_ENUM_REFRESH_CACHE		= 1 << 13,
-	PK_ROLE_ENUM_UPDATE_SYSTEM		= 1 << 14,
-	PK_ROLE_ENUM_REMOVE_PACKAGE		= 1 << 15,
-	PK_ROLE_ENUM_INSTALL_PACKAGE		= 1 << 16,
-	PK_ROLE_ENUM_INSTALL_FILE		= 1 << 17,
-	PK_ROLE_ENUM_INSTALL_SIGNATURE		= 1 << 18,
-	PK_ROLE_ENUM_UPDATE_PACKAGES		= 1 << 19,
-	PK_ROLE_ENUM_GET_REPO_LIST		= 1 << 20,
-	PK_ROLE_ENUM_REPO_ENABLE		= 1 << 21,
-	PK_ROLE_ENUM_REPO_SET_DATA		= 1 << 22,
-	PK_ROLE_ENUM_SERVICE_PACK		= 1 << 23,
-	PK_ROLE_ENUM_WHAT_PROVIDES		= 1 << 24,
-	PK_ROLE_ENUM_UNKNOWN			= 1 << 25
+	PK_ROLE_ENUM_INSTALL_FILE		= 1 << 9,
+	PK_ROLE_ENUM_INSTALL_PACKAGE		= 1 << 10,
+	PK_ROLE_ENUM_INSTALL_SIGNATURE		= 1 << 11,
+	PK_ROLE_ENUM_REFRESH_CACHE		= 1 << 12,
+	PK_ROLE_ENUM_REMOVE_PACKAGE		= 1 << 13,
+	PK_ROLE_ENUM_REPO_ENABLE		= 1 << 14,
+	PK_ROLE_ENUM_REPO_SET_DATA		= 1 << 15,
+	PK_ROLE_ENUM_RESOLVE			= 1 << 16,
+	PK_ROLE_ENUM_ROLLBACK			= 1 << 17,
+	PK_ROLE_ENUM_SEARCH_DETAILS		= 1 << 18,
+	PK_ROLE_ENUM_SEARCH_FILE		= 1 << 19,
+	PK_ROLE_ENUM_SEARCH_GROUP		= 1 << 20,
+	PK_ROLE_ENUM_SEARCH_NAME		= 1 << 21,
+	PK_ROLE_ENUM_SERVICE_PACK		= 1 << 22,
+	PK_ROLE_ENUM_UPDATE_PACKAGES		= 1 << 23,
+	PK_ROLE_ENUM_UPDATE_SYSTEM		= 1 << 24,
+	PK_ROLE_ENUM_WHAT_PROVIDES		= 1 << 25,
+	PK_ROLE_ENUM_UNKNOWN			= 1 << 26
 } PkRoleEnum;
 
 /**
diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index b0124c0..0419830 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -327,6 +327,13 @@ class PackageKitBaseBackend:
         '''
         self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
 
+    def get_packages(self,filters):
+        '''
+        Implement the {backend}-get-packages 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,filters,package,recursive):
         '''
         Implement the {backend}-get-requires functionality
diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index 8ff4b52..0f69375 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -400,6 +400,23 @@ class PackageKitBaseBackend(dbus.service.Object):
         self.Finished(EXIT_FAILED)
 
     @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='s', out_signature='')
+    def GetPackages(self, filters):
+        '''
+        Implement the {backend}-get-packages functionality
+        '''
+        pklog.info("GetPackages()")
+        self.doGetPackages(filters)
+
+    def doGetPackages(self, filters):
+        '''
+        Should be replaced in the corresponding backend sub class
+        '''
+        self.ErrorCode(ERROR_NOT_SUPPORTED,
+                       "This function is not implemented in this backend")
+        self.Finished(EXIT_FAILED)
+
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
                          in_signature='', out_signature='')
     def Cancel(self):
         pklog.info("Cancel()")
diff --git a/src/pk-backend-dbus.c b/src/pk-backend-dbus.c
index b3da9f9..1a6885f 100644
--- a/src/pk-backend-dbus.c
+++ b/src/pk-backend-dbus.c
@@ -943,6 +943,35 @@ pk_backend_dbus_get_requires (PkBackendDbus *backend_dbus, const gchar *filter,
 }
 
 /**
+ * pk_backend_dbus_get_packages:
+ **/
+gboolean
+pk_backend_dbus_get_packages (PkBackendDbus *backend_dbus, const gchar *filter)
+{
+	gboolean ret;
+	GError *error = NULL;
+
+	g_return_val_if_fail (PK_IS_BACKEND_DBUS (backend_dbus), FALSE);
+	g_return_val_if_fail (backend_dbus->priv->proxy != NULL, FALSE);
+
+	/* new sync method call */
+	pk_backend_dbus_time_reset (backend_dbus);
+	ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "GetPackages", &error,
+				 G_TYPE_STRING, filter,
+				 G_TYPE_INVALID, G_TYPE_INVALID);
+	if (error != NULL) {
+		pk_warning ("%s", error->message);
+		pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
+		pk_backend_finished (backend_dbus->priv->backend);
+		g_error_free (error);
+	}
+	if (ret) {
+		pk_backend_dbus_time_check (backend_dbus);
+	}
+	return ret;
+}
+
+/**
  * pk_backend_dbus_get_update_detail:
  **/
 gboolean
diff --git a/src/pk-backend-dbus.h b/src/pk-backend-dbus.h
index e3311fc..9ab9995 100644
--- a/src/pk-backend-dbus.h
+++ b/src/pk-backend-dbus.h
@@ -84,6 +84,8 @@ gboolean	 pk_backend_dbus_search_group		(PkBackendDbus	*backend_dbus,
 gboolean	 pk_backend_dbus_search_file		(PkBackendDbus	*backend_dbus,
 							 const gchar	*filter,
 							 const gchar	*search);
+gboolean	 pk_backend_dbus_get_packages		(PkBackendDbus	*backend_dbus,
+							 const gchar	*filter);
 gboolean	 pk_backend_dbus_get_depends		(PkBackendDbus	*backend_dbus,
 							 const gchar	*filter,
 							 const gchar	*package_id,
diff --git a/src/pk-backend.h b/src/pk-backend.h
index 64cd69d..9f6b79f 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -145,6 +145,8 @@ typedef struct {
 						 const gchar *package_id);
 	void		(*get_files)	        (PkBackend *backend,
 						 const gchar *package_id);
+	void		(*get_packages)	        (PkBackend *backend,
+						 const gchar *filter);
 	void		(*get_repo_list)	(PkBackend *backend,
 						 const gchar *filter);
 	void		(*get_requires)		(PkBackend *backend,
@@ -207,7 +209,7 @@ typedef struct {
 } PkBackendDesc;
 
 #define PK_BACKEND_OPTIONS(description, author, initialize, destroy, get_filters, get_groups, cancel,	\
-			   get_depends, get_description, get_files, get_repo_list, get_requires,	\
+			   get_depends, get_description, get_files, get_packages, get_repo_list, get_requires,	\
 			   get_update_detail, get_updates, install_file, install_package,		\
 			   install_signature, refresh_cache, remove_package, repo_enable,		\
 			   repo_set_data, resolve, rollback, search_details, search_file, search_group,	\
@@ -223,6 +225,7 @@ typedef struct {
 		get_depends,		\
 		get_description,	\
 		get_files,		\
+		get_packages,		\
 		get_repo_list,		\
 		get_requires,		\
 		get_update_detail,	\
diff --git a/src/pk-engine.c b/src/pk-engine.c
index d27e994..b252943 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -498,6 +498,9 @@ pk_engine_get_actions_internal (PkEngine *engine)
 	if (desc->get_requires != NULL) {
 		pk_enum_list_append (elist, PK_ROLE_ENUM_GET_REQUIRES);
 	}
+	if (desc->get_packages != NULL) {
+		pk_enum_list_append (elist, PK_ROLE_ENUM_GET_PACKAGES);
+	}
 	if (desc->what_provides != NULL) {
 		pk_enum_list_append (elist, PK_ROLE_ENUM_WHAT_PROVIDES);
 	}
diff --git a/src/pk-interface-transaction.xml b/src/pk-interface-transaction.xml
index 8185e0f..550dc18 100644
--- a/src/pk-interface-transaction.xml
+++ b/src/pk-interface-transaction.xml
@@ -26,9 +26,12 @@
     <method name="GetOldTransactions">
       <arg type="u" name="number" direction="in"/>
     </method>
-    <method name="GetPackage">
+    <method name="GetPackageLast">
       <arg type="s" name="package" direction="out"/>
     </method>
+    <method name="GetPackages">
+      <arg type="s" name="filter" direction="in"/>
+    </method>
     <method name="GetProgress">
       <arg type="u" name="percentage" direction="out"/>
       <arg type="u" name="subpercentage" direction="out"/>
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index c30baf0..05c4889 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -239,6 +239,8 @@ pk_transaction_set_running (PkTransaction *transaction)
 		desc->what_provides (priv->backend, priv->cached_filter, priv->cached_provides, priv->cached_search);
 	} else if (priv->role == PK_ROLE_ENUM_GET_UPDATES) {
 		desc->get_updates (priv->backend, priv->cached_filter);
+	} else if (priv->role == PK_ROLE_ENUM_GET_PACKAGES) {
+		desc->get_packages (priv->backend, priv->cached_filter);
 	} else if (priv->role == PK_ROLE_ENUM_SEARCH_DETAILS) {
 		desc->search_details (priv->backend, priv->cached_filter, priv->cached_search);
 	} else if (priv->role == PK_ROLE_ENUM_SEARCH_FILE) {
@@ -1245,6 +1247,57 @@ pk_transaction_get_files (PkTransaction *transaction, const gchar *package_id,
 }
 
 /**
+ * pk_transaction_get_packages:
+ **/
+void
+pk_transaction_get_packages (PkTransaction *transaction, const gchar *filter, DBusGMethodInvocation *context)
+{
+	gboolean ret;
+	GError *error;
+
+	g_return_if_fail (PK_IS_TRANSACTION (transaction));
+	g_return_if_fail (transaction->priv->tid != NULL);
+
+	pk_debug ("GetPackages method called: %s", filter);
+
+	/* not implemented yet */
+	if (transaction->priv->backend->desc->search_name == NULL) {
+		pk_debug ("Not implemented yet: GetPackages");
+		error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
+				     "Operation not yet supported by backend");
+		dbus_g_method_return_error (context, error);
+		return;
+	}
+
+	/* check the filter */
+	ret = pk_transaction_filter_check (filter, &error);
+	if (!ret) {
+		dbus_g_method_return_error (context, error);
+		return;
+	}
+
+	/* set the dbus name, so we can get the disconnect */
+	pk_transaction_set_dbus_name (transaction, dbus_g_method_get_sender (context));
+
+	/* save so we can run later */
+	transaction->priv->cached_filter = g_strdup (filter);
+	transaction->priv->status = PK_STATUS_ENUM_WAIT;
+	pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_PACKAGES);
+
+	/* try to commit this */
+	ret = pk_transaction_commit (transaction);
+	if (!ret) {
+		error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
+				     "Could not commit to a transaction object");
+		pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
+		dbus_g_method_return_error (context, error);
+		return;
+	}
+
+	dbus_g_method_return (context);
+}
+
+/**
  * pk_transaction_get_old_transactions:
  **/
 gboolean
@@ -1267,15 +1320,15 @@ pk_transaction_get_old_transactions (PkTransaction *transaction, guint number, G
 }
 
 /**
- * pk_transaction_get_package:
+ * pk_transaction_get_package_last:
  **/
 gboolean
-pk_transaction_get_package (PkTransaction *transaction, gchar **package_id, GError **error)
+pk_transaction_get_package_last (PkTransaction *transaction, gchar **package_id, GError **error)
 {
 	g_return_val_if_fail (PK_IS_TRANSACTION (transaction), FALSE);
 	g_return_val_if_fail (transaction->priv->tid != NULL, FALSE);
 
-	pk_debug ("GetPackage method called");
+	pk_debug ("GetPackageLast method called");
 
 	if (transaction->priv->last_package == NULL) {
 		g_set_error (error, PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_INVALID_STATE,
diff --git a/src/pk-transaction.h b/src/pk-transaction.h
index 485730f..908b783 100644
--- a/src/pk-transaction.h
+++ b/src/pk-transaction.h
@@ -115,9 +115,12 @@ void		 pk_transaction_get_files		(PkTransaction	*transaction,
 gboolean	 pk_transaction_get_old_transactions	(PkTransaction	*transaction,
 							 guint		 number,
 							 GError		**error);
-gboolean	 pk_transaction_get_package		(PkTransaction	*transaction,
+gboolean	 pk_transaction_get_package_last	(PkTransaction	*transaction,
 							 gchar		**package,
 							 GError		**error);
+void		 pk_transaction_get_packages		(PkTransaction	*transaction,
+							 const gchar	*filter,
+							 DBusGMethodInvocation *context);
 gboolean	 pk_transaction_get_progress		(PkTransaction	*transaction,
 							 guint		*percentage,
 							 guint		*subpercentage,
diff --git a/tools/add-method.sh b/tools/add-method.sh
index 219d9fc..4f89a9d 100755
--- a/tools/add-method.sh
+++ b/tools/add-method.sh
@@ -1,4 +1,4 @@
 #!/bin/sh
 
-$EDITOR docs/spec/pk-methods.xml src/pk-interface.xml src/pk-engine.h src/pk-engine.c  src/pk-runner.h src/pk-runner.c python/packagekit/backend.py python/packagekit/daemonBackend.py libpackagekit/pk-client.h libpackagekit/pk-task-client.c client/pk-console.c backends/*/pk-*.c src/pk-backend-dbus.c src/pk-backend-dbus.h
+$EDITOR docs/spec/pk-methods.xml src/pk-interface-transaction.xml src/pk-transaction.h src/pk-transaction.c  python/packagekit/backend.py python/packagekit/daemonBackend.py libpackagekit/pk-client.h libpackagekit/pk-client.c  libpackagekit/pk-enum.h libpackagekit/pk-enum.c client/pk-console.c backends/*/pk-*.c src/pk-backend-dbus.c src/pk-backend-dbus.h contrib/*.bash src/pk-engine.c src/pk-backend.h docs/html/pk-faq.html ../gnome-packagekit/src/gpk-common.c
 
commit 958f08683053645f7b2d536e276cd4cacca01239
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Apr 11 02:08:28 2008 +0100

    start the enums at 1 to make the gnome-packagekit make check to finish

diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index 5e1e26e..b2e36f8 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -50,32 +50,32 @@ typedef struct {
  * these constants
  **/
 typedef enum {
-	PK_ROLE_ENUM_CANCEL			= 1 << 1,
-	PK_ROLE_ENUM_RESOLVE			= 1 << 2,
-	PK_ROLE_ENUM_ROLLBACK			= 1 << 3,
-	PK_ROLE_ENUM_GET_DEPENDS		= 1 << 4,
-	PK_ROLE_ENUM_GET_UPDATE_DETAIL		= 1 << 5,
-	PK_ROLE_ENUM_GET_DESCRIPTION		= 1 << 6,
-	PK_ROLE_ENUM_GET_FILES			= 1 << 7,
-	PK_ROLE_ENUM_GET_REQUIRES		= 1 << 8,
-	PK_ROLE_ENUM_GET_UPDATES		= 1 << 9,
-	PK_ROLE_ENUM_SEARCH_DETAILS		= 1 << 10,
-	PK_ROLE_ENUM_SEARCH_FILE		= 1 << 11,
-	PK_ROLE_ENUM_SEARCH_GROUP		= 1 << 12,
-	PK_ROLE_ENUM_SEARCH_NAME		= 1 << 13,
-	PK_ROLE_ENUM_REFRESH_CACHE		= 1 << 14,
-	PK_ROLE_ENUM_UPDATE_SYSTEM		= 1 << 15,
-	PK_ROLE_ENUM_REMOVE_PACKAGE		= 1 << 16,
-	PK_ROLE_ENUM_INSTALL_PACKAGE		= 1 << 17,
-	PK_ROLE_ENUM_INSTALL_FILE		= 1 << 18,
-	PK_ROLE_ENUM_INSTALL_SIGNATURE		= 1 << 19,
-	PK_ROLE_ENUM_UPDATE_PACKAGES		= 1 << 20,
-	PK_ROLE_ENUM_GET_REPO_LIST		= 1 << 21,
-	PK_ROLE_ENUM_REPO_ENABLE		= 1 << 22,
-	PK_ROLE_ENUM_REPO_SET_DATA		= 1 << 23,
-	PK_ROLE_ENUM_SERVICE_PACK		= 1 << 24,
-	PK_ROLE_ENUM_WHAT_PROVIDES		= 1 << 25,
-	PK_ROLE_ENUM_UNKNOWN
+	PK_ROLE_ENUM_CANCEL			= 1 << 0,
+	PK_ROLE_ENUM_RESOLVE			= 1 << 1,
+	PK_ROLE_ENUM_ROLLBACK			= 1 << 2,
+	PK_ROLE_ENUM_GET_DEPENDS		= 1 << 3,
+	PK_ROLE_ENUM_GET_UPDATE_DETAIL		= 1 << 4,
+	PK_ROLE_ENUM_GET_DESCRIPTION		= 1 << 5,
+	PK_ROLE_ENUM_GET_FILES			= 1 << 6,
+	PK_ROLE_ENUM_GET_REQUIRES		= 1 << 7,
+	PK_ROLE_ENUM_GET_UPDATES		= 1 << 8,
+	PK_ROLE_ENUM_SEARCH_DETAILS		= 1 << 9,
+	PK_ROLE_ENUM_SEARCH_FILE		= 1 << 10,
+	PK_ROLE_ENUM_SEARCH_GROUP		= 1 << 11,
+	PK_ROLE_ENUM_SEARCH_NAME		= 1 << 12,
+	PK_ROLE_ENUM_REFRESH_CACHE		= 1 << 13,
+	PK_ROLE_ENUM_UPDATE_SYSTEM		= 1 << 14,
+	PK_ROLE_ENUM_REMOVE_PACKAGE		= 1 << 15,
+	PK_ROLE_ENUM_INSTALL_PACKAGE		= 1 << 16,
+	PK_ROLE_ENUM_INSTALL_FILE		= 1 << 17,
+	PK_ROLE_ENUM_INSTALL_SIGNATURE		= 1 << 18,
+	PK_ROLE_ENUM_UPDATE_PACKAGES		= 1 << 19,
+	PK_ROLE_ENUM_GET_REPO_LIST		= 1 << 20,
+	PK_ROLE_ENUM_REPO_ENABLE		= 1 << 21,
+	PK_ROLE_ENUM_REPO_SET_DATA		= 1 << 22,
+	PK_ROLE_ENUM_SERVICE_PACK		= 1 << 23,
+	PK_ROLE_ENUM_WHAT_PROVIDES		= 1 << 24,
+	PK_ROLE_ENUM_UNKNOWN			= 1 << 25
 } PkRoleEnum;
 
 /**
@@ -143,23 +143,23 @@ typedef enum {
  **/
 typedef enum {
 	PK_FILTER_ENUM_NONE			= 0,
-	PK_FILTER_ENUM_INSTALLED		= 1 << 1,
-	PK_FILTER_ENUM_NOT_INSTALLED		= 1 << 2,
-	PK_FILTER_ENUM_DEVELOPMENT		= 1 << 3,
-	PK_FILTER_ENUM_NOT_DEVELOPMENT		= 1 << 4,
-	PK_FILTER_ENUM_GUI			= 1 << 5,
-	PK_FILTER_ENUM_NOT_GUI			= 1 << 6,
-	PK_FILTER_ENUM_FREE			= 1 << 7,
-	PK_FILTER_ENUM_NOT_FREE			= 1 << 8,
-	PK_FILTER_ENUM_VISIBLE			= 1 << 9,
-	PK_FILTER_ENUM_NOT_VISIBLE		= 1 << 10,
-	PK_FILTER_ENUM_SUPPORTED		= 1 << 11,
-	PK_FILTER_ENUM_NOT_SUPPORTED		= 1 << 12,
-	PK_FILTER_ENUM_BASENAME			= 1 << 13,
-	PK_FILTER_ENUM_NOT_BASENAME		= 1 << 14,
-	PK_FILTER_ENUM_NEWEST			= 1 << 15,
-	PK_FILTER_ENUM_NOT_NEWEST		= 1 << 16,
-	PK_FILTER_ENUM_UNKNOWN			= 1 << 17
+	PK_FILTER_ENUM_INSTALLED		= 1 << 0,
+	PK_FILTER_ENUM_NOT_INSTALLED		= 1 << 1,
+	PK_FILTER_ENUM_DEVELOPMENT		= 1 << 2,
+	PK_FILTER_ENUM_NOT_DEVELOPMENT		= 1 << 3,
+	PK_FILTER_ENUM_GUI			= 1 << 4,
+	PK_FILTER_ENUM_NOT_GUI			= 1 << 5,
+	PK_FILTER_ENUM_FREE			= 1 << 6,
+	PK_FILTER_ENUM_NOT_FREE			= 1 << 7,
+	PK_FILTER_ENUM_VISIBLE			= 1 << 8,
+	PK_FILTER_ENUM_NOT_VISIBLE		= 1 << 9,
+	PK_FILTER_ENUM_SUPPORTED		= 1 << 10,
+	PK_FILTER_ENUM_NOT_SUPPORTED		= 1 << 11,
+	PK_FILTER_ENUM_BASENAME			= 1 << 12,
+	PK_FILTER_ENUM_NOT_BASENAME		= 1 << 13,
+	PK_FILTER_ENUM_NEWEST			= 1 << 14,
+	PK_FILTER_ENUM_NOT_NEWEST		= 1 << 15,
+	PK_FILTER_ENUM_UNKNOWN			= 1 << 16
 } PkFilterEnum;
 
 /**
commit e298cf608f88c946535f44bec3df588cee8802fd
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Apr 11 02:01:34 2008 +0100

    don't pass text as a filter - it's an enumerated type. there's too much to go wrong with free text

diff --git a/client/pk-console.c b/client/pk-console.c
index 45d9b4a..ed0ba0b 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -471,7 +471,6 @@ pk_console_perhaps_resolve (PkClient *client, PkFilterEnum filter, const gchar *
 {
 	gboolean ret;
 	gboolean valid;
-	const gchar *filter_text;
 	guint i;
 	guint length;
 	PkPackageItem *item;
@@ -483,8 +482,7 @@ pk_console_perhaps_resolve (PkClient *client, PkFilterEnum filter, const gchar *
 	}
 
 	/* we need to resolve it */
-	filter_text = pk_filter_enum_to_text (filter);
-	ret = pk_client_resolve (client_task, filter_text, package, error);
+	ret = pk_client_resolve (client_task, filter, package, error);
 	if (ret == FALSE) {
 		pk_warning (_("Resolve is not supported in this backend"));
 		return NULL;
@@ -500,7 +498,7 @@ pk_console_perhaps_resolve (PkClient *client, PkFilterEnum filter, const gchar *
 			pk_warning ("failed to reset client task");
 			return NULL;
 		}
-		ret = pk_client_what_provides (client_task, filter_text, PK_PROVIDES_ENUM_ANY, package, error);
+		ret = pk_client_what_provides (client_task, filter, PK_PROVIDES_ENUM_ANY, package, error);
 		if (ret == FALSE) {
 			pk_warning (_("WhatProvides is not supported in this backend"));
 			return NULL;
@@ -649,7 +647,7 @@ pk_console_remove_package (PkClient *client, const gchar *package, GError **erro
 	}
 
 	pk_debug (_("Getting installed requires for %s"), package_id);
-	ret = pk_client_get_requires (client_task, "installed", package_id, TRUE, error);
+	ret = pk_client_get_requires (client_task, PK_FILTER_ENUM_INSTALLED, package_id, TRUE, error);
 	if (!ret) {
 		return FALSE;
 	}
@@ -725,7 +723,7 @@ pk_console_get_requires (PkClient *client, const gchar *package, GError **error)
 		g_print (_("Could not find a package with that name to get requires\n"));
 		return FALSE;
 	}
-	ret = pk_client_get_requires (client, "none", package_id, TRUE, error);
+	ret = pk_client_get_requires (client, PK_FILTER_ENUM_NONE, package_id, TRUE, error);
 	g_free (package_id);
 	return ret;
 }
@@ -743,7 +741,7 @@ pk_console_get_depends (PkClient *client, const gchar *package, GError **error)
 		g_print (_("Could not find a package with that name to get depends\n"));
 		return FALSE;
 	}
-	ret = pk_client_get_depends (client, "none", package_id, FALSE, error);
+	ret = pk_client_get_depends (client, PK_FILTER_ENUM_NONE, package_id, FALSE, error);
 	g_free (package_id);
 	return ret;
 }
@@ -836,28 +834,28 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], GError **
 				g_set_error (error, 0, 0, _("specify a search term"));
 				return FALSE;
 			} else {
-				ret = pk_client_search_name (client, "none", details, error);
+				ret = pk_client_search_name (client, PK_FILTER_ENUM_NONE, details, error);
 			}
 		} else if (strcmp (value, "details") == 0) {
 			if (details == NULL) {
 				g_set_error (error, 0, 0, _("specify a search term"));
 				return FALSE;
 			} else {
-				ret = pk_client_search_details (client, "none", details, error);
+				ret = pk_client_search_details (client, PK_FILTER_ENUM_NONE, details, error);
 			}
 		} else if (strcmp (value, "group") == 0) {
 			if (details == NULL) {
 				g_set_error (error, 0, 0, _("specify a search term"));
 				return FALSE;
 			} else {
-				ret = pk_client_search_group (client, "none", details, error);
+				ret = pk_client_search_group (client, PK_FILTER_ENUM_NONE, details, error);
 			}
 		} else if (strcmp (value, "file") == 0) {
 			if (details == NULL) {
 				g_set_error (error, 0, 0, _("specify a search term"));
 				return FALSE;
 			} else {
-				ret = pk_client_search_file (client, "none", details, error);
+				ret = pk_client_search_file (client, PK_FILTER_ENUM_NONE, details, error);
 			}
 		} else {
 			g_set_error (error, 0, 0, _("invalid search type"));
@@ -902,7 +900,7 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], GError **
 			g_set_error (error, 0, 0, _("specify a package name to resolve"));
 			return FALSE;
 		} else {
-			ret = pk_client_resolve (client, "none", value, error);
+			ret = pk_client_resolve (client, PK_FILTER_ENUM_NONE, value, error);
 		}
 	} else if (strcmp (mode, "enable-repo") == 0) {
 		if (value == NULL) {
@@ -975,7 +973,7 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], GError **
 				g_set_error (error, 0, 0, _("specify a search term"));
 				return FALSE;
 			} else {
-				ret = pk_client_what_provides (client, "none", PK_PROVIDES_ENUM_CODEC, details, error);
+				ret = pk_client_what_provides (client, PK_FILTER_ENUM_NONE, PK_PROVIDES_ENUM_CODEC, details, error);
 			}
 		} else if (strcmp (value, "description") == 0) {
 			if (details == NULL) {
@@ -992,7 +990,7 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], GError **
 				ret = pk_console_get_files (client, details, error);
 			}
 		} else if (strcmp (value, "updates") == 0) {
-			ret = pk_client_get_updates (client, "basename", error);
+			ret = pk_client_get_updates (client, PK_FILTER_ENUM_BASENAME, error);
 		} else if (strcmp (value, "actions") == 0) {
 			elist = pk_control_get_actions (control);
 			pk_enum_list_print (elist);
@@ -1004,7 +1002,7 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], GError **
 			g_object_unref (elist);
 			maybe_sync = FALSE;
 		} else if (strcmp (value, "repos") == 0) {
-			ret = pk_client_get_repo_list (client, "none", error);
+			ret = pk_client_get_repo_list (client, PK_FILTER_ENUM_NONE, error);
 		} else if (strcmp (value, "groups") == 0) {
 			elist = pk_control_get_groups (control);
 			pk_enum_list_print (elist);
diff --git a/client/pk-import-desktop.c b/client/pk-import-desktop.c
index 0d1db9e..f2a01f1 100644
--- a/client/pk-import-desktop.c
+++ b/client/pk-import-desktop.c
@@ -58,7 +58,7 @@ pk_desktop_get_name_for_file (const gchar *filename)
 		return NULL;
 	}
 
-	ret = pk_client_search_file (client, "installed", filename, &error);
+	ret = pk_client_search_file (client, PK_FILTER_ENUM_INSTALLED, filename, &error);
 	if (!ret) {
 		pk_warning ("failed to search file: %s", error->message);
 		g_error_free (error);
diff --git a/client/pk-import-specspo.c b/client/pk-import-specspo.c
index 4cb6451..3460328 100644
--- a/client/pk-import-specspo.c
+++ b/client/pk-import-specspo.c
@@ -66,7 +66,7 @@ pk_import_specspo_get_summary (const gchar *name)
 
 	pk_client_set_use_buffer (client, TRUE, NULL);
 	pk_client_set_synchronous (client, TRUE, NULL);
-	ret = pk_client_resolve (client, "none", name, &error);
+	ret = pk_client_resolve (client, PK_FILTER_ENUM_NONE, name, &error);
 	if (!ret) {
 		pk_warning ("failed to resolve: %s", error->message);
 		g_error_free (error);
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index 6d63ba4..846b703 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -88,9 +88,9 @@ struct _PkClientPrivate
 	gchar			*cached_transaction_id;
 	gchar			*cached_key_id;
 	gchar			*cached_full_path;
-	gchar			*cached_filter;
 	gchar			*cached_search;
 	PkProvidesEnum		 cached_provides;
+	PkFilterEnum		 cached_filters;
 };
 
 typedef enum {
@@ -968,7 +968,7 @@ pk_client_allocate_transaction_id (PkClient *client, GError **error)
 /**
  * pk_client_get_updates:
  * @client: a valid #PkClient instance
- * @filter: a filter enum such as "basename;~development" or "none"
+ * @filters: a %PkFilterEnum such as %PK_FILTER_ENUM_GUI | %PK_FILTER_ENUM_FREE or %PK_FILTER_ENUM_NONE
  * @error: a %GError to put the error code and message in, or %NULL
  *
  * Get a list of all the packages that can be updated for all repositories.
@@ -976,12 +976,13 @@ pk_client_allocate_transaction_id (PkClient *client, GError **error)
  * Return value: %TRUE if we got told the daemon to get the update list
  **/
 gboolean
-pk_client_get_updates (PkClient *client, const gchar *filter, GError **error)
+pk_client_get_updates (PkClient *client, PkFilterEnum filters, GError **error)
 {
 	gboolean ret;
+	gchar *filter_text;
 
 	g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
-	g_return_val_if_fail (filter != NULL, FALSE);
+	g_return_val_if_fail (filters != 0, FALSE);
 
 	/* get and set a new ID */
 	ret = pk_client_allocate_transaction_id (client, error);
@@ -991,15 +992,18 @@ pk_client_get_updates (PkClient *client, const gchar *filter, GError **error)
 
 	/* save this so we can re-issue it */
 	client->priv->role = PK_ROLE_ENUM_GET_UPDATES;
+	client->priv->cached_filters = filters;
 
 	/* check to see if we have a valid proxy */
 	if (client->priv->proxy == NULL) {
 		pk_client_error_set (error, PK_CLIENT_ERROR_NO_TID, "No proxy for transaction");
 		return FALSE;
 	}
+	filter_text = pk_filter_enums_to_text (filters);
 	ret = dbus_g_proxy_call (client->priv->proxy, "GetUpdates", error,
-				 G_TYPE_STRING, filter,
+				 G_TYPE_STRING, filter_text,
 				 G_TYPE_INVALID, G_TYPE_INVALID);
+	g_free (filter_text);
 	if (ret) {
 		/* allow clients to respond in the status changed callback */
 		pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
@@ -1099,7 +1103,7 @@ pk_client_update_system (PkClient *client, GError **error)
 /**
  * pk_client_search_name:
  * @client: a valid #PkClient instance
- * @filter: a filter enum such as "basename;~development" or "none"
+ * @filters: a %PkFilterEnum such as %PK_FILTER_ENUM_GUI | %PK_FILTER_ENUM_FREE or %PK_FILTER_ENUM_NONE
  * @search: free text to search for, for instance, "power"
  * @error: a %GError to put the error code and message in, or %NULL
  *
@@ -1109,9 +1113,10 @@ pk_client_update_system (PkClient *client, GError **error)
  * Return value: %TRUE if the daemon queued the transaction
  **/
 gboolean
-pk_client_search_name (PkClient *client, const gchar *filter, const gchar *search, GError **error)
+pk_client_search_name (PkClient *client, PkFilterEnum filters, const gchar *search, GError **error)
 {
 	gboolean ret;
+	gchar *filter_text;
 
 	g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
 
@@ -1123,7 +1128,7 @@ pk_client_search_name (PkClient *client, const gchar *filter, const gchar *searc
 
 	/* save this so we can re-issue it */
 	client->priv->role = PK_ROLE_ENUM_SEARCH_NAME;
-	client->priv->cached_filter = g_strdup (filter);
+	client->priv->cached_filters = filters;
 	client->priv->cached_search = g_strdup (search);
 
 	/* check to see if we have a valid proxy */
@@ -1131,10 +1136,12 @@ pk_client_search_name (PkClient *client, const gchar *filter, const gchar *searc
 		pk_client_error_set (error, PK_CLIENT_ERROR_NO_TID, "No proxy for transaction");
 		return FALSE;
 	}
+	filter_text = pk_filter_enums_to_text (filters);
 	ret = dbus_g_proxy_call (client->priv->proxy, "SearchName", error,
-				 G_TYPE_STRING, filter,
+				 G_TYPE_STRING, filter_text,
 				 G_TYPE_STRING, search,
 				 G_TYPE_INVALID, G_TYPE_INVALID);
+	g_free (filter_text);
 	if (ret) {
 		/* allow clients to respond in the status changed callback */
 		pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
@@ -1151,7 +1158,7 @@ pk_client_search_name (PkClient *client, const gchar *filter, const gchar *searc
 /**
  * pk_client_search_details:
  * @client: a valid #PkClient instance
- * @filter: a filter enum such as "basename;~development" or "none"
+ * @filters: a %PkFilterEnum such as %PK_FILTER_ENUM_GUI | %PK_FILTER_ENUM_FREE or %PK_FILTER_ENUM_NONE
  * @search: free text to search for, for instance, "power"
  * @error: a %GError to put the error code and message in, or %NULL
  *
@@ -1162,9 +1169,10 @@ pk_client_search_name (PkClient *client, const gchar *filter, const gchar *searc
  * Return value: %TRUE if the daemon queued the transaction
  **/
 gboolean
-pk_client_search_details (PkClient *client, const gchar *filter, const gchar *search, GError **error)
+pk_client_search_details (PkClient *client, PkFilterEnum filters, const gchar *search, GError **error)
 {
 	gboolean ret;
+	gchar *filter_text;
 
 	g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
 
@@ -1176,7 +1184,7 @@ pk_client_search_details (PkClient *client, const gchar *filter, const gchar *se
 
 	/* save this so we can re-issue it */
 	client->priv->role = PK_ROLE_ENUM_SEARCH_DETAILS;
-	client->priv->cached_filter = g_strdup (filter);
+	client->priv->cached_filters = filters;
 	client->priv->cached_search = g_strdup (search);
 
 	/* check to see if we have a valid proxy */
@@ -1184,10 +1192,12 @@ pk_client_search_details (PkClient *client, const gchar *filter, const gchar *se
 		pk_client_error_set (error, PK_CLIENT_ERROR_NO_TID, "No proxy for transaction");
 		return FALSE;
 	}
+	filter_text = pk_filter_enums_to_text (filters);
 	ret = dbus_g_proxy_call (client->priv->proxy, "SearchDetails", error,
-				 G_TYPE_STRING, filter,
+				 G_TYPE_STRING, filter_text,
 				 G_TYPE_STRING, search,
 				 G_TYPE_INVALID, G_TYPE_INVALID);
+	g_free (filter_text);
 	if (ret) {
 		/* allow clients to respond in the status changed callback */
 		pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
@@ -1204,7 +1214,7 @@ pk_client_search_details (PkClient *client, const gchar *filter, const gchar *se
 /**
  * pk_client_search_group:
  * @client: a valid #PkClient instance
- * @filter: a filter enum such as "basename;~development" or "none"
+ * @filters: a %PkFilterEnum such as %PK_FILTER_ENUM_GUI | %PK_FILTER_ENUM_FREE or %PK_FILTER_ENUM_NONE
  * @search: a group enum to search for, for instance, "system-tools"
  * @error: a %GError to put the error code and message in, or %NULL
  *
@@ -1213,9 +1223,10 @@ pk_client_search_details (PkClient *client, const gchar *filter, const gchar *se
  * Return value: %TRUE if the daemon queued the transaction
  **/
 gboolean
-pk_client_search_group (PkClient *client, const gchar *filter, const gchar *search, GError **error)
+pk_client_search_group (PkClient *client, PkFilterEnum filters, const gchar *search, GError **error)
 {
 	gboolean ret;
+	gchar *filter_text;
 
 	g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
 
@@ -1227,7 +1238,7 @@ pk_client_search_group (PkClient *client, const gchar *filter, const gchar *sear
 
 	/* save this so we can re-issue it */
 	client->priv->role = PK_ROLE_ENUM_SEARCH_GROUP;
-	client->priv->cached_filter = g_strdup (filter);
+	client->priv->cached_filters = filters;
 	client->priv->cached_search = g_strdup (search);
 
 	/* check to see if we have a valid proxy */
@@ -1235,10 +1246,12 @@ pk_client_search_group (PkClient *client, const gchar *filter, const gchar *sear
 		pk_client_error_set (error, PK_CLIENT_ERROR_NO_TID, "No proxy for transaction");
 		return FALSE;
 	}
+	filter_text = pk_filter_enums_to_text (filters);
 	ret = dbus_g_proxy_call (client->priv->proxy, "SearchGroup", error,
-				 G_TYPE_STRING, filter,
+				 G_TYPE_STRING, filter_text,
 				 G_TYPE_STRING, search,
 				 G_TYPE_INVALID, G_TYPE_INVALID);
+	g_free (filter_text);
 	if (ret) {
 		/* allow clients to respond in the status changed callback */
 		pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
@@ -1255,7 +1268,7 @@ pk_client_search_group (PkClient *client, const gchar *filter, const gchar *sear
 /**
  * pk_client_search_file:
  * @client: a valid #PkClient instance
- * @filter: a filter enum such as "basename;~development" or "none"
+ * @filters: a %PkFilterEnum such as %PK_FILTER_ENUM_GUI | %PK_FILTER_ENUM_FREE or %PK_FILTER_ENUM_NONE
  * @search: file to search for, for instance, "/sbin/service"
  * @error: a %GError to put the error code and message in, or %NULL
  *
@@ -1264,9 +1277,10 @@ pk_client_search_group (PkClient *client, const gchar *filter, const gchar *sear
  * Return value: %TRUE if the daemon queued the transaction
  **/
 gboolean
-pk_client_search_file (PkClient *client, const gchar *filter, const gchar *search, GError **error)
+pk_client_search_file (PkClient *client, PkFilterEnum filters, const gchar *search, GError **error)
 {
 	gboolean ret;
+	gchar *filter_text;
 
 	g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
 
@@ -1278,7 +1292,7 @@ pk_client_search_file (PkClient *client, const gchar *filter, const gchar *searc
 
 	/* save this so we can re-issue it */
 	client->priv->role = PK_ROLE_ENUM_SEARCH_FILE;
-	client->priv->cached_filter = g_strdup (filter);
+	client->priv->cached_filters = filters;
 	client->priv->cached_search = g_strdup (search);
 
 	/* check to see if we have a valid proxy */
@@ -1286,10 +1300,12 @@ pk_client_search_file (PkClient *client, const gchar *filter, const gchar *searc
 		pk_client_error_set (error, PK_CLIENT_ERROR_NO_TID, "No proxy for transaction");
 		return FALSE;
 	}
+	filter_text = pk_filter_enums_to_text (filters);
 	ret = dbus_g_proxy_call (client->priv->proxy, "SearchFile", error,
-				 G_TYPE_STRING, filter,
+				 G_TYPE_STRING, filter_text,
 				 G_TYPE_STRING, search,
 				 G_TYPE_INVALID, G_TYPE_INVALID);
+	g_free (filter_text);
 	if (ret) {
 		/* allow clients to respond in the status changed callback */
 		pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
@@ -1306,7 +1322,7 @@ pk_client_search_file (PkClient *client, const gchar *filter, const gchar *searc
 /**
  * pk_client_get_depends:
  * @client: a valid #PkClient instance
- * @filter: a filter enum such as "basename;~development" or "none"
+ * @filters: a %PkFilterEnum such as %PK_FILTER_ENUM_GUI | %PK_FILTER_ENUM_FREE or %PK_FILTER_ENUM_NONE
  * @package_id: a package_id structure such as "gnome-power-manager;0.0.1;i386;fedora"
  * @recursive: If we should search recursively for depends
  * @error: a %GError to put the error code and message in, or %NULL
@@ -1316,12 +1332,13 @@ pk_client_search_file (PkClient *client, const gchar *filter, const gchar *searc
  * Return value: %TRUE if the daemon queued the transaction
  **/
 gboolean
-pk_client_get_depends (PkClient *client, const gchar *filter, const gchar *package_id, gboolean recursive, GError **error)
+pk_client_get_depends (PkClient *client, PkFilterEnum filters, const gchar *package_id, gboolean recursive, GError **error)
 {
 	gboolean ret;
+	gchar *filter_text;
 
 	g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
-	g_return_val_if_fail (filter != NULL, FALSE);
+	g_return_val_if_fail (filters != 0, FALSE);
 	g_return_val_if_fail (package_id != NULL, FALSE);
 
 	/* check the PackageID here to avoid a round trip if invalid */
@@ -1340,6 +1357,7 @@ pk_client_get_depends (PkClient *client, const gchar *filter, const gchar *packa
 
 	/* save this so we can re-issue it */
 	client->priv->role = PK_ROLE_ENUM_GET_DEPENDS;
+	client->priv->cached_filters = filters;
 	client->priv->cached_package_id = g_strdup (package_id);
 	client->priv->cached_force = recursive;
 
@@ -1348,11 +1366,13 @@ pk_client_get_depends (PkClient *client, const gchar *filter, const gchar *packa
 		pk_client_error_set (error, PK_CLIENT_ERROR_NO_TID, "No proxy for transaction");
 		return FALSE;
 	}
+	filter_text = pk_filter_enums_to_text (filters);
 	ret = dbus_g_proxy_call (client->priv->proxy, "GetDepends", error,
-				 G_TYPE_STRING, filter,
+				 G_TYPE_STRING, filter_text,
 				 G_TYPE_STRING, package_id,
 				 G_TYPE_BOOLEAN, recursive,
 				 G_TYPE_INVALID, G_TYPE_INVALID);
+	g_free (filter_text);
 	if (ret) {
 		/* allow clients to respond in the status changed callback */
 		pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
@@ -1369,7 +1389,7 @@ pk_client_get_depends (PkClient *client, const gchar *filter, const gchar *packa
 /**
  * pk_client_get_requires:
  * @client: a valid #PkClient instance
- * @filter: a filter enum such as "basename;~development" or "none"
+ * @filters: a %PkFilterEnum such as %PK_FILTER_ENUM_GUI | %PK_FILTER_ENUM_FREE or %PK_FILTER_ENUM_NONE
  * @package_id: a package_id structure such as "gnome-power-manager;0.0.1;i386;fedora"
  * @recursive: If we should search recursively for requires
  * @error: a %GError to put the error code and message in, or %NULL
@@ -1379,13 +1399,13 @@ pk_client_get_depends (PkClient *client, const gchar *filter, const gchar *packa
  * Return value: %TRUE if the daemon queued the transaction
  **/
 gboolean
-pk_client_get_requires (PkClient *client, const gchar *filter,
-			const gchar *package_id, gboolean recursive, GError **error)
+pk_client_get_requires (PkClient *client, PkFilterEnum filters, const gchar *package_id, gboolean recursive, GError **error)
 {
 	gboolean ret;
+	gchar *filter_text;
 
 	g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
-	g_return_val_if_fail (filter != NULL, FALSE);
+	g_return_val_if_fail (filters != 0, FALSE);
 	g_return_val_if_fail (package_id != NULL, FALSE);
 
 	/* check the PackageID here to avoid a round trip if invalid */
@@ -1404,6 +1424,7 @@ pk_client_get_requires (PkClient *client, const gchar *filter,
 
 	/* save this so we can re-issue it */
 	client->priv->role = PK_ROLE_ENUM_GET_REQUIRES;
+	client->priv->cached_filters = filters;
 	client->priv->cached_package_id = g_strdup (package_id);
 	client->priv->cached_force = recursive;
 
@@ -1412,11 +1433,13 @@ pk_client_get_requires (PkClient *client, const gchar *filter,
 		pk_client_error_set (error, PK_CLIENT_ERROR_NO_TID, "No proxy for transaction");
 		return FALSE;
 	}
+	filter_text = pk_filter_enums_to_text (filters);
 	ret = dbus_g_proxy_call (client->priv->proxy, "GetRequires", error,
-				 G_TYPE_STRING, filter,
+				 G_TYPE_STRING, filter_text,
 				 G_TYPE_STRING, package_id,
 				 G_TYPE_BOOLEAN, recursive,
 				 G_TYPE_INVALID, G_TYPE_INVALID);
+	g_free (filter_text);
 	if (ret) {
 		/* allow clients to respond in the status changed callback */
 		pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
@@ -1433,7 +1456,7 @@ pk_client_get_requires (PkClient *client, const gchar *filter,
 /**
  * pk_client_what_provides:
  * @client: a valid #PkClient instance
- * @filter: a filter enum such as "basename;~development" or "none"
+ * @filters: a %PkFilterEnum such as %PK_FILTER_ENUM_GUI | %PK_FILTER_ENUM_FREE or %PK_FILTER_ENUM_NONE
  * @provides: a #PkProvidesEnum value such as PK_PROVIDES_ENUM_CODEC
  * @search: a search term such as "sound/mp3"
  * @error: a %GError to put the error code and message in, or %NULL
@@ -1445,14 +1468,15 @@ pk_client_get_requires (PkClient *client, const gchar *filter,
  * Return value: %TRUE if the daemon queued the transaction
  **/
 gboolean
-pk_client_what_provides (PkClient *client, const gchar *filter, PkProvidesEnum provides,
+pk_client_what_provides (PkClient *client, PkFilterEnum filters, PkProvidesEnum provides,
 			 const gchar *search, GError **error)
 {
 	gboolean ret;
 	const gchar *provides_text;
+	gchar *filter_text;
 
 	g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
-	g_return_val_if_fail (filter != NULL, FALSE);
+	g_return_val_if_fail (filters != 0, FALSE);
 	g_return_val_if_fail (provides != PK_PROVIDES_ENUM_UNKNOWN, FALSE);
 	g_return_val_if_fail (search != NULL, FALSE);
 
@@ -1465,7 +1489,7 @@ pk_client_what_provides (PkClient *client, const gchar *filter, PkProvidesEnum p
 	/* save this so we can re-issue it */
 	client->priv->role = PK_ROLE_ENUM_WHAT_PROVIDES;
 	client->priv->cached_search = g_strdup (search);
-	client->priv->cached_filter = g_strdup (filter);
+	client->priv->cached_filters = filters;
 	client->priv->cached_provides = provides;
 
 	provides_text = pk_provides_enum_to_text (provides);
@@ -1475,11 +1499,13 @@ pk_client_what_provides (PkClient *client, const gchar *filter, PkProvidesEnum p
 		pk_client_error_set (error, PK_CLIENT_ERROR_NO_TID, "No proxy for transaction");
 		return FALSE;
 	}
+	filter_text = pk_filter_enums_to_text (filters);
 	ret = dbus_g_proxy_call (client->priv->proxy, "WhatProvides", error,
-				 G_TYPE_STRING, filter,
+				 G_TYPE_STRING, filter_text,
 				 G_TYPE_STRING, provides_text,
 				 G_TYPE_STRING, search,
 				 G_TYPE_INVALID, G_TYPE_INVALID);
+	g_free (filter_text);
 	if (ret) {
 		/* allow clients to respond in the status changed callback */
 		pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
@@ -1603,7 +1629,7 @@ pk_client_rollback (PkClient *client, const gchar *transaction_id, GError **erro
 /**
  * pk_client_resolve:
  * @client: a valid #PkClient instance
- * @filter: a filter enum such as "basename;~development" or "none"
+ * @filters: a %PkFilterEnum such as %PK_FILTER_ENUM_GUI | %PK_FILTER_ENUM_FREE or %PK_FILTER_ENUM_NONE
  * @package: the package name to resolve, e.g. "gnome-system-tools"
  * @error: a %GError to put the error code and message in, or %NULL
  *
@@ -1614,12 +1640,13 @@ pk_client_rollback (PkClient *client, const gchar *transaction_id, GError **erro
  * Return value: %TRUE if the daemon queued the transaction
  **/
 gboolean
-pk_client_resolve (PkClient *client, const gchar *filter, const gchar *package, GError **error)
+pk_client_resolve (PkClient *client, PkFilterEnum filters, const gchar *package, GError **error)
 {
 	gboolean ret;
+	gchar *filter_text;
 
 	g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
-	g_return_val_if_fail (filter != NULL, FALSE);
+	g_return_val_if_fail (filters != 0, FALSE);
 	g_return_val_if_fail (package != NULL, FALSE);
 
 	/* get and set a new ID */
@@ -1630,7 +1657,7 @@ pk_client_resolve (PkClient *client, const gchar *filter, const gchar *package,
 
 	/* save this so we can re-issue it */
 	client->priv->role = PK_ROLE_ENUM_RESOLVE;
-	client->priv->cached_filter = g_strdup (filter);
+	client->priv->cached_filters = filters;
 	client->priv->cached_package_id = g_strdup (package);
 
 	/* check to see if we have a valid proxy */
@@ -1638,10 +1665,12 @@ pk_client_resolve (PkClient *client, const gchar *filter, const gchar *package,
 		pk_client_error_set (error, PK_CLIENT_ERROR_NO_TID, "No proxy for transaction");
 		return FALSE;
 	}
+	filter_text = pk_filter_enums_to_text (filters);
 	ret = dbus_g_proxy_call (client->priv->proxy, "Resolve", error,
-				 G_TYPE_STRING, filter,
+				 G_TYPE_STRING, filter_text,
 				 G_TYPE_STRING, package,
 				 G_TYPE_INVALID, G_TYPE_INVALID);
+	g_free (filter_text);
 	if (ret) {
 		/* allow clients to respond in the status changed callback */
 		pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
@@ -2416,12 +2445,13 @@ pk_client_install_file (PkClient *client, const gchar *file_rel, GError **error)
  * Return value: %TRUE if the daemon queued the transaction
  */
 gboolean
-pk_client_get_repo_list (PkClient *client, const gchar *filter, GError **error)
+pk_client_get_repo_list (PkClient *client, PkFilterEnum filters, GError **error)
 {
 	gboolean ret;
+	gchar *filter_text;
 
 	g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
-	g_return_val_if_fail (filter != NULL, FALSE);
+	g_return_val_if_fail (filters != 0, FALSE);
 
 	/* get and set a new ID */
 	ret = pk_client_allocate_transaction_id (client, error);
@@ -2431,16 +2461,18 @@ pk_client_get_repo_list (PkClient *client, const gchar *filter, GError **error)
 
 	/* save this so we can re-issue it */
 	client->priv->role = PK_ROLE_ENUM_GET_REPO_LIST;
-	client->priv->cached_filter = g_strdup (filter);
+	client->priv->cached_filters = filters;
 
 	/* check to see if we have a valid proxy */
 	if (client->priv->proxy == NULL) {
 		pk_client_error_set (error, PK_CLIENT_ERROR_NO_TID, "No proxy for transaction");
 		return FALSE;
 	}
+	filter_text = pk_filter_enums_to_text (filters);
 	ret = dbus_g_proxy_call (client->priv->proxy, "GetRepoList", error,
-				 G_TYPE_STRING, filter,
+				 G_TYPE_STRING, filter_text,
 				 G_TYPE_INVALID, G_TYPE_INVALID);
+	g_free (filter_text);
 	pk_client_error_fixup (error);
 	if (ret) {
 		/* allow clients to respond in the status changed callback */
@@ -2742,11 +2774,11 @@ pk_client_requeue (PkClient *client, GError **error)
 
 	/* do the correct action with the cached parameters */
 	if (priv->role == PK_ROLE_ENUM_GET_DEPENDS) {
-		ret = pk_client_get_depends (client, priv->cached_filter, priv->cached_package_id, priv->cached_force, error);
+		ret = pk_client_get_depends (client, priv->cached_filters, priv->cached_package_id, priv->cached_force, error);
 	} else if (priv->role == PK_ROLE_ENUM_GET_UPDATE_DETAIL) {
 		ret = pk_client_get_update_detail (client, priv->cached_package_id, error);
 	} else if (priv->role == PK_ROLE_ENUM_RESOLVE) {
-		ret = pk_client_resolve (client, priv->cached_filter, priv->cached_package_id, error);
+		ret = pk_client_resolve (client, priv->cached_filters, priv->cached_package_id, error);
 	} else if (priv->role == PK_ROLE_ENUM_ROLLBACK) {
 		ret = pk_client_rollback (client, priv->cached_transaction_id, error);
 	} else if (priv->role == PK_ROLE_ENUM_GET_DESCRIPTION) {
@@ -2754,17 +2786,17 @@ pk_client_requeue (PkClient *client, GError **error)
 	} else if (priv->role == PK_ROLE_ENUM_GET_FILES) {
 		ret = pk_client_get_files (client, priv->cached_package_id, error);
 	} else if (priv->role == PK_ROLE_ENUM_GET_REQUIRES) {
-		ret = pk_client_get_requires (client, priv->cached_filter, priv->cached_package_id, priv->cached_force, error);
+		ret = pk_client_get_requires (client, priv->cached_filters, priv->cached_package_id, priv->cached_force, error);
 	} else if (priv->role == PK_ROLE_ENUM_GET_UPDATES) {
-		ret = pk_client_get_updates (client, priv->cached_filter, error);
+		ret = pk_client_get_updates (client, priv->cached_filters, error);
 	} else if (priv->role == PK_ROLE_ENUM_SEARCH_DETAILS) {
-		ret = pk_client_search_details (client, priv->cached_filter, priv->cached_search, error);
+		ret = pk_client_search_details (client, priv->cached_filters, priv->cached_search, error);
 	} else if (priv->role == PK_ROLE_ENUM_SEARCH_FILE) {
-		ret = pk_client_search_file (client, priv->cached_filter, priv->cached_search, error);
+		ret = pk_client_search_file (client, priv->cached_filters, priv->cached_search, error);
 	} else if (priv->role == PK_ROLE_ENUM_SEARCH_GROUP) {
-		ret = pk_client_search_group (client, priv->cached_filter, priv->cached_search, error);
+		ret = pk_client_search_group (client, priv->cached_filters, priv->cached_search, error);
 	} else if (priv->role == PK_ROLE_ENUM_SEARCH_NAME) {
-		ret = pk_client_search_name (client, priv->cached_filter, priv->cached_search, error);
+		ret = pk_client_search_name (client, priv->cached_filters, priv->cached_search, error);
 	} else if (priv->role == PK_ROLE_ENUM_INSTALL_PACKAGE) {
 		ret = pk_client_install_package (client, priv->cached_package_id, error);
 	} else if (priv->role == PK_ROLE_ENUM_INSTALL_FILE) {
@@ -2780,7 +2812,7 @@ pk_client_requeue (PkClient *client, GError **error)
 	} else if (priv->role == PK_ROLE_ENUM_UPDATE_SYSTEM) {
 		ret = pk_client_update_system (client, error);
 	} else if (priv->role == PK_ROLE_ENUM_GET_REPO_LIST) {
-		ret = pk_client_get_repo_list (client, priv->cached_filter, error);
+		ret = pk_client_get_repo_list (client, priv->cached_filters, error);
 	} else {
 		pk_client_error_set (error, PK_CLIENT_ERROR_ROLE_UNKNOWN, "role unknown for reque");
 		return FALSE;
@@ -3249,7 +3281,6 @@ pk_client_reset (PkClient *client, GError **error)
 	g_free (client->priv->cached_key_id);
 	g_free (client->priv->cached_transaction_id);
 	g_free (client->priv->cached_full_path);
-	g_free (client->priv->cached_filter);
 	g_free (client->priv->cached_search);
 	g_strfreev (client->priv->cached_package_ids);
 
@@ -3261,9 +3292,9 @@ pk_client_reset (PkClient *client, GError **error)
 	client->priv->cached_key_id = NULL;
 	client->priv->cached_transaction_id = NULL;
 	client->priv->cached_full_path = NULL;
-	client->priv->cached_filter = NULL;
 	client->priv->cached_search = NULL;
 	client->priv->cached_package_ids = NULL;
+	client->priv->cached_filters = PK_FILTER_ENUM_UNKNOWN;
 	client->priv->last_status = PK_STATUS_ENUM_UNKNOWN;
 	client->priv->role = PK_ROLE_ENUM_UNKNOWN;
 	client->priv->is_finished = FALSE;
@@ -3295,9 +3326,9 @@ pk_client_init (PkClient *client)
 	client->priv->cached_transaction_id = NULL;
 	client->priv->cached_key_id = NULL;
 	client->priv->cached_full_path = NULL;
-	client->priv->cached_filter = NULL;
 	client->priv->cached_search = NULL;
 	client->priv->cached_provides = PK_PROVIDES_ENUM_UNKNOWN;
+	client->priv->cached_filters = PK_FILTER_ENUM_UNKNOWN;
 	client->priv->proxy = NULL;
 
 	/* check dbus connections, exit if not valid */
@@ -3401,7 +3432,6 @@ pk_client_finalize (GObject *object)
 	g_free (client->priv->cached_key_id);
 	g_free (client->priv->cached_transaction_id);
 	g_free (client->priv->cached_full_path);
-	g_free (client->priv->cached_filter);
 	g_free (client->priv->cached_search);
 	g_free (client->priv->tid);
 	g_strfreev (client->priv->cached_package_ids);
@@ -3529,7 +3559,7 @@ libst_client (LibSelfTest *test)
 
 	/* run the method */
 	pk_client_set_synchronous (client, TRUE, NULL);
-	ret = pk_client_search_name (client, "none", "power", NULL);
+	ret = pk_client_search_name (client, PK_FILTER_ENUM_NONE, "power", NULL);
 
 	/************************************************************/
 	libst_title (test, "we finished?");
@@ -3554,7 +3584,7 @@ libst_client (LibSelfTest *test)
 
 	/************************************************************/
 	libst_title (test, "search for power");
-	ret = pk_client_search_name (client, "none", "power", &error);
+	ret = pk_client_search_name (client, PK_FILTER_ENUM_NONE, "power", &error);
 	if (!ret) {
 		libst_failed (test, "failed: %s", error->message);
 		g_error_free (error);
@@ -3575,7 +3605,7 @@ libst_client (LibSelfTest *test)
 			libst_failed (test, "failed: to reset: %s", error->message);
 			g_error_free (error);
 		}
-		ret = pk_client_search_name (client, "none", "power", &error);
+		ret = pk_client_search_name (client, PK_FILTER_ENUM_NONE, "power", &error);
 		if (!ret) {
 			libst_failed (test, "failed to search: %s", error->message);
 			g_error_free (error);
@@ -3602,7 +3632,7 @@ libst_client (LibSelfTest *test)
 			  G_CALLBACK (libst_client_copy_package_cb), test);
 
 	/* search with the source */
-	ret = pk_client_search_name (client, "none", "power", &error);
+	ret = pk_client_search_name (client, PK_FILTER_ENUM_NONE, "power", &error);
 	if (!ret) {
 		libst_failed (test, "failed: %s", error->message);
 		g_error_free (error);
diff --git a/libpackagekit/pk-client.h b/libpackagekit/pk-client.h
index 3de0875..e90a553 100644
--- a/libpackagekit/pk-client.h
+++ b/libpackagekit/pk-client.h
@@ -196,33 +196,33 @@ gboolean	 pk_client_cancel			(PkClient	*client,
 							 GError		**error)
 							 G_GNUC_WARN_UNUSED_RESULT;
 gboolean	 pk_client_get_updates			(PkClient	*client,
-							 const gchar	*filter,
+							 PkFilterEnum	 filters,
 							 GError		**error)
 							 G_GNUC_WARN_UNUSED_RESULT;
 gboolean	 pk_client_update_system		(PkClient	*client,
 							 GError		**error)
 							 G_GNUC_WARN_UNUSED_RESULT;
 gboolean	 pk_client_search_name			(PkClient	*client,
-							 const gchar	*filter,
+							 PkFilterEnum	 filters,
 							 const gchar	*search,
 							 GError		**error)
 							 G_GNUC_WARN_UNUSED_RESULT;
 gboolean	 pk_client_search_details		(PkClient	*client,
-							 const gchar	*filter,
+							 PkFilterEnum	 filters,
 							 const gchar	*search,
 							 GError		**error);
 gboolean	 pk_client_search_group			(PkClient	*client,
-							 const gchar	*filter,
+							 PkFilterEnum	 filters,
 							 const gchar	*search,
 							 GError		**error)
 							 G_GNUC_WARN_UNUSED_RESULT;
 gboolean	 pk_client_search_file			(PkClient	*client,
-							 const gchar	*filter,
+							 PkFilterEnum	 filters,
 							 const gchar	*search,
 							 GError		**error)
 							 G_GNUC_WARN_UNUSED_RESULT;
 gboolean	 pk_client_get_depends			(PkClient	*client,
-							 const gchar	*filter,
+							 PkFilterEnum	 filters,
 							 const gchar	*package_id,
 							 gboolean	 recursive,
 							 GError		**error)
@@ -232,13 +232,13 @@ gboolean	 pk_client_get_update_detail		(PkClient	*client,
 							 GError		**error)
 							 G_GNUC_WARN_UNUSED_RESULT;
 gboolean	 pk_client_get_requires			(PkClient	*client,
-							 const gchar	*filter,
+							 PkFilterEnum	 filters,
 							 const gchar	*package_id,
 							 gboolean	 recursive,
 							 GError		**error)
 							 G_GNUC_WARN_UNUSED_RESULT;
 gboolean	 pk_client_what_provides		(PkClient	*client,
-							 const gchar	*filter,
+							 PkFilterEnum	 filters,
 							 PkProvidesEnum	 provides,
 							 const gchar	*search,
 							 GError		**error)
@@ -287,7 +287,7 @@ gboolean	 pk_client_install_file			(PkClient	*client,
 							 GError		**error)
 							 G_GNUC_WARN_UNUSED_RESULT;
 gboolean	 pk_client_resolve			(PkClient	*client,
-							 const gchar	*filter,
+							 PkFilterEnum	 filters,
 							 const gchar	*package,
 							 GError		**error)
 							 G_GNUC_WARN_UNUSED_RESULT;
@@ -304,7 +304,7 @@ gboolean	 pk_client_requeue			(PkClient	*client,
 
 /* repo stuff */
 gboolean	 pk_client_get_repo_list		(PkClient	*client,
-							 const gchar	*filter,
+							 PkFilterEnum	 filters,
 							 GError		**error)
 							 G_GNUC_WARN_UNUSED_RESULT;
 gboolean	 pk_client_repo_enable			(PkClient	*client,
diff --git a/libpackagekit/pk-task-list.c b/libpackagekit/pk-task-list.c
index 5a84738..b916221 100644
--- a/libpackagekit/pk-task-list.c
+++ b/libpackagekit/pk-task-list.c
@@ -514,7 +514,7 @@ libst_task_list (LibSelfTest *test)
 	/************************************************************/
 	libst_title (test, "search for power");
 	client = pk_client_new ();
-	ret = pk_client_search_name (client, "none", "power", &error);
+	ret = pk_client_search_name (client, PK_FILTER_ENUM_NONE, "power", &error);
 	if (!ret) {
 		libst_failed (test, "failed: %s", error->message);
 		g_error_free (error);
commit 83a4c36319ffbf6e687db9b620797f803c0a4f4e
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Apr 11 01:50:52 2008 +0100

    the none filter is special, use zero for it

diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index c555c37..fa83c58 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -826,6 +826,11 @@ pk_filter_enums_to_text (PkFilterEnum filters)
 	GString *string;
 	guint i;
 
+	/* shortcut */
+	if (filters == PK_FILTER_ENUM_NONE) {
+		return g_strdup (pk_filter_enum_to_text (filters));
+	}
+
 	string = g_string_new ("");
 	for (i=1; i<PK_FILTER_ENUM_UNKNOWN; i*=2) {
 		if ((filters & i) == 0) {
@@ -1060,6 +1065,16 @@ libst_enum (LibSelfTest *test)
 	libst_success (test, NULL);
 
 	/************************************************************/
+	libst_title (test, "check we can convert filter enums to text (none)");
+	text = pk_filter_enums_to_text (PK_FILTER_ENUM_NONE);
+	if (pk_strequal (text, "none")) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, "text was %s", text);
+	}
+	g_free (text);
+
+	/************************************************************/
 	libst_title (test, "check we can convert filter enums to text (single)");
 	text = pk_filter_enums_to_text (PK_FILTER_ENUM_NOT_DEVELOPMENT);
 	if (pk_strequal (text, "~devel")) {
@@ -1092,6 +1107,18 @@ libst_enum (LibSelfTest *test)
 	}
 	g_free (text);
 
+	/************************************************************/
+	libst_title (test, "check we can add / remove enums to nothing");
+	filter = PK_FILTER_ENUM_NOT_DEVELOPMENT;
+	pk_enums_remove (filter, PK_FILTER_ENUM_NOT_DEVELOPMENT);
+	text = pk_filter_enums_to_text (filter);
+	if (pk_strequal (text, "none")) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, "text was %s", text);
+	}
+	g_free (text);
+
 	libst_end (test);
 }
 #endif
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index fc00ebf..5e1e26e 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -142,24 +142,24 @@ typedef enum {
  * The filter types
  **/
 typedef enum {
-	PK_FILTER_ENUM_NONE			= 1 << 1,
-	PK_FILTER_ENUM_INSTALLED		= 1 << 2,
-	PK_FILTER_ENUM_NOT_INSTALLED		= 1 << 3,
-	PK_FILTER_ENUM_DEVELOPMENT		= 1 << 4,
-	PK_FILTER_ENUM_NOT_DEVELOPMENT		= 1 << 5,
-	PK_FILTER_ENUM_GUI			= 1 << 6,
-	PK_FILTER_ENUM_NOT_GUI			= 1 << 7,
-	PK_FILTER_ENUM_FREE			= 1 << 8,
-	PK_FILTER_ENUM_NOT_FREE			= 1 << 9,
-	PK_FILTER_ENUM_VISIBLE			= 1 << 10,
-	PK_FILTER_ENUM_NOT_VISIBLE		= 1 << 11,
-	PK_FILTER_ENUM_SUPPORTED		= 1 << 12,
-	PK_FILTER_ENUM_NOT_SUPPORTED		= 1 << 13,
-	PK_FILTER_ENUM_BASENAME			= 1 << 14,
-	PK_FILTER_ENUM_NOT_BASENAME		= 1 << 15,
-	PK_FILTER_ENUM_NEWEST			= 1 << 16,
-	PK_FILTER_ENUM_NOT_NEWEST		= 1 << 17,
-	PK_FILTER_ENUM_UNKNOWN			= 1 << 18
+	PK_FILTER_ENUM_NONE			= 0,
+	PK_FILTER_ENUM_INSTALLED		= 1 << 1,
+	PK_FILTER_ENUM_NOT_INSTALLED		= 1 << 2,
+	PK_FILTER_ENUM_DEVELOPMENT		= 1 << 3,
+	PK_FILTER_ENUM_NOT_DEVELOPMENT		= 1 << 4,
+	PK_FILTER_ENUM_GUI			= 1 << 5,
+	PK_FILTER_ENUM_NOT_GUI			= 1 << 6,
+	PK_FILTER_ENUM_FREE			= 1 << 7,
+	PK_FILTER_ENUM_NOT_FREE			= 1 << 8,
+	PK_FILTER_ENUM_VISIBLE			= 1 << 9,
+	PK_FILTER_ENUM_NOT_VISIBLE		= 1 << 10,
+	PK_FILTER_ENUM_SUPPORTED		= 1 << 11,
+	PK_FILTER_ENUM_NOT_SUPPORTED		= 1 << 12,
+	PK_FILTER_ENUM_BASENAME			= 1 << 13,
+	PK_FILTER_ENUM_NOT_BASENAME		= 1 << 14,
+	PK_FILTER_ENUM_NEWEST			= 1 << 15,
+	PK_FILTER_ENUM_NOT_NEWEST		= 1 << 16,
+	PK_FILTER_ENUM_UNKNOWN			= 1 << 17
 } PkFilterEnum;
 
 /**
commit 495c19b2fb36dc5e11aef0be7fc250c9f6448ea1
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Apr 11 01:41:18 2008 +0100

    add two convenience functions for adding and removing an enum list

diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index 1a9da6e..c555c37 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -885,6 +885,7 @@ libst_enum (LibSelfTest *test)
 	PkRoleEnum value;
 	guint i;
 	gchar *text;
+	PkFilterEnum filter;
 
 	if (libst_start (test, "PkEnum", CLASS_AUTO) == FALSE) {
 		return;
@@ -1078,6 +1079,19 @@ libst_enum (LibSelfTest *test)
 	}
 	g_free (text);
 
+	/************************************************************/
+	libst_title (test, "check we can add / remove enums");
+	filter = PK_FILTER_ENUM_NOT_DEVELOPMENT | PK_FILTER_ENUM_GUI | PK_FILTER_ENUM_NEWEST;
+	pk_enums_add (filter, PK_FILTER_ENUM_NOT_FREE);
+	pk_enums_remove (filter, PK_FILTER_ENUM_NOT_DEVELOPMENT);
+	text = pk_filter_enums_to_text (filter);
+	if (pk_strequal (text, "gui;~free;newest")) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, "text was %s", text);
+	}
+	g_free (text);
+
 	libst_end (test);
 }
 #endif
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index 0e13f9d..fc00ebf 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -37,6 +37,10 @@ typedef struct {
 	const gchar	*string;
 } PkEnumMatch;
 
+/* convenience functions as it's easy to forget the bitwise operators */
+#define pk_enums_add(enums,enum)	do { ((enums) |= (enum)); } while (0)
+#define pk_enums_remove(enums,enum)	do { ((enums) &= ~(enum)); } while (0)
+
 /**
  * PkRoleEnum:
  *
commit 652eb73e63c07a184938e585616164826a3b93ea
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Apr 11 01:39:58 2008 +0100

    iterate the role list properly, and also open the database rw-create

diff --git a/src/pk-transaction-db.c b/src/pk-transaction-db.c
index 5ef2cf5..c90bf86 100644
--- a/src/pk-transaction-db.c
+++ b/src/pk-transaction-db.c
@@ -466,7 +466,7 @@ pk_transaction_db_create_table_last_action (PkTransactionDb *tdb)
 	timespec = pk_iso8601_present ();
 	statement = "CREATE TABLE last_action (role TEXT primary key, timespec TEXT);";
 	sqlite3_exec (tdb->priv->db, statement, NULL, NULL, NULL);
-	for (i=0; i<PK_ROLE_ENUM_UNKNOWN; i++) {
+	for (i=1; i<PK_ROLE_ENUM_UNKNOWN; i*=2) {
 		role_text = pk_role_enum_to_text (i);
 		/* reset to now if the role does not exist */
 		statement = g_strdup_printf ("INSERT INTO last_action (role, timespec) VALUES ('%s', '%s')", role_text, timespec);
@@ -496,10 +496,10 @@ pk_transaction_db_init (PkTransactionDb *tdb)
 	create_file = g_file_test (PK_TRANSACTION_DB_FILE, G_FILE_TEST_EXISTS);
 
 	pk_debug ("trying to open database '%s'", PK_TRANSACTION_DB_FILE);
-	rc = sqlite3_open (PK_TRANSACTION_DB_FILE, &tdb->priv->db);
+	rc = sqlite3_open_v2 (PK_TRANSACTION_DB_FILE, &tdb->priv->db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
 	if (rc) {
-		sqlite3_close (tdb->priv->db);
 		pk_error ("Can't open database: %s\n", sqlite3_errmsg (tdb->priv->db));
+		sqlite3_close (tdb->priv->db);
 		return;
 	} else {
 		if (create_file == FALSE) {
commit c05cf5f3dd84ac918148117dfd42d8c6ceb09bf9
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Apr 11 00:34:27 2008 +0100

    add a new function pk_filter_enums_to_text that allows us to convert the bitfields to text

diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index e2cc562..1a9da6e 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -813,6 +813,38 @@ pk_filter_enum_to_text (PkFilterEnum filter)
 }
 
 /**
+ * pk_filter_enums_to_text:
+ * @filters: The enumerated type values
+ *
+ * Converts a enumerated type bitfield to its text representation
+ *
+ * Return value: the enumerated constant value, e.g. "available;~gui"
+ **/
+gchar *
+pk_filter_enums_to_text (PkFilterEnum filters)
+{
+	GString *string;
+	guint i;
+
+	string = g_string_new ("");
+	for (i=1; i<PK_FILTER_ENUM_UNKNOWN; i*=2) {
+		if ((filters & i) == 0) {
+			continue;
+		}
+		g_string_append_printf (string, "%s;", pk_filter_enum_to_text (i));
+	}
+	/* do we have a 'none' filter? \n */
+	if (string->len == 0) {
+		pk_warning ("not valid!");
+		g_string_append (string, pk_filter_enum_to_text (PK_FILTER_ENUM_NONE));
+	} else {
+		/* remove last \n */
+		g_string_set_size (string, string->len - 1);
+	}
+	return g_string_free (string, FALSE);
+}
+
+/**
  * pk_license_enum_from_text:
  * @license: Text describing the enumerated type
  *
@@ -852,6 +884,7 @@ libst_enum (LibSelfTest *test)
 	const gchar *string;
 	PkRoleEnum value;
 	guint i;
+	gchar *text;
 
 	if (libst_start (test, "PkEnum", CLASS_AUTO) == FALSE) {
 		return;
@@ -1025,6 +1058,26 @@ libst_enum (LibSelfTest *test)
 	}
 	libst_success (test, NULL);
 
+	/************************************************************/
+	libst_title (test, "check we can convert filter enums to text (single)");
+	text = pk_filter_enums_to_text (PK_FILTER_ENUM_NOT_DEVELOPMENT);
+	if (pk_strequal (text, "~devel")) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, "text was %s", text);
+	}
+	g_free (text);
+
+	/************************************************************/
+	libst_title (test, "check we can convert filter enums to text (plural)");
+	text = pk_filter_enums_to_text (PK_FILTER_ENUM_NOT_DEVELOPMENT | PK_FILTER_ENUM_GUI | PK_FILTER_ENUM_NEWEST);
+	if (pk_strequal (text, "~devel;gui;newest")) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, "text was %s", text);
+	}
+	g_free (text);
+
 	libst_end (test);
 }
 #endif
commit 0a829c3b0ff2c9d525482928dce5633c3be16d0f
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Apr 11 00:33:30 2008 +0100

    convert the role and filter enums to bitfields so we can do some cleverness with client side filters

diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index d44e8c5..0e13f9d 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -46,31 +46,31 @@ typedef struct {
  * these constants
  **/
 typedef enum {
-	PK_ROLE_ENUM_CANCEL,
-	PK_ROLE_ENUM_RESOLVE,
-	PK_ROLE_ENUM_ROLLBACK,
-	PK_ROLE_ENUM_GET_DEPENDS,
-	PK_ROLE_ENUM_GET_UPDATE_DETAIL,
-	PK_ROLE_ENUM_GET_DESCRIPTION,
-	PK_ROLE_ENUM_GET_FILES,
-	PK_ROLE_ENUM_GET_REQUIRES,
-	PK_ROLE_ENUM_GET_UPDATES,
-	PK_ROLE_ENUM_SEARCH_DETAILS,
-	PK_ROLE_ENUM_SEARCH_FILE,
-	PK_ROLE_ENUM_SEARCH_GROUP,
-	PK_ROLE_ENUM_SEARCH_NAME,
-	PK_ROLE_ENUM_REFRESH_CACHE,
-	PK_ROLE_ENUM_UPDATE_SYSTEM,
-	PK_ROLE_ENUM_REMOVE_PACKAGE,
-	PK_ROLE_ENUM_INSTALL_PACKAGE,
-	PK_ROLE_ENUM_INSTALL_FILE,
-	PK_ROLE_ENUM_INSTALL_SIGNATURE,
-	PK_ROLE_ENUM_UPDATE_PACKAGES,
-	PK_ROLE_ENUM_GET_REPO_LIST,
-	PK_ROLE_ENUM_REPO_ENABLE,
-	PK_ROLE_ENUM_REPO_SET_DATA,
-	PK_ROLE_ENUM_SERVICE_PACK,
-	PK_ROLE_ENUM_WHAT_PROVIDES,
+	PK_ROLE_ENUM_CANCEL			= 1 << 1,
+	PK_ROLE_ENUM_RESOLVE			= 1 << 2,
+	PK_ROLE_ENUM_ROLLBACK			= 1 << 3,
+	PK_ROLE_ENUM_GET_DEPENDS		= 1 << 4,
+	PK_ROLE_ENUM_GET_UPDATE_DETAIL		= 1 << 5,
+	PK_ROLE_ENUM_GET_DESCRIPTION		= 1 << 6,
+	PK_ROLE_ENUM_GET_FILES			= 1 << 7,
+	PK_ROLE_ENUM_GET_REQUIRES		= 1 << 8,
+	PK_ROLE_ENUM_GET_UPDATES		= 1 << 9,
+	PK_ROLE_ENUM_SEARCH_DETAILS		= 1 << 10,
+	PK_ROLE_ENUM_SEARCH_FILE		= 1 << 11,
+	PK_ROLE_ENUM_SEARCH_GROUP		= 1 << 12,
+	PK_ROLE_ENUM_SEARCH_NAME		= 1 << 13,
+	PK_ROLE_ENUM_REFRESH_CACHE		= 1 << 14,
+	PK_ROLE_ENUM_UPDATE_SYSTEM		= 1 << 15,
+	PK_ROLE_ENUM_REMOVE_PACKAGE		= 1 << 16,
+	PK_ROLE_ENUM_INSTALL_PACKAGE		= 1 << 17,
+	PK_ROLE_ENUM_INSTALL_FILE		= 1 << 18,
+	PK_ROLE_ENUM_INSTALL_SIGNATURE		= 1 << 19,
+	PK_ROLE_ENUM_UPDATE_PACKAGES		= 1 << 20,
+	PK_ROLE_ENUM_GET_REPO_LIST		= 1 << 21,
+	PK_ROLE_ENUM_REPO_ENABLE		= 1 << 22,
+	PK_ROLE_ENUM_REPO_SET_DATA		= 1 << 23,
+	PK_ROLE_ENUM_SERVICE_PACK		= 1 << 24,
+	PK_ROLE_ENUM_WHAT_PROVIDES		= 1 << 25,
 	PK_ROLE_ENUM_UNKNOWN
 } PkRoleEnum;
 
@@ -138,24 +138,24 @@ typedef enum {
  * The filter types
  **/
 typedef enum {
-	PK_FILTER_ENUM_NONE,
-	PK_FILTER_ENUM_INSTALLED,
-	PK_FILTER_ENUM_NOT_INSTALLED,
-	PK_FILTER_ENUM_DEVELOPMENT,
-	PK_FILTER_ENUM_NOT_DEVELOPMENT,
-	PK_FILTER_ENUM_GUI,
-	PK_FILTER_ENUM_NOT_GUI,
-	PK_FILTER_ENUM_FREE,
-	PK_FILTER_ENUM_NOT_FREE,
-	PK_FILTER_ENUM_VISIBLE,
-	PK_FILTER_ENUM_NOT_VISIBLE,
-	PK_FILTER_ENUM_SUPPORTED,
-	PK_FILTER_ENUM_NOT_SUPPORTED,
-	PK_FILTER_ENUM_BASENAME,
-	PK_FILTER_ENUM_NOT_BASENAME,
-	PK_FILTER_ENUM_NEWEST,
-	PK_FILTER_ENUM_NOT_NEWEST,
-	PK_FILTER_ENUM_UNKNOWN
+	PK_FILTER_ENUM_NONE			= 1 << 1,
+	PK_FILTER_ENUM_INSTALLED		= 1 << 2,
+	PK_FILTER_ENUM_NOT_INSTALLED		= 1 << 3,
+	PK_FILTER_ENUM_DEVELOPMENT		= 1 << 4,
+	PK_FILTER_ENUM_NOT_DEVELOPMENT		= 1 << 5,
+	PK_FILTER_ENUM_GUI			= 1 << 6,
+	PK_FILTER_ENUM_NOT_GUI			= 1 << 7,
+	PK_FILTER_ENUM_FREE			= 1 << 8,
+	PK_FILTER_ENUM_NOT_FREE			= 1 << 9,
+	PK_FILTER_ENUM_VISIBLE			= 1 << 10,
+	PK_FILTER_ENUM_NOT_VISIBLE		= 1 << 11,
+	PK_FILTER_ENUM_SUPPORTED		= 1 << 12,
+	PK_FILTER_ENUM_NOT_SUPPORTED		= 1 << 13,
+	PK_FILTER_ENUM_BASENAME			= 1 << 14,
+	PK_FILTER_ENUM_NOT_BASENAME		= 1 << 15,
+	PK_FILTER_ENUM_NEWEST			= 1 << 16,
+	PK_FILTER_ENUM_NOT_NEWEST		= 1 << 17,
+	PK_FILTER_ENUM_UNKNOWN			= 1 << 18
 } PkFilterEnum;
 
 /**
@@ -499,6 +499,7 @@ const gchar	*pk_group_enum_to_text			(PkGroupEnum	 group);
 
 PkFilterEnum	 pk_filter_enum_from_text		(const gchar	*filter);
 const gchar	*pk_filter_enum_to_text			(PkFilterEnum	 filter);
+gchar		*pk_filter_enums_to_text		(PkFilterEnum	 filters);
 
 PkProvidesEnum	 pk_provides_enum_from_text		(const gchar	*provides);
 const gchar	*pk_provides_enum_to_text		(PkProvidesEnum	 provides);
commit 96a151e23af28656343d1ce1e06e29a8806c14eb
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu Apr 10 20:34:58 2008 +0100

    update screenshot of pk-repo

diff --git a/docs/html/img/pk-repo.png b/docs/html/img/pk-repo.png
index a64a00b..df40670 100644
Binary files a/docs/html/img/pk-repo.png and b/docs/html/img/pk-repo.png differ
commit 96f7f08c17ea12ca036d14e3f6619d56b0b21411
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu Apr 10 20:27:50 2008 +0100

    yum: add devel filtering in get-repo-list

diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 73685d0..cbe07a2 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -1156,17 +1156,32 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         except yum.Errors.RepoError,e:
             self.error(ERROR_REPO_NOT_FOUND, "repo %s is not found" % repoid)
 
+    def _is_development_repo(self, repo):
+        if repo.endswith('-debuginfo'):
+            return True
+        if repo.endswith('-testing'):
+            return True
+        if repo.endswith('-debug'):
+            return True
+        if repo.endswith('-development'):
+            return True
+        if repo.endswith('-source'):
+            return True
+        return False
+
     def get_repo_list(self, filters):
         '''
         Implement the {backend}-get-repo-list functionality
         '''
         self._check_init()
         self.status(STATUS_INFO)
+
         for repo in self.yumbase.repos.repos.values():
-            if repo.isEnabled():
-                self.repo_detail(repo.id,repo.name,'true')
-            else:
-                self.repo_detail(repo.id,repo.name,'false')
+            if filters != FILTER_NOT_DEVELOPMENT or not self._is_development_repo(repo.id):
+                if repo.isEnabled():
+                    self.repo_detail(repo.id,repo.name,'true')
+                else:
+                    self.repo_detail(repo.id,repo.name,'false')
 
     def _get_obsoleted(self,name):
         obsoletes = self.yumbase.up.getObsoletesTuples( newest=1 )
commit a331f8090b988d2bd22a89a48d83650f831611fe
Author: Marcin Banasiak <megabajt at pld-linux.org>
Date:   Thu Apr 10 18:34:01 2008 +0200

    poldek: break UpdatePackages when an error occurs

diff --git a/backends/poldek/pk-backend-poldek.c b/backends/poldek/pk-backend-poldek.c
index fd9648a..079884d 100644
--- a/backends/poldek/pk-backend-poldek.c
+++ b/backends/poldek/pk-backend-poldek.c
@@ -1867,6 +1867,7 @@ backend_update_packages_thread (PkBackendThread *thread, gpointer data)
 	struct poclidek_rcmd	*rcmd;
 	struct vf_progress	vf_progress;
 	guint			i;
+	gboolean		update_cancelled = FALSE;
 
 	setup_vf_progress (&vf_progress, td);
 
@@ -1905,6 +1906,7 @@ backend_update_packages_thread (PkBackendThread *thread, gpointer data)
 				error = g_strdup_printf ("Cannot update %s", nvra);
 
 				pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, error);
+				update_cancelled = TRUE;
 
 				g_free (error);
 			}
@@ -1914,6 +1916,9 @@ backend_update_packages_thread (PkBackendThread *thread, gpointer data)
 
 			poclidek_rcmd_free (rcmd);
 			poldek_ts_free (ts);
+
+			if (update_cancelled)
+				break;
 		}
 
 		td->pd->percentage = (gint)((float)(i + 1) * td->pd->stepvalue);
@@ -1924,7 +1929,8 @@ backend_update_packages_thread (PkBackendThread *thread, gpointer data)
 		pkg_free (pkg);
 	}
 
-	pk_backend_set_percentage (backend, 100);
+	if (!update_cancelled)
+		pk_backend_set_percentage (backend, 100);
 
 	g_free (td->pd);
 	g_strfreev (td->package_ids);
commit c1253375dd0f85396e6df1f7e88b6fb4a53b5b06
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu Apr 10 17:11:02 2008 +0100

    send a nag message when backends send unknown error

diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index d1b5a24..c30baf0 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -489,6 +489,12 @@ pk_transaction_error_code_cb (PkBackend *backend, PkErrorCodeEnum code,
 	g_return_if_fail (PK_IS_TRANSACTION (transaction));
 	g_return_if_fail (transaction->priv->tid != NULL);
 
+	if (code == PK_ERROR_ENUM_UNKNOWN) {
+		pk_backend_message (transaction->priv->backend, PK_MESSAGE_ENUM_DAEMON,
+				    "backend emitted 'unknown error' rather than a specific error "
+				    "- this is a backend problem and should be fixed!");
+	}
+
 	code_text = pk_error_enum_to_text (code);
 	pk_debug ("emitting error-code %s, '%s'", code_text, details);
 	g_signal_emit (transaction, signals [PK_TRANSACTION_ERROR_CODE], 0, code_text, details);
commit e6f12c0ae0aab8929eeb0e03ef089f5085b8204d
Author: Stefan Haas <shaas at suse.de>
Date:   Thu Apr 10 15:38:30 2008 +0200

    set pk_status and add patches for intalling

diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 26d1225..0a578d5 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -795,6 +795,12 @@ backend_update_system_thread (PkBackendThread *thread, gpointer data)
 
         // get all Packages for Update
         std::set<zypp::PoolItem> *candidates =  zypp_get_updates ();
+	//get all Patches for Update
+	std::set<zypp::PoolItem> *candidates2 = zypp_get_patches ();
+
+	//concatenate these sets
+
+	candidates->insert (candidates->begin (), candidates->end ());
 
 	pk_backend_set_percentage (backend, 80);
         std::set<zypp::PoolItem>::iterator cb = candidates->begin (), ce = candidates->end (), ci;
@@ -810,6 +816,7 @@ backend_update_system_thread (PkBackendThread *thread, gpointer data)
                 return FALSE;
         }
 
+	delete (candidates2);
         delete (candidates);
 	pk_backend_set_percentage (backend, 100);
 	pk_backend_finished (backend);
@@ -1439,6 +1446,8 @@ backend_repo_enable (PkBackend *backend, const gchar *rid, gboolean enabled)
 {
 	g_return_if_fail (backend != NULL);
 
+	pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+
 	zypp::RepoManager manager;
 	zypp::RepoInfo repo;
 
commit c12b90cbbde447426092041334633c42b2a1082c
Author: Stefan Haas <shaas at suse.de>
Date:   Thu Apr 10 14:42:07 2008 +0200

    removed code duplication in backend_get_updates_thread

diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 7d229d2..26d1225 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -563,7 +563,7 @@ backend_get_description_thread (PkBackendThread *thread, gpointer data)
 	pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
 
 	std::vector<zypp::sat::Solvable> *v;
-	v = zypp_get_packages_by_name ((const gchar *)pi->name, TRUE);
+	v = zypp_get_packages_by_name ((const gchar *)pi->name, zypp::ResKind::package, TRUE);
 
 	zypp::sat::Solvable package;
 	for (std::vector<zypp::sat::Solvable>::iterator it = v->begin ();
@@ -658,8 +658,11 @@ backend_get_updates_thread (PkBackendThread *thread, gpointer data)
 	pk_backend_set_percentage (backend, 40);
 
 
-        // get all Packages for Update
-        std::set<zypp::PoolItem> *candidates =  zypp_get_updates ();
+        // get all Packages and Patches for Update
+        std::set<zypp::PoolItem> *candidates = zypp_get_updates ();
+	std::set<zypp::PoolItem> *candidates2 = zypp_get_patches ();
+
+	candidates->insert (candidates2->begin (), candidates2->end ());
 
 	pk_backend_set_percentage (backend, 80);
         std::set<zypp::PoolItem>::iterator cb = candidates->begin (), ce = candidates->end (), ci;
@@ -667,9 +670,15 @@ backend_get_updates_thread (PkBackendThread *thread, gpointer data)
 		zypp::ResObject::constPtr res = ci->resolvable();
 
 		// Emit the package
+
+		PkInfoEnum infoEnum = PK_INFO_ENUM_AVAILABLE;
+
+		if (zypp::isKind<zypp::Patch>(res))
+			infoEnum = PK_INFO_ENUM_SECURITY;
+
 		gchar *package_id = zypp_build_package_id_from_resolvable (res->satSolvable ());
 		pk_backend_package (backend,
-				    PK_INFO_ENUM_AVAILABLE,
+				    infoEnum,
 				    package_id,
 					"");
 				    // some package descriptions generate markup parse failures
@@ -679,40 +688,9 @@ backend_get_updates_thread (PkBackendThread *thread, gpointer data)
 	}
 
 	delete (candidates);
+	delete (candidates2);
 
-        //get all Patches for Update
-
-        std::set<zypp::ui::Selectable::Ptr> *patches = zypp_get_patches ();
-
-        for (std::set<zypp::ui::Selectable::Ptr>::iterator it = patches->begin (); it != patches->end (); it++) {
-                gchar *package_id;
-
-                zypp::ResObject::constPtr candidate = (*it)->candidateObj ();
-                zypp::Patch::constPtr patch = zypp::asKind<zypp::Patch>(candidate);
-
-                PkInfoEnum infoEnum = PK_INFO_ENUM_SECURITY;
-
-                /* This is usesless ATM, because category isn't implemented yet
-                if(patch->category () == "security") {
-                        infoEnum = PK_INFO_ENUM_SECURITY;
-                }else if(patch->category () == "recommended") {
-                        infoEnum = PK_INFO_ENUM_IMPORTANT;
-                }*/
-
-                package_id = pk_package_id_build ((*it)->name ().c_str (),
-                                                  candidate->edition ().c_str (),
-                                                  candidate->arch ().c_str (),
-                                                  candidate->repoInfo ().alias ().c_str ());
-
-                pk_backend_package (backend,
-                                    infoEnum,
-                                    package_id,
-                                    candidate->description ().c_str ());
-                g_free (package_id);
-        }
-
-        delete (patches);
-        pk_backend_set_percentage (backend, 100);
+ 	pk_backend_set_percentage (backend, 100);
 	pk_backend_finished (backend);
 	return TRUE;
 }
@@ -1167,7 +1145,7 @@ backend_resolve_thread (PkBackendThread *thread, gpointer data)
 	pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
 
 	std::vector<zypp::sat::Solvable> *v;
-	v = zypp_get_packages_by_name ((const gchar *)rdata->name, TRUE);
+	v = zypp_get_packages_by_name ((const gchar *)rdata->name, zypp::ResKind::package, TRUE);
 
 	zypp::sat::Solvable package;
 	for (std::vector<zypp::sat::Solvable>::iterator it = v->begin ();
@@ -1242,7 +1220,7 @@ find_packages_real (PkBackend *backend, const gchar *search, const gchar *filter
 
 	switch (mode) {
 		case SEARCH_TYPE_NAME:
-			v = zypp_get_packages_by_name (search, TRUE);
+			v = zypp_get_packages_by_name (search, zypp::ResKind::package, TRUE);
 			break;
 
                 case SEARCH_TYPE_DETAILS:
@@ -1501,7 +1479,7 @@ backend_get_files_thread (PkBackendThread *thread, gpointer data) {
 	pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
 
 	std::vector<zypp::sat::Solvable> *v;
-	v = zypp_get_packages_by_name ((const gchar *)pi->name, TRUE);
+	v = zypp_get_packages_by_name ((const gchar *)pi->name, zypp::ResKind::package, TRUE);
 
 	zypp::sat::Solvable package;
 	for (std::vector<zypp::sat::Solvable>::iterator it = v->begin ();
diff --git a/backends/zypp/zypp-utils.cpp b/backends/zypp/zypp-utils.cpp
index f85e773..49e6eba 100644
--- a/backends/zypp/zypp-utils.cpp
+++ b/backends/zypp/zypp-utils.cpp
@@ -252,13 +252,13 @@ get_enum_group (zypp::sat::Solvable item)
 }
 
 std::vector<zypp::sat::Solvable> *
-zypp_get_packages_by_name (const gchar *package_name, gboolean include_local)
+zypp_get_packages_by_name (const gchar *package_name, const zypp::ResKind kind, gboolean include_local)
 {
 	std::vector<zypp::sat::Solvable> *v = new std::vector<zypp::sat::Solvable> ();
 
 	zypp::ResPool pool = zypp_build_pool (include_local);
 
-        zypp::Capability cap (package_name, zypp::ResKind::package, zypp::Capability::PARSED);
+        zypp::Capability cap (package_name, kind, zypp::Capability::PARSED);
         zypp::sat::WhatProvides provs (cap);
 
         for (zypp::sat::WhatProvides::const_iterator it = provs.begin ();
@@ -318,7 +318,11 @@ zypp_get_package_by_id (const gchar *package_id)
 		return zypp::sat::Solvable::noSolvable;
 	}
 
-	std::vector<zypp::sat::Solvable> *v = zypp_get_packages_by_name (pi->name, TRUE);
+	std::vector<zypp::sat::Solvable> *v = zypp_get_packages_by_name (pi->name, zypp::ResKind::package, TRUE);
+	std::vector<zypp::sat::Solvable> *v2 = zypp_get_packages_by_name (pi->name, zypp::ResKind::patch, TRUE);
+
+	v->insert (v->end (), v2->begin (), v2->end ());
+	
 	if (v == NULL)
 		return zypp::sat::Solvable::noSolvable;
 
@@ -337,6 +341,7 @@ zypp_get_package_by_id (const gchar *package_id)
 	}
 
 	delete (v);
+	delete (v2);
 	return package;
 }
 
@@ -469,10 +474,10 @@ zypp_get_updates ()
         return pks;
 }
 
-std::set<zypp::ui::Selectable::Ptr> *
+std::set<zypp::PoolItem> *
 zypp_get_patches ()
 {
-        std::set<zypp::ui::Selectable::Ptr> *patches = new std::set<zypp::ui::Selectable::Ptr> ();
+        std::set<zypp::PoolItem> *patches = new std::set<zypp::PoolItem> ();
 
         zypp::ZYpp::Ptr zypp;
         zypp = get_zypp ();
@@ -481,7 +486,7 @@ zypp_get_patches ()
                         it != zypp->poolProxy ().byKindEnd<zypp::Patch>(); it ++) {
                 // check if patch is needed 
                 if((*it)->candidateObj ().isBroken())
-                        patches->insert (*it);
+                        patches->insert ((*it)->candidateObj ());
 
         }
 
diff --git a/backends/zypp/zypp-utils.h b/backends/zypp/zypp-utils.h
index 0e9213b..ff40c3a 100644
--- a/backends/zypp/zypp-utils.h
+++ b/backends/zypp/zypp-utils.h
@@ -66,7 +66,7 @@ PkGroupEnum get_enum_group (zypp::sat::Solvable item);
 /**
  * Returns a list of packages that match the specified package_name.
  */
-std::vector<zypp::sat::Solvable> * zypp_get_packages_by_name (const gchar *package_name, gboolean include_local);
+std::vector<zypp::sat::Solvable> * zypp_get_packages_by_name (const gchar *package_name, const zypp::ResKind kind, gboolean include_local);
 
 /**
  * Returns a list of packages that match the specified term in its name or description.
@@ -117,7 +117,7 @@ std::set<zypp::PoolItem> * zypp_get_updates ();
 /**
   * Returns a set of all patches the could be installed
   */
-std::set<zypp::ui::Selectable::Ptr> * zypp_get_patches ();
+std::set<zypp::PoolItem> * zypp_get_patches ();
 
 /**
   * perform changes in pool to the system
commit 7a3042329d789fec4656b6493212a220da2e59b5
Author: Stefan Haas <shaas at suse.de>
Date:   Thu Apr 10 11:33:01 2008 +0200

    fixed segfault

diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 163c5e7..7d229d2 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -760,8 +760,7 @@ backend_get_update_detail_thread (PkBackendThread *thread, gpointer data)
 
 	PkRestartEnum restart = PK_RESTART_ENUM_NONE;
 
-	zypp::ZYpp::Ptr zypp = get_zypp ();
-	zypp::ResObject::constPtr item = zypp->pool ().find (solvable).resolvable ();
+	zypp::PoolItem item = zypp::ResPool::instance ().find (solvable);
 
 	if (zypp::isKind<zypp::Patch>(solvable)) {
 		zypp::Patch::constPtr patch = zypp::asKind<zypp::Patch>(item);
@@ -780,7 +779,7 @@ backend_get_update_detail_thread (PkBackendThread *thread, gpointer data)
 				  "",
 				  "",
 				  restart,
-				  item->description ().c_str ());
+				  solvable.lookupStrAttribute (zypp::sat::SolvAttr::description).c_str ());
 
 	g_free (obsoletes);
 	pk_package_id_free (pi);
diff --git a/backends/zypp/zypp-utils.cpp b/backends/zypp/zypp-utils.cpp
index fdfd798..f85e773 100644
--- a/backends/zypp/zypp-utils.cpp
+++ b/backends/zypp/zypp-utils.cpp
@@ -323,14 +323,17 @@ zypp_get_package_by_id (const gchar *package_id)
 		return zypp::sat::Solvable::noSolvable;
 
 	zypp::sat::Solvable package;
+
 	for (std::vector<zypp::sat::Solvable>::iterator it = v->begin ();
 			it != v->end (); it++) {
-		const char *version = it->edition ().asString ().c_str ();
-		const char *arch = it->arch ().c_str ();
+		gchar *version = g_strdup (it->edition ().c_str ());
+		gchar *arch = g_strdup (it->arch ().c_str ());
 		if (strcmp (pi->version, version) == 0 && strcmp (pi->arch, arch) == 0) {
 			package = *it;
 			break;
 		}
+		g_free (version);
+		g_free (arch);
 	}
 
 	delete (v);
commit b91d14cf21605fdfbd2af7def58e0e7eec75fb09
Author: Scott Reeves <sreeves at novell.com>
Date:   Fri Apr 4 08:54:57 2008 -0600

    fix logic check to match version AND arch. Fixes BNC# 378591

diff --git a/backends/zypp/zypp-utils.cpp b/backends/zypp/zypp-utils.cpp
index 6c79fbc..fdfd798 100644
--- a/backends/zypp/zypp-utils.cpp
+++ b/backends/zypp/zypp-utils.cpp
@@ -305,7 +305,7 @@ zypp_get_packages_by_file (const gchar *search_file)
 		}
 	}
 
-        return v;
+	return v;
 }
 
 zypp::sat::Solvable
@@ -326,8 +326,8 @@ zypp_get_package_by_id (const gchar *package_id)
 	for (std::vector<zypp::sat::Solvable>::iterator it = v->begin ();
 			it != v->end (); it++) {
 		const char *version = it->edition ().asString ().c_str ();
-                const char *arch = it->arch ().c_str ();
-		if (strcmp (pi->version, version) == 0 || strcmp (pi->arch, arch) == 0) {
+		const char *arch = it->arch ().c_str ();
+		if (strcmp (pi->version, version) == 0 && strcmp (pi->arch, arch) == 0) {
 			package = *it;
 			break;
 		}
commit b68cc360b1ec711967cfd78fdb57b5a65782f89a
Merge: 877a99c... 0c3c766...
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Wed Apr 9 22:59:06 2008 -0400

    Merge branch 'master' of git+ssh://rnorwood@git.packagekit.org/srv/git/PackageKit

commit 877a99c29345b7539a57d32c546922b7245b7c09
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Wed Apr 9 22:58:49 2008 -0400

    purge ERROR_INTERNAL_ERROR from all backends.

diff --git a/backends/apt/helpers/aptBackend.py b/backends/apt/helpers/aptBackend.py
index d804cf5..3c4bff3 100644
--- a/backends/apt/helpers/aptBackend.py
+++ b/backends/apt/helpers/aptBackend.py
@@ -71,7 +71,7 @@ class Package(apt.Package):
             print "wanted",wanted_ver
             for ver in pkg._pkg.VersionList:
                 print "vers",version,ver.VerStr
-            backend.error(ERROR_INTERNAL_ERROR,"Can't find version %s for %s"%(version,self.name))
+            backend.error(ERROR_PACKAGE_NOT_FOUND, "Can't find version %s for %s"%(version,self.name))
 
     def setVersion(self,version,compare="="):
         if version!=None and (self.installedVersion == None or not apt_pkg.CheckDep(version,compare,self.installedVersion)):
@@ -98,7 +98,7 @@ class Package(apt.Package):
                 self.__setParent(self._backend._caches[origin][name])
                 self.markInstall(False,False)
                 if not apt_pkg.CheckDep(self.candidateVersion,compare,version):
-                    self._backend.error(ERROR_INTERNAL_ERROR,
+                    self._backend.error(ERROR_PACKAGE_NOT_FOUND,
                             "Unable to locate package version %s (only got %s) for %s"%(version,self.candidateVersion,name))
                     return
                 self.markKeep()
@@ -196,7 +196,8 @@ class PackageKitProgress(apt.progress.OpProgress, apt.progress.FetchProgress):
         self._backend.percentage(100)
 
     def mediaChange(self, medium, drive):
-        self._backend.error(ERROR_INTERNAL_ERROR,
+        # This probably should not be an error, but a Message.
+        self._backend.error(ERROR_UNKNOWN,
                 "Medium change needed")
 
 class PackageKitAptBackend(PackageKitBaseBackend):
@@ -266,7 +267,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         try:
             res = self._apt_cache.update(PackageKitProgress(self))
         except Exception, error_message:
-             self.error(ERROR_INTERNAL_ERROR,
+             self.error(ERROR_UNKNOWN,
                         "Failed to fetch the following items:\n%s" % error_message)
         return res
 
@@ -423,7 +424,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         try:
             repo["__sources"].save()
         except IOError,e:
-            self.error(ERROR_INTERNAL_ERROR, "Problem while trying to save repo settings to %s: %s"%(e.filename,e.strerror))
+            self.error(ERROR_UNKNOWN, "Problem while trying to save repo settings to %s: %s"%(e.filename,e.strerror))
 
     def get_updates(self, filter):
         self._apt_cache.upgrade(False)
@@ -472,7 +473,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         # FIXME: nasty hack. Need a better way in
         ret = system("dpkg -i %s"%inst_file)
         if ret!=0:
-            self.error(ERROR_INTERNAL_ERROR,"Can't install package")
+            self.error(ERROR_UNKNOWN,"Can't install package")
 
     ### Helpers ###
     def _emit_package(self, package):
diff --git a/backends/apt2/aptDBUSBackend.py b/backends/apt2/aptDBUSBackend.py
index bfc322b..e38b14d 100755
--- a/backends/apt2/aptDBUSBackend.py
+++ b/backends/apt2/aptDBUSBackend.py
@@ -124,7 +124,7 @@ class PackageKitFetchProgress(apt.progress.FetchProgress):
 
     def mediaChange(self, medium, drive):
         #FIXME: use the Message method to notify the user
-        self._backend.error(ERROR_INTERNAL_ERROR,
+        self._backend.error(ERROR_UNKNOWN,
                             "Medium change needed")
 
 class PackageKitInstallProgress(apt.progress.InstallProgress):
@@ -366,7 +366,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
             return
         except:
             self._open_cache(prange=(95,100))
-            self.ErrorCode(ERROR_INTERNAL_ERROR, "System update failed")
+            self.ErrorCode(ERROR_UNKNOWN, "System update failed")
             self.Finished(EXIT_FAILED)
             return
         self.PercentageChanged(100)
@@ -402,7 +402,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
                                PackageKitInstallProgress(self, prange=(10,90)))
         except:
             self._open_cache(prange=(90,100))
-            self.ErrorCode(ERROR_INTERNAL_ERROR, "Removal failed")
+            self.ErrorCode(ERROR_UNKNOWN, "Removal failed")
             self.Finished(EXIT_FAILED)
             return
         self._open_cache(prange=(90,100))
@@ -410,7 +410,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         if not self._cache.has_key(name) or not self._cache[name].isInstalled:
             self.Finished(EXIT_SUCCESS)
         else:
-            self.ErrorCode(ERROR_INTERNAL_ERROR, "Package is still installed")
+            self.ErrorCode(ERROR_UNKNOWN, "Package is still installed")
             self.Finished(EXIT_FAILED)
 
     @threaded
@@ -443,7 +443,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
                                PackageKitInstallProgress(self, prange=(50,90)))
         except:
             self._open_cache(prange=(90,100))
-            self.ErrorCode(ERROR_INTERNAL_ERROR, "Installation failed")
+            self.ErrorCode(ERROR_UNKNOWN, "Installation failed")
             self.Finished(EXIT_FAILED)
             return
         self._open_cache(prange=(90,100))
@@ -451,7 +451,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         if self._cache.has_key(name) and self._cache[name].isInstalled:
             self.Finished(EXIT_SUCCESS)
         else:
-            self.ErrorCode(ERROR_INTERNAL_ERROR, "Installation failed")
+            self.ErrorCode(ERROR_UNKNOWN, "Installation failed")
             self.Finished(EXIT_FAILED)
 
     @threaded
@@ -479,7 +479,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
             return
         except:
             self._open_cache(prange=(95,100))
-            self.ErrorCode(ERROR_INTERNAL_ERROR, "Refreshing cache failed")
+            self.ErrorCode(ERROR_UNKNOWN, "Refreshing cache failed")
             self.Finished(EXIT_FAILED)
             return
         self.PercentageChanged(100)
@@ -502,7 +502,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
             self.Exit()
             return
         if self._cache._depcache.BrokenCount > 0:
-            self.ErrorCode(ERROR_INTERNAL_ERROR,
+            self.ErrorCode(ERROR_DEP_RESOLUTION_FAILED,
                            "Not all dependecies can be satisfied")
             self.Finished(EXIT_FAILED)
             self.Exit()
diff --git a/backends/conary/helpers/conaryBackend.py b/backends/conary/helpers/conaryBackend.py
index f0e8e46..31d5e92 100644
--- a/backends/conary/helpers/conaryBackend.py
+++ b/backends/conary/helpers/conaryBackend.py
@@ -37,9 +37,9 @@ def ExceptionHandler(func):
             self.error(ERROR_DEP_RESOLUTION_FAILED, display(e), exit=True)
         except conaryclient.UpdateError, e:
             # FIXME: Need a enum for UpdateError
-            self.error(ERROR_INTERNAL_ERROR, display(e), exit=True)
+            self.error(ERROR_UNKNOWN, display(e), exit=True)
         except Exception, e:
-            self.error(ERROR_INTERNAL_ERROR, display(e), exit=True)
+            self.error(ERROR_UNKNOWN, display(e), exit=True)
     return wrapper
 
 class PackageKitConaryBackend(PackageKitBaseBackend):
@@ -429,7 +429,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
             # Package size goes here, but I don't know how to find that for conary packages.
             self.description(shortDesc, id, categories, longDesc, url, 0)
         else:
-            self.error(ERROR_INTERNAL_ERROR,'Package was not found')
+            self.error(ERROR_PACKAGE_NOT_FOUND,'Package was not found')
 
     def _show_package(self,name, version, flavor, status):
         '''  Show info about package'''
diff --git a/backends/pisi/helpers/pisiBackend.py b/backends/pisi/helpers/pisiBackend.py
index 8b54d54..ddffc8d 100644
--- a/backends/pisi/helpers/pisiBackend.py
+++ b/backends/pisi/helpers/pisiBackend.py
@@ -270,7 +270,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
             try:
                 pisi.api.install([package])
             except pisi.Error,e:
-                self.error(ERROR_INTERNAL_ERROR, e)
+                self.error(ERROR_UNKNOWN, e)
         else:
             self.error(ERROR_PACKAGE_NOT_INSTALLED, "Package is already installed")
 
@@ -316,7 +316,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
             try:
                 pisi.api.add_repo(repo_id, value, parameter)
             except pisi.Error, e:
-                self.error(ERROR_INTERNAL_ERROR, e)
+                self.error(ERROR_UNKNOWN, e)
 
             try:
                 pisi.api.update_repo(repo_id)
@@ -395,7 +395,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
             try:
                 pisi.api.upgrade([package])
             except pisi.Error,e:
-                self.error(ERROR_INTERNAL_ERROR, e)
+                self.error(ERROR_UNKNOWN, e)
         else:
             self.error(ERROR_PACKAGE_NOT_INSTALLED, "Package is already installed")
 
@@ -406,9 +406,9 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
         self.percentage(None)
 
         if not len(pisi.api.list_upgradable()) > 0:
-            self.error(ERROR_INTERNAL_ERROR, "System is already up2date")
+            self.error(ERROR_NO_PACKAGES_TO_UPDATE, "System is already up2date")
 
         try:
             pisi.api.upgrade(pisi.api.list_upgradable())
         except pisi.Error,e:
-            self.error(ERROR_INTERNAL_ERROR, e)
+            self.error(ERROR_UNKNOWN, e)
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 6592a9e..73685d0 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -271,7 +271,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
                 time.sleep(2)
                 retries += 1
                 if retries > 100:
-                    self.error(ERROR_INTERNAL_ERROR,'Yum is locked by another application')
+                    self.error(ERROR_CANNOT_GET_LOCK,'Yum is locked by another application')
 
     def unLock(self):
         ''' Unlock Yum'''
@@ -804,7 +804,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         if txmbr:
             self._runYumTransaction()
         else:
-            self.error(ERROR_INTERNAL_ERROR,"Nothing to do")
+            self.error(ERROR_NO_PACKAGES_TO_UPDATE,"Nothing to do")
 
     def refresh_cache(self):
         '''
@@ -839,7 +839,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             self.percentage(100)
 
         except yum.Errors.YumBaseError, e:
-            self.error(ERROR_INTERNAL_ERROR,str(e))
+            self.error(ERROR_UNKNOWN,str(e))
 
     def resolve(self, filters, name):
         '''
@@ -1002,20 +1002,14 @@ class PackageKitYumBackend(PackageKitBaseBackend):
                 self.error(ERROR_PACKAGE_DOWNLOAD_FAILED,retmsg)
             except yum.Errors.YumGPGCheckError, ye:
                 retmsg = "Error in Package Signatures;" + self._format_msgs(ye.value)
-                self.error(ERROR_INTERNAL_ERROR,retmsg)
+                self.error(ERROR_BAD_GPG_SIGNATURE,retmsg)
             except GPGKeyNotImported, e:
                 keyData = self.yumbase.missingGPGKey
-                print "debug :",keyData
                 if not keyData:
-                    self.error(ERROR_INTERNAL_ERROR,
+                    self.error(ERROR_BAD_GPG_SIGNATURE,
                                "GPG key not imported, and no GPG information was found.")
 
-# We need a yum with this change:
-# http://devel.linux.duke.edu/gitweb/?p=yum.git;a=commit;h=09640c743fb6a7ade5711183dc7d5964e1bd3221
-# to have fingerprint and timestamp available here
-# the above change is now in the latest yum for Fedor arawhide (yum-3.2.6-5.fc8)
                 id = self._pkg_to_id(keyData['po'])
-                print id
                 self.repo_signature_required(id,
                                              keyData['po'].repoid,
                                              keyData['keyurl'],
@@ -1024,7 +1018,6 @@ class PackageKitYumBackend(PackageKitBaseBackend):
                                              keyData['fingerprint'],
                                              keyData['timestamp'],
                                              'GPG')
-                print "post"                                             
                 self.error(ERROR_GPG_FAILURE,"GPG key not imported.")
             except yum.Errors.YumBaseError, ye:
                 retmsg = "Error in Transaction Processing;" + self._format_msgs(ye.value)
@@ -1066,7 +1059,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         if pkg:
             self._show_description(pkg)
         else:
-            self.error(ERROR_INTERNAL_ERROR,'Package was not found')
+            self.error(ERROR_PACKAGE_NOT_FOUND,'Package was not found')
 
     def _show_description(self,pkg):        
         pkgver = self._get_package_ver(pkg)
@@ -1093,7 +1086,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
             self.files(package, file_list)
         else:
-            self.error(ERROR_INTERNAL_ERROR,'Package was not found')
+            self.error(ERROR_PACKAGE_NOT_FOUND,'Package was not found')
 
     def _pkg_to_id(self,pkg):
         pkgver = self._get_package_ver(pkg)
@@ -1282,7 +1275,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             try:
                 repo.cfg.write(file(repo.repofile, 'w'))
             except IOError, e:
-                self.error(ERROR_INTERNAL_ERROR,str(e))
+                self.error(ERROR_CANNOT_WRITE_REPO_CONFIG,str(e))
         else:
             self.error(ERROR_REPO_NOT_FOUND,'repo %s not found' % repoid)
 
@@ -1296,7 +1289,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             try:
                 self.yumbase.getKeyForPackage(pkg, askcb = lambda x, y, z: True)
             except yum.Errors.YumBaseError, e:
-                self.error(ERROR_INTERNAL_ERROR,str(e))
+                self.error(ERROR_UNKNOWN,str(e))
             except:
                 self.error(ERROR_GPG_FAILURE,"Error importing GPG Key for %s" % pkg)
 


More information about the PackageKit-commit mailing list