From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pms-test-suite:master commit in: /, pmstestsuite/
Date: Tue, 3 Jan 2012 15:52:32 +0000 (UTC) [thread overview]
Message-ID: <7e5c58594f88551c0727647faa7ea85fed6bf205.mgorny@gentoo> (raw)
commit: 7e5c58594f88551c0727647faa7ea85fed6bf205
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 3 11:31:54 2012 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jan 3 11:31:54 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=7e5c5859
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 @@
-<?xml version="1.0"?>
-<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-
-<busconfig>
- <type>session</type>
- <listen>unix:tmpdir=/tmp</listen>
-
- <user>portage</user> <!-- XXX -->
-
- <policy context="default">
- <allow user="root"/>
-
- <allow send_destination="*" eavesdrop="true"/>
- <allow eavesdrop="true"/>
- <allow own="*"/>
- </policy>
-</busconfig>
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ł Górny <mgorny@gentoo.org>
# Released under the terms of the 2-clause BSD license.
-import dbus, os, signal
+import dbus, os, signal, tempfile
from dbus.mainloop.glib import DBusGMainLoop
dbus_interface_name = 'org.gentoo.pmstestsuite'
dbus_bus_name = dbus_interface_name
dbus_object_prefix = '/org/gentoo/pmstestsuite'
+dbus_config = """<?xml version="1.0"?>
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+
+<busconfig>
+ <type>session</type>
+ <listen>unix:tmpdir=/tmp</listen>
+
+ <user>%s</user>
+
+ <policy context="default">
+ <allow user="root"/>
+
+ <allow send_destination="*" eavesdrop="true"/>
+ <allow eavesdrop="true"/>
+ <allow own="*"/>
+ </policy>
+</busconfig>"""
+
class DBusHandler(object):
""" A class handling all D-Bus interaction for PMS Test Suite. """
def start_dbus(self, uid):
+ tmpf = tempfile.NamedTemporaryFile('w')
+ tmpf.write(dbus_config % uid)
+ tmpf.flush()
+
(read_fd, write_fd) = os.pipe()
self.dbus_pid = os.fork()
if self.dbus_pid == 0:
os.close(read_fd)
os.execlp('dbus-daemon', 'dbus-daemon', '--nofork',
- '--config-file=bus.conf', # XXX: path
+ '--config-file=%s' % tmpf.name,
'--print-address=%d' % write_fd)
else:
addr = os.read(read_fd, 1024)
os.close(write_fd)
+ tmpf.close()
self.bus_address = addr.strip()
next reply other threads:[~2012-01-03 15:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-03 15:52 Michał Górny [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-06-27 21:24 [gentoo-commits] proj/pms-test-suite:master commit in: /, pmstestsuite/ Michał Górny
2011-06-01 12:30 [gentoo-commits] proj/pms-test-suite:master commit in: /, PMSTestSuite/ Michał Górny
2011-06-01 12:30 Michał Górny
2011-05-29 18:57 Michał Górny
2011-05-29 17:55 Michał Górny
2011-05-29 17:55 Michał Górny
2011-05-29 17:46 Michał Górny
2011-05-29 17:46 Michał Górny
2011-05-29 17:13 Michał Górny
2011-05-22 9:17 Michał Górny
2011-05-16 20:00 Michał Górny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7e5c58594f88551c0727647faa7ea85fed6bf205.mgorny@gentoo \
--to=mgorny@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox