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

Richard Hughes hughsient at kemper.freedesktop.org
Mon Sep 3 15:12:27 PDT 2007


 TODO                              |    3 ++
 helpers/conary/conaryBackend.py   |   41 ++++++++++++++++++++++----------------
 helpers/conary/get-description.py |    4 +++
 helpers/conary/remove.py          |    4 +++
 helpers/yum/yumBackend.py         |    4 +--
 5 files changed, 37 insertions(+), 19 deletions(-)

New commits:
diff-tree 31ded1b2263c1edf0e7ef9737e6c47f5491cdc6b (from 51f07229ffff5636b872a6fa495ab530f5396dbc)
Author: Richard Hughes <richard at hughsie.com>
Date:   Mon Sep 3 23:12:14 2007 +0100

    add todo items

diff --git a/TODO b/TODO
index 0734da3..d4ec301 100644
--- a/TODO
+++ b/TODO
@@ -13,6 +13,7 @@ Core:
 * Add logging so we can see what was installed/removed and when
 * Add "when installed" data into description
 * Add "installed by 'Richard Hughes'" data into description
+* /var/db/PackageKit/$package_id/installed_by, when_installed
 * Add GetUpdateDetail(s=package_id)
 UpdateDetail(
 string url
@@ -21,6 +22,8 @@ string updates
 string obsoletes
 string update_text
 }
+* Get the set_job and get_job out of the pk-task structure (use g_object)
+* Switch to dlopened backends and remove bodge of pk-task-common.*
 
 Backends:
 * Complete conary backend
diff-tree 51f07229ffff5636b872a6fa495ab530f5396dbc (from d5e3b2050657280aa4a371663a144140c2e4d560)
Author: Ken VanDine <ken at vandine.org>
Date:   Mon Sep 3 17:50:01 2007 -0400

    fix up the wrapper

diff --git a/helpers/conary/get-description.py b/helpers/conary/get-description.py
index 339fca9..bfc1f49 100755
--- a/helpers/conary/get-description.py
+++ b/helpers/conary/get-description.py
@@ -10,5 +10,9 @@
 # (at your option) any later version.
 
 import sys
+from conaryBackend import PackageKitConaryBackend
 
+package = sys.argv[1]
+backend = PackageKitConaryBackend(sys.argv[1:])
+backend.get_description(package)
 sys.exit(0)
diff-tree d5e3b2050657280aa4a371663a144140c2e4d560 (from a36b18a532643df80cb3ecc07f86321d115eb072)
Author: Ken VanDine <ken at vandine.org>
Date:   Mon Sep 3 17:46:46 2007 -0400

    More work on install and remove, all the checks are done just need the actually install and remove specific stuff to be added.

