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

Richard Hughes hughsient at kemper.freedesktop.org
Wed Oct 24 09:39:15 PDT 2007


 backends/BACKENDS                        |    4 -
 backends/pisi/helpers/Makefile.am        |    2 
 backends/pisi/helpers/get-description.py |   19 +++++
 backends/pisi/helpers/pisiBackend.py     |   37 ++++++++++-
 backends/pisi/helpers/update-system.py   |   19 +++++
 backends/pisi/pk-backend-pisi.c          |    4 -
 backends/yum/helpers/yumBackend.py       |    3 
 client/pk-console.c                      |   44 ++++++++++++-
 python/packagekit/backend.py             |  102 +++++++++++++++++++++++++++----
 python/packagekit/frontend.py            |   51 +++++++--------
 python/pk-frontend-test.py               |    1 
 11 files changed, 240 insertions(+), 46 deletions(-)

New commits:
commit 6e71f01a528093dc1bef5a3ec4455c6667f8691c
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Oct 24 17:36:05 2007 +0100

    remove a metric ton of trailing whitespace in the py files

diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index ba2962b..99a2d54 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -168,11 +168,11 @@ class PackageKitBaseBackend:
         '''
         Send 'updatedetail' signal
         @param id: The package ID name, e.g. openoffice-clipart;2.6.22;ppc64;fedora
-        @param updates: 
-        @param obsoletes: 
-        @param url: 
+        @param updates:
+        @param obsoletes:
+        @param url:
         @param restart:
-        @param update_text:  
+        @param update_text:
         '''
         print >> sys.stdout,"updatedetail\t%s\t%s\t%s\t%s\t%s\t%s" % (id,updates,obsoletes,url,restart,update_text)
 
@@ -250,7 +250,6 @@ class PackageKitBaseBackend:
         '''
         self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
 
-
     def get_update_detail(self,package):
         '''
         Implement the {backend}-get-update-detail functionality
@@ -279,7 +278,6 @@ class PackageKitBaseBackend:
         '''
         self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
 
-
     def refresh_cache(self):
         '''
         Implement the {backend}-refresh_cache functionality
@@ -357,18 +355,17 @@ class PackageKitBaseBackend:
         Needed to be implemented in a sub class
         '''
         self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
-        
-        
+
 class PackagekitProgress:
     '''
     Progress class there controls the total progress of a transaction
     the transaction is divided in n milestones. the class contains a subpercentage
     of the current step (milestone n -> n+1) and the percentage of the whole transaction
-    
+
     Usage:
-        
+
     from packagekit.backend import PackagekitProgress
-    
+
     steps = [10,30,50,70] # Milestones in %
     progress = PackagekitProgress()
     progress.set_steps(steps)
@@ -379,26 +376,26 @@ class PackagekitProgress:
             progress.set_subpercent(i+1)
             print "progress : %s " % progress.percent
         progress.step() # step to next milestone
-                
+
     '''
-    
-    #TODO: Add support for elapsed/remaining time 
-    
+
+    #TODO: Add support for elapsed/remaining time
+
     def __init__(self):
         self.percent = 0
         self.steps = []
         self.current_step = 0
         self.subpercent = 0
-        
+
     def set_steps(self,steps):
-        ''' 
-        Set the steps for the whole transaction 
+        '''
+        Set the steps for the whole transaction
         @param steps: list of int representing the percentage of each step in the transaction
         '''
         self.reset()
         self.steps = steps
         self.current_step = 0
-        
+
     def reset(self):
         self.percent = 0
         self.steps = []
@@ -416,14 +413,14 @@ class PackagekitProgress:
         else:
             self.percent = 100
             self.subpercent = 0
-            
+
     def set_subpercent(self,pct):
         '''
         Set subpercentage and update percentage
         '''
         self.subpercent = pct
         self._update_percent()
