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

Richard Hughes hughsient at kemper.freedesktop.org
Wed Oct 24 23:35:18 PDT 2007


 backends/BACKENDS                       |    6 +++---
 backends/box/pk-backend-box.c           |   27 ++++++++++++++++++++++++++-
 backends/smart/helpers/refresh-cache.py |   19 +++++++++++++++++++
 backends/smart/helpers/smartBackend.py  |   29 +++++++++++++++++++++++++++--
 backends/smart/helpers/update.py        |   20 ++++++++++++++++++++
 backends/smart/pk-backend-smart.c       |    4 ++--
 html/pk-faq.html                        |    4 ++--
 7 files changed, 99 insertions(+), 10 deletions(-)

New commits:
commit c9689e2fb1691ef3cb8253bcde15c38d84f06540
Merge: b153b89... 752fbb9...
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu Oct 25 07:31:26 2007 +0100

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

commit 752fbb9a829e15d20092c79deb55a917b831fe1e
Author: Grzegorz Dabrowski <gdx at o2.pl>
Date:   Thu Oct 25 07:34:54 2007 +0000

    [box] implemented get_repo_list()

diff --git a/backends/BACKENDS b/backends/BACKENDS
index 954a8ac..abc1228 100644
--- a/backends/BACKENDS
+++ b/backends/BACKENDS
@@ -18,7 +18,7 @@ get-depends       |        |  X  |     |  X  |      |       |   X  |
 get-requires      |   X    |     |     |  X  |      |       |   X  |
 get-description   |   X    |  X  |  X  |  X  |      |       |   X  |
 get-update-detail |        |     |     |     |      |       |      |
-get-repo-list     |        |  X  |     |     |  X   |       |   X  |
+get-repo-list     |        |  X  |     |  X  |  X   |       |   X  |
 repo-enable       |        |  X  |     |     |      |       |      |
 repo-set-data     |        |     |     |     |      |       |      |
 cancel-transaction|        |     |     |     |      |       |      |
diff --git a/backends/box/pk-backend-box.c b/backends/box/pk-backend-box.c
index 438ebe9..12f6f8a 100644
--- a/backends/box/pk-backend-box.c
+++ b/backends/box/pk-backend-box.c
@@ -30,6 +30,7 @@
 #include <libbox/libbox-db.h>
 #include <libbox/libbox-db-utils.h>
 #include <libbox/libbox-db-repos.h>
+#include <libbox/libbox-repos.h>
 
 enum PkgSearchType {
 	SEARCH_TYPE_NAME = 0,
@@ -582,6 +583,30 @@ backend_update_system (PkBackend *backend)
 	pk_backend_spawn_helper (backend, "update-system.sh", NULL);
 }
 
+/**
+ * backend_get_repo_list:
+ */
+static void
+backend_get_repo_list (PkBackend *backend)
+{
+	GList *list;
+	GList *li;
+	RepoInfo *repo;
+
+	g_return_if_fail (backend != NULL);
+
+
+	list = box_repos_list_get ();
+	for (li = list; li != NULL; li=li->next)
+	{
+		repo = (RepoInfo*) li->data;
+		pk_backend_repo_detail (backend, repo->name, repo->description, repo->enabled);
+	}
+	box_repos_list_free (list);
+
+	pk_backend_finished (backend);
+}
+
 
 PK_BACKEND_OPTIONS (
 	"Box",					/* description */
@@ -609,7 +634,7 @@ PK_BACKEND_OPTIONS (
 	backend_search_name,			/* search_name */
 	backend_update_package,			/* update_package */
 	backend_update_system,			/* update_system */
-	NULL,					/* get_repo_list */
+	backend_get_repo_list,			/* get_repo_list */
 	NULL,					/* repo_enable */
 	NULL					/* repo_set_data */
 );
commit dd65cea777170a2fa86402db0e9c3aa43ba17fe4
Merge: bfa5f7a... 9749563...
Author: James Bowes <jbowes at dangerouslyinc.com>
Date:   Wed Oct 24 19:47:23 2007 -0400

    Merge branch 'smart'

commit 9749563ce9572fcf2dbcec98d0c697cf1c576c84
Author: James Bowes <jbowes at dangerouslyinc.com>
Date:   Wed Oct 24 16:43:52 2007 -0400

    smart: Implement update-package.

diff --git a/backends/BACKENDS b/backends/BACKENDS
index 8a96e22..954a8ac 100644
--- a/backends/BACKENDS
+++ b/backends/BACKENDS
@@ -13,7 +13,7 @@ search-group      |        |     |     |     |      |       |      |
 install-package   |   X    |  X  |     |  X  |  X   |   X   |   X  |
 install-file      |        |  X  |     |  X  |      |       |      |
 remove-package    |   X    |  X  |     |  X  |  X   |   X   |   X  |
-update-package    |        |  X  |     |  X  |      |       |   X  |
+update-package    |        |  X  |     |  X  |      |   X   |   X  |
 get-depends       |        |  X  |     |  X  |      |       |   X  |
 get-requires      |   X    |     |     |  X  |      |       |   X  |
 get-description   |   X    |  X  |  X  |  X  |      |       |   X  |
diff --git a/backends/smart/helpers/smartBackend.py b/backends/smart/helpers/smartBackend.py
index 767fa96..21498d2 100644
--- a/backends/smart/helpers/smartBackend.py
+++ b/backends/smart/helpers/smartBackend.py
@@ -67,6 +67,22 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
         trans.run()
         self.ctrl.commitTransaction(trans, confirm=False)
 
+    def update(self, packageid):
+        idparts = packageid.split(';')
+        packagestring = "%s-%s@%s" % (idparts[0], idparts[1], idparts[2])
+        ratio, results, suggestions = self.ctrl.search(packagestring)
+
+        packages = self._process_search_results(results)
+        installed = [package for package in packages if package.installed]
+        if len(installed) != 1:
+            return
+        package = installed[0]
+        trans = smart.transaction.Transaction(self.ctrl.getCache(),
+                smart.transaction.PolicyUpgrade)
+        trans.enqueue(package, smart.transaction.UPGRADE)
+        trans.run()
+        self.ctrl.commitTransaction(trans, confirm=False)
+
     def update_system(self):
         cache = self.ctrl.getCache()
         trans = smart.transaction.Transaction(self.ctrl.getCache(),
diff --git a/backends/smart/helpers/update.py b/backends/smart/helpers/update.py
new file mode 100755
index 0000000..efbd5a1
--- /dev/null
+++ b/backends/smart/helpers/update.py
@@ -0,0 +1,20 @@
+#!/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
+
+package = sys.argv[1]
+backend = PackageKitSmartBackend(sys.argv[1:])
+backend.update(package)
+sys.exit(0)
diff --git a/backends/smart/pk-backend-smart.c b/backends/smart/pk-backend-smart.c
index d2ac470..1c3a4b8 100644
--- a/backends/smart/pk-backend-smart.c
+++ b/backends/smart/pk-backend-smart.c
@@ -48,7 +48,7 @@ PK_BACKEND_OPTIONS (
 	NULL,						/* search_file */
 	NULL,						/* search_group */
 	pk_backend_python_search_name,			/* search_name */
-	NULL,						/* update_package */
+	pk_backend_python_update_package,		/* update_package */
 	pk_backend_python_update_system,		/* update_system */
 	NULL,						/* get_repo_list */
 	NULL,						/* repo_enable */
diff --git a/html/pk-faq.html b/html/pk-faq.html
index b089705..ac637f1 100644
--- a/html/pk-faq.html
+++ b/html/pk-faq.html
@@ -36,7 +36,7 @@ search-group      |        |     |     |     |      |       |      |
 install-package   |   X    |  X  |     |  X  |  X   |   X   |   X  |
 install-file      |        |  X  |     |  X  |      |       |      |
 remove-package    |   X    |  X  |     |  X  |  X   |   X   |   X  |
-update-package    |        |  X  |     |  X  |      |       |   X  |
+update-package    |        |  X  |     |  X  |      |   X   |   X  |
 get-depends       |        |  X  |     |  X  |      |       |   X  |
 get-requires      |   X    |     |     |  X  |      |       |   X  |
 get-description   |   X    |  X  |  X  |  X  |      |       |   X  |
commit bfa5f7a3d3ed3043d2c1270875dcf2349e4af6c7
Author: James Bowes <jbowes at dangerouslyinc.com>
Date:   Wed Oct 24 19:31:17 2007 -0400

    smart: Implement installed state filter for resolve.

diff --git a/backends/smart/helpers/smartBackend.py b/backends/smart/helpers/smartBackend.py
index c830214..0767d5f 100644
--- a/backends/smart/helpers/smartBackend.py
+++ b/backends/smart/helpers/smartBackend.py
@@ -18,7 +18,7 @@
 
 import smart
 from packagekit.backend import PackageKitBaseBackend, INFO_INSTALLED, \
-        INFO_AVAILABLE, INFO_NORMAL
+        INFO_AVAILABLE, INFO_NORMAL, FILTER_NON_INSTALLED, FILTER_INSTALLED
 
 class PackageKitSmartBackend(PackageKitBaseBackend):
 
@@ -94,9 +94,14 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
                 self._show_package(package, status=INFO_NORMAL)
 
     def resolve(self, filters, packagename):
+        filterlist = filters.split(';')
+
         ratio, results, suggestions = self.ctrl.search(packagename)
         for result in results:
-            self._show_package(result)
+            if FILTER_NON_INSTALLED not in filterlist and result.installed:
+                self._show_package(result)
+            if FILTER_INSTALLED not in filterlist and not result.installed:
+                self._show_package(result)
 
     def search_name(self, filters, packagename):
         globbed = "*%s*" % packagename
commit 4c65b1058dbfb47294df3bddfbfa52339605c698
Author: James Bowes <jbowes at dangerouslyinc.com>
Date:   Wed Oct 24 16:32:56 2007 -0400

    smart: Implement refresh-cache.

diff --git a/backends/BACKENDS b/backends/BACKENDS
index 88e40c7..8a96e22 100644
--- a/backends/BACKENDS
+++ b/backends/BACKENDS
@@ -3,7 +3,7 @@ Current status of the backends
                   | conary | yum | apt | box | alpm | smart | pisi |
 --------------------------------------------------------------------
 resolve           |        |  X  |     |  X  |      |   X   |   X  |
-refresh-cache     |   X    |  X  |  X  |  X  |      |       |   X  |
+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   |      |
diff --git a/backends/smart/helpers/refresh-cache.py b/backends/smart/helpers/refresh-cache.py
new file mode 100755
index 0000000..862e4da
--- /dev/null
+++ b/backends/smart/helpers/refresh-cache.py
@@ -0,0 +1,19 @@
+#!/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
+
+backend = PackageKitSmartBackend(sys.argv[1:])
+backend.refresh_cache()
+sys.exit(0)
diff --git a/backends/smart/helpers/smartBackend.py b/backends/smart/helpers/smartBackend.py
index c830214..767fa96 100644
--- a/backends/smart/helpers/smartBackend.py
+++ b/backends/smart/helpers/smartBackend.py
@@ -107,6 +107,10 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
         for package in packages:
             self._show_package(package)
 
+    def refresh_cache(self):
+        self.ctrl.rebuildSysConfChannels()
+        self.ctrl.reloadChannels(None, caching=smart.const.NEVER)
+
     def _show_package(self, package, status=None):
         if not status:
             if package.installed:
diff --git a/backends/smart/pk-backend-smart.c b/backends/smart/pk-backend-smart.c
index a16daa5..d2ac470 100644
--- a/backends/smart/pk-backend-smart.c
+++ b/backends/smart/pk-backend-smart.c
@@ -40,7 +40,7 @@ PK_BACKEND_OPTIONS (
 	pk_backend_python_get_updates,			/* get_updates */
 	pk_backend_python_install_package,		/* install_package */
 	NULL,						/* install_file */
-	NULL,						/* refresh_cache */
+	pk_backend_python_refresh_cache,		/* refresh_cache */
 	pk_backend_python_remove_package,		/* remove_package */
 	pk_backend_python_resolve,			/* resolve */
 	NULL,						/* rollback */
diff --git a/html/pk-faq.html b/html/pk-faq.html
index 4913e08..b089705 100644
--- a/html/pk-faq.html
+++ b/html/pk-faq.html
@@ -26,7 +26,7 @@ this is the latest version of that file:
                   | conary | yum | apt | box | alpm | smart | pisi |
 --------------------------------------------------------------------
 resolve           |        |  X  |     |  X  |      |   X   |   X  |
-refresh-cache     |   X    |  X  |  X  |  X  |      |       |   X  |
+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   |      |



More information about the PackageKit mailing list