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

Richard Hughes hughsient at kemper.freedesktop.org
Sat Nov 3 01:06:46 PDT 2007


 .gitignore                               |    2 +-
 TODO                                     |    6 ------
 backends/pisi/helpers/pisiBackend.py     |   19 ++++++++++++-------
 backends/pisi/pk-backend-pisi.c          |    2 +-
 backends/smart/helpers/Makefile.am       |    1 +
 backends/smart/helpers/search-details.py |   22 ++++++++++++++++++++++
 backends/smart/helpers/smartBackend.py   |   25 +++++++++++++++++++------
 backends/smart/pk-backend-smart.c        |    2 +-
 html/pk-faq.html                         |    6 +++---
 9 files changed, 60 insertions(+), 25 deletions(-)

New commits:
commit 11f7c0831fdb69c27295d6772904584786fbe28b
Author: James Bowes <jbowes at dangerouslyinc.com>
Date:   Fri Nov 2 21:43:00 2007 -0400

    faq: Add installed filter for smart.

diff --git a/html/pk-faq.html b/html/pk-faq.html
index 9e1d550..6c1f133 100644
--- a/html/pk-faq.html
+++ b/html/pk-faq.html
@@ -49,7 +49,7 @@ cancel-transaction|        |  X  |     |     |      |       |   X  |
 <pre>
                   | conary | yum | apt | box | alpm | smart | pisi |
 --------------------------------------------------------------------
-installed         |   X    |  X  |  X  |  X  |  X   |       |   X  |
+installed         |   X    |  X  |  X  |  X  |  X   |   X   |   X  |
 development       |        |  X  |  X  |  X  |      |       |      |
 gui               |        |  X  |  X  |  X  |      |       |   X  |
 </pre>
commit 1d90fa57f2c7cabf52daacc1c2eb19b22eb7e75e
Merge: a86d883... 54034d1...
Author: James Bowes <jbowes at dangerouslyinc.com>
Date:   Fri Nov 2 21:42:10 2007 -0400

    Merge branch 'smart'
    
    Conflicts:
    
    	backends/smart/helpers/Makefile.am
    	html/pk-faq.html

diff --cc backends/smart/helpers/Makefile.am
index 6d1d835,cffe044..bf6f631
--- a/backends/smart/helpers/Makefile.am
+++ b/backends/smart/helpers/Makefile.am
@@@ -4,21 -4,10 +4,22 @@@ helperdir = $(datadir)/PackageKit/helpe
  NULL =
  
  dist_helper_DATA = 			\
 +	get-depends.py			\
 +	get-description.py		\
 +	get-files.py			\
 +	get-repo-list.py		\
 +	get-updates.py			\
 +	install-file.py			\
 +	install.py			\
 +	refresh-cache.py		\
  	remove.py			\
 +	repo-enable.py			\
  	resolve.py			\
 -	smartBackend.py			\
 +	search-name.py			\
+ 	search-details.py		\
 +	smartBackend.py			\
 +	update.py			\
 +	update-system.py		\
  	$(NULL)
  
  install-data-hook:
diff --cc html/pk-faq.html
index a5e3678,43461c3..9e1d550
--- a/html/pk-faq.html
+++ b/html/pk-faq.html
@@@ -27,7 -26,7 +27,7 @@@ refresh-cache     |   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  |      |       |   X  |
 -search-details    |        |  X  |  X  |  X  |      |   X   |      |
++search-details    |        |  X  |  X  |  X  |      |   X   |   X  |
  search-file       |        |  X  |     |  X  |      |       |   X  |
  search-group      |        |  X  |     |     |      |       |   X  |
  install-package   |   X    |  X  |     |  X  |  X   |   X   |   X  |
commit a86d883f24e1cf0240add8d3391b8278e0ede16b
Author: S.Çağlar Onur <caglar at pardus.org.tr>
Date:   Sat Nov 3 02:28:54 2007 +0200

    PiSi: Add GUI filter support

diff --git a/backends/pisi/helpers/pisiBackend.py b/backends/pisi/helpers/pisiBackend.py
index 660ec3c..aeefc69 100644
--- a/backends/pisi/helpers/pisiBackend.py
+++ b/backends/pisi/helpers/pisiBackend.py
@@ -131,13 +131,18 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
         else:
             self.error(ERROR_INTERNAL_ERROR, "Package was not found")
 
