* COMAR raises python.missing exception if method is not defined in
script. PiSi will pass silently if python.missing is catched. * set_comar_sockname() replaced with set_dbus_sockname(), since a dbus socket address is required instead of comar socket.
This commit is contained in:
+68
-18
@@ -1,8 +1,8 @@
|
|||||||
Index: comariface.py
|
Index: pisi/comariface.py
|
||||||
===================================================================
|
===================================================================
|
||||||
--- comariface.py (revision 16699)
|
--- pisi/comariface.py (revision 16759)
|
||||||
+++ comariface.py (working copy)
|
+++ pisi/comariface.py (working copy)
|
||||||
@@ -25,117 +25,126 @@
|
@@ -25,117 +25,137 @@
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -33,14 +33,17 @@ Index: comariface.py
|
|||||||
+def get_iface(package="", model=""):
|
+def get_iface(package="", model=""):
|
||||||
+ """Connect to the DBus daemon and return the system interface."""
|
+ """Connect to the DBus daemon and return the system interface."""
|
||||||
|
|
||||||
+ """
|
- sockname = "/var/run/comar.socket"
|
||||||
sockname = "/var/run/comar.socket"
|
+ sockname = "unix:path=/var/run/dbus/system_bus_socket"
|
||||||
# YALI starts comar chrooted in the install target, but uses PiSi outside of
|
# YALI starts comar chrooted in the install target, but uses PiSi outside of
|
||||||
# the chroot environment, so PiSi needs to use a different socket path to be
|
# the chroot environment, so PiSi needs to use a different socket path to be
|
||||||
# able to connect true comar (usually /mnt/target/var/run/comar.socket).
|
- # able to connect true comar (usually /mnt/target/var/run/comar.socket).
|
||||||
if ctx.comar_sockname:
|
- if ctx.comar_sockname:
|
||||||
sockname = ctx.comar_sockname
|
- sockname = ctx.comar_sockname
|
||||||
+ """
|
+ # able to connect true dbus (and comar).
|
||||||
|
+ # (usually unix:path=/var/run/dbus/system_bus_socket)
|
||||||
|
+ if ctx.dbus_sockname:
|
||||||
|
+ sockname = ctx.dbus_sockname
|
||||||
|
|
||||||
+ if package:
|
+ if package:
|
||||||
+ obj_path = "/package/%s" % package
|
+ obj_path = "/package/%s" % package
|
||||||
@@ -60,7 +63,7 @@ Index: comariface.py
|
|||||||
- com = comar.Link(sockname)
|
- com = comar.Link(sockname)
|
||||||
- return com
|
- return com
|
||||||
- except comar.CannotConnect:
|
- except comar.CannotConnect:
|
||||||
+ bus = dbus.SystemBus()
|
+ bus = dbus.bus.BusConnection(address_or_type=sockname)
|
||||||
+ obj = bus.get_object("tr.org.pardus.comar", obj_path)
|
+ obj = bus.get_object("tr.org.pardus.comar", obj_path)
|
||||||
+ iface = dbus.Interface(obj, dbus_interface=obj_interface)
|
+ iface = dbus.Interface(obj, dbus_interface=obj_interface)
|
||||||
+ return iface
|
+ return iface
|
||||||
@@ -139,7 +142,10 @@ Index: comariface.py
|
|||||||
+ try:
|
+ try:
|
||||||
+ iface.setupPackage(metapath, filepath, timeout=300)
|
+ iface.setupPackage(metapath, filepath, timeout=300)
|
||||||
+ except dbus.DBusException, exception:
|
+ except dbus.DBusException, exception:
|
||||||
+ raise Error, _("Script error: %s") % exception
|
+ # Do nothing if setupPackage 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
|
||||||
|
|
||||||
if self_post:
|
if self_post:
|
||||||
- args = {
|
- args = {
|
||||||
@@ -160,7 +166,10 @@ Index: comariface.py
|
|||||||
+ iface = get_iface(object_name, "System.Package")
|
+ iface = get_iface(object_name, "System.Package")
|
||||||
+ iface.postInstall(fromVersion, fromRelease, toVersion, toRelease, timeout=300)
|
+ iface.postInstall(fromVersion, fromRelease, toVersion, toRelease, timeout=300)
|
||||||
+ except dbus.DBusException, exception:
|
+ except dbus.DBusException, exception:
|
||||||
+ raise Error, _("Script error: %s") % exception
|
+ # 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
|
||||||
|
|
||||||
def pre_remove(package_name, metapath, filepath):
|
def pre_remove(package_name, metapath, filepath):
|
||||||
"""Do package's pre removal operations"""
|
"""Do package's pre removal operations"""
|
||||||
@@ -179,7 +188,10 @@ Index: comariface.py
|
|||||||
+ try:
|
+ try:
|
||||||
+ iface.preRemove(timeout=300)
|
+ iface.preRemove(timeout=300)
|
||||||
+ except dbus.DBusException, exception:
|
+ except dbus.DBusException, exception:
|
||||||
+ raise Error, _("Script error: %s") % exception
|
+ # Do nothing if preRemove 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
|
||||||
|
|
||||||
ctx.ui.debug(_("Calling pre remove handlers"))
|
ctx.ui.debug(_("Calling pre remove handlers"))
|
||||||
- com.call("System.PackageHandler.cleanupPackage", [ "metapath", metapath, "filepath", filepath ])
|
- com.call("System.PackageHandler.cleanupPackage", [ "metapath", metapath, "filepath", filepath ])
|
||||||
@@ -189,7 +201,10 @@ Index: comariface.py
|
|||||||
+ try:
|
+ try:
|
||||||
+ iface.cleanupPackage(metapath, filepath, timeout=300)
|
+ iface.cleanupPackage(metapath, filepath, timeout=300)
|
||||||
+ except dbus.DBusException, exception:
|
+ except dbus.DBusException, exception:
|
||||||
+ raise Error, _("Script error: %s") % exception
|
+ # Do nothing if cleanupPackage 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
|
||||||
|
|
||||||
ctx.ui.debug(_("Unregistering comar scripts"))
|
ctx.ui.debug(_("Unregistering comar scripts"))
|
||||||
- com.remove(package_name)
|
- com.remove(package_name)
|
||||||
@@ -198,10 +213,32 @@ Index: comariface.py
|
|||||||
+ sys_iface.remove(object_name)
|
+ sys_iface.remove(object_name)
|
||||||
+ except dbus.DBusException, exception:
|
+ except dbus.DBusException, exception:
|
||||||
+ raise Error, _("Script error: %s") % exception
|
+ raise Error, _("Script error: %s") % exception
|
||||||
Index: atomicoperations.py
|
Index: pisi/api.py
|
||||||
===================================================================
|
===================================================================
|
||||||
--- atomicoperations.py (revision 16699)
|
--- pisi/api.py (revision 16759)
|
||||||
+++ atomicoperations.py (working copy)
|
+++ pisi/api.py (working copy)
|
||||||
|
@@ -70,13 +70,13 @@
|
||||||
|
"""
|
||||||
|
ctx.comar = enable
|
||||||
|
|
||||||
|
-def set_comar_sockname(sockname):
|
||||||
|
+def set_dbus_sockname(sockname):
|
||||||
|
"""
|
||||||
|
- Set comar socket file
|
||||||
|
+ Set dbus socket file
|
||||||
|
Used by YALI
|
||||||
|
- @param sockname: Path to comar socket file
|
||||||
|
+ @param sockname: Path to dbus socket file
|
||||||
|
"""
|
||||||
|
- ctx.comar_sockname = sockname
|
||||||
|
+ ctx.dbus_sockname = sockname
|
||||||
|
|
||||||
|
def set_options(options):
|
||||||
|
"""
|
||||||
|
Index: pisi/atomicoperations.py
|
||||||
|
===================================================================
|
||||||
|
--- pisi/atomicoperations.py (revision 16759)
|
||||||
|
+++ pisi/atomicoperations.py (working copy)
|
||||||
@@ -146,7 +146,7 @@
|
@@ -146,7 +146,7 @@
|
||||||
# check comar
|
# check comar
|
||||||
if self.metadata.package.providesComar and ctx.comar:
|
if self.metadata.package.providesComar and ctx.comar:
|
||||||
@@ -211,3 +248,16 @@ Index: atomicoperations.py
|
|||||||
|
|
||||||
def check_relations(self):
|
def check_relations(self):
|
||||||
# check dependencies
|
# check dependencies
|
||||||
|
Index: pisi/context.py
|
||||||
|
===================================================================
|
||||||
|
--- pisi/context.py (revision 16759)
|
||||||
|
+++ pisi/context.py (working copy)
|
||||||
|
@@ -38,7 +38,7 @@
|
||||||
|
stderr = None
|
||||||
|
|
||||||
|
comar = True
|
||||||
|
-comar_sockname = None
|
||||||
|
+dbus_sockname = None
|
||||||
|
|
||||||
|
# Bug #2879
|
||||||
|
# FIXME: Maybe we can create a simple rollback mechanism. There are other
|
||||||
|
|||||||
Reference in New Issue
Block a user