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

Richard Hughes hughsient at kemper.freedesktop.org
Thu Sep 27 14:12:50 PDT 2007


 TODO                                     |   30 +++++++++++++++
 backends/conary/helpers/conaryBackend.py |   56 +++++++++++++++++++----------
 backends/conary/pk-backend-conary.c      |    8 ++++
 python/packagekit/frontend.py            |   59 ++++++++++++++++++-------------
 python/pk-frontend-test.py               |   27 +++++++++++++-
 5 files changed, 134 insertions(+), 46 deletions(-)

New commits:
diff-tree 601f53fa434bfa45bc1ba95f23b81d51b0aaf87a (from parents)
Merge: 42230e36162bf9fc4cbeaf3683d1713a6d626db7 84584116dd6f75d9222d93ac3dbecd816aa98173
Author: Elliot Peele <elliot at bentlogic.net>
Date:   Thu Sep 27 16:42:34 2007 -0400

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

diff-tree 42230e36162bf9fc4cbeaf3683d1713a6d626db7 (from 0272febd715a2675d1207510bb25549e5e3029c2)
Author: Elliot Peele <elliot at bentlogic.net>
Date:   Thu Sep 27 16:42:25 2007 -0400

    fix support for noarch packages

diff --git a/backends/conary/helpers/conaryBackend.py b/backends/conary/helpers/conaryBackend.py
index 0a7960a..370c088 100644
--- a/backends/conary/helpers/conaryBackend.py
+++ b/backends/conary/helpers/conaryBackend.py
@@ -23,6 +23,7 @@ class PackageKitConaryBackend(PackageKit
         PackageKitBaseBackend.__init__(self, args)
         self.cfg = conarycfg.ConaryConfiguration(True)
         self.cfg.initializeFlavors()
+        self.cfg.autoResolve = True
         self.client = conaryclient.ConaryClient(self.cfg)
         self.callback = UpdateCallback(self, self.cfg)
         self.client.setUpdateCallback(self.callback)
@@ -34,13 +35,10 @@ class PackageKitConaryBackend(PackageKit
             arches = [ 'noarch' ]
         return ','.join(arches)
 
-    def get_package_id(self, name, versionObj, flavor=None):
+    def get_package_id(self, name, versionObj, flavor):
         version = versionObj.trailingRevision()
         fullVersion = versionObj.asString()
-        if flavor is not None:
-            arch = self._get_arch(flavor)
-        else:
-            arch = ""
+        arch = self._get_arch(flavor)
         return PackageKitBaseBackend.get_package_id(self, name, version, arch,
                                                     fullVersion)
 
@@ -57,7 +55,7 @@ class PackageKitConaryBackend(PackageKit
             arches = 'is: %s' %  ' '.join(archString.split(','))
             flavor = deps.parseFlavor(arches)
         else:
-            flavor = None
+            flavor = deps.parseFlavor('')
 
         return name, version, flavor
 
@@ -155,8 +153,6 @@ class PackageKitConaryBackend(PackageKit
             self.error(ERROR_INTERNAL_ERROR, 'An internal error has occurred')
 
     def _do_update(self, applyList, apply=False):
-        self.cfg.autoResolve = True
-
         updJob = self.client.newUpdateJob()
         suggMap = self.client.prepareUpdateJob(updJob, applyList)
 
diff-tree 84584116dd6f75d9222d93ac3dbecd816aa98173 (from parents)
Merge: f911e2e8040bff812921d86295aea113e2c33f90 93188a58e728d7db48bcbee1e1b2b8001898b234
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Thu Sep 27 16:34:51 2007 -0400

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

diff-tree f911e2e8040bff812921d86295aea113e2c33f90 (from e05b6db3e389a6fa30c8e1335ee26bdeadaa0176)
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Thu Sep 27 16:16:01 2007 -0400

    Add quick GetOldTransactions handler.

diff --git a/python/packagekit/frontend.py b/python/packagekit/frontend.py
index f37558d..f38d7e8 100644
--- a/python/packagekit/frontend.py
+++ b/python/packagekit/frontend.py
@@ -126,7 +126,9 @@ class PackageKit:
 			self.ErrorCode(args[0],args[1],args[2])
 		elif kwargs['member'] == "RequireRestart":
 			self.RequireRestart(args[0],args[1],args[2])
-		elif kwargs['member'] in ["NoPercentageUpdates","TransactionListChanged","Transaction",
+		elif kwargs['member'] == "Transaction":
+			self.Transaction(args[0],args[1],args[2],args[3],args[4],args[5])
+		elif kwargs['member'] in ["NoPercentageUpdates","TransactionListChanged",
 					  "AllowInterrupt","JobListChanged"]:
 			pass
 		else:
@@ -199,6 +201,17 @@ class PackageKit:
 			   ):
 		pass
 
+	def Transaction(self,
+			jid,       # Job ID
+			old_jid,   # Old Job ID
+			timespec,  # Time (2007-09-27T15:29:22Z)
+			succeeded, # 1 or 0
+			role,      # enum, see task_role in pk-enum.c
+			duration   # in seconds
+			):
+		pass
+
+
 
 # --- PK Methods ---
 	
@@ -216,3 +229,9 @@ class PackageKit:
 	@job_id
 	def RefreshCache(self,force=False):
 		return self.pk_iface.RefreshCache(self.tid(),force)
+
+	@dbusException
+	@job_id
+	def GetOldTransactions(self,number=5):
+		return self.pk_iface.GetOldTransactions(self.tid(),number)
+
diff --git a/python/pk-frontend-test.py b/python/pk-frontend-test.py
index 9c50496..c64a350 100755
--- a/python/pk-frontend-test.py
+++ b/python/pk-frontend-test.py
@@ -34,6 +34,17 @@ class pkt(PackageKit):
 		print "  %s" % url
 		print "  %s" % detail
 
+	def Transaction(self,jid,old_jid,timespec,succeeded,role,duration):
+		success = "Failed"
+		if succeeded:
+			success = "Successful"
+
+		print "Transaction: %s\n" % old_jid,
+		print "  %s" % role
+		print "  %s" % timespec
+		print "  %s seconds" % duration
+		print "  %s" % success
+
 try:
 	p = pkt()
 except PackageKitNotStarted:
@@ -53,12 +64,24 @@ def desc(*args):
 		raise PackageKitTransactionFailure
 	return p.GetDescription(args[0][0])
 
-def update(args):
+def refresh_cache(args):
 	if len(args)>0 and len(args[0])>0:
-		print "update doesn't take args"
+		print "refresh_cache doesn't take args"
 		raise PackageKitTransactionFailure
 	return p.RefreshCache()
 
+def history(*args):
+	count = 5
+	if len(args)==1 and len(args[0])==1:
+		count = args[0][0]
+	
+	count = int(count)
+
+	if count < 1:
+		print "history takes an integer (how many transactions to show)"
+
+	return p.GetOldTransactions(count)
+
 def usage():
 	print "Usage: %s <command> <options>"%argv[0]
 	print "Valid commands are:"
diff-tree 93188a58e728d7db48bcbee1e1b2b8001898b234 (from 28d0b5ceebc1124ff3aa1cc5cf12974032c609e1)
Author: Ken VanDine <ken at vandine.org>
Date:   Thu Sep 27 15:11:59 2007 -0400

    Query repo metadata for descriptions and categories

diff --git a/backends/conary/helpers/conaryBackend.py b/backends/conary/helpers/conaryBackend.py
index 98eaa6c..110e6fb 100644
--- a/backends/conary/helpers/conaryBackend.py
+++ b/backends/conary/helpers/conaryBackend.py
@@ -268,23 +268,45 @@ class PackageKitConaryBackend(PackageKit
             self.error(ERROR_PACKAGE_ALREADY_INSTALLED,
                 'Package was not found')
 
-    def get_description(self, package_id):
+    def _get_metadata(self, id, field):
+        '''
+        Retrieve metadata from the repository and return result
+        field should be one of:
+                bibliography
+                url
+                notes
+                crypto
+                licenses
+                shortDesc
+                longDesc
+                categories
+        '''
+        n, v, f = self.get_package_from_id(id)
+
+        trvList = self.client.repos.findTrove(self.cfg.installLabelPath,
+                                     (n, v, f),
+                                     defaultFlavor = self.cfg.flavor)
+
+        troves = self.client.repos.getTroves(trvList, withFiles=False)
+        result = ''
+        for trove in troves:
+            result = trove.getMetadata()[field]
+        return result
+
+    def get_description(self, id):
         '''
         Print a detailed description for a given package
         '''
-        name, version, flavor, installed = self._findPackage(package_id)
+        name, version, flavor, installed = self._findPackage(id)
+
+        
 
         if name:
-            id = self.get_package_id(name, version, flavor)
-            desc = ""
-            desc += "%s \n" % name
-            desc += "%s \n" % version.trailingRevision()
-            desc = desc.replace('\n\n',';')
-            desc = desc.replace('\n',' ')
-            detail = ""
+            shortDesc = self._get_metadata(id, 'shortDesc') or name
+            longDesc = self._get_metadata(id, 'longDesc') or ""
             url = "http://www.foresightlinux.org/packages/" + name + ".html"
-            group = "other"
-            self.description(desc, id, group, detail, url)
+            categories = self._get_metadata(id, 'categories') or "other"
+            self.description(shortDesc, id, categories, longDesc, url)
         else:
             self.error(ERROR_INTERNAL_ERROR,'Package was not found')
 
diff-tree 28d0b5ceebc1124ff3aa1cc5cf12974032c609e1 (from e05b6db3e389a6fa30c8e1335ee26bdeadaa0176)
Author: Ken VanDine <ken at vandine.org>
Date:   Thu Sep 27 15:11:15 2007 -0400

    Added groups

diff --git a/backends/conary/pk-backend-conary.c b/backends/conary/pk-backend-conary.c
index 70c770a..bd6f4e4 100644
--- a/backends/conary/pk-backend-conary.c
+++ b/backends/conary/pk-backend-conary.c
@@ -34,7 +34,15 @@ backend_get_groups (PkBackend *backend, 
 	g_return_if_fail (backend != NULL);
 	pk_enum_list_append_multiple (elist,
 				      PK_GROUP_ENUM_ACCESSIBILITY,
+				      PK_GROUP_ENUM_ACCESSORIES,
+				      PK_GROUP_ENUM_EDUCATION,
 				      PK_GROUP_ENUM_GAMES,
+				      PK_GROUP_ENUM_GRAPHICS,
+				      PK_GROUP_ENUM_INTERNET,
+				      PK_GROUP_ENUM_OFFICE,
+				      PK_GROUP_ENUM_OTHER,
+				      PK_GROUP_ENUM_PROGRAMMING,
+				      PK_GROUP_ENUM_MULTIMEDIA,
 				      PK_GROUP_ENUM_SYSTEM,
 				      -1);
 }
diff-tree e05b6db3e389a6fa30c8e1335ee26bdeadaa0176 (from 085436b3a5181060f7450772332b6b7ac3297ae2)
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu Sep 27 19:48:53 2007 +0100

    update TODO

diff --git a/TODO b/TODO
index 6d3fb58..a0e48ba 100644
--- a/TODO
+++ b/TODO
@@ -4,6 +4,32 @@ Order of no particular importance:
 For the icon to update after we've done a system upgrade
 NOTE: RELEASE BLOCKER
 
+*** convert the magic number in Package to a string type *** 
+Define Package to be (s,s) not (i,s) where the first status is
+"installed, removed, updated, security, normal, etc"
+Need to convert to enumerated types early on, and in the client library
+NOTE: RELEASE BLOCKER
+
+*** pk-notify-icon (client) ***
+Do automatic updates at login time when system has gone idle
+ * needs gnome-screensaver integration
+NOTE: RELEASE BLOCKER
+
+*** pk-application (client) ***
+Move the buttons to the left hand side of pk-application, not a bar at the top
+Use an icons for installed and not-installed rather than tickboxes
+Refresh the query list after an install or remove (means saving the query and re-issuing)
+
+*** Prepare download to refresh system ***
+Either use a flag or a new method. I'm not sure which yet.
+
+*** cache signal responses from methods ***
+Need to cache packages in the daemon. yes the daemon.
+We need this for transaction logging of what was removed or added.
+Need to convert the gptrarray to a Gstring
+installed,moo;1.23.;i386;fedora,removed,foo;1.23.;i386;fedora and save
+to database
+
 *** Add a way to import GPG keys ***
 In fedora, if you add a signed repo you have to agree to the GPG key.
 
@@ -26,6 +52,8 @@ Need to monitor the Package's emitted by
 
 *** Handle rollbacks for select backends ***
 To do rollbacks sanely in PK we need a few things:
- * write an application that can see the description of the transactions
+ * emit internal signal for SetTransactionData
+ * write pk_transaction_id_equal to not compare data
+ * allow transaction data to be changed in _db
  * use an new method to handle the rollbacks and pass it to the backend
 
diff-tree 085436b3a5181060f7450772332b6b7ac3297ae2 (from parents)
Merge: 9990bb564c1213be74ef075164a6661cda4c24d5 bce56c6e02741171fd7c33169173cbf27ff9af4d
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Thu Sep 27 11:53:26 2007 -0400

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

diff-tree 9990bb564c1213be74ef075164a6661cda4c24d5 (from ce07ba0e5597428e155b82ed3ff2e60f6d22f211)
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Thu Sep 27 11:53:20 2007 -0400

    use self.progress instead of just progress

diff --git a/python/packagekit/frontend.py b/python/packagekit/frontend.py
index ceca90b..16a04d7 100644
--- a/python/packagekit/frontend.py
+++ b/python/packagekit/frontend.py
@@ -113,11 +113,11 @@ class PackageKit:
 			self.loop.quit()
 			self.Finished(args[0],args[1],args[2])
 		elif kwargs['member'] == "PercentageChanged":
-			progress = float(args[1])+(progress%1.0)
-			self.Percentage(args[0], progress)
+			self.progress = float(args[1])+(self.progress%1.0)
+			self.Percentage(args[0], self.progress)
 		elif kwargs['member'] == "SubPercentageChanged":
-			progress = (float(args[1])/100.0)+int(progress)
-			self.Percentage(args[0], progress)
+			self.progress = (float(args[1])/100.0)+int(self.progress)
+			self.Percentage(args[0], self.progress)
 		elif kwargs['member'] == "TransactionStatusChanged":
 			self.JobStatus(args[0], args[1])
 		elif kwargs['member'] == "Package":
diff-tree bce56c6e02741171fd7c33169173cbf27ff9af4d (from ce07ba0e5597428e155b82ed3ff2e60f6d22f211)
Author: Tom Parker <palfrey at tevp.net>
Date:   Thu Sep 27 15:50:40 2007 +0200

    dbusException fixes in PackageKit.frontend
    Move dbusException in class PackageKit, and drop the silly
    "wibble" printing for non-DBus exceptions

diff --git a/python/packagekit/frontend.py b/python/packagekit/frontend.py
index ceca90b..b8dc717 100644
--- a/python/packagekit/frontend.py
+++ b/python/packagekit/frontend.py
@@ -55,24 +55,20 @@ class PackageKitTransactionFailure(Packa
 class PackageKitBackendFailure(PackageKitException):
 	pass
 
-def dbusException(func):
-	def wrapper(*args,**kwargs):
-		try:
-			return func(*args,**kwargs)
-		except dbus.exceptions.DBusException,e:
-			if e.get_dbus_name() == "org.freedesktop.DBus.Error.AccessDenied":
-				raise PackageKitAccessDenied
-			elif e.get_dbus_name() == "org.freedesktop.DBus.Error.NoReply":
-				raise PackageKitBackendFailure
-			else:
-				raise PackageKitException(e)
-		except Exception:
-			print "wibble"
-			raise
-	return wrapper
-
-
 class PackageKit:
+	def dbusException(func):
+		def wrapper(*args,**kwargs):
+			try:
+				return func(*args,**kwargs)
+			except dbus.exceptions.DBusException,e:
+				if e.get_dbus_name() == "org.freedesktop.DBus.Error.AccessDenied":
+					raise PackageKitAccessDenied
+				elif e.get_dbus_name() == "org.freedesktop.DBus.Error.NoReply":
+					raise PackageKitBackendFailure
+				else:
+					raise PackageKitException(e)
+		return wrapper
+
 	def job_id(func):
 		def wrapper(*args,**kwargs):
 			jid = func(*args,**kwargs)
@@ -220,7 +216,3 @@ class PackageKit:
 	@job_id
 	def RefreshCache(self,force=False):
 		return self.pk_iface.RefreshCache(self.tid(),force)
-
-# hack to avoid exporting them
-del dbusException
-



More information about the PackageKit mailing list