diff --git a/rigo/RigoDaemon/app.py b/rigo/RigoDaemon/app.py index 67acc8a21..584a2b76c 100755 --- a/rigo/RigoDaemon/app.py +++ b/rigo/RigoDaemon/app.py @@ -219,6 +219,8 @@ class RigoDaemonService(dbus.service.Object): BUS_NAME = DbusConfig.BUS_NAME OBJECT_PATH = DbusConfig.OBJECT_PATH + API_VERSION = 0 + """ RigoDaemon is the dbus service Object in charge of executing privileged tasks, like repository updates, package installation @@ -676,6 +678,16 @@ class RigoDaemonService(dbus.service.Object): return self._acquired_exclusive + @dbus.service.method(BUS_NAME, in_signature='', + out_signature='i') + def api(self): + """ + Return RigoDaemon API version. + """ + write_output("api called", debug=True) + + return RigoDaemonService.API_VERSION + @dbus.service.method(BUS_NAME, in_signature='', out_signature='') def pong(self): diff --git a/rigo/RigoDaemon/dbus/org.sabayon.Rigo.xml b/rigo/RigoDaemon/dbus/org.sabayon.Rigo.xml index cd1b9596c..259206867 100644 --- a/rigo/RigoDaemon/dbus/org.sabayon.Rigo.xml +++ b/rigo/RigoDaemon/dbus/org.sabayon.Rigo.xml @@ -33,6 +33,10 @@ + + + + diff --git a/rigo/rigo_app.py b/rigo/rigo_app.py index 4f2514520..23523a958 100644 --- a/rigo/rigo_app.py +++ b/rigo/rigo_app.py @@ -179,6 +179,7 @@ class RigoServiceController(GObject.Object): _PROCESSING_APPLICATION_SIGNAL = "processing_application" _APPLICATION_PROCESSED_SIGNAL = "application_processed" _APPLICATIONS_MANAGED_SIGNAL = "applications_managed" + _SUPPORTED_APIS = [0] def __init__(self, rigo_app, activity_rwsem, auth, entropy_client, entropy_ws): @@ -328,6 +329,12 @@ class RigoServiceController(GObject.Object): """ return self._local_transactions + def supported_apis(self): + """ + Return a list of supported RigoDaemon APIs. + """ + return RigoServiceController._SUPPORTED_APIS + @property def repositories_lock(self): """ @@ -874,6 +881,14 @@ class RigoServiceController(GObject.Object): self._entropy_bus, dbus_interface=self.DBUS_INTERFACE).exclusive() + def api(self): + """ + Return RigoDaemon API version + """ + return dbus.Interface( + self._entropy_bus, + dbus_interface=self.DBUS_INTERFACE).api() + def _release_local_resources(self, clear_avc=True): """ Release all the local resources (like repositories) @@ -2465,6 +2480,18 @@ class Rigo(Gtk.Application): Gtk.main_quit() return + supported_apis = self._service.supported_apis() + daemon_api = self._service.api() + if daemon_api not in supported_apis: + self._show_ok_dialog( + None, + escape_markup(_("Rigo")), + escape_markup( + _("API mismatch, please update Rigo and RigoDaemon"))) + entropy.tools.kill_threads() + Gtk.main_quit() + return + acquired = not self._entropy.wait_resources( max_lock_count=1, shared=True)