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

Richard Hughes hughsient at kemper.freedesktop.org
Sat Mar 1 15:06:58 PST 2008


 backends/dummy/pk-backend-dummy.c           |    3 
 backends/test/helpers/PackageKitDbusTest.py |  114 +----
 backends/yum2/helpers/yumDBUSBackend.py     |  296 +++++++------
 client/pk-console.c                         |    2 
 libpackagekit/pk-enum.c                     |    1 
 libpackagekit/pk-enum.h                     |    1 
 libpackagekit/pk-network-nm.c               |   15 
 python/packagekit/daemonBackend.py          |  620 ++++++++++++++++------------
 src/pk-engine.c                             |    6 
 9 files changed, 571 insertions(+), 487 deletions(-)

New commits:
commit 1c744d7263a77619ba81e3156bf66a2c44acf192
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Sat Mar 1 17:44:34 2008 -0500

    forgot to set locked state.

diff --git a/backends/yum2/helpers/yumDBUSBackend.py b/backends/yum2/helpers/yumDBUSBackend.py
index c93eac2..0802dd2 100755
--- a/backends/yum2/helpers/yumDBUSBackend.py
+++ b/backends/yum2/helpers/yumDBUSBackend.py
@@ -322,6 +322,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         while not self.locked:
             try: # Try to lock yum
                 self.yumbase.doLock( YUM_PID_FILE )
+                self.locked = True
             except:
                 if retries == 0:
                     self.StatusChanged(STATUS_WAIT)
commit d62313cdcdc2b13ce814e0074d44e300ef585297
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Sat Mar 1 17:43:05 2008 -0500

    Remove Lock() and Unlock() calls.

diff --git a/backends/yum2/helpers/yumDBUSBackend.py b/backends/yum2/helpers/yumDBUSBackend.py
index f4da8f8..c93eac2 100755
--- a/backends/yum2/helpers/yumDBUSBackend.py
+++ b/backends/yum2/helpers/yumDBUSBackend.py
@@ -242,6 +242,8 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         PackageKitBaseBackend.__init__(self,
                                        bus_name,
                                        dbus_path)
+
+        self.locked = False
         print "__init__ done"
 
 #
@@ -311,20 +313,15 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         print "yum set up"
 
     def doExit(self):
-        if self.isLocked():
+        if self.locked:
             self._unlock_yum()
 
-    def doLock(self):
-        self._lock_yum()
-        PackageKitBaseBackend.doLock(self)
-
     def _lock_yum(self):
         ''' Lock Yum'''
         retries = 0
-        while not self.isLocked():
+        while not self.locked:
             try: # Try to lock yum
                 self.yumbase.doLock( YUM_PID_FILE )
-                PackageKitBaseBackend.doLock(self)
             except:
                 if retries == 0:
                     self.StatusChanged(STATUS_WAIT)
@@ -335,13 +332,9 @@ class PackageKitYumBackend(PackageKitBaseBackend):
                     self.Finished(EXIT_FAILED)
                     self.loop.quit()
 
-    def doUnlock(self):
-        self._unlock_yum()
-
     def _unlock_yum(self):
         ''' Unlock Yum'''
-        if self.isLocked():
-            PackageKitBaseBackend.doUnlock(self)
+        if self.locked:
             self.yumbase.closeRpmDB()
             self.yumbase.doUnlock(YUM_PID_FILE)
 
@@ -350,6 +343,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         Implement the {backend}-search-name functionality
         '''
         self._check_init(lazy_cache=True)
+        self._lock_yum()
         self.AllowCancel(True)
         self.NoPercentageUpdates()
 
@@ -359,8 +353,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         successful = self._do_search(searchlist, filters, search)
         if not successful:
             self.Finished(EXIT_FAILED)
+            self._unlock_yum()
             return
             
+        self._unlock_yum()
         self.Finished(EXIT_SUCCESS)
 
     def doSearchDetails(self,filters,key):
@@ -368,6 +364,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         Implement the {backend}-search-details functionality
         '''
         self._check_init(lazy_cache=True)
+        self._lock_yum()
         self.AllowCancel(True)
         self.NoPercentageUpdates()
 
@@ -376,9 +373,11 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
         successful = self._do_search(searchlist, filters, key)
         if not successful:
+            self._unlock_yum()
             self.Finished(EXIT_FAILED)
             return
 
+        self._unlock_yum()
         self.Finished(EXIT_SUCCESS)
 
     def doSearchGroup(self,filters,key):
@@ -386,6 +385,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         Implement the {backend}-search-group functionality
         '''
         self._check_init(lazy_cache=True)
+        self._lock_yum()
         self.AllowCancel(True)
         self.NoPercentageUpdates()
         self.StatusChanged(STATUS_QUERY)
@@ -421,10 +421,12 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         except yum.Errors.RepoError,e:
             self.Message(MESSAGE_NOTICE, "The package cache is invalid and is being rebuilt.")
             self._refresh_yum_cache()
+            self._unlock_yum()
             self.Finished(EXIT_FAILED)
 
             return
 
+        self._unlock_yum()
         self.Finished(EXIT_SUCCESS)
 
     def doSearchFile(self,filters,key):
@@ -432,6 +434,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         Implement the {backend}-search-file functionality
         '''
         self._check_init(lazy_cache=True)
+        self._lock_yum()
         self.AllowCancel(True)
         self.NoPercentageUpdates()
         self.StatusChanged(STATUS_QUERY)
@@ -456,6 +459,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
                         self._show_package(pkg, INFO_AVAILABLE)
                         found[str(pkg)] = 1
 
+        self._unlock_yum()
         self.Finished(EXIT_SUCCESS)
 
     def doGetRequires(self,package,recursive):
@@ -463,6 +467,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         Print a list of requires for a given package
         '''
         self._check_init(lazy_cache=True)
+        self._lock_yum()
         self.AllowCancel(True)
         self.NoPercentageUpdates()
         self.StatusChanged(STATUS_INFO)
@@ -470,6 +475,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         
         if not pkg:
             self.ErrorCode(ERROR_PACKAGE_NOT_FOUND,'Package was not found')
+            self._unlock_yum()
             self.Finished(EXIT_FAILED)
             return
 
@@ -480,6 +486,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             else:
                 self._show_package(pkg,INFO_AVAILABLE)
 
+        self._unlock_yum()
         self.Finished(EXIT_SUCCESS)
 
     def doGetDepends(self,package,recursive):
@@ -487,6 +494,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         Print a list of depends for a given package
         '''
         self._check_init(lazy_cache=True)
+        self._lock_yum()
         self.AllowCancel(True)
         self.PercentageChanged(0)
         self.StatusChanged(STATUS_INFO)
@@ -497,6 +505,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
         if not pkg:
             self.ErrorCode(ERROR_PACKAGE_NOT_FOUND,'Package was not found')
+            self._unlock_yum()
             self.Finished(EXIT_FAILED)
             return
 
@@ -513,6 +522,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
                     if self._installable(pkg):
                         self._show_package(pkg, INFO_AVAILABLE)
 
+        self._unlock_yum()
         self.Finished(EXIT_SUCCESS)
 
     def doUpdateSystem(self):
@@ -520,6 +530,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         Implement the {backend}-update-system functionality
         '''
         self._check_init()
+        self._lock_yum()
         self.AllowCancel(False)
         self.PercentageChanged(0)
         old_throttle = self.yumbase.conf.throttle
@@ -540,11 +551,13 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             self.yumbase.conf.throttle = old_throttle
             self.yumbase.conf.skip_broken = old_skip_broken
             self.ErrorCode(ERROR_INTERNAL_ERROR,"Nothing to do")
+            self._unlock_yum()
             self.Finished(EXIT_FAILED)
             return
 
         self.yumbase.conf.throttle = old_throttle
         self.yumbase.conf.skip_broken = old_skip_broken
+        self._unlock_yum()
         self.Finished(EXIT_SUCCESS)
 
     def doRefreshCache(self, force):
@@ -552,6 +565,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         Implement the {backend}-refresh_cache functionality
         '''
         self._check_init()
+        self._lock_yum()
         self.AllowCancel(True)
         self.PercentageChanged(0)
         self.StatusChanged(STATUS_REFRESH_CACHE)
@@ -564,6 +578,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         try:
             if len(self.yumbase.repos.listEnabled()) == 0:
                 self.PercentageChanged(100)
+                self._unlock_yum()
                 self.Finished(EXIT_SUCCESS)
                 return
 
@@ -590,12 +605,14 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
         except yum.Errors.YumBaseError, e:
             self.ErrorCode(ERROR_INTERNAL_ERROR,str(e))
+            self._unlock_yum()
             self.Finished(EXIT_FAILED)
             self.Exit()
 
         self.yumbase.conf.cache = old_cache_setting
         self.yumbase.repos.setCache(old_cache_setting)
 
+        self._unlock_yum()
         self.Finished(EXIT_SUCCESS)
 
     def doResolve(self, filters, name):
@@ -603,6 +620,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         Implement the {backend}-resolve functionality
         '''
         self._check_init(lazy_cache=True)
+        self._lock_yum()
         self.AllowCancel(True)
         self.NoPercentageUpdates()
         self.StatusChanged(STATUS_QUERY)
@@ -629,10 +647,12 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         except yum.Errors.RepoError,e:
             self.Message(MESSAGE_NOTICE, "The package cache is invalid and is being rebuilt.")
             self._refresh_yum_cache()
+            self._unlock_yum()
             self.Finished(EXIT_FAILED)
 
             return
 
+        self._unlock_yum()
         self.Finished(EXIT_SUCCESS)
 
     def doInstallPackage(self, package):
@@ -641,6 +661,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         This will only work with yum 3.2.4 or higher
         '''
         self._check_init()
