* Register only System.Package, System.Service and System.PackageHandler scripts only.

Other models in 2007 repo are not compatible with COMAR 2.0. You need to register 
  them manually from uludag/branches/comar-dbus/tests/

* Also try calling postInstall without version/release arguments.
This commit is contained in:
Bahadır Kandemir
2008-02-13 16:16:14 +00:00
parent cf69af7085
commit c8cb6bd3d6
+27 -13
View File
@@ -1,8 +1,16 @@
Index: pisi/comariface.py
===================================================================
--- pisi/comariface.py (revision 17117)
--- pisi/comariface.py (revision 17125)
+++ pisi/comariface.py (working copy)
@@ -25,117 +25,151 @@
@@ -13,6 +13,7 @@
import os
import time
import select
+import string
import gettext
__trans = gettext.translation('pisi', fallback=True)
@@ -25,117 +26,157 @@
pass
try:
@@ -16,11 +24,7 @@ Index: pisi/comariface.py
- """Connect to the comar daemon and return the handle"""
+def is_char_valid(char):
+ """Test if char is valid object path character."""
+ char = ord(char)
+ return (char in xrange(65, 91) or
+ char in xrange(97, 123) or
+ char in xrange(48, 58) or
+ char == '_')
+ return char in string.ascii_letters + string.digits + "_"
+
+def make_object_path(package):
+ """Generates DBus object name from package name."""
@@ -66,7 +70,7 @@ Index: pisi/comariface.py
- return com
- except comar.CannotConnect:
+ bus = dbus.bus.BusConnection(address_or_type=sockname)
+ obj = bus.get_object(ctx.comar_destination, obj_path)
+ obj = bus.get_object(ctx.comar_destination, obj_path, introspect=False)
+ iface = dbus.Interface(obj, dbus_interface=obj_interface)
+ return iface
+ except dbus.DBusException:
@@ -127,6 +131,10 @@ Index: pisi/comariface.py
+ object_name = make_object_path(package_name)
for script in provided_scripts:
+ # Other object models in stable repo. are not compatible with COMAR 2.0
+ # TODO: Remove after 2007
+ if script.om not in ["System.Service", "System.Package", "System.PackageHandler"]:
+ continue
ctx.ui.debug(_("Registering %s comar script") % script.om)
if script.om == "System.Package":
self_post = True
@@ -180,9 +188,15 @@ Index: pisi/comariface.py
+ # Do nothing if postInstall method is not defined in package script
+ if not (exception._dbus_error_name.startswith("tr.org.pardus.comar") and
+ exception._dbus_error_name.split('tr.org.pardus.comar.')[1] == 'python.missing'):
+ raise Error, _("Script error: %s") % exception
+ # Try again, this time without arguments.
+ # TODO: Remove after 2007
+ try:
+ iface = get_iface(object_name, "System.Package")
+ iface.postInstall(timeout=300)
+ except dbus.DBusException, exception:
+ raise Error, _("Script error: %s") % exception
+
+ if package_name == 'comar':
+ if package_name == 'kdemultimedia':
+ pisi.api.set_comar_destination('tr.org.pardus.comar.new')
def pre_remove(package_name, metapath, filepath):
@@ -229,7 +243,7 @@ Index: pisi/comariface.py
+ raise Error, _("Script error: %s") % exception
Index: pisi/api.py
===================================================================
--- pisi/api.py (revision 17117)
--- pisi/api.py (revision 17125)
+++ pisi/api.py (working copy)
@@ -71,13 +71,20 @@
"""
@@ -258,7 +272,7 @@ Index: pisi/api.py
"""
Index: pisi/atomicoperations.py
===================================================================
--- pisi/atomicoperations.py (revision 17117)
--- pisi/atomicoperations.py (revision 17125)
+++ pisi/atomicoperations.py (working copy)
@@ -152,7 +152,7 @@
# check comar
@@ -271,7 +285,7 @@ Index: pisi/atomicoperations.py
# check dependencies
Index: pisi/context.py
===================================================================
--- pisi/context.py (revision 17117)
--- pisi/context.py (revision 17125)
+++ pisi/context.py (working copy)
@@ -38,7 +38,8 @@
stderr = None