From 43c2c5e0037d85aa60ed15c30a691e409b2d2726 Mon Sep 17 00:00:00 2001 From: Alexandre Rostovtsev Date: Mon, 14 Nov 2011 06:10:32 +0000 Subject: [PATCH] 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. --- eclass/ChangeLog | 8 +++++++- eclass/gnome2-utils.eclass | 26 +++++++++++++++++++++++++- eclass/gnome2.eclass | 6 +++--- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/eclass/ChangeLog b/eclass/ChangeLog index fb2ae10ab7d2..d91c91648096 100644 --- a/eclass/ChangeLog +++ b/eclass/ChangeLog @@ -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 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 qt4-r2.eclass: Restore ${S} fallback, but with a deprecation notice saying that it will be diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass index af948140b52d..9038517fb2ef 100644 --- a/eclass/gnome2-utils.eclass +++ b/eclass/gnome2-utils.eclass @@ -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 diff --git a/eclass/gnome2.eclass b/eclass/gnome2.eclass index 9813fc875661..8256c51434b2 100644 --- a/eclass/gnome2.eclass +++ b/eclass/gnome2.eclass @@ -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 -- 2.26.2