+        self._lock_yum()
         self.AllowCancel(False)
         self.PercentageChanged(0)
 
@@ -648,6 +669,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         if pkg:
             if inst:
                 self.ErrorCode(ERROR_PACKAGE_ALREADY_INSTALLED,'Package already installed')
+                self._unlock_yum()
                 self.Finished(EXIT_FAILED)
                 return
             try:
@@ -658,13 +680,16 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             except yum.Errors.InstallError,e:
                 msgs = '\n'.join(e)
                 self.ErrorCode(ERROR_PACKAGE_ALREADY_INSTALLED,msgs)
+                self._unlock_yum()
                 self.Finished(EXIT_FAILED)
                 return
         else:
             self.ErrorCode(ERROR_PACKAGE_NOT_FOUND,"Package was not found")
+            self._unlock_yum()
             self.Finished(EXIT_FAILED)
             return
             
+        self._unlock_yum()
         self.Finished(EXIT_SUCCESS)
 
     def doInstallFile (self, inst_file):
@@ -674,6 +699,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         Needed to be implemented in a sub class
         '''
         self._check_init()
+        self._lock_yum()
         self.AllowCancel(False)
         self.PercentageChanged(0)
 
@@ -689,9 +715,11 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         except yum.Errors.InstallError,e:
             msgs = '\n'.join(e)
             self.ErrorCode(ERROR_PACKAGE_ALREADY_INSTALLED,msgs)
+            self._unlock_yum()
             self.Finished(EXIT_FAILED)
             return
 
+        self._unlock_yum()
         self.Finished(EXIT_SUCCESS)
 
     def doUpdatePackage(self, package):
@@ -700,6 +728,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         This will only work with yum 3.2.4 or higher
         '''
         self._check_init()
+        self._lock_yum()
         self.AllowCancel(False)
         self.PercentageChanged(0)
 
@@ -712,13 +741,16 @@ class PackageKitYumBackend(PackageKitBaseBackend):
                     return
             else:
                 self.ErrorCode(ERROR_PACKAGE_ALREADY_INSTALLED,"No available updates")
+                self._unlock_yum()
                 self.Finished(EXIT_FAILED)
                 return
         else:
             self.ErrorCode(ERROR_PACKAGE_ALREADY_INSTALLED,"No available updates")
+            self._unlock_yum()
             self.Finished(EXIT_FAILED)
             return
             
+        self._unlock_yum()
         self.Finished(EXIT_SUCCESS)
 
     def doRemovePackage(self, package, allowdep):
@@ -727,6 +759,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         '''
         self.last_action_time = time.time()
         self._check_init()
+        self._lock_yum()
         self.AllowCancel(False)
         self.PercentageChanged(0)
 
@@ -744,20 +777,24 @@ class PackageKitYumBackend(PackageKitBaseBackend):
                         return
             else:
                 self.ErrorCode(ERROR_PACKAGE_NOT_INSTALLED,"Package is not installed")
+                self._unlock_yum()
                 self.Finished(EXIT_FAILED)
                 return
 
+            self._unlock_yum()
             self.Finished(EXIT_SUCCESS)
         else:
             self.ErrorCode(ERROR_PACKAGE_NOT_INSTALLED,"Package is not installed")
+            self._unlock_yum()
             self.Finished(EXIT_FAILED)
-            return
+        return
             
     def doGetDescription(self, package):
         '''
         Print a detailed description for a given package
         '''
         self._check_init(lazy_cache=True)
+        self._lock_yum()
         self.AllowCancel(True)
         self.NoPercentageUpdates()
         self.StatusChanged(STATUS_INFO)
@@ -767,13 +804,16 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             self._show_package_description(pkg)            
         else:
             self.ErrorCode(ERROR_PACKAGE_NOT_FOUND,'Package was not found')
+            self._unlock_yum()
             self.Finished(EXIT_FAILED)
             return
             
+        self._unlock_yum()
         self.Finished(EXIT_SUCCESS)
 
     def doGetFiles(self, package):
         self._check_init(lazy_cache=True)
+        self._lock_yum()
         self.AllowCancel(True)
         self.NoPercentageUpdates()
         self.StatusChanged(STATUS_INFO)
@@ -788,9 +828,11 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             self.Files(package, file_list)
         else:
             self.ErrorCode(ERROR_PACKAGE_NOT_FOUND,'Package was not found')
+            self._unlock_yum()
             self.Finished(EXIT_FAILED)
             return
 
+        self._unlock_yum()
         self.Finished(EXIT_SUCCESS)
 
     def doGetUpdates(self, filters):
@@ -799,6 +841,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         @param filters: package types to show
         '''
         self._check_init(lazy_cache=True)
+        self._lock_yum()
         self.AllowCancel(True)
         self.NoPercentageUpdates()
         self.StatusChanged(STATUS_INFO)
@@ -820,10 +863,12 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         except yum.Errors.RepoError,e:
             self.Message(MESSAGE_NOTICE, "The package cache is invalid and is being rebuilt.")
             self._refresh_yum_cache()
+            self._unlock_yum()
             self.Finished(EXIT_FAILED)
 
             return
 
+        self._unlock_yum()
         self.Finished(EXIT_SUCCESS)
         
     def doGetPackages(self,filters,showdesc='no'):
@@ -834,6 +879,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         @param key: key to seach for
         '''
         self._check_init(lazy_cache=True)
+        self._lock_yum()
         self.AllowCancel(True)
         self.NoPercentageUpdates()
         self.StatusChanged(STATUS_QUERY)
@@ -865,10 +911,12 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         except yum.Errors.RepoError,e:
             self.Message(MESSAGE_NOTICE, "The package cache is invalid and is being rebuilt.")
             self._refresh_yum_cache()
+            self._unlock_yum()
             self.Finished(EXIT_FAILED)
 
             return
 
+        self._unlock_yum()
         self.Finished(EXIT_SUCCESS)
         
     def doRepoEnable(self, repoid, enable):
@@ -887,9 +935,11 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
         except yum.Errors.RepoError,e:
             self.ErrorCode(ERROR_REPO_NOT_FOUND, "repo %s is not found" % repoid)
+            self._unlock_yum()
             self.Finished(EXIT_FAILED)
             return
 
+        self._unlock_yum()
         self.Finished(EXIT_SUCCESS)
 
     def doGetRepoList(self):
@@ -904,6 +954,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             else:
                 self.RepoDetail(repo.id,repo.name,False)
 
+        self._unlock_yum()
         self.Finished(EXIT_SUCCESS)
 
     def doGetUpdateDetail(self,package):
@@ -911,6 +962,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         Implement the {backend}-get-update_detail functionality
         '''
         self._check_init()
+        self._lock_yum()
         self.AllowCancel(True)
         self.NoPercentageUpdates()
         self.StatusChanged(STATUS_INFO)
@@ -918,6 +970,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         
         if not pkg:
             self.ErrorCode(ERROR_PACKAGE_NOT_FOUND,'Package was not found')
+            self._unlock_yum()
             self.Finished(EXIT_FAILED)
             return
 
@@ -930,6 +983,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
         self.UpdateDetail(package,update,obsolete,vendor_url,bz_url,cve_url,reboot,desc)
 
+        self._unlock_yum()
         self.Finished(EXIT_SUCCESS)
 
     def doRepoSetData(self, repoid, parameter, value):
@@ -937,6 +991,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         Implement the {backend}-repo-set-data functionality
         '''
         self._check_init()
+        self._lock_yum()
         self.AllowCancel(False)
         self.NoPercentageUpdates()
         # Get the repo
@@ -947,13 +1002,16 @@ class PackageKitYumBackend(PackageKitBaseBackend):
                 repo.cfg.write(file(repo.repofile, 'w'))
             except IOError, e:
                 self.ErrorCode(ERROR_INTERNAL_ERROR,str(e))
+                self._unlock_yum()
                 self.Finished(EXIT_FAILED)
                 return
         else:
             self.ErrorCode(ERROR_REPO_NOT_FOUND,'repo %s not found' % repoid)
+            self._unlock_yum()
             self.Finished(EXIT_FAILED)
             return
 
+        self._unlock_yum()
         self.Finished(EXIT_SUCCESS)
 
 #
@@ -1243,6 +1301,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             po = yum.packages.YumLocalPackage(ts=self.yumbase.rpmdb.readOnlyTS(), filename=pkg)
         except yum.Errors.MiscError:
             self.ErrorCode(ERROR_INTERNAL_ERROR,'Cannot open file: %s. Skipping.' % pkg)
+            self._unlock_yum()
             self.Finished(EXIT_FAILED)
             self.Exit()
 
@@ -1319,6 +1378,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         if rc !=2:
             retmsg = "Error in Dependency Resolution\n" +"\n".join(msgs)
             self.ErrorCode(ERROR_DEP_RESOLUTION_FAILED,retmsg)
+            self._unlock_yum()
             self.Finished(EXIT_FAILED)
             return
         else:
@@ -1327,6 +1387,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
                 if len(self.yumbase.tsInfo) > 1:
                     retmsg = 'package could not be remove, because something depends on it'
                     self.ErrorCode(ERROR_DEP_RESOLUTION_FAILED,retmsg)
+                    self._unlock_yum()
                     self.Finished(EXIT_FAILED)
                     return False
             try:
@@ -1337,11 +1398,13 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             except yum.Errors.YumDownloadError, ye:
                 retmsg = "Error in Download\n" + "\n".join(ye.value)
                 self.ErrorCode(ERROR_PACKAGE_DOWNLOAD_FAILED,retmsg)
+                self._unlock_yum()
                 self.Finished(EXIT_FAILED)
                 return False
             except yum.Errors.YumGPGCheckError, ye:
                 retmsg = "Error in Package Signatures\n" +"\n".join(ye.value)
                 self.ErrorCode(ERROR_INTERNAL_ERROR,retmsg)
+                self._unlock_yum()
                 self.Finished(EXIT_FAILED)
                 return False
             except GPGKeyNotImported, e:
@@ -1349,6 +1412,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
                 if not keyData:
                     self.ErrorCode(ERROR_INTERNAL_ERROR,
                                "GPG key not imported, but no GPG information received from Yum.")
+                    self._unlock_yum()
                     self.Finished(EXIT_FAILED)
                     return False
                 self.repo_signature_required(keyData['po'].repoid,
@@ -1359,11 +1423,13 @@ class PackageKitYumBackend(PackageKitBaseBackend):
                                              keyData['timestamp'],
                                              'GPG')
                 self.ErrorCode(ERROR_GPG_FAILURE,"GPG key not imported.")
+                self._unlock_yum()
                 self.Finished(EXIT_FAILED)
                 return False
             except yum.Errors.YumBaseError, ye:
                 retmsg = "Error in Transaction Processing\n" + "\n".join(ye.value)
                 self.ErrorCode(ERROR_TRANSACTION_ERROR,retmsg)
+                self._unlock_yum()
                 self.Finished(EXIT_FAILED)
                 return False
         return True
diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index a0b3dff..a861e9f 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -71,7 +71,6 @@ class PackageKitBaseBackend(dbus.service.Object):
     def __init__(self, bus_name, dbus_path):
         dbus.service.Object.__init__(self, bus_name, dbus_path)
 
-        self._locked = False
         self._allow_cancel = False
         self._child_pid = None
         self._is_child = False
@@ -83,17 +82,6 @@ class PackageKitBaseBackend(dbus.service.Object):
 
         self.loop.run()
 
-    def doLock(self):
-        ''' Generic locking, overide and extend in child class'''
-        self._locked = True
-
-    def doUnlock(self):
-        ''' Generic unlocking, overide and extend in child class'''
-        self._locked = False
-
-    def isLocked(self):
-        return self._locked
-
     def check_for_inactivity(self):
         if time.time() - self.last_action_time > INACTIVE_TIMEOUT:
             print "Exiting due to timeout."
@@ -297,30 +285,6 @@ class PackageKitBaseBackend(dbus.service.Object):
         self.loop.quit()
  
     @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='', out_signature='')
-    def Lock(self):
-        print "Lock()"
-        if self._child_is_running():
-            self.ErrorCode(ERROR_INTERNAL_ERROR, "Lock() called while child process still running.")
-            self.Exit()
-
-            return
-
-        self.doLock()
- 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='', out_signature='')
-    def Unlock(self):
-        print "Unlock()"
-        if self._child_is_running():
-            self.ErrorCode(ERROR_INTERNAL_ERROR, "Unlock() called while child process still running.")
-            self.Exit()
-
-            return
-
-        self.doUnlock()
- 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
                          in_signature='ss', out_signature='')
     def SearchName(self, filters, search):
         '''
commit 971553a80f79b317e37d6eb149e0666a31dab56f
Merge: 0f7fbe9... 0456fac...
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Sat Mar 1 17:27:36 2008 -0500

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

commit 0456fac51ba64c5fef30323e676486ccdf24019f
Author: Richard Hughes <richard at hughsie.com>
Date:   Sat Mar 1 21:39:28 2008 +0100

    make sure we don't create and destroy, then create a network manager instance, as it doesn't disconnect the proxy correctly. This should fix the bug where packagekitd sometimes fails to start (1 in 20 times) with the message:
    
    GLib-GObject-WARNING **: instance with invalid (NULL) class pointer. Yay for valgrind.

diff --git a/src/pk-engine.c b/src/pk-engine.c
index 33abcbd..10397fd 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -2806,6 +2806,9 @@ pk_engine_init (PkEngine *engine)
 	/* lock database */
 	pk_backend_lock (engine->priv->backend);
 
+	/* we dont need this, just don't keep creating and destroying it */
+	engine->priv->network = pk_network_new ();
+
 	/* create a new backend so we can get the static stuff */
 	runner = pk_runner_new ();
 	engine->priv->actions = pk_runner_get_actions (runner);
@@ -2818,9 +2821,6 @@ pk_engine_init (PkEngine *engine)
 	/* we save a cache of the latest update lists sowe can do cached responses */
 	engine->priv->updates_cache = NULL;
 
-	/* we dont need this, just don't keep creating and destroying it */
-	engine->priv->network = pk_network_new ();
-
 	/* we need an auth framework */
 	engine->priv->security = pk_security_new ();
 
commit 9d92e4a5ddf6f5833999432419b55d73ec510e05
Author: Richard Hughes <richard at hughsie.com>
Date:   Sat Mar 1 21:31:56 2008 +0100

    add some paranoid debugging in PkNetworkNm to try to debug a backtrace

diff --git a/libpackagekit/pk-network-nm.c b/libpackagekit/pk-network-nm.c
index 617dd70..4a1a7b4 100644
--- a/libpackagekit/pk-network-nm.c
+++ b/libpackagekit/pk-network-nm.c
@@ -81,6 +81,10 @@ pk_network_is_online (PkNetwork *network)
 {
 	libnm_glib_state state;
 	gboolean ret;
+
+	g_return_val_if_fail (network != NULL, FALSE);
+	g_return_val_if_fail (PK_IS_NETWORK (network), FALSE);
+
 	state = libnm_glib_get_network_state (network->priv->ctx);
 	switch (state) {
 	case LIBNM_NO_NETWORK_CONNECTION:
@@ -100,6 +104,10 @@ pk_network_nm_changed_cb (libnm_glib_ctx *libnm_ctx, gpointer data)
 {
 	gboolean ret;
 	PkNetwork *network = (PkNetwork *) data;
+
+	g_return_if_fail (network != NULL);
+	g_return_if_fail (PK_IS_NETWORK (network));
+
 	ret = pk_network_is_online (network);
 	g_signal_emit (network, signals [PK_NETWORK_ONLINE], 0, ret);
 }
@@ -137,6 +145,7 @@ pk_network_init (PkNetwork *network)
 		libnm_glib_register_callback (network->priv->ctx,
 					      pk_network_nm_changed_cb,
 					      network, context);
+	pk_debug ("ctx=%p, id=%i", network->priv->ctx, network->priv->callback_id);
 }
 
 /**
@@ -152,9 +161,15 @@ pk_network_finalize (GObject *object)
 	network = PK_NETWORK (object);
 
 	g_return_if_fail (network->priv != NULL);
+
+	pk_debug ("ctx=%p, id=%i", network->priv->ctx, network->priv->callback_id);
 	libnm_glib_unregister_callback (network->priv->ctx, network->priv->callback_id);
 	libnm_glib_shutdown (network->priv->ctx);
 
+	/* be paranoid */
+	network->priv->ctx = NULL;
+	network->priv->callback_id = 0;
+
 	G_OBJECT_CLASS (pk_network_parent_class)->finalize (object);
 }
 
commit 0f7fbe9f367c7219eae4b15409aa2c4081f5bfab
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Sat Mar 1 09:39:45 2008 -0500

    Fix GetUpdates method.

diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index 6faf0f8..a0b3dff 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -550,8 +550,8 @@ class PackageKitBaseBackend(dbus.service.Object):
         sys.exit(0)
 
     @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='', out_signature='')
-    def GetUpdates(self):
+                         in_signature='s', out_signature='')
+    def GetUpdates(self, filters):
         '''
         Implement the {backend}-get-updates functionality
         '''
@@ -559,7 +559,7 @@ class PackageKitBaseBackend(dbus.service.Object):
         self.forkme()
         if self._child_pid:
             return
-        self.doGetUpdates()
+        self.doGetUpdates(filters)
         sys.exit(0)
 
     @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
commit aa75cc8e2a0975f746179e7a8bfb78cbef7da82e
Author: Richard Hughes <richard at hughsie.com>
Date:   Sat Mar 1 11:25:27 2008 +0100

    emit more than one url;pair in the dummy backend

diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index 0d6b36c..a9d32d5 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -190,7 +190,8 @@ backend_get_update_detail (PkBackend *backend, const gchar *package_id)
 		pk_backend_update_detail (backend, "kernel;2.6.23-0.115.rc3.git1.fc8;i386;available",
 					  "kernel;2.6.22-0.105.rc3.git7.fc8;i386;installed", "",
 					  "http://www.distro-update.org/page?moo;Bugfix release for kernel",
-					  "http://bgzilla.fd.org/result.php?#12344;Freedesktop Bugzilla #12344",
+					  "http://bgzilla.fd.org/result.php?#12344;Freedesktop Bugzilla #12344;"
+					  "http://bgzilla.gnome.org/result.php?#9876;GNOME Bugzilla #9876",
 					  "http://nvd.nist.gov/nvd.cfm?cvename=CVE-2007-3381;CVE-2007-3381",
 					  PK_RESTART_ENUM_SYSTEM, "Update to newest version");
 	}
commit a3d4ed2cbdc68a22f74032bb35a0482e5a4ce820
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Fri Feb 29 21:06:43 2008 -0500

    Finished() isn't required after Init()

diff --git a/backends/yum2/helpers/yumDBUSBackend.py b/backends/yum2/helpers/yumDBUSBackend.py
index 9efd62e..f4da8f8 100755
--- a/backends/yum2/helpers/yumDBUSBackend.py
+++ b/backends/yum2/helpers/yumDBUSBackend.py
@@ -309,7 +309,6 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         yumbase = self.yumbase
         self._setup_yum()
         print "yum set up"
