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

Richard Hughes hughsient at kemper.freedesktop.org
Tue Oct 30 15:38:12 PDT 2007


 backends/apt/helpers/aptBackend.py |   16 +++++++++++-----
 backends/apt/pk-backend-apt.c      |   15 ++++++++++++---
 python/packagekit/backend.py       |    2 +-
 3 files changed, 24 insertions(+), 9 deletions(-)

New commits:
commit 9163498cb48238c2ca8926791d226815993c3078
Merge: 71e4b94... fbb5438...
Author: Ali Sabil <ali.sabil at gmail.com>
Date:   Tue Oct 30 22:18:36 2007 +0100

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

commit 71e4b9467111decc245cdf3d398245ad6b3482ae
Author: Ali Sabil <ali.sabil at gmail.com>
Date:   Tue Oct 30 22:01:24 2007 +0100

    python: fixed get_package_from_id when the summary contains a ';'

diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index dbe6504..09b7b3b 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -249,7 +249,7 @@ class PackageKitBaseBackend:
         ''' split up a package id name;ver;arch;data into a tuple
             containing (name,ver,arch,data)
         '''
-        return tuple(id.split(';'))
+        return tuple(id.split(';', 4))
 #
 # Backend Action Methods
 #
commit 7649dcb8ecf38aaabf2e51175d0e9355d1704973
Author: Ali Sabil <ali.sabil at gmail.com>
Date:   Tue Oct 30 21:58:58 2007 +0100

    apt: added groups support

diff --git a/backends/apt/helpers/aptBackend.py b/backends/apt/helpers/aptBackend.py
index a7a868b..8122474 100644
--- a/backends/apt/helpers/aptBackend.py
+++ b/backends/apt/helpers/aptBackend.py
@@ -86,7 +86,7 @@ class Package(object):
         #if section in ():
         #    return GROUP_ACCESSIBILITY
         if section in ('utils',):
-            return GROUP_ACCESSORIES
+            return "accessories"
         #if section in ():
         #    return GROUP_EDUCATION
         if section in ('games',):
@@ -161,6 +161,13 @@ class Package(object):
             return True
         return False
 
+    def match_group(self, name):
+        needle = name.strip().lower()
+        haystack = self.group
+        if haystack.startswith(needle):
+            return True
+        return False
+
     ### Helpers ###
     def _seek_records(self, use_candidate=True):
         if use_candidate:
@@ -234,10 +241,9 @@ class PackageKitAptBackend(PackageKitBaseBackend):
         Implement the {backend}-search-group functionality
         '''
         self.allow_interrupt(True)
-        self.percentage(None)
-
-        self.error(ERROR_NOT_SUPPORTED,
-                "This function is not implemented in this backend")
+        for package in self._do_search(filters,
+                lambda pkg: pkg.match_group(key)):
+            self._emit_package(package)
 
     def search_file(self, filters, key):
         '''
diff --git a/backends/apt/pk-backend-apt.c b/backends/apt/pk-backend-apt.c
index bd2ea3f..513d0e4 100644
--- a/backends/apt/pk-backend-apt.c
+++ b/backends/apt/pk-backend-apt.c
@@ -32,9 +32,7 @@ backend_get_groups (PkBackend *backend, PkEnumList *elist)
 {
 	g_return_if_fail (backend != NULL);
 	pk_enum_list_append_multiple (elist,
-				      PK_GROUP_ENUM_ACCESSIBILITY,
 				      PK_GROUP_ENUM_ACCESSORIES,
-				      PK_GROUP_ENUM_EDUCATION,
 				      PK_GROUP_ENUM_GAMES,
 				      PK_GROUP_ENUM_GRAPHICS,
 				      PK_GROUP_ENUM_INTERNET,
@@ -155,6 +153,17 @@ backend_search_name (PkBackend *backend, const gchar *filter, const gchar *searc
 }
 
 /**
+ * backend_search_group:
+ */
+static void
+backend_search_group (PkBackend *backend, const gchar *filter, const gchar *search)
+{
+	g_return_if_fail (backend != NULL);
+	pk_backend_allow_interrupt (backend, TRUE);
+	pk_backend_spawn_helper (backend, "search-group.py", filter, search, NULL);
+}
+
+/**
   * backend_update_package:
  */
 static void
@@ -215,7 +224,7 @@ PK_BACKEND_OPTIONS (
 	NULL,					/* rollback */
 	backend_search_details,			/* search_details */
 	NULL,					/* search_file */
-	NULL,					/* search_group */
+	backend_search_group,			/* search_group */
 	backend_search_name,			/* search_name */
 	backend_update_package,			/* update_package */
 	backend_update_system,			/* update_system */



More information about the PackageKit mailing list