diff --git a/helpers/conary/conaryBackend.py b/helpers/conary/conaryBackend.py
index a26c21f..7d34e96 100644
--- a/helpers/conary/conaryBackend.py
+++ b/helpers/conary/conaryBackend.py
@@ -66,8 +66,7 @@ class PackageKitConaryBackend(PackageKit
             troveTuple = tuple([item.encode('UTF-8') for item in troveTuple])
             name = troveTuple[0]
             version = versions.ThawVersion(troveTuple[1]).trailingRevision()
-            fullVersion = troveTuple[1]
-            #fullVersion = versions.ThawVersion(troveTuple[1])
+            fullVersion = versions.ThawVersion(troveTuple[1])
             flavor = deps.ThawFlavor(troveTuple[2])
             # We don't have summary data yet... so leave it blank for now
             summary = " "
@@ -78,6 +77,7 @@ class PackageKitConaryBackend(PackageKit
                 id = self.get_package_id(name, version, flavor, fullVersion)
                 self.package(id, installed, summary)
 
+
     def _do_search_live(self,searchlist,filters):
         '''
         Search for conary packages
@@ -130,7 +130,7 @@ class PackageKitConaryBackend(PackageKit
     def check_installed(self, troveTuple):
         db = conaryclient.ConaryClient(self.cfg).db
         try:
-            troveTuple = troveTuple[0], versions.ThawVersion(troveTuple[1]), troveTuple[2]
+            troveTuple = troveTuple[0], troveTuple[1], troveTuple[2]
             localInstall = db.findTrove(None, troveTuple)
             installed = 1
         except:
@@ -175,16 +175,29 @@ class PackageKitConaryBackend(PackageKit
             if inst:
                 self.error(ERROR_PACKAGE_ALREADY_INSTALLED,'Package already installed')
             try:
-                print "FOOOOO"
+                print "Update code goes here"
             except:
                 pass
         else:
             self.error(ERROR_PACKAGE_ALREADY_INSTALLED,"Package was not found")
 
-        pass
 
-    def remove(self, allowdep, package_id):
-        pass
+    def remove(self, package_id):
+        '''
+        Implement the {backend}-remove functionality
+        '''
+        pkg,inst = self._findPackage(package_id)
+
+        if pkg:
+            if not inst:
+                self.error(ERROR_PACKAGE_NOT_INSTALLED,'Package not installed')
+            try:
+                print "Remove code goes here"
+            except:
+                pass
+        else:
+            self.error(ERROR_PACKAGE_ALREADY_INSTALLED,"Package was not found")
+
 
     def get_description(self, package_id):
         return ''
@@ -264,10 +277,7 @@ class PackageKitConaryBackend(PackageKit
         '''
         # Split up the id
         (name,version,arch,fullVersion) = self.get_package_from_id(id)
-        cache = Cache()
-        troveTuple = cache.search(name,fullVersion)
-        troveTuple = [item.encode('UTF-8') for item in troveTuple[0]]
-
+        troveTuple = tuple([name, versions.VersionFromString(fullVersion), None])
         installed = self.check_installed(troveTuple)
         return name,installed
 
@@ -338,17 +348,14 @@ class Cache(object):
                 component = ""
 
             installed = 0
-            localVersion = ""
-            flavor = troveTuple[2]
-            frozenFlavor = troveTuple[2].freeze()
-            version = str(troveTuple[1].trailingRevision())
-            frozenVersion = troveTuple[1].freeze()
+            flavor = troveTuple[2].freeze()
+            fullVersion = troveTuple[1].freeze()
             label = str(troveTuple[1].branch().label())
             description = ""
             category = ""
             packagegroup = ""
             size = ""
-            packages.append([trove, component, frozenVersion, label, frozenFlavor, description, category, packagegroup, size])
+            packages.append([trove, component, fullVersion, label, flavor, description, category, packagegroup, size])
 
         return packages
 
diff --git a/helpers/conary/remove.py b/helpers/conary/remove.py
index 339fca9..e935597 100755
--- a/helpers/conary/remove.py
+++ b/helpers/conary/remove.py
@@ -10,5 +10,9 @@
 # (at your option) any later version.
 
 import sys
+from conaryBackend import PackageKitConaryBackend
 
+package = sys.argv[1]
+backend = PackageKitConaryBackend(sys.argv[1:])
+backend.remove(package)
 sys.exit(0)
diff-tree a36b18a532643df80cb3ecc07f86321d115eb072 (from 9747b54cd549e6b7c0d495f37ddf5d2fceab1a3f)
Author: Tim Lauridsen <tla at rasmil.dk>
Date:   Mon Sep 3 15:45:51 2007 +0200

    Minor cleanup in yumBackend

diff --git a/helpers/yum/yumBackend.py b/helpers/yum/yumBackend.py
index 1750706..b1e5b98 100644
--- a/helpers/yum/yumBackend.py
+++ b/helpers/yum/yumBackend.py
@@ -201,6 +201,8 @@ class PackageKitYumBackend(PackageKitBas
         '''
         Print a list of requires for a given package
         '''
+        self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+        
 
     def get_depends(self,package):
         '''
@@ -228,7 +230,6 @@ class PackageKitYumBackend(PackageKitBas
     def update_system(self):
         '''
         Implement the {backend}-update-system functionality
-        Needed to be implemented in a sub class
         '''
         self._setup_yum()
         self.percentage(0)
@@ -241,7 +242,6 @@ class PackageKitYumBackend(PackageKitBas
     def refresh_cache(self):
         '''
         Implement the {backend}-refresh_cache functionality
-        Needed to be implemented in a sub class
         '''
         self._setup_yum()
         pct = 0



More information about the PackageKit mailing list