-        self.Finished(EXIT_SUCCESS)
 
     def doExit(self):
         if self.isLocked():
commit d96318ae648cada3e875523a147b82972c0c86b3
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Fri Feb 29 20:50:20 2008 -0500

    Fix a few more things.

diff --git a/backends/yum2/helpers/yumDBUSBackend.py b/backends/yum2/helpers/yumDBUSBackend.py
index deab53a..9efd62e 100755
--- a/backends/yum2/helpers/yumDBUSBackend.py
+++ b/backends/yum2/helpers/yumDBUSBackend.py
@@ -303,9 +303,13 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 #
 
     def doInit(self):
+        print "Now in doInit()"
         self.yumbase = PackageKitYumBase()
+        print "new yumbase object"
         yumbase = self.yumbase
         self._setup_yum()
+        print "yum set up"
+        self.Finished(EXIT_SUCCESS)
 
     def doExit(self):
         if self.isLocked():
diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index 0ced5e0..6faf0f8 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -108,7 +108,7 @@ class PackageKitBaseBackend(dbus.service.Object):
             raise Exception, "forkme() called from child thread."
         self.last_action_time = time.time()
 
-        if self.child_is_running():
+        if self._child_is_running():
             print "child was already running"
             self.ErrorCode(ERROR_INTERNAL_ERROR, "Method called while child process is still running.")
             raise Exception, "Method called while child process is still running"
@@ -119,7 +119,7 @@ class PackageKitBaseBackend(dbus.service.Object):
         else:
             self._is_child = True
 
-    def child_is_running(self):
+    def _child_is_running(self):
         print "in child_is_running"
         if self._child_pid:
             print "in child_is_running, pid = %s" % self._child_pid
@@ -280,7 +280,7 @@ class PackageKitBaseBackend(dbus.service.Object):
                          in_signature='', out_signature='')
     def Init(self):
         print "Init()"
-        if self.child_is_running():
+        if self._child_is_running():
             self.ErrorCode(ERROR_INTERNAL_ERROR, "Init() called while child process still running.")
             self.Exit()
             
commit 417d7a9f8a955ccd039ad02735994cfb9d8ed77b
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Fri Feb 29 20:14:41 2008 -0500

    Forgot import.

diff --git a/backends/test/helpers/PackageKitDbusTest.py b/backends/test/helpers/PackageKitDbusTest.py
index 4775c56..1764bb5 100755
--- a/backends/test/helpers/PackageKitDbusTest.py
+++ b/backends/test/helpers/PackageKitDbusTest.py
@@ -18,6 +18,7 @@ import dbus.service
 import gobject
 from packagekit.enums import *
 import time
+import signal
 
 # This is common between backends
 from packagekit.daemonBackend import PACKAGEKIT_DBUS_INTERFACE, PACKAGEKIT_DBUS_PATH
commit 1155364116d877c47866d0550a814cf21a9b8a2a
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Fri Feb 29 20:10:03 2008 -0500

    Add signal handler back to PackageKitDbusTest.

diff --git a/backends/test/helpers/PackageKitDbusTest.py b/backends/test/helpers/PackageKitDbusTest.py
index 801875a..4775c56 100755
--- a/backends/test/helpers/PackageKitDbusTest.py
+++ b/backends/test/helpers/PackageKitDbusTest.py
@@ -27,9 +27,16 @@ PACKAGEKIT_DBUS_SERVICE = 'org.freedesktop.PackageKitTestBackend'
 
 #sudo dbus-send --system --dest=org.freedesktop.PackageKitTestBackend --type=method_call --print-reply /org/freedesktop/PackageKitBackend org.freedesktop.PackageKitBackend.SearchName string:filter string:search
 
+def sigquit(signum, frame):
+    print >> sys.stderr, "Quit signal sent - exiting immediately"
+
+    sys.exit(1)
+
 class PackageKitTestBackendService(PackageKitBaseBackend):
 
     def __init__(self, bus_name, bus_path):
+        signal.signal(signal.SIGQUIT, sigquit)
+
         self.bus_name = bus_name
         self.bus_path = bus_path
         PackageKitBaseBackend.__init__(self, bus_name, bus_path)
commit 5bd6e7e193e85ff7fc1ba6008927b3bb01da51d0
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Fri Feb 29 19:59:28 2008 -0500

    another try at using waitpid() correctly.

diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index 208a336..0ced5e0 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -123,13 +123,17 @@ class PackageKitBaseBackend(dbus.service.Object):
         print "in child_is_running"
         if self._child_pid:
             print "in child_is_running, pid = %s" % self._child_pid
+            running = True
             try:
                 (pid, status) = os.waitpid(self._child_pid, os.WNOHANG)
+                if pid:
+                    running = False
             except OSError, e:
                 print "OS Error: %s" % str(e)
+                running = False
 
-            if os.WIFSTOPPED(status):
-                print "child is stopped"
+            if not running:
+                print "child %s is stopped" % pid
                 self._child_pid = None
                 return False
 
@@ -288,10 +292,7 @@ class PackageKitBaseBackend(dbus.service.Object):
                          in_signature='', out_signature='')
     def Exit(self):
         print "Exit()"
-        if self.child_is_running():
-            # Don't call Exit() or ErrorCode() here
-            return
-
+    
         self.doExit()
         self.loop.quit()
  
@@ -299,7 +300,7 @@ class PackageKitBaseBackend(dbus.service.Object):
                          in_signature='', out_signature='')
     def Lock(self):
         print "Lock()"
-        if self._child_pid:
+        if self._child_is_running():
             self.ErrorCode(ERROR_INTERNAL_ERROR, "Lock() called while child process still running.")
             self.Exit()
 
@@ -311,7 +312,7 @@ class PackageKitBaseBackend(dbus.service.Object):
                          in_signature='', out_signature='')
     def Unlock(self):
         print "Unlock()"
-        if self._child_pid:
+        if self._child_is_running():
             self.ErrorCode(ERROR_INTERNAL_ERROR, "Unlock() called while child process still running.")
             self.Exit()
 
commit d3ae9c066d1d1dd17e2ebaac2effc3854d9b4179
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Fri Feb 29 19:35:57 2008 -0500

    fix several more errors.

diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index e5c2784..208a336 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -278,16 +278,19 @@ class PackageKitBaseBackend(dbus.service.Object):
         print "Init()"
         if self.child_is_running():
             self.ErrorCode(ERROR_INTERNAL_ERROR, "Init() called while child process still running.")
+            self.Exit()
+            
+            return
 
         self.doInit()
-        return                            
 
     @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
                          in_signature='', out_signature='')
     def Exit(self):
         print "Exit()"
         if self.child_is_running():
-            self.ErrorCode(ERROR_INTERNAL_ERROR, "Exit() called while child process still running.")
+            # Don't call Exit() or ErrorCode() here
+            return
 
         self.doExit()
         self.loop.quit()
@@ -298,8 +301,11 @@ class PackageKitBaseBackend(dbus.service.Object):
         print "Lock()"
         if self._child_pid:
             self.ErrorCode(ERROR_INTERNAL_ERROR, "Lock() called while child process still running.")
+            self.Exit()
+
+            return
+
         self.doLock()
-        return
  
     @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
                          in_signature='', out_signature='')
@@ -307,8 +313,11 @@ class PackageKitBaseBackend(dbus.service.Object):
         print "Unlock()"
         if self._child_pid:
             self.ErrorCode(ERROR_INTERNAL_ERROR, "Unlock() called while child process still running.")
+            self.Exit()
+
+            return
+
         self.doUnlock()
-        return
  
     @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
                          in_signature='ss', out_signature='')
@@ -329,6 +338,7 @@ class PackageKitBaseBackend(dbus.service.Object):
         print "Cancel()"
     	if not self._allow_cancel:
             self.ErrorCode(ERROR_CANNOT_CANCEL, "Current action cannot be cancelled")
+            self.Exit()
             return
     		
         if self._child_pid:
commit a450ceb7969fcd49f9643377564ea50e4c07ce75
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Fri Feb 29 19:20:16 2008 -0500

    Catch error if there is no child.

diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index 16ae5b3..e5c2784 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -123,7 +123,10 @@ class PackageKitBaseBackend(dbus.service.Object):
         print "in child_is_running"
         if self._child_pid:
             print "in child_is_running, pid = %s" % self._child_pid
-            (pid, status) = os.waitpid(self._child_pid, os.WNOHANG)
+            try:
+                (pid, status) = os.waitpid(self._child_pid, os.WNOHANG)
+            except OSError, e:
+                print "OS Error: %s" % str(e)
 
             if os.WIFSTOPPED(status):
                 print "child is stopped"
commit eb71587680246c78eebe6a7b523cdf2ee33862ef
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Fri Feb 29 19:08:33 2008 -0500

    Another one.

diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index d2091de..16ae5b3 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -122,7 +122,7 @@ class PackageKitBaseBackend(dbus.service.Object):
     def child_is_running(self):
         print "in child_is_running"
         if self._child_pid:
-            print "in child_is_running, pid = " % self._child_pid
+            print "in child_is_running, pid = %s" % self._child_pid
             (pid, status) = os.waitpid(self._child_pid, os.WNOHANG)
 
             if os.WIFSTOPPED(status):
commit 4c9b96c3a1325d82e4730132762c77f468c7216c
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Fri Feb 29 19:02:53 2008 -0500

    another silly typo

diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index 040371c..d2091de 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -74,6 +74,7 @@ class PackageKitBaseBackend(dbus.service.Object):
         self._locked = False
         self._allow_cancel = False
         self._child_pid = None
+        self._is_child = False
 
         self.loop = gobject.MainLoop()
 
