From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Ri6fr-0001p5-Mb for garchives@archives.gentoo.org; Tue, 03 Jan 2012 15:53:15 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DEA5E21C17D; Tue, 3 Jan 2012 15:52:33 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 99FB721C171 for ; Tue, 3 Jan 2012 15:52:33 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 171181B401A for ; Tue, 3 Jan 2012 15:52:33 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 5DE7180057 for ; Tue, 3 Jan 2012 15:52:32 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <7e5c58594f88551c0727647faa7ea85fed6bf205.mgorny@gentoo> Subject: [gentoo-commits] proj/pms-test-suite:master commit in: /, pmstestsuite/ X-VCS-Repository: proj/pms-test-suite X-VCS-Files: bus.conf pmstestsuite/dbus_handler.py X-VCS-Directories: / pmstestsuite/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 7e5c58594f88551c0727647faa7ea85fed6bf205 Date: Tue, 3 Jan 2012 15:52:32 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: ac1b6232-8a3a-47e1-b36e-6ed5bf98a9fa X-Archives-Hash: 80fe1868620eea880f9d678884687afc commit: 7e5c58594f88551c0727647faa7ea85fed6bf205 Author: Micha=C5=82 G=C3=B3rny gentoo org> AuthorDate: Tue Jan 3 11:31:54 2012 +0000 Commit: Micha=C5=82 G=C3=B3rny gentoo org> CommitDate: Tue Jan 3 11:31:54 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/pms-test-suit= e.git;a=3Dcommit;h=3D7e5c5859 Generate D-Bus configuration file in runtime. --- bus.conf | 18 ------------------ pmstestsuite/dbus_handler.py | 28 ++++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/bus.conf b/bus.conf deleted file mode 100644 index a078c1c..0000000 --- a/bus.conf +++ /dev/null @@ -1,18 +0,0 @@ - - - - - session - unix:tmpdir=3D/tmp - - portage - - - - - - - - - diff --git a/pmstestsuite/dbus_handler.py b/pmstestsuite/dbus_handler.py index 9a8c529..456e63d 100644 --- a/pmstestsuite/dbus_handler.py +++ b/pmstestsuite/dbus_handler.py @@ -2,27 +2,51 @@ # (c) 2011-2012 Micha=C5=82 G=C3=B3rny # Released under the terms of the 2-clause BSD license. =20 -import dbus, os, signal +import dbus, os, signal, tempfile from dbus.mainloop.glib import DBusGMainLoop =20 dbus_interface_name =3D 'org.gentoo.pmstestsuite' dbus_bus_name =3D dbus_interface_name dbus_object_prefix =3D '/org/gentoo/pmstestsuite' =20 +dbus_config =3D """ + + + + session + unix:tmpdir=3D/tmp + + %s + + + + + + + + +""" + class DBusHandler(object): """ A class handling all D-Bus interaction for PMS Test Suite. """ =20 def start_dbus(self, uid): + tmpf =3D tempfile.NamedTemporaryFile('w') + tmpf.write(dbus_config % uid) + tmpf.flush() + (read_fd, write_fd) =3D os.pipe() self.dbus_pid =3D os.fork() if self.dbus_pid =3D=3D 0: os.close(read_fd) os.execlp('dbus-daemon', 'dbus-daemon', '--nofork', - '--config-file=3Dbus.conf', # XXX: path + '--config-file=3D%s' % tmpf.name, '--print-address=3D%d' % write_fd) else: addr =3D os.read(read_fd, 1024) os.close(write_fd) + tmpf.close() =20 self.bus_address =3D addr.strip() =20