-        
+
     def _update_percent(self):
         '''
         Increment percentage based on current step and subpercentage
@@ -440,5 +437,5 @@ class PackagekitProgress:
         f = float(self.subpercent)/100.0
         incr = int(f*deltapct)
         self.percent = startpct + incr
-        
+
         
diff --git a/python/packagekit/frontend.py b/python/packagekit/frontend.py
index 9f84871..154e1fd 100644
--- a/python/packagekit/frontend.py
+++ b/python/packagekit/frontend.py
@@ -14,7 +14,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-# Copyright (C) 2007 
+# Copyright (C) 2007
 #    Tim Lauridsen <timlau at fedoraproject.org>
 #    Tom Parker <palfrey at tevp.net>
 #    Robin Norwood <rnorwood at redhat.com>
@@ -218,8 +218,6 @@ class PackageKit:
 			):
 		pass
 
-
-
 # --- PK Methods ---
 
 ## Start a new transaction to do Foo
@@ -476,7 +474,6 @@ class PackageKit:
 		"""
 		return self.pk_iface.GetFilters()
 
-
 class DumpingPackageKit(PackageKit):
 	"""
 	Just like PackageKit(), but prints all signals instead of handling them
diff --git a/python/pk-frontend-test.py b/python/pk-frontend-test.py
index afa594d..c0c5356 100755
--- a/python/pk-frontend-test.py
+++ b/python/pk-frontend-test.py
@@ -110,7 +110,6 @@ def get_backend_detail(*args):
 	# Quit immediately because no job was scheduled
 	exit(0)
 
-
 def usage():
 	print "Usage: %s <command> <options>"%argv[0]
 	print "Valid commands are:"
commit 17f5c3e107aa69d1598668187fe74eb1fe48dd36
Author: S.Çağlar Onur <caglar at pardus.org.tr>
Date:   Wed Oct 24 17:52:04 2007 +0300

    PiSi: Fix update type information broken with commit id 944d0b011222029f82a2a058a03ca0a909a953cf

diff --git a/backends/pisi/helpers/pisiBackend.py b/backends/pisi/helpers/pisiBackend.py
index b85c17e..62793ad 100644
--- a/backends/pisi/helpers/pisiBackend.py
+++ b/backends/pisi/helpers/pisiBackend.py
@@ -169,7 +169,8 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
             id = self.get_package_id(pkg.name, version, self.arch, "")
 
             # Internal FIXME: PiSi must provide this information as a single API call :(
-            updates = [i for i in self.packagedb.get_package(package).history if pisi.version.Version(i.release) > pisi.version.Version(pkg.release)]
+            updates = [i for i in self.packagedb.get_package(package).history 
+                    if pisi.version.Version(i.release) > pisi.version.Version(self.installdb.get_package(package).release)]
             if pisi.util.any(lambda i:i.type == "security", updates):
                 self.package(id, INFO_SECURITY, pkg.summary)
             else:
commit 944d0b011222029f82a2a058a03ca0a909a953cf
Author: S.Çağlar Onur <caglar at pardus.org.tr>
Date:   Wed Oct 24 17:41:01 2007 +0300

    PiSi: Display new package as a update not the one installed in system

diff --git a/backends/pisi/helpers/pisiBackend.py b/backends/pisi/helpers/pisiBackend.py
index 7bb8e5f..b85c17e 100644
--- a/backends/pisi/helpers/pisiBackend.py
+++ b/backends/pisi/helpers/pisiBackend.py
@@ -163,7 +163,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
 
         for package in pisi.api.list_upgradable():
 
-            pkg = self.installdb.get_package(package)
+            pkg = self.packagedb.get_package(package)
 
             version = self.__get_package_version(pkg)
             id = self.get_package_id(pkg.name, version, self.arch, "")
commit 8f2707978365fbaa755996f0a853c01a65e65eb7
Author: S.Çağlar Onur <caglar at pardus.org.tr>
Date:   Wed Oct 24 17:36:04 2007 +0300

    Add resolve support to "pkcon get updatedetail"

diff --git a/client/pk-console.c b/client/pk-console.c
index 4ade778..c799bfc 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -520,7 +520,7 @@ pk_console_get_description(PkClient *client, const gchar *package)
 	gchar *package_id;
 	package_id = pk_console_perhaps_resolve (client, PK_FILTER_ENUM_INSTALLED, package);
 	if (package_id == NULL) {
-		g_print ("Could not find a package with that name to get depends\n");
+		g_print ("Could not find a package with that name to get description\n");
 		return FALSE;
 	}
 	ret = pk_client_get_description (client, package_id);
@@ -529,6 +529,24 @@ pk_console_get_description(PkClient *client, const gchar *package)
 }
 
 /**
+ * pk_console_get_update_detail
+ **/
+static gboolean
+pk_console_get_update_detail(PkClient *client, const gchar *package)
+{
+	gboolean ret;
+	gchar *package_id;
+	package_id = pk_console_perhaps_resolve (client, PK_FILTER_ENUM_INSTALLED, package);
+	if (package_id == NULL) {
+		g_print ("Could not find a package with that name to get update details\n");
+		return FALSE;
+	}
+	ret = pk_client_get_update_detail (client, package_id);
+	g_free (package_id);
+	return ret;
+}
+
+/**
  * pk_console_process_commands:
  **/
 static gboolean
@@ -641,7 +659,7 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], gboolean
 				g_set_error (error, 0, 0, "you need to specify a search term");
 				return FALSE;
 			} else {
-				wait = pk_client_get_update_detail (client, details);
+				wait = pk_console_get_update_detail (client, details);
 			}
 		} else if (strcmp (value, "requires") == 0) {
 			if (details == NULL) {
commit d2e529f1ae6b4f9b18722760e47418c4d47a0dad
Author: S.Çağlar Onur <caglar at pardus.org.tr>
Date:   Wed Oct 24 17:19:20 2007 +0300

    Update BACKENDS file

diff --git a/backends/BACKENDS b/backends/BACKENDS
index 28bb7da..81e6cad 100644
--- a/backends/BACKENDS
+++ b/backends/BACKENDS
@@ -16,7 +16,7 @@ remove-package    |   X    |  X  |     |  X  |  X   |   X   |   X  |
 update-package    |        |     |     |  X  |      |       |   X  |
 get-depends       |        |  X  |     |  X  |      |       |   X  |
 get-requires      |   X    |     |     |  X  |      |       |   X  |
-get-description   |   X    |  X  |  X  |  X  |      |       |      |
+get-description   |   X    |  X  |  X  |  X  |      |       |   X  |
 get-update-detail |        |     |     |     |      |       |      |
 get-repo-list     |        |  X  |     |     |  X   |       |   X  |
 repo-enable       |        |  X  |     |     |      |       |      |
commit ad388f0059755806a7cbafa6e97ab2dddac40297
Author: S.Çağlar Onur <caglar at pardus.org.tr>
Date:   Wed Oct 24 17:18:53 2007 +0300

    PiSi: add get-description to backend

diff --git a/backends/pisi/helpers/Makefile.am b/backends/pisi/helpers/Makefile.am
index f56e56a..9399b69 100644
--- a/backends/pisi/helpers/Makefile.am
+++ b/backends/pisi/helpers/Makefile.am
@@ -5,6 +5,7 @@ NULL =
 
 dist_helper_DATA = 			\
 	get-depends.py			\
+	get-description.py		\
 	get-repo-list.py 		\
 	get-requires.py			\
 	get-updates.py			\
diff --git a/backends/pisi/helpers/get-description.py b/backends/pisi/helpers/get-description.py
new file mode 100644
index 0000000..8bfa835
--- /dev/null
+++ b/backends/pisi/helpers/get-description.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.get_description(sys.argv[1])
+
+sys.exit()
diff --git a/backends/pisi/helpers/pisiBackend.py b/backends/pisi/helpers/pisiBackend.py
index 83aafef..7bb8e5f 100644
--- a/backends/pisi/helpers/pisiBackend.py
+++ b/backends/pisi/helpers/pisiBackend.py
@@ -121,6 +121,9 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
         self.allow_interrupt(False);
         self.percentage(None)
 
+        if not len(pisi.api.list_upgradable()) > 0:
+            self.error(ERROR_INTERNAL_ERROR, "System is already up2date")
+
         try:
             pisi.api.upgrade(pisi.api.list_upgradable())
         except pisi.Error,e:
@@ -135,6 +138,24 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
             # Internal FIXME: What an ugly way to get repo uri
             self.repo_detail(repo, self.repodb.get_repo(repo).indexuri.get_uri(), "true")
 
+    def get_description(self, package_id):
+        """ Prints a detailed description for a given package """
+        self.allow_interrupt(True)
+        self.percentage(None)
+
+        package = self.get_package_from_id(package_id)[0]
+        pkg = self.packagedb.get_package(package)
+
+        if pkg:
+            self.description("%s-%s" % (pkg.name, self.__get_package_version(pkg)), 
+                            pkg.license, 
+                            pkg.partOf, 
+                            pkg.description, 
+                            pkg.packageURI, 
+                            pkg.packageSize, "")
+        else:
+            self.error(ERROR_INTERNAL_ERROR, "Package was not found")
+
     def get_updates(self):
         """ Prints available updates and types """
         self.allow_interrupt(True);
diff --git a/backends/pisi/pk-backend-pisi.c b/backends/pisi/pk-backend-pisi.c
index a4b6ba2..f1809a9 100644
--- a/backends/pisi/pk-backend-pisi.c
+++ b/backends/pisi/pk-backend-pisi.c
@@ -33,7 +33,7 @@ PK_BACKEND_OPTIONS (
 	NULL,						/* get_filters */
 	NULL,						/* cancel */
 	pk_backend_python_get_depends,			/* get_depends */
-	NULL,						/* get_description */
+	pk_backend_python_get_description,		/* get_description */
 	pk_backend_python_get_requires,			/* get_requires */
 	NULL,						/* get_update_detail */
 	pk_backend_python_get_updates,			/* get_updates */
commit 082638ed37b2b554e498e952178b9a65f376af2c
Author: S.Çağlar Onur <caglar at pardus.org.tr>
Date:   Wed Oct 24 17:15:32 2007 +0300

    Add resolve support to "pkcon get description",
    Clear the progress bar line if "pkcon get description" called from console

diff --git a/client/pk-console.c b/client/pk-console.c
index 79d869e..4ade778 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -511,6 +511,24 @@ pk_console_get_depends(PkClient *client, const gchar *package)
 }
 
 /**
+ * pk_console_get_description:
+ **/
+static gboolean
+pk_console_get_description(PkClient *client, const gchar *package)
+{
+	gboolean ret;
+	gchar *package_id;
+	package_id = pk_console_perhaps_resolve (client, PK_FILTER_ENUM_INSTALLED, package);
+	if (package_id == NULL) {
+		g_print ("Could not find a package with that name to get depends\n");
+		return FALSE;
+	}
+	ret = pk_client_get_description (client, package_id);
+	g_free (package_id);
+	return ret;
+}
+
+/**
  * pk_console_process_commands:
  **/
 static gboolean
@@ -637,7 +655,7 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], gboolean
 				g_set_error (error, 0, 0, "you need to specify a package to find the description for");
 				return FALSE;
 			} else {
-				wait = pk_client_get_description (client, details);
+				wait = pk_console_get_description (client, details);
 			}
 		} else if (strcmp (value, "updates") == 0) {
 			wait = pk_client_get_updates (client);
@@ -699,6 +717,10 @@ pk_console_description_cb (PkClient *client, const gchar *package_id,
 			   const gchar *description, const gchar *url,
 			   gulong size, const gchar *filelist, gpointer data)
 {
+	/* if on console, clear the progress bar line */
+	if (is_console == TRUE && printed_bar == TRUE) {
+		g_print ("\n");
+	}
 	g_print ("Package description\n");
 	g_print ("  package:     '%s'\n", package_id);
 	g_print ("  licence:     '%s'\n", licence);
commit 86cbc65e1eb7d6a6df0b3d664e3b17aee5b35ce8
Author: Tim Lauridsen <tla at rasmil.dk>
Date:   Wed Oct 24 16:07:15 2007 +0200

    yum: Added a general progress class to store the transaction progress (not used yet)

diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index e4372e8..4e4cd71 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -38,8 +38,11 @@ import exceptions
 import types
 import signal
 import time
+from packagekit.backend import PackagekitProgress
 
+# Global vars
 yumbase = None
+progress = PackagekitProgress()  # Progress object to store the progress
 
 class GPGKeyNotImported(exceptions.Exception):
     pass
diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index 5e5b4bc..ba2962b 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -357,3 +357,88 @@ class PackageKitBaseBackend:
         Needed to be implemented in a sub class
         '''
         self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+        
+        
+class PackagekitProgress:
+    '''
+    Progress class there controls the total progress of a transaction
+    the transaction is divided in n milestones. the class contains a subpercentage
+    of the current step (milestone n -> n+1) and the percentage of the whole transaction
+    
+    Usage:
+        
+    from packagekit.backend import PackagekitProgress
+    
+    steps = [10,30,50,70] # Milestones in %
+    progress = PackagekitProgress()
+    progress.set_steps(steps)
+    for milestone in range(len(steps)):
+        # do the action is this step
+        for i in range(100):
+            # do some action
+            progress.set_subpercent(i+1)
+            print "progress : %s " % progress.percent
+        progress.step() # step to next milestone
+                
+    '''
+    
+    #TODO: Add support for elapsed/remaining time 
+    
+    def __init__(self):
+        self.percent = 0
+        self.steps = []
+        self.current_step = 0
+        self.subpercent = 0
+        
+    def set_steps(self,steps):
+        ''' 
+        Set the steps for the whole transaction 
+        @param steps: list of int representing the percentage of each step in the transaction
+        '''
+        self.reset()
+        self.steps = steps
+        self.current_step = 0
+        
+    def reset(self):
+        self.percent = 0
+        self.steps = []
+        self.current_step = 0
+        self.subpercent = 0
+
+    def step(self):
+        '''
+        Step to the next step in the transaction
+        '''
+        if self.current_step < len(self.steps)-1:
+            self.current_step += 1
+            self.percent = self.steps[self.current_step]
+            self.subpercent = 0
+        else:
+            self.percent = 100
+            self.subpercent = 0
+            
+    def set_subpercent(self,pct):
+        '''
+        Set subpercentage and update percentage
+        '''
+        self.subpercent = pct
+        self._update_percent()
+        
+    def _update_percent(self):
+        '''
+        Increment percentage based on current step and subpercentage
+        '''
+        if self.current_step == 0:
+            startpct = 0
+        else:
+            startpct = self.steps[self.current_step-1]
+        if self.current_step < len(self.steps)-1:
+            endpct = self.steps[self.current_step+1]
+        else:
+            endpct = 100
+        deltapct = endpct -startpct
+        f = float(self.subpercent)/100.0
+        incr = int(f*deltapct)
+        self.percent = startpct + incr
+        
+        
commit c7ff19f66a9ce3ecd566c8eeff9471e73ff724a4
Author: S.Çağlar Onur <caglar at pardus.org.tr>
Date:   Wed Oct 24 16:20:21 2007 +0300

    cosmetic changes (remove trailing whitespaces, convert smart-tabs to real tabs)

diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index 75dcf78..5e5b4bc 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -78,15 +78,15 @@ class PackageKitBaseBackend:
     def __init__(self,cmds):
         self.cmds = cmds
         self._locked = False
-        
+
     def doLock(self):
         ''' Generic locking, overide and extend in child class'''
         self._locked = True
-        
-    def unLock(self):        
+
+    def unLock(self):
         ''' Generic unlocking, overide and extend in child class'''
         self._locked = False
-        
+
     def isLocked(self):
         return self._locked
 
diff --git a/python/packagekit/frontend.py b/python/packagekit/frontend.py
index 891f856..9f84871 100644
--- a/python/packagekit/frontend.py
+++ b/python/packagekit/frontend.py
@@ -145,30 +145,30 @@ class PackageKit:
 # --- PK Signal Handlers ---
 
 	def Finished(self,
-		     jid,          # Job ID
-		     status,       # enum - unknown, success, failed, canceled
-		     running_time  # amount of time transaction has been running in seconds
-		     ):
+			jid,          # Job ID
+			status,       # enum - unknown, success, failed, canceled
+			running_time  # amount of time transaction has been running in seconds
+			):
 		pass
 
 	def Percentage(self,
-		       jid,        # Job ID
-		       progress    # 0.0 - 100.0
-		       ):
+			jid,        # Job ID
+			progress    # 0.0 - 100.0
+			):
 		pass
 
 	def JobStatus(self,
-		      jid,        # Job ID
-		      status      # enum - invalid, setup, download, install, update, exit
-		      ):
+			jid,        # Job ID
+			status      # enum - invalid, setup, download, install, update, exit
+			):
 		pass
 
 	def Package(self,
-		    jid,        # Job ID
-		    value,      # installed=1, not-installed=0 | security=1, normal=0
-		    package_id,
-		    package_summary
-		    ):
+			jid,        # Job ID
+			value,      # installed=1, not-installed=0 | security=1, normal=0
+			package_id,
+			package_summary
+			):
 		pass
 
 	def UpdateDetail(self,
@@ -195,17 +195,17 @@ class PackageKit:
 		pass
 
 	def ErrorCode(self,
-		      jid,        # Job ID
-		      error_code, # enumerated - see pk-enum.c in PackageKit source
-		      details     # non-localized details
-		      ):
+			jid,        # Job ID
+			error_code, # enumerated - see pk-enum.c in PackageKit source
+			details     # non-localized details
+			):
 		pass
 
 	def RequireRestart(self,
-			   jid,        # Job ID
-			   type,       # enum - system,application,session
-			   details     # non-localized details
-			   ):
+			jid,        # Job ID
+			type,       # enum - system,application,session
+			details     # non-localized details
+			):
 		pass
 
 	def Transaction(self,
commit bd983c4291c3bb7563323bebe41663cf137fa412
Author: S.Çağlar Onur <caglar at pardus.org.tr>
Date:   Wed Oct 24 15:28:50 2007 +0300

    PiSi: install update-system helper

diff --git a/backends/pisi/helpers/Makefile.am b/backends/pisi/helpers/Makefile.am
index 1cd5852..f56e56a 100644
--- a/backends/pisi/helpers/Makefile.am
+++ b/backends/pisi/helpers/Makefile.am
@@ -13,6 +13,7 @@ dist_helper_DATA = 			\
 	remove.py			\
 	resolve.py			\
 	update.py			\
+	update-system.py		\
 	pisiBackend.py			\
 	$(NULL)
 
commit 285c612a2a3737f4a4e2db6f0c03283a0f6f8fe6
Author: S.Çağlar Onur <caglar at pardus.org.tr>
Date:   Wed Oct 24 15:27:00 2007 +0300

    PiSi: add update-system to backend

diff --git a/backends/BACKENDS b/backends/BACKENDS
index 9d28f6b..28bb7da 100644
--- a/backends/BACKENDS
+++ b/backends/BACKENDS
@@ -5,7 +5,7 @@ Current status of the backends
 resolve           |        |  X  |     |  X  |      |   X   |   X  |
 refresh-cache     |   X    |  X  |  X  |  X  |      |       |   X  |
 get-updates       |   X    |  X  |     |  X  |      |       |   X  |
-update-system     |   X    |  X  |     |  X  |      |       |      |
+update-system     |   X    |  X  |     |  X  |      |       |   X  |
 search-name       |   X    |  X  |  X  |  X  |  X   |       |      |
 search-details    |        |  X  |  X  |  X  |      |       |      |
 search-file       |        |  X  |     |  X  |      |       |      |
diff --git a/backends/pisi/helpers/pisiBackend.py b/backends/pisi/helpers/pisiBackend.py
index caaa689..83aafef 100644
--- a/backends/pisi/helpers/pisiBackend.py
+++ b/backends/pisi/helpers/pisiBackend.py
@@ -115,6 +115,17 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
         else:
             self.error(ERROR_PACKAGE_NOT_INSTALLED, "Package is already installed")
 
+    def update_system(self):
+        """ Updates all available packages """
+        # FIXME: fetch/install progress
+        self.allow_interrupt(False);
+        self.percentage(None)
+
+        try:
+            pisi.api.upgrade(pisi.api.list_upgradable())
+        except pisi.Error,e:
+            self.error(ERROR_INTERNAL_ERROR, e)
+
     def get_repo_list(self):
         """ Prints available repositories """
         self.allow_interrupt(True);
diff --git a/backends/pisi/helpers/update-system.py b/backends/pisi/helpers/update-system.py
new file mode 100644
index 0000000..86ec437
--- /dev/null
+++ b/backends/pisi/helpers/update-system.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.update_system()
+
+sys.exit()
diff --git a/backends/pisi/pk-backend-pisi.c b/backends/pisi/pk-backend-pisi.c
index 2366036..a4b6ba2 100644
--- a/backends/pisi/pk-backend-pisi.c
+++ b/backends/pisi/pk-backend-pisi.c
@@ -48,7 +48,7 @@ PK_BACKEND_OPTIONS (
 	NULL,						/* search_group */
 	NULL,						/* search_name */
 	pk_backend_python_update_package,		/* update_package */
-	NULL,						/* update_system */
+	pk_backend_python_update_system,		/* update_system */
 	pk_backend_python_get_repo_list,		/* get_repo_list */
 	NULL,						/* repo_enable */
 	NULL						/* repo_set_data */


More information about the PackageKit mailing list