commit 5a6fca454d9aabccbdc8b3a6bea502b09cbe0313
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Fri Feb 29 18:55:31 2008 -0500

    fix silly typo

diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index 3277046..040371c 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -101,7 +101,7 @@ class PackageKitBaseBackend(dbus.service.Object):
         return True
 
     def forkme(self):
-        print "Calling forkme, child pid = " % self._child_pid
+        print "Calling forkme, child pid = %s" % self._child_pid
         if self._is_child:
             print "forkme() called from child thread."
             raise Exception, "forkme() called from child thread."
commit 1ccc6a2826b93f656812bd2e33366c3ebb3338e4
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Fri Feb 29 18:16:12 2008 -0500

    Work in progress.  Change the daemonBackend to fork to perform actions.

diff --git a/backends/test/helpers/PackageKitDbusTest.py b/backends/test/helpers/PackageKitDbusTest.py
index 19de9fa..801875a 100755
--- a/backends/test/helpers/PackageKitDbusTest.py
+++ b/backends/test/helpers/PackageKitDbusTest.py
@@ -17,117 +17,43 @@ import dbus.glib
 import dbus.service
 import gobject
 from packagekit.enums import *
+import time
 
 # This is common between backends
 from packagekit.daemonBackend import PACKAGEKIT_DBUS_INTERFACE, PACKAGEKIT_DBUS_PATH
+from packagekit.daemonBackend import PackageKitBaseBackend
 
 PACKAGEKIT_DBUS_SERVICE = 'org.freedesktop.PackageKitTestBackend'
 
 #sudo dbus-send --system --dest=org.freedesktop.PackageKitTestBackend --type=method_call --print-reply /org/freedesktop/PackageKitBackend org.freedesktop.PackageKitBackend.SearchName string:filter string:search
 
-class PackageKitTestBackendService(dbus.service.Object):
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='', out_signature='')
-    def Init(self):
+class PackageKitTestBackendService(PackageKitBaseBackend):
+
+    def __init__(self, bus_name, bus_path):
+        self.bus_name = bus_name
+        self.bus_path = bus_path
+        PackageKitBaseBackend.__init__(self, bus_name, bus_path)
+
+    def doInit(self):
         print 'Init!'
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='', out_signature='')
-    def Lock(self):
+    def doLock(self):
         print 'Lock!'
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='', out_signature='')
-    def Unlock(self):
+    def doUnlock(self):
         print 'Unlock!'
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='', out_signature='')
-    def Exit(self):
+    def doExit(self):
         sys.exit(0)
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='ss', out_signature='')
-    def SearchName(self, filters, search):
+    def doSearchName(self, filters, search):
         print "SearchName (%s, %s)" % (filters, search)
         self.StatusChanged(STATUS_QUERY)
+        self.Package(INFO_AVAILABLE, "foo;0.0.1;i398;fedora", "Foo")
+        time.sleep(10)
         self.Package(INFO_AVAILABLE, "foo-devel;0.0.1;i398;fedora", "Foo build files")
         self.Finished(EXIT_SUCCESS)
 
-    @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
-                         signature='s')
-    def Finished(self, exit):
-        print "Finished (%s)" % (exit)
-
-    @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
-                         signature='ssb')
-    def RepoDetail(self, repo_id, description, enabled):
-        print "RepoDetail (%s, %s, %i)" % (repo_id, description, enabled)
-
-    @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
-                         signature='s')
-    def StatusChanged(self, status):
-        print "StatusChanged (%s)" % (status)
-
-    @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
-                         signature='u')
-    def PercentageChanged(self, percentage):
-        print "PercentageChanged (%i)" % (percentage)
-
-    @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
-                         signature='u')
-    def SubPercentageChanged(self, percentage):
-        print "SubPercentageChanged (%i)" % (percentage)
-
-    @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
-                         signature='')
-    def NoPercentageChanged(self):
-        print "NoPercentageChanged"
-
-    @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
-                         signature='sss')
-    def Package(self, status, package_id, summary):
-        print "Package (%s, %s, %s)" % (status, package_id, summary)
-
-    @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
-                         signature='ssssst')
-    def Description(self, package_id, license, group, detail, url, size):
-        print "Description (%s, %s, %s, %s, %s, %u)" % (package_id, license, group, detail, url, size)
-
-    @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
-                         signature='ss')
-    def Files(self, package_id, file_list):
-        print "Files (%s, %s)" % (package_id, file_list)
-
-    @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
-                         signature='ssssssss')
-    def UpdateDetail(self, package_id, updates, obsoletes, vendor_url, bugzilla_url, cve_url, restart, update):
-        print "UpdateDetail (%s, %s, %s, %s, %s, %s, %s, %s)" % (package_id, updates, obsoletes, vendor_url, bugzilla_url, cve_url, restart, update)
-
-    @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
-                         signature='b')
-    def AllowCancel(self, allow_cancel):
-        print "AllowCancel (%i)" % (allow_cancel)
-
-    @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
-                         signature='ss')
-    def ErrorCode(self, code, description):
-        print "ErrorCode (%s, %s)" % (code, description)
-
-    @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
-                         signature='ss')
-    def RequireRestart(self, restart, description):
-        print "RequireRestart (%s, %s)" % (restart, description)
-
-    @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
-                         signature='ss')
-    def Message(self, message, description):
-        print "Message (%s, %s)" % (message, description)
-
-    @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
-                         signature='sssssss')
-    def RepoSignatureRequired(self, repository_name, key_url, key_userid, key_id, key_fingerprint, key_timestamp, sig_type):
-        print "RepoSignatureRequired (%s, %s, %s, %s, %s, %s, %s)" % (repository_name, key_url, key_userid, key_id, key_fingerprint, key_timestamp, sig_type)
 
 bus = dbus.SystemBus()
 bus_name = dbus.service.BusName(PACKAGEKIT_DBUS_SERVICE, bus=bus)
diff --git a/backends/yum2/helpers/yumDBUSBackend.py b/backends/yum2/helpers/yumDBUSBackend.py
index c6b4396..deab53a 100755
--- a/backends/yum2/helpers/yumDBUSBackend.py
+++ b/backends/yum2/helpers/yumDBUSBackend.py
@@ -238,10 +238,11 @@ class PackageKitYumBackend(PackageKitBaseBackend):
     def __init__(self, bus_name, dbus_path):
         signal.signal(signal.SIGQUIT, sigquit)
 
+        print "__init__"
         PackageKitBaseBackend.__init__(self,
                                        bus_name,
                                        dbus_path)
-        print "__init__"
+        print "__init__ done"
 
 #
 # Signals ( backend -> engine -> client )
@@ -301,41 +302,20 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 # Methods ( client -> engine -> backend )
 #
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='', out_signature='')
-    def Init(self):
-        self.last_action_time = time.time()
+    def doInit(self):
         self.yumbase = PackageKitYumBase()
         yumbase = self.yumbase
         self._setup_yum()
-        self.doLock()
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='', out_signature='')
-    def Exit(self):
-        self.last_action_time = time.time()
+    def doExit(self):
         if self.isLocked():
-            self.doUnlock()
-
-        self.loop.quit()
-    
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='', out_signature='')
-    def Cancel(self):
-        print "Cancelling immediately."
-        if hasattr(self, 'yumbase'):
-            self.yumbase.closeRpmDB()
-            self.yumbase.doUnlock(YUM_PID_FILE)
-
-        self.loop.quit()
-
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='', out_signature='')
-    def Lock(self):
-        self.last_action_time = time.time()
-        self.doLock()
+            self._unlock_yum()
 
     def doLock(self):
+        self._lock_yum()
+        PackageKitBaseBackend.doLock(self)
+
+    def _lock_yum(self):
         ''' Lock Yum'''
         retries = 0
         while not self.isLocked():
@@ -350,28 +330,22 @@ class PackageKitYumBackend(PackageKitBaseBackend):
                 if retries > 20:
                     self.ErrorCode(ERROR_INTERNAL_ERROR,'Yum is locked by another application')
                     self.Finished(EXIT_FAILED)
-                    return
-
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='', out_signature='')
-    def Unlock(self):
-        self.last_action_time = time.time()
-        self.doUnlock()
+                    self.loop.quit()
 
     def doUnlock(self):
+        self._unlock_yum()
+
+    def _unlock_yum(self):
         ''' Unlock Yum'''
         if self.isLocked():
             PackageKitBaseBackend.doUnlock(self)
             self.yumbase.closeRpmDB()
             self.yumbase.doUnlock(YUM_PID_FILE)
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='ss', out_signature='')
-    def SearchName(self, filters, search):
+    def doSearchName(self, filters, search):
         '''
         Implement the {backend}-search-name functionality
         '''
-        self.last_action_time = time.time()
         self._check_init(lazy_cache=True)
         self.AllowCancel(True)
         self.NoPercentageUpdates()
@@ -386,13 +360,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             
         self.Finished(EXIT_SUCCESS)
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='ss', out_signature='')
-    def SearchDetails(self,filters,key):
+    def doSearchDetails(self,filters,key):
         '''
         Implement the {backend}-search-details functionality
         '''
-        self.last_action_time = time.time()
         self._check_init(lazy_cache=True)
         self.AllowCancel(True)
         self.NoPercentageUpdates()
@@ -407,13 +378,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
         self.Finished(EXIT_SUCCESS)
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='ss', out_signature='')
-    def SearchGroup(self,filters,key):
+    def doSearchGroup(self,filters,key):
         '''
         Implement the {backend}-search-group functionality
         '''
-        self.last_action_time = time.time()
         self._check_init(lazy_cache=True)
         self.AllowCancel(True)
         self.NoPercentageUpdates()
