Add gnome2_environment_reset() to reset env variables that often cause build or test...
authorAlexandre Rostovtsev <tetromino@gentoo.org>
Mon, 14 Nov 2011 06:10:32 +0000 (06:10 +0000)
committerAlexandre Rostovtsev <tetromino@gentoo.org>
Mon, 14 Nov 2011 06:10:32 +0000 (06:10 +0000)
eclass/ChangeLog
eclass/gnome2-utils.eclass
eclass/gnome2.eclass

index fb2ae10ab7d2068c92a14cbc8bf7a253eee91441..d91c916480961aa7a8312b2624eb29d55cf9d163 100644 (file)
@@ -1,6 +1,12 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.11 2011/11/12 20:46:39 pesa Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.12 2011/11/14 06:10:32 tetromino Exp $
+
+  14 Nov 2011; Alexandre Rostovtsev <tetromino@gentoo.org> gnome2-utils.eclass,
+  gnome2.eclass:
+  Add gnome2_environment_reset() to reset env variables that often cause build
+  or test failures (most recently bug #380639). The XDG_* resetting code had
+  been tested in the gnome overlay for months with good results.
 
   12 Nov 2011; Davide Pesavento <pesa@gentoo.org> qt4-r2.eclass:
   Restore ${S} fallback, but with a deprecation notice saying that it will be
index af948140b52dec7b1dd9814c5639ac3b35b76bf7..9038517fb2ef88c5c3cb667794a5636a1cac7630 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.23 2011/08/22 04:46:31 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.24 2011/11/14 06:10:32 tetromino Exp $
 
 # @ECLASS: gnome2-utils.eclass
 # @MAINTAINER:
@@ -72,6 +72,30 @@ esac
 DEPEND=">=sys-apps/sed-4"
 
 
+# @FUNCTION: gnome2_environment_reset
+# @DESCRIPTION:
+# Reset various variables inherited from root's evironment to a reasonable
+# default for ebuilds to help avoid access violations and test failures.
+gnome2_environment_reset() {
+       # Respected by >=glib-2.30.1-r1
+       export G_HOME="${T}"
+
+       # GST_REGISTRY is to work around gst utilities trying to read/write /root
+       export GST_REGISTRY="${T}/registry.xml"
+
+       # XXX: code for resetting XDG_* directories should probably be moved into
+       # a separate function in a non-gnome eclass
+       export XDG_DATA_HOME="${T}/.local/share"
+       export XDG_CONFIG_HOME="${T}/.config"
+       export XDG_CACHE_HOME="${T}/.cache"
+       export XDG_RUNTIME_DIR="${T}/run"
+       mkdir -p "${XDG_DATA_HOME}" "${XDG_CONFIG_HOME}" "${XDG_CACHE_HOME}" \
+               "${XDG_RUNTIME_DIR}"
+       # This directory needs to be owned by the user, and chmod 0700
+       # http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
+       chmod 0700 "${XDG_RUNTIME_DIR}"
+}
+
 # @FUNCTION: gnome2_gconf_savelist
 # @DESCRIPTION:
 # Find the GConf schemas that are about to be installed and save their location
index 9813fc875661401d88c62a6df29d7ad4c6ffc1bb..8256c51434b29f8eeb7130b5d4604d1fb4c67630 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2.eclass,v 1.102 2011/09/25 15:15:21 pacho Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2.eclass,v 1.103 2011/11/14 06:10:32 tetromino Exp $
 
 # @ECLASS: gnome2.eclass
 # @MAINTAINER:
@@ -88,8 +88,8 @@ gnome2_src_unpack() {
 # Prepare environment for build, fix build of scrollkeeper documentation,
 # run elibtoolize.
 gnome2_src_prepare() {
-       # GST_REGISTRY is to work around gst utilities trying to read/write /root
-       export GST_REGISTRY="${T}/registry.xml"
+       # Prevent assorted access violations and test failures
+       gnome2_environment_reset
 
        # Prevent scrollkeeper access violations
        gnome2_omf_fix