Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 155161 | Differences between
and this patch

Collapse All | Expand All

(-)bin/ebuild.sh (-1 / +38 lines)
Lines 35-41 Link Here
35
35
36
qa_call() {
36
qa_call() {
37
	local shopts=$(shopt) OLDIFS="$IFS"
37
	local shopts=$(shopt) OLDIFS="$IFS"
38
	"$@" || return 1
38
	call-ebuildshell "$@" || return 1
39
	[[ $shopts != $(shopt) ]] &&
39
	[[ $shopts != $(shopt) ]] &&
40
		eqawarn "QA Notice: Global shell options changed and were not restored while calling '$*'"
40
		eqawarn "QA Notice: Global shell options changed and were not restored while calling '$*'"
41
	[[ "$IFS" != "$OLDIFS" ]] &&
41
	[[ "$IFS" != "$OLDIFS" ]] &&
Lines 43-48 Link Here
43
	return 0
43
	return 0
44
}
44
}
45
45
46
call-ebuildshell() {
47
	if ! hasq ebuildshell ${FEATURES}; then
48
		"$@"
49
		return $?
50
	fi
51
52
	(
53
		umask 002
54
		(
55
			echo 'unset ENV'
56
			echo 'unset BASH_ENV'
57
			set | egrep -v '^(BASH_VERSINFO|EUID|PPID|SHELLOPTS|UID)='
58
			export -p | sed -e 's:declare -rx:export:'
59
			shopt -p
60
			echo "export PS1='EBUILD ${PN} $1 \$ '" 
61
			echo 'unset ENV'
62
			echo "type $1"
63
			echo "echo WANTED: $@"
64
			# 'declare -x VAR=val' does not work when called within bash function,
65
			# it needs to be 'export VAR=val'.
66
			# is this a bash-bug or intentional ?
67
			echo "trap 'umask 002; ( set ; export -p | sed -e \"s:declare -x:export:\" ) > ${T}/ebuildshell-environment-outcome' 0"
68
		) > ${T}/ebuildshell-environment
69
		chown portage:portage "${T}/ebuildshell-environment" &>/dev/null
70
		chmod g+w "${T}/ebuildshell-environment" &>/dev/null
71
	)
72
73
	rm -f "${T}/ebuildshell-environment-outcome" >&/dev/null
74
75
	unset BASH_ENV
76
	${BASH} --rcfile "${T}/ebuildshell-environment"  -i || die
77
78
	chown portage:portage "${T}/ebuildshell-environment-outcome" &>/dev/null
79
	chmod g+w "${T}/ebuildshell-environment-outcome" &>/dev/null
80
	source "${T}/ebuildshell-environment-outcome" &>/dev/null
81
}
82
46
if [ "$*" != "depend" ] && [ "$*" != "clean" ] && [ "$*" != "nofetch" ]; then
83
if [ "$*" != "depend" ] && [ "$*" != "clean" ] && [ "$*" != "nofetch" ]; then
47
	if [ -f "${T}/environment" ]; then
84
	if [ -f "${T}/environment" ]; then
48
		qa_source "${T}/environment" &>/dev/null
85
		qa_source "${T}/environment" &>/dev/null

Return to bug 155161