@@ -456,13 +424,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
         self.Finished(EXIT_SUCCESS)
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='ss', out_signature='')
-    def SearchFile(self,filters,key):
+    def doSearchFile(self,filters,key):
         '''
         Implement the {backend}-search-file functionality
         '''
-        self.last_action_time = time.time()
         self._check_init(lazy_cache=True)
         self.AllowCancel(True)
         self.NoPercentageUpdates()
@@ -490,13 +455,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
         self.Finished(EXIT_SUCCESS)
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='sb', out_signature='')
-    def GetRequires(self,package,recursive):
+    def doGetRequires(self,package,recursive):
         '''
         Print a list of requires for a given package
         '''
-        self.last_action_time = time.time()
         self._check_init(lazy_cache=True)
         self.AllowCancel(True)
         self.NoPercentageUpdates()
@@ -517,13 +479,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
         self.Finished(EXIT_SUCCESS)
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='sb', out_signature='')
-    def GetDepends(self,package,recursive):
+    def doGetDepends(self,package,recursive):
         '''
         Print a list of depends for a given package
         '''
-        self.last_action_time = time.time()
         self._check_init(lazy_cache=True)
         self.AllowCancel(True)
         self.PercentageChanged(0)
@@ -553,13 +512,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
         self.Finished(EXIT_SUCCESS)
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='', out_signature='')
-    def UpdateSystem(self):
+    def doUpdateSystem(self):
         '''
         Implement the {backend}-update-system functionality
         '''
-        self.last_action_time = time.time()
         self._check_init()
         self.AllowCancel(False)
         self.PercentageChanged(0)
@@ -588,13 +544,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         self.yumbase.conf.skip_broken = old_skip_broken
         self.Finished(EXIT_SUCCESS)
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='b', out_signature='')
-    def RefreshCache(self, force):
+    def doRefreshCache(self, force):
         '''
         Implement the {backend}-refresh_cache functionality
         '''
-        self.last_action_time = time.time()
         self._check_init()
         self.AllowCancel(True)
         self.PercentageChanged(0)
@@ -642,13 +595,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
         self.Finished(EXIT_SUCCESS)
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='ss', out_signature='')
-    def Resolve(self, filters, name):
+    def doResolve(self, filters, name):
         '''
         Implement the {backend}-resolve functionality
         '''
-        self.last_action_time = time.time()
         self._check_init(lazy_cache=True)
         self.AllowCancel(True)
         self.NoPercentageUpdates()
@@ -682,14 +632,11 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
         self.Finished(EXIT_SUCCESS)
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='s', out_signature='')
-    def InstallPackage(self, package):
+    def doInstallPackage(self, package):
         '''
         Implement the {backend}-install functionality
         This will only work with yum 3.2.4 or higher
         '''
-        self.last_action_time = time.time()
         self._check_init()
         self.AllowCancel(False)
         self.PercentageChanged(0)
@@ -717,15 +664,12 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             
         self.Finished(EXIT_SUCCESS)
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='s', out_signature='')
-    def InstallFile (self, inst_file):
+    def doInstallFile (self, inst_file):
         '''
         Implement the {backend}-install_file functionality
         Install the package containing the inst_file file
         Needed to be implemented in a sub class
         '''
-        self.last_action_time = time.time()
         self._check_init()
         self.AllowCancel(False)
         self.PercentageChanged(0)
@@ -747,14 +691,11 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
         self.Finished(EXIT_SUCCESS)
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='s', out_signature='')
-    def UpdatePackage(self, package):
+    def doUpdatePackage(self, package):
         '''
         Implement the {backend}-update functionality
         This will only work with yum 3.2.4 or higher
         '''
-        self.last_action_time = time.time()
         self._check_init()
         self.AllowCancel(False)
         self.PercentageChanged(0)
@@ -777,9 +718,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             
         self.Finished(EXIT_SUCCESS)
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='sb', out_signature='')
-    def RemovePackage(self, package, allowdep):
+    def doRemovePackage(self, package, allowdep):
         '''
         Implement the {backend}-remove functionality
         '''
@@ -811,13 +750,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             self.Finished(EXIT_FAILED)
             return
             
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='s', out_signature='')
-    def GetDescription(self, package):
+    def doGetDescription(self, package):
         '''
         Print a detailed description for a given package
         '''
-        self.last_action_time = time.time()
         self._check_init(lazy_cache=True)
         self.AllowCancel(True)
         self.NoPercentageUpdates()
@@ -833,10 +769,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             
         self.Finished(EXIT_SUCCESS)
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='s', out_signature='')
-    def GetFiles(self, package):
-        self.last_action_time = time.time()
+    def doGetFiles(self, package):
         self._check_init(lazy_cache=True)
         self.AllowCancel(True)
         self.NoPercentageUpdates()
@@ -857,14 +790,11 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
         self.Finished(EXIT_SUCCESS)
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='s', out_signature='')
-    def GetUpdates(self, filters):
+    def doGetUpdates(self, filters):
         '''
         Implement the {backend}-get-updates functionality
         @param filters: package types to show
         '''
-        self.last_action_time = time.time()
         self._check_init(lazy_cache=True)
         self.AllowCancel(True)
         self.NoPercentageUpdates()
@@ -893,16 +823,13 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
         self.Finished(EXIT_SUCCESS)
         
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='ss', out_signature='')
-    def GetPackages(self,filters,showdesc='no'):
+    def doGetPackages(self,filters,showdesc='no'):
         '''
         Search for yum packages
         @param searchlist: The yum package fields to search in
         @param filters: package types to search (all,installed,available)
         @param key: key to seach for
         '''
-        self.last_action_time = time.time()
         self._check_init(lazy_cache=True)
         self.AllowCancel(True)
         self.NoPercentageUpdates()
@@ -941,13 +868,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
         self.Finished(EXIT_SUCCESS)
         
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='sb', out_signature='')
-    def RepoEnable(self, repoid, enable):
+    def doRepoEnable(self, repoid, enable):
         '''
         Implement the {backend}-repo-enable functionality
         '''
-        self.last_action_time = time.time()
         self._check_init()
         try:
             repo = self.yumbase.repos.getRepo(repoid)
@@ -965,13 +889,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
         self.Finished(EXIT_SUCCESS)
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='', out_signature='')
-    def GetRepoList(self):
+    def doGetRepoList(self):
         '''
         Implement the {backend}-get-repo-list functionality
         '''
-        self.last_action_time = time.time()
         self._check_init()
         self.StatusChanged(STATUS_INFO)
         for repo in self.yumbase.repos.repos.values():
@@ -982,13 +903,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
         self.Finished(EXIT_SUCCESS)
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='s', out_signature='')
-    def GetUpdateDetail(self,package):
+    def doGetUpdateDetail(self,package):
         '''
         Implement the {backend}-get-update_detail functionality
         '''
-        self.last_action_time = time.time()
         self._check_init()
         self.AllowCancel(True)
         self.NoPercentageUpdates()
@@ -1011,13 +929,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
         self.Finished(EXIT_SUCCESS)
 
-    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='sss', out_signature='')
-    def RepoSetData(self, repoid, parameter, value):
+    def doRepoSetData(self, repoid, parameter, value):
         '''
         Implement the {backend}-repo-set-data functionality
         '''
-        self.last_action_time = time.time()
         self._check_init()
         self.AllowCancel(False)
         self.NoPercentageUpdates()
diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index c484534..3277046 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -28,6 +28,7 @@ import types
 from enums import *
 import gobject
 import os
+import signal
 from pkexceptions import *
 import dbus.service
 
@@ -71,6 +72,8 @@ class PackageKitBaseBackend(dbus.service.Object):
         dbus.service.Object.__init__(self, bus_name, dbus_path)
 
         self._locked = False
+        self._allow_cancel = False
+        self._child_pid = None
 
         self.loop = gobject.MainLoop()
 
@@ -97,6 +100,41 @@ class PackageKitBaseBackend(dbus.service.Object):
 
         return True
 
+    def forkme(self):
+        print "Calling forkme, child pid = " % self._child_pid
+        if self._is_child:
+            print "forkme() called from child thread."
+            raise Exception, "forkme() called from child thread."
+        self.last_action_time = time.time()
+
+        if self.child_is_running():
+            print "child was already running"
+            self.ErrorCode(ERROR_INTERNAL_ERROR, "Method called while child process is still running.")
+            raise Exception, "Method called while child process is still running"
+    
+        self._child_pid = os.fork()
+        if self._child_pid:
+            self._is_child = False
+        else:
+            self._is_child = True
+
+    def child_is_running(self):
+        print "in child_is_running"
+        if self._child_pid:
+            print "in child_is_running, pid = " % self._child_pid
+            (pid, status) = os.waitpid(self._child_pid, os.WNOHANG)
+
+            if os.WIFSTOPPED(status):
+                print "child is stopped"
+                self._child_pid = None
+                return False
+
+            print "child still running"
+            return True
+
+        print "No child."
+        return False
+                            
 #
 # Signals ( backend -> engine -> client )
 #
@@ -117,6 +155,7 @@ class PackageKitBaseBackend(dbus.service.Object):
     @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
                          signature='b')
     def AllowCancel(self, allow_cancel):
+        self._allow_cancel = allow_cancel
         print "AllowCancel (%i)" % (allow_cancel)
 
     @PKSignalHouseKeeper
