From 8079db861b8ffdce69fa10a9ab9ef4740045187f Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Mon, 10 Dec 2012 12:25:00 +0100
Subject: [PATCH 2/2] Revert "analyze: use GDBus instead of dbus-python"

This reverts commit 4940c64240541e91411620b7dc0963e012aa6b91.

Python-gobject is too old in current OE
---
 src/analyze/systemd-analyze |   31 ++++++++++++++-----------------
 1 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/src/analyze/systemd-analyze b/src/analyze/systemd-analyze
index 87a83dd..636fd74 100755
--- a/src/analyze/systemd-analyze
+++ b/src/analyze/systemd-analyze
@@ -1,15 +1,14 @@
 #!/usr/bin/python
 
-import getopt, sys, os
-from gi.repository import Gio
+import getopt, dbus, sys, os
 try:
         import cairo
 except ImportError:
         cairo = None
 
 def acquire_time_data():
-        manager = Gio.DBusProxy.new_for_bus_sync(bus, Gio.DBusProxyFlags.NONE,
-                None, 'org.freedesktop.systemd1', '/org/freedesktop/systemd1', 'org.freedesktop.systemd1.Manager', None)
+
+        manager = dbus.Interface(bus.get_object('org.freedesktop.systemd1', '/org/freedesktop/systemd1'), 'org.freedesktop.systemd1.Manager')
         units = manager.ListUnits()
 
         l = []
@@ -18,25 +17,23 @@ def acquire_time_data():
                 if i[5] != "":
                         continue
 
-                properties = Gio.DBusProxy.new_for_bus_sync(bus, Gio.DBusProxyFlags.NONE,
-                        None, 'org.freedesktop.systemd1', i[6], 'org.freedesktop.DBus.Properties', None)
+                properties = dbus.Interface(bus.get_object('org.freedesktop.systemd1', i[6]), 'org.freedesktop.DBus.Properties')
 
-                ixt = properties.Get('(ss)', 'org.freedesktop.systemd1.Unit', 'InactiveExitTimestampMonotonic')
-                aet = properties.Get('(ss)', 'org.freedesktop.systemd1.Unit', 'ActiveEnterTimestampMonotonic')
-                axt = properties.Get('(ss)', 'org.freedesktop.systemd1.Unit', 'ActiveExitTimestampMonotonic')
-                iet = properties.Get('(ss)', 'org.freedesktop.systemd1.Unit', 'InactiveEnterTimestampMonotonic')
+                ixt = int(properties.Get('org.freedesktop.systemd1.Unit', 'InactiveExitTimestampMonotonic'))
+                aet = int(properties.Get('org.freedesktop.systemd1.Unit', 'ActiveEnterTimestampMonotonic'))
+                axt = int(properties.Get('org.freedesktop.systemd1.Unit', 'ActiveExitTimestampMonotonic'))
+                iet = int(properties.Get('org.freedesktop.systemd1.Unit', 'InactiveEnterTimestampMonotonic'))
 
                 l.append((str(i[0]), ixt, aet, axt, iet))
 
         return l
 
 def acquire_start_time():
-        properties = Gio.DBusProxy.new_for_bus_sync(bus, Gio.DBusProxyFlags.NONE,
-                None, 'org.freedesktop.systemd1', '/org/freedesktop/systemd1', 'org.freedesktop.DBus.Properties', None)
+        properties = dbus.Interface(bus.get_object('org.freedesktop.systemd1', '/org/freedesktop/systemd1'), 'org.freedesktop.DBus.Properties')
 
-        initrd_time = properties.Get('(ss)', 'org.freedesktop.systemd1.Manager', 'InitRDTimestampMonotonic')
-        userspace_time = properties.Get('(ss)', 'org.freedesktop.systemd1.Manager', 'UserspaceTimestampMonotonic')
-        finish_time = properties.Get('(ss)', 'org.freedesktop.systemd1.Manager', 'FinishTimestampMonotonic')
+        initrd_time = int(properties.Get('org.freedesktop.systemd1.Manager', 'InitRDTimestampMonotonic'))
+        userspace_time = int(properties.Get('org.freedesktop.systemd1.Manager', 'UserspaceTimestampMonotonic'))
+        finish_time = int(properties.Get('org.freedesktop.systemd1.Manager', 'FinishTimestampMonotonic'))
 
         if finish_time == 0:
                 sys.stderr.write("Bootup is not yet finished. Please try again later.\n")
@@ -284,7 +281,7 @@ def unknown_verb():
         usage()
         sys.exit(1)
 
-bus = Gio.BusType.SYSTEM
+bus = dbus.SystemBus()
 
 try:
         opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ["help", "user"])
@@ -296,7 +293,7 @@ for o, a in opts:
         if o in ("-h", "--help"):
                 help()
         elif o == '--user':
-                bus = Gio.BusType.SESSION
+                bus = dbus.SessionBus()
         else:
                 assert False, "unhandled option"
 
-- 
1.7.7.6

