commit:     cdd0c40791d9fe3ea305beb2458b6de7ca08598f
Author:     Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  8 21:06:59 2015 +0000
Commit:     Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
CommitDate: Mon Jun  8 21:06:59 2015 +0000
URL:        https://gitweb.gentoo.org/proj/gnome.git/commit/?id=cdd0c407

dev-util/dogtail: fix issue running unittest through portage

It appears that USER is not set while running unittests through portage
but LOGNAME is. Set up a more robuste chain to get current user.

 ...ail-0.9.0-r1.ebuild => dogtail-0.9.0-r2.ebuild} |  4 ++++
 .../dogtail/files/dogtail-0.9.0-get-user.patch     | 28 ++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/dev-util/dogtail/dogtail-0.9.0-r1.ebuild 
b/dev-util/dogtail/dogtail-0.9.0-r2.ebuild
similarity index 92%
rename from dev-util/dogtail/dogtail-0.9.0-r1.ebuild
rename to dev-util/dogtail/dogtail-0.9.0-r2.ebuild
index 91a19af..ee3b77c 100644
--- a/dev-util/dogtail/dogtail-0.9.0-r1.ebuild
+++ b/dev-util/dogtail/dogtail-0.9.0-r2.ebuild
@@ -35,6 +35,10 @@ src_prepare() {
        # Install docs in one place
        sed "s:doc/${PN}:doc/${PF}:" -i setup.py || die
 
+       # Fix current user detection, upstream bug #46
+       # Also, respect TMPDIR
+       epatch "${FILESDIR}"/${PN}-0.9.0-get-user.patch
+
        # Upstream loads resources relative to __file__, which doesn't work with
        # gentoo's dev-lang/python-exec. So we need to add hard-coded paths.
        epatch "${FILESDIR}"/${PN}-0.9.0-gentoo-paths.patch

diff --git a/dev-util/dogtail/files/dogtail-0.9.0-get-user.patch 
b/dev-util/dogtail/files/dogtail-0.9.0-get-user.patch
new file mode 100644
index 0000000..2a7fbb2
--- /dev/null
+++ b/dev-util/dogtail/files/dogtail-0.9.0-get-user.patch
@@ -0,0 +1,28 @@
+Do not use USER as it can be unset.
+
+Use LOGNAME first as recommended by python documentation, then try 
alternatives.
+
+Also, use tempfile to respect environment variables changing tmpdir.
+
+Upstream: https://fedorahosted.org/dogtail/ticket/46
+Debian: http://bugs.debian.org/743500
+
+--- a/dogtail/config.py        2015-06-08 22:59:08.664107350 +0200
++++ b/dogtail/config.py        2015-06-08 22:57:54.433669729 +0200
+@@ -6,11 +6,15 @@
+ import os
+ import sys
+ import locale
++import tempfile
+ 
+ 
+ def _userTmpDir(baseName):
+     # i.e. /tmp/dogtail-foo
+-    return '-'.join(('/'.join(('/tmp', baseName)), os.getenv['USER']))
++    return '-'.join((
++        '/'.join((tempfile.gettempdir(), baseName)),
++        os.getenv('LOGNAME', os.getenv('USER', os.getlogin()))
++    ))
+ 
+ 
+ class _Config(object):

Reply via email to