* 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:
+27
-13
@@ -1,8 +1,16 @@
|
|||||||
Index: pisi/comariface.py
|
Index: pisi/comariface.py
|
||||||
===================================================================
|
===================================================================
|
||||||
--- pisi/comariface.py (revision 17117)
|
--- pisi/comariface.py (revision 17125)
|
||||||
+++ pisi/comariface.py (working copy)
|
+++ 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
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -16,11 +24,7 @@ Index: pisi/comariface.py
|
|||||||
- """Connect to the comar daemon and return the handle"""
|
- """Connect to the comar daemon and return the handle"""
|
||||||
+def is_char_valid(char):
|
+def is_char_valid(char):
|
||||||
+ """Test if char is valid object path character."""
|
+ """Test if char is valid object path character."""
|
||||||
+ char = ord(char)
|
+ return char in string.ascii_letters + string.digits + "_"
|
||||||
+ return (char in xrange(65, 91) or
|
|
||||||
+ char in xrange(97, 123) or
|
|
||||||
+ char in xrange(48, 58) or
|
|
||||||
+ char == '_')
|
|
||||||
+
|
+
|
||||||
+def make_object_path(package):
|
+def make_object_path(package):
|
||||||
+ """Generates DBus object name from package name."""
|
+ """Generates DBus object name from package name."""
|
||||||
@@ -66,7 +70,7 @@ Index: pisi/comariface.py
|
|||||||
- return com
|
- return com
|
||||||
- except comar.CannotConnect:
|
- except comar.CannotConnect:
|
||||||
+ bus = dbus.bus.BusConnection(address_or_type=sockname)
|
+ 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)
|
+ iface = dbus.Interface(obj, dbus_interface=obj_interface)
|
||||||
+ return iface
|
+ return iface
|
||||||
+ except dbus.DBusException:
|
+ except dbus.DBusException:
|
||||||
@@ -127,6 +131,10 @@ Index: pisi/comariface.py
|
|||||||
+ object_name = make_object_path(package_name)
|
+ object_name = make_object_path(package_name)
|
||||||
|
|
||||||
for script in provided_scripts:
|
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)
|
ctx.ui.debug(_("Registering %s comar script") % script.om)
|
||||||
if script.om == "System.Package":
|
if script.om == "System.Package":
|
||||||
self_post = True
|
self_post = True
|
||||||
@@ -180,9 +188,15 @@ Index: pisi/comariface.py
|
|||||||
+ # Do nothing if postInstall method is not defined in package script
|
+ # Do nothing if postInstall method is not defined in package script
|
||||||
+ if not (exception._dbus_error_name.startswith("tr.org.pardus.comar") and
|
+ if not (exception._dbus_error_name.startswith("tr.org.pardus.comar") and
|
||||||
+ exception._dbus_error_name.split('tr.org.pardus.comar.')[1] == 'python.missing'):
|
+ 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')
|
+ pisi.api.set_comar_destination('tr.org.pardus.comar.new')
|
||||||
|
|
||||||
def pre_remove(package_name, metapath, filepath):
|
def pre_remove(package_name, metapath, filepath):
|
||||||
@@ -229,7 +243,7 @@ Index: pisi/comariface.py
|
|||||||
+ raise Error, _("Script error: %s") % exception
|
+ raise Error, _("Script error: %s") % exception
|
||||||
Index: pisi/api.py
|
Index: pisi/api.py
|
||||||
===================================================================
|
===================================================================
|
||||||
--- pisi/api.py (revision 17117)
|
--- pisi/api.py (revision 17125)
|
||||||
+++ pisi/api.py (working copy)
|
+++ pisi/api.py (working copy)
|
||||||
@@ -71,13 +71,20 @@
|
@@ -71,13 +71,20 @@
|
||||||
"""
|
"""
|
||||||
@@ -258,7 +272,7 @@ Index: pisi/api.py
|
|||||||
"""
|
"""
|
||||||
Index: pisi/atomicoperations.py
|
Index: pisi/atomicoperations.py
|
||||||
===================================================================
|
===================================================================
|
||||||
--- pisi/atomicoperations.py (revision 17117)
|
--- pisi/atomicoperations.py (revision 17125)
|
||||||
+++ pisi/atomicoperations.py (working copy)
|
+++ pisi/atomicoperations.py (working copy)
|
||||||
@@ -152,7 +152,7 @@
|
@@ -152,7 +152,7 @@
|
||||||
# check comar
|
# check comar
|
||||||
@@ -271,7 +285,7 @@ Index: pisi/atomicoperations.py
|
|||||||
# check dependencies
|
# check dependencies
|
||||||
Index: pisi/context.py
|
Index: pisi/context.py
|
||||||
===================================================================
|
===================================================================
|
||||||
--- pisi/context.py (revision 17117)
|
--- pisi/context.py (revision 17125)
|
||||||
+++ pisi/context.py (working copy)
|
+++ pisi/context.py (working copy)
|
||||||
@@ -38,7 +38,8 @@
|
@@ -38,7 +38,8 @@
|
||||||
stderr = None
|
stderr = None
|
||||||
|
|||||||
Reference in New Issue
Block a user