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

Richard Hughes hughsient at kemper.freedesktop.org
Fri Nov 2 12:03:43 PDT 2007


 backends/pisi/helpers/Makefile.am       |    1 +
 backends/pisi/helpers/pisiBackend.py    |   27 ++++++++++++++++++---------
 backends/pisi/helpers/search-details.py |   19 +++++++++++++++++++
 backends/pisi/pk-backend-pisi.c         |    5 +++--
 backends/yum/helpers/yumBackend.py      |   17 ++++++++++++++++-
 backends/yum/pk-backend-yum.c           |    2 +-
 html/pk-faq.html                        |   12 +++++++++++-
 libpackagekit/pk-enum.c                 |    1 +
 libpackagekit/pk-enum.h                 |    1 +
 python/packagekit/backend.py            |    1 +
 10 files changed, 72 insertions(+), 14 deletions(-)

New commits:
commit c4c715191ec08f63d5d4fbfd937a8482db9b35ab
Author: S.Çağlar Onur <caglar at pardus.org.tr>
Date:   Fri Nov 2 16:50:15 2007 +0200

    PiSi: Start to use OTHER and POWER_MANAGEMENT groups

diff --git a/backends/pisi/pk-backend-pisi.c b/backends/pisi/pk-backend-pisi.c
index 8cf347f..f47e1c0 100644
--- a/backends/pisi/pk-backend-pisi.c
+++ b/backends/pisi/pk-backend-pisi.c
@@ -38,7 +38,7 @@ backend_get_groups (PkBackend *backend, PkEnumList *elist)
 				         /* PK_GROUP_ENUM_GRAPHICS, */
 				         PK_GROUP_ENUM_INTERNET,
 				         /* PK_GROUP_ENUM_OFFICE, */
-				         /* PK_GROUP_ENUM_OTHER, */
+				         PK_GROUP_ENUM_OTHER,
 				         PK_GROUP_ENUM_PROGRAMMING,
 				         PK_GROUP_ENUM_MULTIMEDIA,
 				         PK_GROUP_ENUM_SYSTEM,
@@ -51,6 +51,7 @@ backend_get_groups (PkBackend *backend, PkEnumList *elist)
 				         PK_GROUP_ENUM_LOCALIZATION,
 				         PK_GROUP_ENUM_VIRTUALIZATION,
 				         PK_GROUP_ENUM_SECURITY,
+				         PK_GROUP_ENUM_POWER_MANAGEMENT,
 				         PK_GROUP_ENUM_UNKNOWN,
 				         -1);
 }
commit fb99170afda82f924f41b83b209ae0d8efb4eb0f
Author: S.Çağlar Onur <caglar at pardus.org.tr>
Date:   Fri Nov 2 16:41:42 2007 +0200

    PiSi: implement search_details and change components mapping

diff --git a/backends/pisi/helpers/Makefile.am b/backends/pisi/helpers/Makefile.am
index d657cc1..457939e 100644
--- a/backends/pisi/helpers/Makefile.am
+++ b/backends/pisi/helpers/Makefile.am
@@ -16,6 +16,7 @@ dist_helper_DATA = 			\
 	remove.py			\
 	resolve.py			\
 	repo-set-data.py		\
+	search-details.py		\
 	search-file.py			\
 	search-group.py			\
 	search-name.py			\
diff --git a/backends/pisi/helpers/pisiBackend.py b/backends/pisi/helpers/pisiBackend.py
index 9ba6999..660ec3c 100644
--- a/backends/pisi/helpers/pisiBackend.py
+++ b/backends/pisi/helpers/pisiBackend.py
@@ -26,30 +26,30 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
     # It's an ugly way to sync with PK Groups and PiSi Components
     # Maybe we can provide these with our index?
     groups = {
-            "applications" : GROUP_UNKNOWN,
+            "applications" : GROUP_OTHER,
             "applications.admin" : GROUP_ADMIN_TOOLS,
-            "applications.archive" : GROUP_UNKNOWN,
+            "applications.archive" : GROUP_OTHER,
             "applications.crypto" : GROUP_SECURITY,
             "applications.doc" : GROUP_PUBLISHING,
             "applications.doc.docbook" : GROUP_PUBLISHING,
             "applications.editors" : GROUP_ACCESSORIES,
             "applications.editors.emacs" : GROUP_ACCESSORIES,
-            "applications.emulators" : GROUP_UNKNOWN,
-            "applications.filesystems" : GROUP_UNKNOWN,
+            "applications.emulators" : GROUP_OTHER,
+            "applications.filesystems" : GROUP_OTHER,
             "applications.games" : GROUP_GAMES,
-            "applications.hardware" : GROUP_UNKNOWN,
+            "applications.hardware" : GROUP_OTHER,
             "applications.multimedia" : GROUP_MULTIMEDIA,
             "applications.network" : GROUP_INTERNET,
             "applications.network.mozilla" : GROUP_INTERNET,
             "applications.pda" : GROUP_ACCESSORIES,
-            "applications.powermanagement" : GROUP_UNKNOWN,
+            "applications.powermanagement" : GROUP_POWER_MANAGEMENT,
             "applications.printing" : GROUP_PUBLISHING,
             "applications.science" : GROUP_EDUCATION,
             "applications.science.astronomy" : GROUP_EDUCATION,
             "applications.science.electronics" : GROUP_EDUCATION,
             "applications.science.mathematics" : GROUP_EDUCATION,
             "applications.security" : GROUP_SECURITY,
-            "applications.shells" : GROUP_UNKNOWN,
+            "applications.shells" : GROUP_OTHER,
             "applications.tex" : GROUP_PUBLISHING,
             "applications.util" : GROUP_ACCESSORIES,
             "applications.virtualization" : GROUP_VIRTUALIZATION,
@@ -332,6 +332,15 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
 
         self.__get_package(package, filters)
 
+    def search_details(self, filters, key):
+        """ Prints a detailed list of packages contains search term """
+        self.allow_interrupt(True)
+        self.percentage(None)
+
+        # Internal FIXME: Use search_details instead of _package when API gains that ability :)
+        for pkg in pisi.api.search_package([key]):
+            self.__get_package(pkg, filters)
+
     def search_file(self, filters, key):
         """ Prints the installed package which contains the specified file """
         self.allow_interrupt(True)
@@ -344,7 +353,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
             self.__get_package(pkg)
 
     def search_group(self, filters, group):
-        """ Prints a list of packages contains search term """
+        """ Prints a list of packages belongs to searched group """
         self.allow_interrupt(True)
         self.percentage(None)
 
@@ -357,7 +366,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
             self.error(ERROR_INTERNAL_ERROR, "Component %s was not found" % group)
 
     def search_name(self, filters, package):
-        """ Prints a list of packages contains search term """
+        """ Prints a list of packages contains search term in its name """
         self.allow_interrupt(True)
         self.percentage(None)
 
diff --git a/backends/pisi/helpers/search-details.py b/backends/pisi/helpers/search-details.py
new file mode 100644
index 0000000..066b029
--- /dev/null
+++ b/backends/pisi/helpers/search-details.py
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2007 S.Çağlar Onur <caglar at pardus.org.tr>
+#
+# Licensed under the GNU General Public License Version 2
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+import sys
+import pisiBackend
+
+backend = pisiBackend.PackageKitPisiBackend(sys.argv[1:])
+backend.search_details(sys.argv[1], sys.argv[2])
+
+sys.exit()
diff --git a/backends/pisi/pk-backend-pisi.c b/backends/pisi/pk-backend-pisi.c
index 2af9f50..8cf347f 100644
--- a/backends/pisi/pk-backend-pisi.c
+++ b/backends/pisi/pk-backend-pisi.c
@@ -89,7 +89,7 @@ PK_BACKEND_OPTIONS (
 	pk_backend_python_remove_package,		/* remove_package */
 	pk_backend_python_resolve,			/* resolve */
 	NULL,						/* rollback */
-	NULL,						/* search_details */
+	pk_backend_python_search_details,		/* search_details */
 	pk_backend_python_search_file,			/* search_file */
 	pk_backend_python_search_group,			/* search_group */
 	pk_backend_python_search_name,			/* search_name */
diff --git a/html/pk-faq.html b/html/pk-faq.html
index 621d48c..835e356 100644
--- a/html/pk-faq.html
+++ b/html/pk-faq.html
@@ -27,7 +27,7 @@ refresh-cache     |   X    |  X  |  X  |  X  |      |   X   |   X  |
 get-updates       |   X    |  X  |     |  X  |      |   X   |   X  |
 update-system     |   X    |  X  |     |  X  |      |   X   |   X  |
 search-name       |   X    |  X  |  X  |  X  |  X   |   X   |   X  |
-search-details    |        |  X  |  X  |  X  |      |       |      |
+search-details    |        |  X  |  X  |  X  |      |       |   X  |
 search-file       |        |  X  |     |  X  |      |       |   X  |
 search-group      |        |  X  |     |     |      |       |   X  |
 install-package   |   X    |  X  |     |  X  |  X   |   X   |   X  |
commit 40fc0adc6809d386ed9c8d72dd93e467f74b3a46
Merge: eb31882... 3356d0f...
Author: S.Çağlar Onur <caglar at pardus.org.tr>
Date:   Fri Nov 2 16:36:07 2007 +0200

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

commit eb318824d59171bf619eaa76cde1366fda2d5800
Author: S.Çağlar Onur <caglar at pardus.org.tr>
Date:   Fri Nov 2 16:35:54 2007 +0200

    Add PK_GROUP_ENUM_POWER_MANAGEMENT enum

diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index 14956c1..295bb59 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -146,6 +146,7 @@ static PkEnumMatch enum_group[] = {
 	{PK_GROUP_ENUM_LEGACY,			"legacy"},
 	{PK_GROUP_ENUM_LOCALIZATION,		"localization"},
 	{PK_GROUP_ENUM_VIRTUALIZATION,		"virtualization"},
+	{PK_GROUP_ENUM_POWER_MANAGEMENT,	"power-management"},
 	{PK_GROUP_ENUM_SECURITY,		"security"},
 	{0, NULL},
 };
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index 260c774..f14ffbc 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -143,6 +143,7 @@ typedef enum {
 	PK_GROUP_ENUM_LOCALIZATION,
 	PK_GROUP_ENUM_VIRTUALIZATION,
 	PK_GROUP_ENUM_SECURITY,
+	PK_GROUP_ENUM_POWER_MANAGEMENT,
 	PK_GROUP_ENUM_UNKNOWN
 } PkGroupEnum;
 
diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index e0285ef..025411f 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -99,6 +99,7 @@ GROUP_LEGACY            = "legacy"
 GROUP_LOCALIZATION      = "localization"
 GROUP_VIRTUALIZATION    = "virtualization"
 GROUP_SECURITY          = "security"
+GROUP_POWER_MANAGEMENT  = "power-management"
 GROUP_UNKNOWN           = "unknown"
 
 # Classes
commit 3356d0f7ced27ca75fc4388bb3c9442660ba969b
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Nov 2 14:23:42 2007 +0000

    add filters to pk-faq.html

diff --git a/html/pk-faq.html b/html/pk-faq.html
index 998b808..621d48c 100644
--- a/html/pk-faq.html
+++ b/html/pk-faq.html
@@ -18,6 +18,7 @@
 <h1>Frequently asked questions</h1>
 
 <h3>How complete are the backends?</h3>
+<h4>Methods</h4>
 <pre>
                   | conary | yum | apt | box | alpm | smart | pisi |
 --------------------------------------------------------------------
@@ -44,6 +45,15 @@ repo-set-data     |        |     |     |  X  |      |       |   X  |
 cancel-transaction|        |  X  |     |     |      |       |   X  |
 </pre>
 
+<h4>Filters</h4>
+<pre>
+                  | conary | yum | apt | box | alpm | smart | pisi |
+--------------------------------------------------------------------
+installed         |   X    |  X  |  X  |  X  |  X   |       |   X  |
+development       |        |  X  |  X  |  X  |      |       |      |
+gui               |        |  X  |  X  |  X  |      |       |      |
+</pre>
+
 <h3>What if the backend package manager doesn't support percentage updates?</h3>
 <p>
 You don't have to have a backend that supports percentage updates.
commit 93189c59972117c6b5478fb21b68cf7fd86c85d5
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Nov 2 14:18:27 2007 +0000

    yum now supports the GUI filter

diff --git a/backends/yum/pk-backend-yum.c b/backends/yum/pk-backend-yum.c
index fea483e..c5c85ba 100644
--- a/backends/yum/pk-backend-yum.c
+++ b/backends/yum/pk-backend-yum.c
@@ -58,7 +58,7 @@ backend_get_filters (PkBackend *backend, PkEnumList *elist)
 {
 	g_return_if_fail (backend != NULL);
 	pk_enum_list_append_multiple (elist,
-				      /*PK_FILTER_ENUM_GUI,*/
+				      PK_FILTER_ENUM_GUI,
 				      PK_FILTER_ENUM_INSTALLED,
 				      PK_FILTER_ENUM_DEVELOPMENT,
 				      -1);
commit 57cab74c4e63ffa01280696c4d273802f9997f06
Author: Tim Lauridsen <tla at rasmil.dk>
Date:   Fri Nov 2 14:56:58 2007 +0100

    yum: Added support for gui/~gui filters

diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 70cbae6..6470588 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -185,6 +185,8 @@ groupMap = {
 'language-support;ethiopic-support'           : GROUP_LOCALIZATION
 }
 
+GUI_KEYS = re.compile(r'(qt)|(gtk)')
+
 class GPGKeyNotImported(exceptions.Exception):
     pass
 
@@ -222,6 +224,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         @param url: The upstream project homepage
         @param bytes: The size of the package, in bytes
         @param file_list: List of the files in the package, separated by ';'
+        convert the description to UTF before sending
         '''
         desc = self._toUTF(desc)
         PackageKitBaseBackend.description(self,id,licence,group,desc,url,bytes,file_list)
@@ -232,6 +235,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         @param info: the enumerated INFO_* string
         @param id: The package ID name, e.g. openoffice-clipart;2.6.22;ppc64;fedora
         @param summary: The package Summary
+        convert the summary to UTF before sending
         '''
         summary = self._toUTF(summary)
         PackageKitBaseBackend.package(self,id,status,summary)
@@ -332,8 +336,19 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             wantGUI = True
         else:
             wantGUI = False
-        isGUI = wantGUI # Fake it for now
+        isGUI = self._check_for_gui(pkg) 
         return isGUI == wantGUI
+    
+    def _check_for_gui(self,pkg):
+        '''  Check if the GUI_KEYS regex matches any package requirements'''
+        try:
+            for req in pkg.requires:
+                reqname = req[0]
+                if GUI_KEYS.search(reqname):
+                    return True
+            return False
+        except yum.Errors.RepoError,e:
+            self.error(ERROR_NO_CACHE,"Yum cache is invalid")
 
     def _do_devel_filtering(self,flt,pkg):
         isDevel = False



More information about the PackageKit mailing list