@@ -229,253 +268,339 @@ class PackageKitBaseBackend(dbus.service.Object):
 # they're commented out here.  Just implement the ones you need in
 # your class, and don't forget the decorators.
 #
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='', out_signature='')
-#    def Init(self):
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='', out_signature='')
-#    def Exit(self):
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='', out_signature='')
-#    def Lock(self):
-#        self.doLock()
-#
-#    def doLock(self):
-#        ''' Lock Yum'''
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='', out_signature='')
-#    def Unlock(self):
-#        self.doUnlock()
-#
-#    def doUnlock(self):
-#        ''' Unlock Yum'''
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @PKMethodHouseKeeper
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='ss', out_signature='')
-#    def SearchName(self, filters, search):
-#        '''
-#        Implement the {backend}-search-name functionality
-#        '''
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @PKMethodHouseKeeper
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='ss', out_signature='')
-#    def SearchDetails(self,filters,key):
-#        '''
-#        Implement the {backend}-search-details functionality
-#        '''
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @PKMethodHouseKeeper
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='ss', out_signature='')
-#    def SearchGroup(self,filters,key):
-#        '''
-#        Implement the {backend}-search-group functionality
-#        '''
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @PKMethodHouseKeeper
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='ss', out_signature='')
-#    def SearchFile(self,filters,key):
-#        '''
-#        Implement the {backend}-search-file functionality
-#        '''
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @PKMethodHouseKeeper
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='sb', out_signature='')
-#    def GetRequires(self,package,recursive):
-#        '''
-#        Print a list of requires for a given package
-#        '''
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @PKMethodHouseKeeper
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='sb', out_signature='')
-#    def GetDepends(self,package,recursive):
-#        '''
-#        Print a list of depends for a given package
-#        '''
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @PKMethodHouseKeeper
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='', out_signature='')
-#    def UpdateSystem(self):
-#        '''
-#        Implement the {backend}-update-system functionality
-#        '''
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @PKMethodHouseKeeper
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='b', out_signature='')
-#    def RefreshCache(self, force):
-#        '''
-#        Implement the {backend}-refresh_cache functionality
-#        '''
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @PKMethodHouseKeeper
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='ss', out_signature='')
-#    def Resolve(self, filters, name):
-#        '''
-#        Implement the {backend}-resolve functionality
-#        '''
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @PKMethodHouseKeeper
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='s', out_signature='')
-#    def InstallPackage(self, package):
-#        '''
-#        Implement the {backend}-install functionality
-#        This will only work with yum 3.2.4 or higher
-#        '''
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @PKMethodHouseKeeper
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='s', out_signature='')
-#    def InstallFile (self, inst_file):
-#        '''
-#        Implement the {backend}-install_file functionality
-#        Install the package containing the inst_file file
-#        Needed to be implemented in a sub class
-#        '''
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @PKMethodHouseKeeper
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='s', out_signature='')
-#    def ServicePack (self, location):
-#        '''
-#        Implement the {backend}-service-pack functionality
-#        Install the package containing the inst_file file
-#        Needed to be implemented in a sub class
-#        '''
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @PKMethodHouseKeeper
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='s', out_signature='')
-#    def UpdatePackage(self, package):
-#        '''
-#        Implement the {backend}-update functionality
-#        '''
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @PKMethodHouseKeeper
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='sb', out_signature='')
-#    def RemovePackage(self, package, allowdep):
-#        '''
-#        Implement the {backend}-remove functionality
-#        '''
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @PKMethodHouseKeeper
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='s', out_signature='')
-#    def GetDescription(self, package):
-#        '''
-#        Print a detailed description for a given package
-#        '''
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @PKMethodHouseKeeper
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='s', out_signature='')
-#    def GetFiles(self, package):
-#        '''
-#        Implement the get-files method
-#        '''
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @PKMethodHouseKeeper
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='', out_signature='')
-#    def GetUpdates(self):
-#        '''
-#        Implement the {backend}-get-updates functionality
-#        '''
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @PKMethodHouseKeeper
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='sb', out_signature='')
-#    def RepoEnable(self, repoid, enable):
-#        '''
-#        Implement the {backend}-repo-enable functionality
-#        '''
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @PKMethodHouseKeeper
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='', out_signature='')
-#    def GetRepoList(self):
-#        '''
-#        Implement the {backend}-get-repo-list functionality
-#        '''
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @PKMethodHouseKeeper
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='s', out_signature='')
-#    def GetUpdateDetail(self,package):
-#        '''
-#        Implement the {backend}-get-update_detail functionality
-#        '''
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
-#
-#    @PKMethodHouseKeeper
-#    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-#                         in_signature='sss', out_signature='')
-#    def RepoSetData(self, repoid, parameter, value):
-#        '''
-#        Implement the {backend}-repo-set-data functionality
-#        '''
-#        self.ErrorCode(ERROR_NOT_SUPPORTED,"Method not supported")
-#        self.Exit()
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='', out_signature='')
+    def Init(self):
+        print "Init()"
+        if self.child_is_running():
+            self.ErrorCode(ERROR_INTERNAL_ERROR, "Init() called while child process still running.")
+
+        self.doInit()
+        return                            
+
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='', out_signature='')
+    def Exit(self):
+        print "Exit()"
+        if self.child_is_running():
+            self.ErrorCode(ERROR_INTERNAL_ERROR, "Exit() called while child process still running.")
+
+        self.doExit()
+        self.loop.quit()
+ 
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='', out_signature='')
+    def Lock(self):
+        print "Lock()"
+        if self._child_pid:
+            self.ErrorCode(ERROR_INTERNAL_ERROR, "Lock() called while child process still running.")
+        self.doLock()
+        return
+ 
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='', out_signature='')
+    def Unlock(self):
+        print "Unlock()"
+        if self._child_pid:
+            self.ErrorCode(ERROR_INTERNAL_ERROR, "Unlock() called while child process still running.")
+        self.doUnlock()
+        return
+ 
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='ss', out_signature='')
+    def SearchName(self, filters, search):
+        '''
+        Implement the {backend}-search-name functionality
+        '''
+        print "SearchName()"
+        self.forkme()
+        if self._child_pid:
+            return
+        self.doSearchName(filters, search)
+        sys.exit(0)
+
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='', out_signature='')
+    def Cancel(self):
+        print "Cancel()"
+    	if not self._allow_cancel:
+            self.ErrorCode(ERROR_CANNOT_CANCEL, "Current action cannot be cancelled")
+            return
+    		
+        if self._child_pid:
+            os.kill(self._child_pid, signal.SIGQUIT)
+            self._child_pid = None
+
+        return
+    
+
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='ss', out_signature='')
+    def SearchDetails(self,filters,key):
+        '''
+        Implement the {backend}-search-details functionality
+        '''
+        print "SearchDetails()"
+        self.forkme()
+        if self._child_pid:
+            return
+        self.doSearchDetails(filters,key)
+        sys.exit(0)
+
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='ss', out_signature='')
+    def SearchGroup(self,filters,key):
+        '''
+        Implement the {backend}-search-group functionality
+        '''
+        print "SearchGroup()"
+        self.forkme()
+        if self._child_pid:
+            return
+        self.doSearchGroup(filters,key)
+        sys.exit(0)
+
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='ss', out_signature='')
+    def SearchFile(self,filters,key):
+        '''
+        Implement the {backend}-search-file functionality
+        '''
+        print "SearchFile()"
+        self.forkme()
+        if self._child_pid:
+            return
+        self.doSearchFile(filters,key)
+        sys.exit(0)
+
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='sb', out_signature='')
+    def GetRequires(self,package,recursive):
+        '''
+        Print a list of requires for a given package
+        '''
+        print "GetRequires()"
+        self.forkme()
+        if self._child_pid:
+            return
+        self.doGetRequires(package,recursive)
+        sys.exit(0)
+
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='sb', out_signature='')
+    def GetDepends(self,package,recursive):
+        '''
+        Print a list of depends for a given package
+        '''
+        print "GetDepends()"
+        self.forkme()
+        if self._child_pid:
+            return
+        self.doGetDepends(package,recursive)
+        sys.exit(0)
+
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='', out_signature='')
+    def UpdateSystem(self):
+        '''
+        Implement the {backend}-update-system functionality
+        '''
+        print "UpdateSystem()"
+        self.forkme()
+        if self._child_pid:
+            return
+        self.doUpdateSystem()
+        sys.exit(0)
+
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='b', out_signature='')
+    def RefreshCache(self, force):
+        '''
+        Implement the {backend}-refresh_cache functionality
+        '''
+        print "RefreshCache()"
+        self.forkme()
+        if self._child_pid:
+            return
+        self.doRefreshCache( force)
+        sys.exit(0)
+
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='ss', out_signature='')
+    def Resolve(self, filters, name):
+        '''
+        Implement the {backend}-resolve functionality
+        '''
+        print "Resolve()"
+        self.forkme()
+        if self._child_pid:
+            return
+        self.doResolve( filters, name)
+        sys.exit(0)
+
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='s', out_signature='')
+    def InstallPackage(self, package):
+        '''
+        Implement the {backend}-install functionality
+        This will only work with yum 3.2.4 or higher
+        '''
+        print "InstallPackage()"
+        self.forkme()
+        if self._child_pid:
+            return
+        self.doInstallPackage( package)
+        sys.exit(0)
+
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='s', out_signature='')
+    def InstallFile (self, inst_file):
+        '''
+        Implement the {backend}-install_file functionality
+        Install the package containing the inst_file file
+        Needed to be implemented in a sub class
+        '''
+        print "InstallFile()"
+        self.forkme()
+        if self._child_pid:
+            return
+        self.doInstallFile( inst_file)
+        sys.exit(0)
+
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='s', out_signature='')
+    def ServicePack (self, location):
+        '''
+        Implement the {backend}-service-pack functionality
+        Install the package containing the inst_file file
+        Needed to be implemented in a sub class
+        '''
+        print "ServicePack()"
+        self.forkme()
+        if self._child_pid:
+            return
+        self.doServicePack( location)
+        sys.exit(0)
+
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='s', out_signature='')
+    def UpdatePackage(self, package):
+        '''
+        Implement the {backend}-update functionality
+        '''
+        print "UpdatePackage()"
+        self.forkme()
+        if self._child_pid:
+            return
+        self.doUpdatePackage( package)
+        sys.exit(0)
+
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='sb', out_signature='')
+    def RemovePackage(self, package, allowdep):
+        '''
+        Implement the {backend}-remove functionality
+        '''
+        print "RemovePackage()"
+        self.forkme()
+        if self._child_pid:
+            return
+        self.doRemovePackage( package, allowdep)
+        sys.exit(0)
+
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='s', out_signature='')
+    def GetDescription(self, package):
+        '''
+        Print a detailed description for a given package
+        '''
+        print "GetDescription()"
+        self.forkme()
+        if self._child_pid:
+            return
+        self.doGetDescription( package)
+        sys.exit(0)
+
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='s', out_signature='')
+    def GetFiles(self, package):
+        '''
+        Implement the get-files method
+        '''
+        print "GetFiles()"
+        self.forkme()
+        if self._child_pid:
+            return
+        self.doGetFiles( package)
+        sys.exit(0)
+
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='', out_signature='')
+    def GetUpdates(self):
+        '''
+        Implement the {backend}-get-updates functionality
+        '''
+        print "GetUpdates()"
+        self.forkme()
+        if self._child_pid:
+            return
+        self.doGetUpdates()
+        sys.exit(0)
+
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='sb', out_signature='')
+    def RepoEnable(self, repoid, enable):
+        '''
+        Implement the {backend}-repo-enable functionality
+        '''
+        print "RepoEnable()"
+        self.forkme()
+        if self._child_pid:
+            return
+        self.doRepoEnable( repoid, enable)
+        sys.exit(0)
+
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='', out_signature='')
+    def GetRepoList(self):
+        '''
+        Implement the {backend}-get-repo-list functionality
+        '''
+        print "GetRepoList()"
+        self.forkme()
+        if self._child_pid:
+            return
+        self.doGetRepoList()
+        sys.exit(0)
+
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='s', out_signature='')
+    def GetUpdateDetail(self,package):
+        '''
+        Implement the {backend}-get-update_detail functionality
+        '''
+        print "GetUpdateDetail()"
+        self.forkme()
+        if self._child_pid:
+            return
+        self.doGetUpdateDetail(package)
+        sys.exit(0)
+
+    @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+                         in_signature='sss', out_signature='')
+    def RepoSetData(self, repoid, parameter, value):
+        '''
+        Implement the {backend}-repo-set-data functionality
+        '''
+        print "RepoSetData()"
+        self.forkme()
+        if self._child_pid:
+            return
+        self.doRepoSetData( repoid, parameter, value)
+        sys.exit(0)
+
 
