From 0221874f0ba925700d9a782e4c78d5827a3fe20f Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Tue, 2 Dec 2008 03:38:10 +0000 Subject: Allow user access without policykit (Portage version: 2.1.4.5) --- app-emulation/virt-manager/ChangeLog | 9 ++- .../virt-manager-0.6.0-read-only-fallback.patch | 77 ++++++++++++++++++++++ .../virt-manager/virt-manager-0.6.0-r1.ebuild | 54 +++++++++++++++ .../virt-manager/virt-manager-0.6.0.ebuild | 48 -------------- 4 files changed, 139 insertions(+), 49 deletions(-) create mode 100644 app-emulation/virt-manager/files/virt-manager-0.6.0-read-only-fallback.patch create mode 100644 app-emulation/virt-manager/virt-manager-0.6.0-r1.ebuild delete mode 100644 app-emulation/virt-manager/virt-manager-0.6.0.ebuild (limited to 'app-emulation/virt-manager') diff --git a/app-emulation/virt-manager/ChangeLog b/app-emulation/virt-manager/ChangeLog index 33085a7d09fd..5389d8ca8c99 100644 --- a/app-emulation/virt-manager/ChangeLog +++ b/app-emulation/virt-manager/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for app-emulation/virt-manager # Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/app-emulation/virt-manager/ChangeLog,v 1.9 2008/11/25 05:06:50 marineam Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-emulation/virt-manager/ChangeLog,v 1.10 2008/12/02 03:38:10 marineam Exp $ + +*virt-manager-0.6.0-r1 (02 Dec 2008) + + 02 Dec 2008; Michael Marineau + +files/virt-manager-0.6.0-read-only-fallback.patch, + -virt-manager-0.6.0.ebuild, +virt-manager-0.6.0-r1.ebuild: + Add patch to allow user access without policykit. 25 Nov 2008; Michael Marineau virt-manager-0.6.0.ebuild: diff --git a/app-emulation/virt-manager/files/virt-manager-0.6.0-read-only-fallback.patch b/app-emulation/virt-manager/files/virt-manager-0.6.0-read-only-fallback.patch new file mode 100644 index 000000000000..f270810dd27a --- /dev/null +++ b/app-emulation/virt-manager/files/virt-manager-0.6.0-read-only-fallback.patch @@ -0,0 +1,77 @@ +--- virt-manager-0.6.0/src/virtManager/connection.py.orig 2008-09-10 15:37:12.000000000 -0400 ++++ virt-manager-0.6.0/src/virtManager/connection.py 2008-12-01 22:33:34.000000000 -0500 +@@ -38,11 +38,6 @@ + from virtManager.netdev import vmmNetDevice + from virtManager.storagepool import vmmStoragePool + +-LIBVIRT_POLICY_FILES = [ +- "/usr/share/PolicyKit/policy/libvirtd.policy", +- "/usr/share/PolicyKit/policy/org.libvirt.unix.policy" +-] +- + def get_local_hostname(): + try: + (host, aliases, ipaddrs) = gethostbyaddr(gethostname()) +@@ -139,15 +134,6 @@ + self.uri = "xen:///" + + self.readOnly = readOnly +- if not self.is_remote() and os.getuid() != 0 and self.uri != "qemu:///session": +- hasPolkit = False +- for f in LIBVIRT_POLICY_FILES: +- if os.path.exists(f): +- hasPolkit = True +- +- if not hasPolkit: +- self.readOnly = True +- + self.state = self.STATE_DISCONNECTED + self.vmm = None + self.storage_capable = None +@@ -464,8 +450,7 @@ + logging.error(self.connectError) + return -1 + +- def _open_thread(self): +- logging.debug("Background thread is running") ++ def _try_open(self): + try: + flags = 0 + if self.readOnly: +@@ -478,12 +463,34 @@ + libvirt.VIR_CRED_EXTERNAL], + self._do_creds, + None], flags) ++ except: ++ exc_info = sys.exc_info() ++ ++ # If the previous attempt was read/write try to fall back ++ # on read-only connection, otherwise report the error. ++ if not self.readOnly: ++ try: ++ self.vmm = libvirt.openReadOnly(self.uri) ++ self.readOnly = True ++ logging.info("Read/write connection failed to %s," ++ "falling back on read-only." % self.uri) ++ return ++ except: ++ pass ++ ++ return exc_info + ++ def _open_thread(self): ++ logging.debug("Background thread is running") ++ ++ open_error = self._try_open() ++ ++ if not open_error: + self.state = self.STATE_ACTIVE +- except: ++ else: + self.state = self.STATE_DISCONNECTED + +- (type, value, stacktrace) = sys.exc_info () ++ (type, value, stacktrace) = open_error + # Detailed error message, in English so it can be Googled. + self.connectError = \ + ("Unable to open connection to hypervisor URI '%s':\n" % diff --git a/app-emulation/virt-manager/virt-manager-0.6.0-r1.ebuild b/app-emulation/virt-manager/virt-manager-0.6.0-r1.ebuild new file mode 100644 index 000000000000..a4b22a8a39f3 --- /dev/null +++ b/app-emulation/virt-manager/virt-manager-0.6.0-r1.ebuild @@ -0,0 +1,54 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-emulation/virt-manager/virt-manager-0.6.0-r1.ebuild,v 1.1 2008/12/02 03:38:10 marineam Exp $ + +# Stop gnome2.eclass from doing stuff on USE=debug +GCONF_DEBUG="no" + +inherit eutils gnome2 + +DESCRIPTION="A graphical tool for administering virtual machines such as Xen" +HOMEPAGE="http://virt-manager.org/" +SRC_URI="http://virt-manager.org/download/sources/${PN}/${P}.tar.gz" +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="gnome-keyring" +RDEPEND=">=dev-python/pygtk-1.99.12 + >=app-emulation/libvirt-0.4.5 + >=dev-libs/libxml2-2.6.23 + >=app-emulation/virtinst-0.400.0 + >=gnome-base/librsvg-2 + >=x11-libs/vte-0.12.2 + >=net-libs/gtk-vnc-0.3.4 + dev-python/dbus-python + dev-python/gconf-python + dev-python/libgnome-python + gnome-keyring? ( dev-python/gnome-keyring-python )" +DEPEND="${RDEPEND}" + +pkg_setup() { + if ! built_with_use dev-libs/libxml2 python; then + local msg="You must install libxml2 with USE=python." + eerror "$msg" + die "$msg" + fi + + if ! built_with_use x11-libs/vte python; then + local msg="You must install vte with USE=python." + eerror "$msg" + die "$msg" + fi + + if ! built_with_use net-libs/gtk-vnc python; then + local msg="You must install gtk-vnc with USE=python." + eerror "$msg" + die "$msg" + fi +} + +src_unpack() { + unpack ${A} + cd "${S}" + epatch "${FILESDIR}/${P}-read-only-fallback.patch" +} diff --git a/app-emulation/virt-manager/virt-manager-0.6.0.ebuild b/app-emulation/virt-manager/virt-manager-0.6.0.ebuild deleted file mode 100644 index 31fc812c388e..000000000000 --- a/app-emulation/virt-manager/virt-manager-0.6.0.ebuild +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright 1999-2008 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/app-emulation/virt-manager/virt-manager-0.6.0.ebuild,v 1.2 2008/11/25 05:06:50 marineam Exp $ - -# Stop gnome2.eclass from doing stuff on USE=debug -GCONF_DEBUG="no" - -inherit eutils gnome2 - -DESCRIPTION="A graphical tool for administering virtual machines such as Xen" -HOMEPAGE="http://virt-manager.org/" -SRC_URI="http://virt-manager.org/download/sources/${PN}/${P}.tar.gz" -LICENSE="GPL-2" -SLOT="0" -KEYWORDS="~amd64 ~x86" -IUSE="gnome-keyring" -RDEPEND=">=dev-python/pygtk-1.99.12 - >=app-emulation/libvirt-0.4.5 - >=dev-libs/libxml2-2.6.23 - >=app-emulation/virtinst-0.400.0 - >=gnome-base/librsvg-2 - >=x11-libs/vte-0.12.2 - >=net-libs/gtk-vnc-0.3.4 - dev-python/dbus-python - dev-python/gconf-python - dev-python/libgnome-python - gnome-keyring? ( dev-python/gnome-keyring-python )" -DEPEND="${RDEPEND}" - -pkg_setup() { - if ! built_with_use dev-libs/libxml2 python; then - local msg="You must install libxml2 with USE=python." - eerror "$msg" - die "$msg" - fi - - if ! built_with_use x11-libs/vte python; then - local msg="You must install vte with USE=python." - eerror "$msg" - die "$msg" - fi - - if ! built_with_use net-libs/gtk-vnc python; then - local msg="You must install gtk-vnc with USE=python." - eerror "$msg" - die "$msg" - fi -} -- cgit v1.2.3-65-gdbad