-        if filters or "none" not in filters:
-            filterlist = filters.split(';')
-
-            if FILTER_INSTALLED in filterlist and status != INFO_INSTALLED:
-                return
-            if FILTER_NON_INSTALLED in filterlist and status != INFO_AVAILABLE:
-                return
+        if filters:
+            if "none" not in filters:
+                filterlist = filters.split(';')
+
+                if FILTER_INSTALLED in filterlist and status != INFO_INSTALLED:
+                    return
+                if FILTER_NON_INSTALLED in filterlist and status == INFO_INSTALLED:
+                    return
+                if FILTER_GUI in filterlist and "app:gui" not in pkg.isA:
+                    return
+                if FILTER_NON_GUI in filterlist and "app:gui" in pkg.isA:
+                    return
 
         version = self.__get_package_version(pkg)
 
diff --git a/backends/pisi/pk-backend-pisi.c b/backends/pisi/pk-backend-pisi.c
index f47e1c0..779b694 100644
--- a/backends/pisi/pk-backend-pisi.c
+++ b/backends/pisi/pk-backend-pisi.c
@@ -64,7 +64,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);
diff --git a/html/pk-faq.html b/html/pk-faq.html
index 835e356..a5e3678 100644
--- a/html/pk-faq.html
+++ b/html/pk-faq.html
@@ -51,7 +51,7 @@ cancel-transaction|        |  X  |     |     |      |       |   X  |
 --------------------------------------------------------------------
 installed         |   X    |  X  |  X  |  X  |  X   |       |   X  |
 development       |        |  X  |  X  |  X  |      |       |      |
-gui               |        |  X  |  X  |  X  |      |       |      |
+gui               |        |  X  |  X  |  X  |      |       |   X  |
 </pre>
 
 <h3>What if the backend package manager doesn't support percentage updates?</h3>
commit 2a451695d3e714302bc7d31d5c254e3f54569001
Author: S.Çağlar Onur <caglar at pardus.org.tr>
Date:   Sat Nov 3 02:27:57 2007 +0200

    Update .gitignore

diff --git a/.gitignore b/.gitignore
index 39b82ac..97a4b34 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,7 +28,7 @@ intl
 macros
 INSTALL
 PackageKit-*.tar.gz
-PackageKit.conf
+org.freedesktop.PackageKit.conf
 xml-i18n-extract.in
 xml-i18n-extract
 xml-i18n-merge.in
commit fe5319504e8211a989a5402f48e7d9c2f457d100
Author: Richard Hughes <richard at hughsie.com>
Date:   Sat Nov 3 00:05:13 2007 +0000

    update TODO

diff --git a/TODO b/TODO
index b06d3ca..b52b129 100644
--- a/TODO
+++ b/TODO
@@ -6,12 +6,6 @@ Requires writing to a database for config stuff
 New method GetHoursSinceLastUpdate
 Use this in the update icon
 
-*** Add new callback for status ***
-TimeRemaining()
-
-*** Prepare download to refresh system ***
-Either use a flag or a new method. I'm not sure which yet.
-
 *** Add a way to import GPG keys ***
 In fedora, if you add a signed repo you have to agree to the GPG key.
 
commit 54034d1c9f0475c997fa14b51afe41dfbdc451c6
Author: James Bowes <jbowes at dangerouslyinc.com>
Date:   Fri Nov 2 18:08:08 2007 -0400

    smart: Extract a passes_filters method.

diff --git a/backends/smart/helpers/smartBackend.py b/backends/smart/helpers/smartBackend.py
index 00800c1..a850a16 100644
--- a/backends/smart/helpers/smartBackend.py
+++ b/backends/smart/helpers/smartBackend.py
@@ -143,37 +143,27 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
 
     @needs_cache
     def resolve(self, filters, packagename):
-        filterlist = filters.split(';')
-
         ratio, results, suggestions = self.ctrl.search(packagename)
         for result in results:
-            if FILTER_NON_INSTALLED not in filterlist and result.installed:
-                self._show_package(result)
-            if FILTER_INSTALLED not in filterlist and not result.installed:
+            if self._passes_filters(result, filters):
                 self._show_package(result)
 
     @needs_cache
     def search_name(self, filters, packagename):
-        filterlist = filters.split(';')
-
         globbed = "*%s*" % packagename
         ratio, results, suggestions = self.ctrl.search(globbed)
 
         packages = self._process_search_results(results)
 
         for package in packages:
-            if FILTER_NON_INSTALLED not in filterlist and package.installed or \
-                    FILTER_INSTALLED not in filterlist and not package.installed:
+            if self._passes_filters(package, filters):
                 self._show_package(package)
 
     @needs_cache
     def search_details(self, filters, searchstring):
-        filterlist = filters.split(';')
-
         packages = self.ctrl.getCache().getPackages()
         for package in packages:
-            if FILTER_NON_INSTALLED not in filterlist and package.installed or \
-                    FILTER_INSTALLED not in filterlist and not package.installed:
+            if self._passes_filters(package, filters):
                 info = package.loaders.keys()[0].getInfo(package)
                 if searchstring in info.getDescription():
                     self._show_package(package)
@@ -323,3 +313,10 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
                     packages.append(pkg)
 
         return packages
+
+    @staticmethod
+    def _passes_filters(package, filters):
+        filterlist = filters.split(';')
+
+        return (FILTER_NON_INSTALLED not in filterlist and package.installed
+                or FILTER_INSTALLED not in filterlist and not package.installed)
commit ff637a16df07c11c12b08df104d8f905b71d7a4a
Author: James Bowes <jbowes at dangerouslyinc.com>
Date:   Fri Nov 2 17:35:09 2007 -0400

    smart: Use filters in search-name.

diff --git a/backends/smart/helpers/smartBackend.py b/backends/smart/helpers/smartBackend.py
index 0afbf6f..00800c1 100644
--- a/backends/smart/helpers/smartBackend.py
+++ b/backends/smart/helpers/smartBackend.py
@@ -154,13 +154,17 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
 
     @needs_cache
     def search_name(self, filters, packagename):
+        filterlist = filters.split(';')
+
         globbed = "*%s*" % packagename
         ratio, results, suggestions = self.ctrl.search(globbed)
 
         packages = self._process_search_results(results)
 
         for package in packages:
-            self._show_package(package)
+            if FILTER_NON_INSTALLED not in filterlist and package.installed or \
+                    FILTER_INSTALLED not in filterlist and not package.installed:
+                self._show_package(package)
 
     @needs_cache
     def search_details(self, filters, searchstring):
commit 29ebaab8da3b3f420014f1e586dc5b915cb85df9
Author: James Bowes <jbowes at dangerouslyinc.com>
Date:   Fri Nov 2 17:33:15 2007 -0400

    smart: Implement search-details.

diff --git a/backends/smart/helpers/Makefile.am b/backends/smart/helpers/Makefile.am
index fceff8a..cffe044 100644
--- a/backends/smart/helpers/Makefile.am
+++ b/backends/smart/helpers/Makefile.am
@@ -7,6 +7,7 @@ dist_helper_DATA = 			\
 	remove.py			\
 	resolve.py			\
 	smartBackend.py			\
+	search-details.py		\
 	$(NULL)
 
 install-data-hook:
diff --git a/backends/smart/helpers/search-details.py b/backends/smart/helpers/search-details.py
new file mode 100755
index 0000000..fb77501
--- /dev/null
+++ b/backends/smart/helpers/search-details.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2007 Richard Hughes <richard at hughsie.com>
+# Copyright (C) 2007 James Bowes <jbowes at dangerouslyinc.com>
+#
+# Licensed under the GNU General Public License Version 2
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+import sys
+
+from smartBackend import PackageKitSmartBackend
+
+options = sys.argv[1]
+searchterms = sys.argv[2]
+
+backend = PackageKitSmartBackend(sys.argv[1:])
+backend.search_details(options,searchterms)
+sys.exit(0)
diff --git a/backends/smart/helpers/smartBackend.py b/backends/smart/helpers/smartBackend.py
index 478a607..0afbf6f 100644
--- a/backends/smart/helpers/smartBackend.py
+++ b/backends/smart/helpers/smartBackend.py
@@ -162,6 +162,18 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
         for package in packages:
             self._show_package(package)
 
+    @needs_cache
+    def search_details(self, filters, searchstring):
+        filterlist = filters.split(';')
+
+        packages = self.ctrl.getCache().getPackages()
+        for package in packages:
+            if FILTER_NON_INSTALLED not in filterlist and package.installed or \
+                    FILTER_INSTALLED not in filterlist and not package.installed:
+                info = package.loaders.keys()[0].getInfo(package)
+                if searchstring in info.getDescription():
+                    self._show_package(package)
+
     def refresh_cache(self):
         self.ctrl.rebuildSysConfChannels()
         self.ctrl.reloadChannels(None, caching=smart.const.NEVER)
diff --git a/backends/smart/pk-backend-smart.c b/backends/smart/pk-backend-smart.c
index 017661c..1cec462 100644
--- a/backends/smart/pk-backend-smart.c
+++ b/backends/smart/pk-backend-smart.c
@@ -44,7 +44,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 */
 	NULL,						/* search_file */
 	NULL,						/* search_group */
 	pk_backend_python_search_name,			/* search_name */
diff --git a/html/pk-faq.html b/html/pk-faq.html
index 998b808..43461c3 100644
--- a/html/pk-faq.html
+++ b/html/pk-faq.html
@@ -26,7 +26,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  |



More information about the PackageKit mailing list