+                    
 #
 # Utility methods
 #
commit d046f7b0d4e68ba03d801f3dda5a2f19a57c0fbc
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Feb 29 22:30:15 2008 +0100

    add another error constant: cannot-cancel

diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index 23b264b..d08b16e 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -122,6 +122,7 @@ static PkEnumMatch enum_error[] = {
 	{PK_ERROR_ENUM_FAILED_INITIALIZATION,	"failed-initialization"},
 	{PK_ERROR_ENUM_FAILED_FINALISE,		"failed-finalise"},
 	{PK_ERROR_ENUM_FAILED_CONFIG_PARSING,	"failed-config-parsing"},
+	{PK_ERROR_ENUM_CANNOT_CANCEL,		"cannot-cancel"},
 	{0, NULL}
 };
 
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index 69b3d4d..1b4373d 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -193,6 +193,7 @@ typedef enum {
 	PK_ERROR_ENUM_FAILED_INITIALIZATION,
 	PK_ERROR_ENUM_FAILED_FINALISE,
 	PK_ERROR_ENUM_FAILED_CONFIG_PARSING,
+	PK_ERROR_ENUM_CANNOT_CANCEL,
 	PK_ERROR_ENUM_UNKNOWN
 } PkErrorCodeEnum;
 
commit 8620563b2a45141b31929d532730b0687b7eeddd
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Fri Feb 29 12:07:04 2008 -0500

    Add skip_broken flag to update system.

diff --git a/backends/yum2/helpers/yumDBUSBackend.py b/backends/yum2/helpers/yumDBUSBackend.py
index 5146d03..c6b4396 100755
--- a/backends/yum2/helpers/yumDBUSBackend.py
+++ b/backends/yum2/helpers/yumDBUSBackend.py
@@ -566,18 +566,26 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         old_throttle = self.yumbase.conf.throttle
         self.yumbase.conf.throttle = "60%" # Set bandwidth throttle to 60%
                                            # to avoid taking all the system's bandwidth.
+        old_skip_broken = self.yumbase.conf.skip_broken
+        self.yumbase.conf.skip_broken = 1
 
         txmbr = self.yumbase.update() # Add all updates to Transaction
         if txmbr:
             successful = self._runYumTransaction()
             if not successful:
+                self.yumbase.conf.throttle = old_throttle
+                self.yumbase.conf.skip_broken = old_skip_broken
+                # _runYumTransaction() sets the error code and calls Finished()
                 return
         else:
+            self.yumbase.conf.throttle = old_throttle
+            self.yumbase.conf.skip_broken = old_skip_broken
             self.ErrorCode(ERROR_INTERNAL_ERROR,"Nothing to do")
             self.Finished(EXIT_FAILED)
             return
 
         self.yumbase.conf.throttle = old_throttle
+        self.yumbase.conf.skip_broken = old_skip_broken
         self.Finished(EXIT_SUCCESS)
 
     @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
commit 854e667b1af68a8c88674da0d0c4847eeba422d5
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Fri Feb 29 11:53:06 2008 -0500

    Do basename filtering in pkcon get updates.

diff --git a/client/pk-console.c b/client/pk-console.c
index 89b87c3..130f922 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -886,7 +886,7 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], GError **
 				ret = pk_console_get_files (client, details, error);
 			}
 		} else if (strcmp (value, "updates") == 0) {
-			ret = pk_client_get_updates (client, "none", error);
+			ret = pk_client_get_updates (client, "basename", error);
 		} else if (strcmp (value, "actions") == 0) {
 			elist = pk_client_get_actions (client);
 			pk_enum_list_print (elist);
commit 833d87a91bdc95363fffff6580636d07c753dde5
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Fri Feb 29 11:13:19 2008 -0500

    Add basename filter to update method.

diff --git a/backends/yum2/helpers/yumDBUSBackend.py b/backends/yum2/helpers/yumDBUSBackend.py
index 3f4a6fc..5146d03 100755
--- a/backends/yum2/helpers/yumDBUSBackend.py
+++ b/backends/yum2/helpers/yumDBUSBackend.py
@@ -850,27 +850,32 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         self.Finished(EXIT_SUCCESS)
 
     @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
-                         in_signature='', out_signature='')
-    def GetUpdates(self):
+                         in_signature='s', out_signature='')
+    def GetUpdates(self, filters):
         '''
         Implement the {backend}-get-updates functionality
+        @param filters: package types to show
         '''
         self.last_action_time = time.time()
         self._check_init(lazy_cache=True)
         self.AllowCancel(True)
         self.NoPercentageUpdates()
         self.StatusChanged(STATUS_INFO)
+
+        fltlist = filters.split(';')
+
         try:
             ygl = self.yumbase.doPackageLists(pkgnarrow='updates')
             md = self.updateMetadata
             for pkg in ygl.updates:
-                # Get info about package in updates info
-                notice = md.get_notice((pkg.name, pkg.version, pkg.release))
-                if notice:
-                    status = self._get_status(notice)
-                    self._show_package(pkg,status)
-                else:
-                    self._show_package(pkg,INFO_NORMAL)
+                if self._do_extra_filtering(pkg, fltlist):
+                    # Get info about package in updates info
+                    notice = md.get_notice((pkg.name, pkg.version, pkg.release))
+                    if notice:
+                        status = self._get_status(notice)
+                        self._show_package(pkg,status)
+                    else:
+                        self._show_package(pkg,INFO_NORMAL)
         except yum.Errors.RepoError,e:
             self.Message(MESSAGE_NOTICE, "The package cache is invalid and is being rebuilt.")
             self._refresh_yum_cache()
@@ -1082,6 +1087,9 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             elif filter in (FILTER_FREE, FILTER_NOT_FREE):
                 if not self._do_free_filtering(filter, pkg):
                     return False
+            elif filter in (FILTER_BASENAME, FILTER_NOT_BASENAME):
+                if not self._do_basename_filtering(filter, pkg):
+                    return False
         return True
 
     def _do_gui_filtering(self,flt,pkg):
@@ -1123,6 +1131,33 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
         return isFree == wantFree
 
+    def _do_basename_filtering(self,flt,pkg):
+        if flt == FILTER_BASENAME:
+            wantBase = True
+        else:
+            wantBase = False
+
+        isBase = self._check_basename(pkg)
+
+        return isBase == wantBase
+
+    def _check_basename(self, pkg):
+        '''
+        If a package does not have a source rpm (If that ever
+        happens), or it does have a source RPM, and the package's name
+        is the same as the source RPM's name, then we assume it is the
+        'base' package.
+        '''
+        basename = pkg.name
+
+        if pkg.sourcerpm:
+            basename = rpmUtils.miscutils.splitFilename(pkg.sourcerpm)[0]
+            
+        if basename == pkg.name:
+            return True
+
+        return False
+    
     def _buildGroupDict(self):
         pkgGroups= {}
         cats = self.yumbase.comps.categories



More information about the PackageKit mailing list