[packagekit] yum: detecting file conflicts and using a custom error
Richard Hughes
hughsient at gmail.com
Tue Apr 15 08:39:52 PDT 2008
On Tue, 2008-04-15 at 14:14 +0100, Richard Hughes wrote:
> Now, if yum can't give us sane error types, we can screenscrape, as
> yum is always run in the C locale by packagekit. If nobody has any
> complaints, I'm going to add heuristic code to the yum backend to send
> proper errors.
Adding these few lines of code:
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index dfd44c7..0c5a55e 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -1005,8 +1005,11 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'GPG')
self.error(ERROR_GPG_FAILURE,"GPG key not imported.")
except yum.Errors.YumBaseError, ye:
- retmsg = "Error in Transaction Processing;" + self._format_msgs(ye.value)
- self.error(ERROR_TRANSACTION_ERROR,retmsg)
+ message = self._format_msgs(ye.value)
+ if message.find ("conflicts with file") != -1:
+ self.error(ERROR_FILE_CONFLICTS,message)
+ else:
+ self.error(ERROR_TRANSACTION_ERROR,message)
def remove(self, allowdep, package):
'''
Means we get the attached dialog, which, I'm sure you'll agree is much
better than "Transaction Error". I've merged the patch to git master.
Richard.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pk-error-fix.png
Type: image/png
Size: 23468 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/packagekit/attachments/20080415/1f3ace52/attachment-0001.png
More information about the PackageKit
mailing list