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

(-)a/bin/ebuild.sh (-1 / +53 lines)
Lines 90-96 __qa_source() { Link Here
90
__qa_call() {
90
__qa_call() {
91
	local shopts=$(shopt) OLDIFS="$IFS"
91
	local shopts=$(shopt) OLDIFS="$IFS"
92
	local retval
92
	local retval
93
	"$@"
93
	__call-ebuildshell "$@"
94
	retval=$?
94
	retval=$?
95
	set +e
95
	set +e
96
	[[ $shopts != $(shopt) ]] &&
96
	[[ $shopts != $(shopt) ]] &&
Lines 467-472 if [[ -n ${QA_INTERCEPTORS} ]] ; then Link Here
467
	unset BIN_PATH BIN BODY FUNC_SRC
467
	unset BIN_PATH BIN BODY FUNC_SRC
468
fi
468
fi
469
469
470
__call-ebuildshell() {
471
	if ! has ebuildshell ${FEATURES}; then
472
		"$@"
473
		return $?
474
	fi
475
	(
476
		umask 002
477
		(
478
			(
479
				set
480
				declare -p
481
				declare -fp
482
				shopt -p
483
				if [[ ${BASH_VERSINFO[0]} == 3 ]]; then
484
					export
485
				fi
486
			) | __filter_readonly_variables --filter-for-subshell
487
			echo 'declare -r $PORTAGE_READONLY_METADATA $PORTAGE_READONLY_VARS'
488
			echo "export PS1='EBUILD ${PN} $1 \$ '" 
489
			echo 'unset ENV'
490
			echo "type $1"
491
			echo "echo WANTED: $@"
492
			echo "trap '"
493
			echo "umask 002"
494
			echo "("
495
			echo "	set"
496
			echo "	declare -p"
497
			echo "	declare -fp"
498
			echo "	shopt -p | grep -v extdebug$"
499
			if [[ ${BASH_VERSINFO[0]} == 3 ]]; then
500
				echo "	export"
501
			fi
502
			echo -n ")"
503
			echo -n " | __filter_readonly_variables --filter-metadata"
504
			echo " > ${T}/ebuildshell-environment-outcome' 0"
505
			echo "shopt -u extdebug"
506
			echo "trap - DEBUG"
507
		) > ${T}/ebuildshell-environment
508
		chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} "${T}/ebuildshell-environment" &>/dev/null
509
		chmod g+w "${T}/ebuildshell-environment" &>/dev/null
510
	)
511
512
	rm -f "${T}/ebuildshell-environment-outcome" >&/dev/null
513
514
	unset BASH_ENV
515
	env -i ${BASH} --rcfile "${T}/ebuildshell-environment"  -i || die
516
517
	chown ${PORTAGE_USER:-portage}:${PORTAGE_GROUP:-portage} "${T}/ebuildshell-environment-outcome" &>/dev/null
518
	chmod g+w "${T}/ebuildshell-environment-outcome" &>/dev/null
519
	source "${T}/ebuildshell-environment-outcome" &>/dev/null
520
}
521
470
# Subshell/helper die support (must export for the die helper).
522
# Subshell/helper die support (must export for the die helper).
471
export EBUILD_MASTER_PID=$BASHPID
523
export EBUILD_MASTER_PID=$BASHPID
472
trap 'exit 1' SIGTERM
524
trap 'exit 1' SIGTERM
(-)a/bin/phase-functions.sh (-5 / +11 lines)
Lines 87-93 PORTAGE_MUTABLE_FILTERED_VARS="AA HOSTNAME" Link Here
87
__filter_readonly_variables() {
87
__filter_readonly_variables() {
88
	local x filtered_vars
88
	local x filtered_vars
89
	local readonly_bash_vars="BASHOPTS BASHPID DIRSTACK EUID
89
	local readonly_bash_vars="BASHOPTS BASHPID DIRSTACK EUID
90
		FUNCNAME GROUPS PIPESTATUS PPID SHELLOPTS UID"
90
		FUNCNAME GROUPS PIPESTATUS PPID SHELLOPTS UID BASH_VERSINFO"
91
	local bash_misc_vars="BASH BASH_.* COLUMNS COMP_WORDBREAKS HISTCMD
91
	local bash_misc_vars="BASH BASH_.* COLUMNS COMP_WORDBREAKS HISTCMD
92
		HISTFILE HOSTNAME HOSTTYPE IFS LINENO MACHTYPE OLDPWD
92
		HISTFILE HOSTNAME HOSTTYPE IFS LINENO MACHTYPE OLDPWD
93
		OPTERR OPTIND OSTYPE POSIXLY_CORRECT PS4 PWD RANDOM
93
		OPTERR OPTIND OSTYPE POSIXLY_CORRECT PS4 PWD RANDOM
Lines 98-109 __filter_readonly_variables() { Link Here
98
	# Untrusted due to possible application of package renames to binpkgs
98
	# Untrusted due to possible application of package renames to binpkgs
99
	local binpkg_untrusted_vars="CATEGORY P PF PN PR PV PVR"
99
	local binpkg_untrusted_vars="CATEGORY P PF PN PR PV PVR"
100
	local misc_garbage_vars="_portage_filter_opts"
100
	local misc_garbage_vars="_portage_filter_opts"
101
	filtered_vars="$readonly_bash_vars $bash_misc_vars
101
	filtered_vars="$readonly_bash_vars"
102
		$PORTAGE_READONLY_VARS $misc_garbage_vars"
102
	if ! has --filter-for-subshell $* ; then
103
		filtered_vars="$filtered_vars $bash_misc_vars $PORTAGE_READONLY_VARS $misc_garbage_vars"
104
	fi
103
105
104
	# Don't filter/interfere with prefix variables unless they are
106
	# Don't filter/interfere with prefix variables unless they are
105
	# supported by the current EAPI.
107
	# supported by the current EAPI.
106
	if ___eapi_has_prefix_variables; then
108
	if ___eapi_has_prefix_variables && ! has --filter-for-subshell $* ; then
107
		filtered_vars+=" ED EPREFIX EROOT"
109
		filtered_vars+=" ED EPREFIX EROOT"
108
	fi
110
	fi
109
111
Lines 123-129 __filter_readonly_variables() { Link Here
123
			LC_CTYPE LC_MESSAGES LC_MONETARY
125
			LC_CTYPE LC_MESSAGES LC_MONETARY
124
			LC_NUMERIC LC_PAPER LC_TIME"
126
			LC_NUMERIC LC_PAPER LC_TIME"
125
	fi
127
	fi
126
	if ! has --allow-extra-vars $* ; then
128
	if has --filter-metadata $* ; then
129
		filtered_vars="$filtered_vars $PORTAGE_READONLY_METADATA"
130
	fi
131
	if ! has --allow-extra-vars $* &&
132
	   ! has --filter-for-subshell $* ; then
127
		if [ "${EMERGE_FROM}" = binary ] ; then
133
		if [ "${EMERGE_FROM}" = binary ] ; then
128
			# preserve additional variables from build time,
134
			# preserve additional variables from build time,
129
			# while excluding untrusted variables
135
			# while excluding untrusted variables
(-)a/man/make.conf.5 (+6 lines)
Lines 345-350 exist). Also see the related \fIunmerge\-backup\fR feature. Link Here
345
Use locks to ensure that unsandboxed ebuild phases never execute
345
Use locks to ensure that unsandboxed ebuild phases never execute
346
concurrently. Also see \fIparallel\-install\fR.
346
concurrently. Also see \fIparallel\-install\fR.
347
.TP
347
.TP
348
.B ebuildshell
349
Drop into an interactive shell for each phase function, meant for
350
debugging.  Because the shell would normally be used to execute the
351
phase function, commands like src_unpack or epatch are available in the
352
interactive shell.  Use `exit 1` to terminate the merge.
353
.TP
348
.B fakeroot
354
.B fakeroot
349
Enable fakeroot for the install and package phases when a non-root user runs
355
Enable fakeroot for the install and package phases when a non-root user runs
350
the \fBebuild\fR(1) command.
356
the \fBebuild\fR(1) command.
(-)a/pym/_emerge/AbstractEbuildProcess.py (+1 lines)
Lines 136-141 class AbstractEbuildProcess(SpawnProcess): Link Here
136
			self.fd_pipes = {}
136
			self.fd_pipes = {}
137
		null_fd = None
137
		null_fd = None
138
		if 0 not in self.fd_pipes and \
138
		if 0 not in self.fd_pipes and \
139
			"ebuildshell" not in self.settings.features and \
139
			self.phase not in self._phases_interactive_whitelist and \
140
			self.phase not in self._phases_interactive_whitelist and \
140
			"interactive" not in self.settings.get("PROPERTIES", "").split():
141
			"interactive" not in self.settings.get("PROPERTIES", "").split():
141
			null_fd = os.open('/dev/null', os.O_RDONLY)
142
			null_fd = os.open('/dev/null', os.O_RDONLY)
(-)a/pym/portage/const.py (+1 lines)
Lines 159-164 Link Here
159
	"distlocks",
159
	"distlocks",
160
	"downgrade-backup",
160
	"downgrade-backup",
161
	"ebuild-locks",
161
	"ebuild-locks",
162
	"ebuildshell",
162
	"fail-clean",
163
	"fail-clean",
163
	"fakeroot",
164
	"fakeroot",
164
	"fixlafiles",
165
	"fixlafiles",

Return to bug 155161