public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/
@ 2011-05-07 22:00 Zac Medico
  0 siblings, 0 replies; 14+ messages in thread
From: Zac Medico @ 2011-05-07 22:00 UTC (permalink / raw
  To: gentoo-commits

commit:     8601ea2b80208491b471f37710b35813fd341c28
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat May  7 21:59:54 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat May  7 21:59:54 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8601ea2b

doebuild: use EbuildBuildDir for locking

EbuildBuildDir also performs safe removal of the category when it is
empty, so ebuild.sh/dyn_clean doesn't need to do it anymore. This
fixes a race condition if one process is trying to remove the category
directory while another one is trying to create it for
PORTAGE_BUILDDIR.

---
 bin/ebuild.sh                          |    2 +-
 pym/portage/package/ebuild/doebuild.py |   15 +++++++++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index f3349ae..c3cf181 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -812,7 +812,7 @@ dyn_clean() {
 	# Some kernels, such as Solaris, return EINVAL when an attempt
 	# is made to remove the current working directory.
 	cd "$PORTAGE_BUILDDIR"/../..
-	rmdir "$PORTAGE_BUILDDIR" "${PORTAGE_BUILDDIR%/*}" 2>/dev/null
+	rmdir "$PORTAGE_BUILDDIR" 2>/dev/null
 
 	true
 }

diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 1c04822..f83a1e3 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -566,8 +566,19 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
 			use_cache, mydbapi)
 
 		if mydo in clean_phases:
-			return _spawn_phase(mydo, mysettings,
-				fd_pipes=fd_pipes, returnpid=returnpid)
+			builddir_lock = None
+			if not returnpid and \
+				'PORTAGE_BUILDIR_LOCKED' not in mysettings:
+				builddir_lock = EbuildBuildDir(
+					scheduler=PollScheduler().sched_iface,
+					settings=mysettings)
+				builddir_lock.lock()
+			try:
+				return _spawn_phase(mydo, mysettings,
+					fd_pipes=fd_pipes, returnpid=returnpid)
+			finally:
+				if builddir_lock is not None:
+					builddir_lock.unlock()
 
 		restrict = set(mysettings.get('PORTAGE_RESTRICT', '').split())
 		# get possible slot information from the deps file



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/
@ 2011-08-28 23:32 Zac Medico
  0 siblings, 0 replies; 14+ messages in thread
From: Zac Medico @ 2011-08-28 23:32 UTC (permalink / raw
  To: gentoo-commits

commit:     ae9b6cb513c7b29376caecf3b4e52aac452e2b93
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 28 23:29:49 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Aug 28 23:29:49 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ae9b6cb5

doebuild: avoid redundant distfiles checks

When the unpack phase is already marked as complete, it's wasteful to
check distfiles digests. In order to avoid this, we have to migrate the
distfiles/workdir timestamp comparisons from ebuild.sh to doebuild.py,
so that doebuild always knows when unpack will be triggered. This also
allows us to eliminate code in dyn_unpack that duplicated dyn_clean,
actually call dyn_clean instead.

---
 bin/ebuild.sh                          |   37 +---------------
 pym/portage/package/ebuild/doebuild.py |   70 +++++++++++++++++++++++++++++++-
 2 files changed, 71 insertions(+), 36 deletions(-)

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index d68e54b..23a1240 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -726,41 +726,10 @@ dyn_setup() {
 }
 
 dyn_unpack() {
-	local newstuff="no"
-	if [ -e "${WORKDIR}" ]; then
-		local x
-		local checkme
-		for x in $A ; do
-			vecho ">>> Checking ${x}'s mtime..."
-			if [ "${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/${x}" -nt "${WORKDIR}" ]; then
-				vecho ">>> ${x} has been updated; recreating WORKDIR..."
-				newstuff="yes"
-				break
-			fi
-		done
-		if [ ! -f "${PORTAGE_BUILDDIR}/.unpacked" ] ; then
-			vecho ">>> Not marked as unpacked; recreating WORKDIR..."
-			newstuff="yes"
-		fi
-	fi
-	if [ "${newstuff}" == "yes" ]; then
-		# We don't necessarily have privileges to do a full dyn_clean here.
-		rm -rf "${PORTAGE_BUILDDIR}"/{.setuped,.unpacked,.prepared,.configured,.compiled,.tested,.installed,.packaged,build-info}
-		if ! has keepwork $FEATURES ; then
-			rm -rf "${WORKDIR}"
-		fi
-		if [ -d "${T}" ] && \
-			! has keeptemp $FEATURES ; then
-			rm -rf "${T}" && mkdir "${T}"
-		fi
-	fi
-	if [ -e "${WORKDIR}" ]; then
-		if [ "$newstuff" == "no" ]; then
-			vecho ">>> WORKDIR is up-to-date, keeping..."
-			return 0
-		fi
+	if [[ -f ${PORTAGE_BUILDDIR}/.unpacked ]] ; then
+		vecho ">>> WORKDIR is up-to-date, keeping..."
+		return 0
 	fi
-
 	if [ ! -d "${WORKDIR}" ]; then
 		install -m${PORTAGE_WORKDIR_MODE:-0700} -d "${WORKDIR}" || die "Failed to create dir '${WORKDIR}'"
 	fi

diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index c252e86..a95a418 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -432,6 +432,7 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
 	"install":["test"],
 	"rpm":    ["install"],
 	"package":["install"],
+	"merge"  :["install"],
 	}
 	
 	if mydbapi is None:
@@ -666,6 +667,68 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
 			return unmerge(mysettings["CATEGORY"],
 				mysettings["PF"], myroot, mysettings, vartree=vartree)
 
+		phases_to_run = set()
+		if "noauto" in mysettings.features or \
+			mydo not in actionmap_deps:
+			phases_to_run.add(mydo)
+		else:
+			phase_stack = [mydo]
+			while phase_stack:
+				x = phase_stack.pop()
+				if x in phases_to_run:
+					continue
+				phases_to_run.add(x)
+				phase_stack.extend(actionmap_deps.get(x, []))
+			del phase_stack
+
+		alist = set(mysettings.configdict["pkg"].get("A", "").split())
+
+		unpacked = False
+		if "unpack" in phases_to_run:
+			try:
+				workdir_st = os.stat(mysettings["WORKDIR"])
+			except OSError:
+				pass
+			else:
+				newstuff = False
+				if not os.path.exists(os.path.join(
+					mysettings["PORTAGE_BUILDDIR"], ".unpacked")):
+					writemsg_stdout(
+						">>> Not marked as unpacked; recreating WORKDIR...\n")
+					newstuff = True
+				else:
+					for x in alist:
+						writemsg_stdout(">>> Checking %s's mtime...\n" % x)
+						try:
+							x_st = os.stat(os.path.join(
+								mysettings["DISTDIR"], x))
+						except OSError:
+							# file not fetched yet
+							x_st = None
+
+						if x_st is None or x_st.st_mtime > workdir_st.st_mtime:
+							writemsg_stdout(">>> Timestamp of "
+								"%s has changed; recreating WORKDIR...\n" % x)
+							newstuff = True
+							break
+
+				if newstuff:
+					if builddir_lock is None and \
+						'PORTAGE_BUILDIR_LOCKED' not in mysettings:
+						builddir_lock = EbuildBuildDir(
+							scheduler=PollScheduler().sched_iface,
+							settings=mysettings)
+						builddir_lock.lock()
+					try:
+						_spawn_phase("clean", mysettings)
+					finally:
+						if builddir_lock is not None:
+							builddir_lock.unlock()
+							builddir_lock = None
+				else:
+					writemsg_stdout(">>> WORKDIR is up-to-date, keeping...\n")
+					unpacked = True
+
 		# Build directory creation isn't required for any of these.
 		# In the fetch phase, the directory is needed only for RESTRICT=fetch
 		# in order to satisfy the sane $PWD requirement (from bug #239560)
@@ -739,10 +802,9 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
 		# Only try and fetch the files if we are going to need them ...
 		# otherwise, if user has FEATURES=noauto and they run `ebuild clean
 		# unpack compile install`, we will try and fetch 4 times :/
-		need_distfiles = tree == "porttree" and \
+		need_distfiles = tree == "porttree" and not unpacked and \
 			(mydo in ("fetch", "unpack") or \
 			mydo not in ("digest", "manifest") and "noauto" not in features)
-		alist = set(mysettings.configdict["pkg"].get("A", "").split())
 		if need_distfiles:
 
 			src_uri, = mydbapi.aux_get(mysettings.mycpv,
@@ -787,6 +849,10 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
 			# Files are already checked inside fetch(),
 			# so do not check them again.
 			checkme = []
+		elif unpacked:
+			# The unpack phase is marked as complete, so it
+			# would be wasteful to check distfiles again.
+			checkme = []
 		else:
 			checkme = alist
 



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/
@ 2011-09-22  0:05 Zac Medico
  0 siblings, 0 replies; 14+ messages in thread
From: Zac Medico @ 2011-09-22  0:05 UTC (permalink / raw
  To: gentoo-commits

commit:     9144182d9c8f0cf16973d8ec91eafc624310c6ca
Author:     Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Wed Sep 21 22:50:28 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Sep 22 00:03:45 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9144182d

add install hooks

---
 bin/misc-functions.sh                  |   15 +++++++++++++++
 pym/portage/package/ebuild/doebuild.py |    3 ++-
 2 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index 30244a7..7d858a2 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -985,6 +985,21 @@ success_hooks() {
 	done
 }
 
+install_hooks() {
+	local hooks_dir="${PORTAGE_CONFIG_ROOT}/etc/portage/hooks/install"
+	local fp
+	local ret=0
+	shopt -s nullglob
+	for fp in "${hooks_dir}"/*; do
+		if [ -x "$fp" ]; then
+			"$fp"
+			ret=$(( $ret | $? ))
+		fi
+	done
+	shopt +s nullglob
+	return $ret
+}
+
 if [ -n "${MISC_FUNCTIONS_ARGS}" ]; then
 	source_all_bashrcs
 	[ "$PORTAGE_DEBUG" == "1" ] && set -x

diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 427589a..9939e9c 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -1393,7 +1393,8 @@ _post_phase_cmds = {
 
 	"install" : [
 		"install_qa_check",
-		"install_symlink_html_docs"],
+		"install_symlink_html_docs",
+		"install_hooks"],
 
 	"preinst" : [
 		"preinst_sfperms",



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/
@ 2011-10-15 18:38 Zac Medico
  0 siblings, 0 replies; 14+ messages in thread
From: Zac Medico @ 2011-10-15 18:38 UTC (permalink / raw
  To: gentoo-commits

commit:     f4807e05962845c17d689b8bb80a1f55b85834c9
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 15 18:38:35 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Oct 15 18:38:35 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f4807e05

frozenset categories optimize pordbapi.cp_list()

---
 bin/repoman                          |    6 +++---
 pym/portage/package/ebuild/config.py |    6 ++++--
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/bin/repoman b/bin/repoman
index 2a6d782..b80b783 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -680,9 +680,9 @@ categories = []
 for path in set([portdir, repodir]):
 	categories.extend(portage.util.grabfile(
 		os.path.join(path, 'profiles', 'categories')))
-repoman_settings.categories = tuple(sorted(
-	portage.util.stack_lists([categories], incremental=1)))
-categories = frozenset(repoman_settings.categories)
+repoman_settings.categories = frozenset(
+	portage.util.stack_lists([categories], incremental=1))
+categories = repoman_settings.categories
 
 portdb.settings = repoman_settings
 root_config = RootConfig(repoman_settings, trees[root], None)

diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 37dcbb4..a80c82d 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -606,9 +606,11 @@ class config(object):
 			self.categories = [grabfile(os.path.join(x, "categories")) \
 				for x in locations_manager.profile_and_user_locations]
 			category_re = dbapi._category_re
-			self.categories = tuple(sorted(
+			# categories used to be a tuple, but now we use a frozenset
+			# for hashed category validation in pordbapi.cp_list()
+			self.categories = frozenset(
 				x for x in stack_lists(self.categories, incremental=1)
-				if category_re.match(x) is not None))
+				if category_re.match(x) is not None)
 
 			archlist = [grabfile(os.path.join(x, "arch.list")) \
 				for x in locations_manager.profile_and_user_locations]



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/
@ 2011-11-05 18:53 Zac Medico
  0 siblings, 0 replies; 14+ messages in thread
From: Zac Medico @ 2011-11-05 18:53 UTC (permalink / raw
  To: gentoo-commits

commit:     7c5e61b3f442b8ca2e75a08bf34eb65eec285b93
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  5 18:53:20 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Nov  5 18:53:20 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7c5e61b3

Enable colors during the depend phase.

---
 bin/isolated-functions.sh              |   27 +++++++++++++--------------
 pym/portage/package/ebuild/doebuild.py |   13 +++++++++++++
 2 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 733795a..d2ea319 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -411,7 +411,11 @@ unset_colors() {
 
 set_colors() {
 	COLS=${COLUMNS:-0}      # bash's internal COLUMNS variable
-	(( COLS == 0 )) && COLS=$(set -- $(stty size 2>/dev/null) ; echo $2)
+	# Avoid wasteful stty calls during the "depend" phases.
+	# If stdout is a pipe, the parent process can export COLUMNS
+	# if it's relevant.
+	[[ $COLS == 0 && $EBUILD_PHASE != depend ]] && \
+		COLS=$(set -- $(stty size 2>/dev/null) ; echo $2)
 	(( COLS > 0 )) || (( COLS = 80 ))
 
 	# Now, ${ENDCOL} will move us to the end of the
@@ -434,19 +438,14 @@ RC_INDENTATION=''
 RC_DEFAULT_INDENT=2
 RC_DOT_PATTERN=''
 
-if [[ $EBUILD_PHASE == depend ]] ; then
-	# avoid unneeded stty call in set_colors during "depend" phase
-	unset_colors
-else
-	case "${NOCOLOR:-false}" in
-		yes|true)
-			unset_colors
-			;;
-		no|false)
-			set_colors
-			;;
-	esac
-fi
+case "${NOCOLOR:-false}" in
+	yes|true)
+		unset_colors
+		;;
+	no|false)
+		set_colors
+		;;
+esac
 
 if [[ -z ${USERLAND} ]] ; then
 	case $(uname -s) in

diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index ccea574..cb7da78 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -283,6 +283,19 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
 			(c, style_to_ansi_code(c)))
 	mysettings["PORTAGE_COLORMAP"] = "\n".join(mycolors)
 
+	if "COLUMNS" not in mysettings:
+		# Set COLUMNS, in order to prevent unnecessary stty calls
+		# inside the set_colors function of isolated-functions.sh.
+		# We cache the result in os.environ, in order to avoid
+		# multiple stty calls in cases when get_term_size() falls
+		# back to stty due to a missing or broken curses module.
+		columns = os.environ.get("COLUMNS")
+		if columns is None:
+			rows, columns = portage.output.get_term_size()
+			columns = str(columns)
+			os.environ["COLUMNS"] = columns
+		mysettings["COLUMNS"] = columns
+
 	# All EAPI dependent code comes last, so that essential variables
 	# like PORTAGE_BUILDDIR are still initialized even in cases when
 	# UnsupportedAPIException needs to be raised, which can be useful



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/
@ 2011-11-09  0:21 Zac Medico
  0 siblings, 0 replies; 14+ messages in thread
From: Zac Medico @ 2011-11-09  0:21 UTC (permalink / raw
  To: gentoo-commits

commit:     75768ea8c922c0266829458025e4b2d35ff49804
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Nov  9 00:21:07 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Nov  9 00:21:07 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=75768ea8

Include EPREFIX directories in PATH.

This relocates the PATH generation code from ebuild.sh to
doebuild_environment, which helps to eliminate duplicate code.

---
 bin/ebuild.sh                          |   19 -------------
 bin/phase-functions.sh                 |    1 +
 pym/portage/package/ebuild/doebuild.py |   46 +++++++++++++++++++++++++-------
 3 files changed, 37 insertions(+), 29 deletions(-)

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 8ca7a41..226b9f6 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -5,13 +5,6 @@
 PORTAGE_BIN_PATH="${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"
 PORTAGE_PYM_PATH="${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}"
 
-ROOTPATH=${ROOTPATH##:}
-ROOTPATH=${ROOTPATH%%:}
-PREROOTPATH=${PREROOTPATH##:}
-PREROOTPATH=${PREROOTPATH%%:}
-PATH=$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${ROOTPATH:+:}$ROOTPATH
-export PATH
-
 # Prevent aliases from causing portage to act inappropriately.
 # Make sure it's before everything so we don't mess aliases that follow.
 unalias -a
@@ -585,18 +578,6 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
 
 		if [[ $EBUILD_PHASE != depend ]] ; then
 
-			case "$EAPI" in
-				0|1|2|3)
-					_ebuild_helpers_path="$PORTAGE_BIN_PATH/ebuild-helpers"
-					;;
-				*)
-					_ebuild_helpers_path="$PORTAGE_BIN_PATH/ebuild-helpers/4:$PORTAGE_BIN_PATH/ebuild-helpers"
-					;;
-			esac
-
-			PATH=$_ebuild_helpers_path:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${ROOTPATH:+:}$ROOTPATH
-			unset _ebuild_helpers_path
-
 			_eprefix=${EPREFIX}
 			case "$EAPI" in 0|1|2) _eprefix= ;; esac
 			# Use default ABI libdir in accordance with bug #355283.

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index f46368d..a686dcd 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -229,6 +229,7 @@ dyn_unpack() {
 		return 0
 	fi
 	if [ ! -d "${WORKDIR}" ]; then
+		echo PATH=$PATH
 		install -m${PORTAGE_WORKDIR_MODE:-0700} -d "${WORKDIR}" || die "Failed to create dir '${WORKDIR}'"
 	fi
 	cd "${WORKDIR}" || die "Directory change failed: \`cd '${WORKDIR}'\`"

diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index cb7da78..da95a63 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -115,6 +115,38 @@ def _spawn_phase(phase, settings, actionmap=None, **kwargs):
 	ebuild_phase.wait()
 	return ebuild_phase.returncode
 
+def _doebuild_path(settings, eapi=None):
+	"""
+	Generate the PATH variable.
+	"""
+
+	# Note: PORTAGE_BIN_PATH may differ from the global constant
+	# when portage is reinstalling itself.
+	portage_bin_path = settings["PORTAGE_BIN_PATH"]
+	eprefix = settings["EPREFIX"]
+	prerootpath = [x for x in settings.get("PREROOTPATH", "").split(":") if x]
+	rootpath = [x for x in settings.get("ROOTPATH", "").split(":") if x]
+
+	prefixes = []
+	if eprefix:
+		prefixes.append(eprefix)
+	prefixes.append("/")
+
+	path = []
+
+	if eapi not in (None, "0", "1", "2"):
+		path.append(os.path.join(portage_bin_path, "ebuild-helpers", "4"))
+
+	path.append(os.path.join(portage_bin_path, "ebuild-helpers"))
+	path.extend(prerootpath)
+
+	for prefix in prefixes:
+		for x in ("usr/local/sbin", "usr/local/bin", "usr/sbin", "usr/bin", "sbin", "bin"):
+			path.append(os.path.join(prefix, x))
+
+	path.extend(rootpath)
+	settings["PATH"] = ":".join(path)
+
 def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
 	debug=False, use_cache=None, db=None):
 	"""
@@ -234,16 +266,6 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
 	else:
 		mysettings["PVR"]=mysplit[1]+"-"+mysplit[2]
 
-	if "PATH" in mysettings:
-		mysplit=mysettings["PATH"].split(":")
-	else:
-		mysplit=[]
-	# Note: PORTAGE_BIN_PATH may differ from the global constant
-	# when portage is reinstalling itself.
-	portage_bin_path = mysettings["PORTAGE_BIN_PATH"]
-	if portage_bin_path not in mysplit:
-		mysettings["PATH"] = portage_bin_path + ":" + mysettings["PATH"]
-
 	# All temporary directories should be subdirectories of
 	# $PORTAGE_TMPDIR/portage, since it's common for /tmp and /var/tmp
 	# to be mounted with the "noexec" option (see bug #346899).
@@ -311,6 +333,7 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
 
 		if eapi is not None:
 			if not eapi_is_supported(eapi):
+				_doebuild_path(mysettings)
 				raise UnsupportedAPIException(mycpv, eapi)
 			mysettings.configdict['pkg']['EAPI'] = eapi
 
@@ -320,6 +343,7 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
 		eapi = mysettings["EAPI"]
 		if not eapi_is_supported(eapi):
 			# can't do anything with this.
+			_doebuild_path(mysettings)
 			raise UnsupportedAPIException(mycpv, eapi)
 
 		if hasattr(mydbapi, "getFetchMap") and \
@@ -346,6 +370,8 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
 			else:
 				mysettings.configdict["pkg"]["AA"] = " ".join(uri_map)
 
+	_doebuild_path(mysettings, eapi=eapi)
+
 	if not eapi_exports_KV(eapi):
 		# Discard KV for EAPIs that don't support it. Cache KV is restored
 		# from the backupenv whenever config.reset() is called.



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/
@ 2011-11-10  3:12 Zac Medico
  0 siblings, 0 replies; 14+ messages in thread
From: Zac Medico @ 2011-11-10  3:12 UTC (permalink / raw
  To: gentoo-commits

commit:     68e467790f02ea8330a8efd5e3b55ebac3dd3462
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 10 03:11:35 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Nov 10 03:11:35 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=68e46779

Move ccache/distcc PATH code to doebuild_env.

---
 bin/ebuild.sh                          |   10 ----------
 pym/portage/package/ebuild/doebuild.py |   20 ++++++++++++++++++++
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 226b9f6..f39e536 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -578,19 +578,11 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
 
 		if [[ $EBUILD_PHASE != depend ]] ; then
 
-			_eprefix=${EPREFIX}
-			case "$EAPI" in 0|1|2) _eprefix= ;; esac
-			# Use default ABI libdir in accordance with bug #355283.
-			x=LIBDIR_${DEFAULT_ABI}
-			[[ -n $DEFAULT_ABI && -n ${!x} ]] && x=${!x} || x=lib
-
 			if has distcc $FEATURES ; then
-				PATH="${_eprefix}/usr/$x/distcc/bin:$PATH"
 				[[ -n $DISTCC_LOG ]] && addwrite "${DISTCC_LOG%/*}"
 			fi
 
 			if has ccache $FEATURES ; then
-				PATH="${_eprefix}/usr/$x/ccache/bin:$PATH"
 
 				if [[ -n $CCACHE_DIR ]] ; then
 					addread "$CCACHE_DIR"
@@ -600,8 +592,6 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
 				[[ -n $CCACHE_SIZE ]] && ccache -M $CCACHE_SIZE &> /dev/null
 			fi
 
-			unset x _eprefix
-
 			if [[ -n $QA_PREBUILT ]] ; then
 
 				# these ones support fnmatch patterns

diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 3b72807..bdfcbcc 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -372,6 +372,26 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
 
 	_doebuild_path(mysettings, eapi=eapi)
 
+	if mydo != "depend":
+		ccache = "ccache" in mysettings.features
+		distcc = "distcc" in mysettings.features
+		if ccache or distcc:
+			# Use default ABI libdir in accordance with bug #355283.
+			libdir = None
+			default_abi = mysettings.get("DEFAULT_ABI")
+			if default_abi:
+				libdir = mysettings.get("LIBDIR_" + default_abi)
+			if not libdir:
+				libdir = "lib"
+
+			if distcc:
+				mysettings["PATH"] = os.path.join(os.sep, eprefix_lstrip,
+					 "usr", libdir, "distcc", "bin") + ":" + mysettings["PATH"]
+
+			if ccache:
+				mysettings["PATH"] = os.path.join(os.sep, eprefix_lstrip,
+					 "usr", libdir, "ccache", "bin") + ":" + mysettings["PATH"]
+
 	if not eapi_exports_KV(eapi):
 		# Discard KV for EAPIs that don't support it. Cache KV is restored
 		# from the backupenv whenever config.reset() is called.



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/
@ 2012-04-22 17:56 Zac Medico
  0 siblings, 0 replies; 14+ messages in thread
From: Zac Medico @ 2012-04-22 17:56 UTC (permalink / raw
  To: gentoo-commits

commit:     b93b24f9fa1b2761aa0768274bd93ade9b526961
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 22 17:56:01 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Apr 22 17:56:01 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b93b24f9

Add ${T}/build.log symlink to PORT_LOGDIR.

This will fix bug #412865. This makes it easier on people who
`emerge foo`, do stuff, `emerge foo`, do stuff, etc... to have
the same path to the log in between runs.

---
 bin/isolated-functions.sh                        |   11 +++++++++--
 pym/portage/package/ebuild/prepare_build_dirs.py |   22 ++++++++++++++++++++--
 2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 98be41e..3630488 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -216,8 +216,15 @@ die() {
 		> "$PORTAGE_BUILDDIR/.die_hooks"
 	fi
 
-	[[ -n ${PORTAGE_LOG_FILE} ]] \
-		&& eerror "The complete build log is located at '${PORTAGE_LOG_FILE}'."
+	if [[ -n ${PORTAGE_LOG_FILE} ]] ; then
+		eerror "The complete build log is located at '${PORTAGE_LOG_FILE}'."
+		if [[ ${PORTAGE_LOG_FILE} != ${T}/* ]] ; then
+			# Display path to symlink in ${T}, as requested in bug #412865.
+			local log_ext=${PORTAGE_LOG_FILE##*/}
+			log_ext=${log_ext#*.}
+			eerror "For convenience, a symlink to the build log is located at '${T}/build.${log_ext}'."
+		fi
+	fi
 	if [ -f "${T}/environment" ] ; then
 		eerror "The ebuild environment file is located at '${T}/environment'."
 	elif [ -d "${T}" ] ; then

diff --git a/pym/portage/package/ebuild/prepare_build_dirs.py b/pym/portage/package/ebuild/prepare_build_dirs.py
index 50b14ec..b8fbdc5 100644
--- a/pym/portage/package/ebuild/prepare_build_dirs.py
+++ b/pym/portage/package/ebuild/prepare_build_dirs.py
@@ -346,13 +346,31 @@ def _prepare_workdir(mysettings):
 				writemsg(_unicode_decode("!!! %s: %s\n") %
 					(_("Permission Denied"), log_subdir), noiselevel=-1)
 
+	tmpdir_log_path = os.path.join(
+		mysettings["T"], "build.log%s" % compress_log_ext)
 	if not logdir_subdir_ok:
 		# NOTE: When sesandbox is enabled, the local SELinux security policies
 		# may not allow output to be piped out of the sesandbox domain. The
 		# current policy will allow it to work when a pty is available, but
 		# not through a normal pipe. See bug #162404.
-		mysettings["PORTAGE_LOG_FILE"] = os.path.join(
-			mysettings["T"], "build.log%s" % compress_log_ext)
+		mysettings["PORTAGE_LOG_FILE"] = tmpdir_log_path
+	else:
+		# Create a symlink from tmpdir_log_path to PORTAGE_LOG_FILE, as
+		# requested in bug #412865.
+		make_new_symlink = False
+		try:
+			target = os.readlink(tmpdir_log_path)
+		except OSError:
+			make_new_symlink = True
+		else:
+			if target != mysettings["PORTAGE_LOG_FILE"]:
+				make_new_symlink = True
+		if make_new_symlink:
+			try:
+				os.unlink(tmpdir_log_path)
+			except OSError:
+				pass
+			os.symlink(mysettings["PORTAGE_LOG_FILE"], tmpdir_log_path)
 
 def _ensure_log_subdirs(logdir, subdir):
 	"""



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/
@ 2012-09-13 18:25 Zac Medico
  0 siblings, 0 replies; 14+ messages in thread
From: Zac Medico @ 2012-09-13 18:25 UTC (permalink / raw
  To: gentoo-commits

commit:     7fac4fd060dff7a5a6180f243176b2ddbb655133
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 13 18:24:54 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Sep 13 18:24:54 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7fac4fd0

FEATURES=test: test flag respect IUSE_FFECTIVE

---
 bin/phase-functions.sh               |    2 +-
 pym/portage/package/ebuild/config.py |    3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index ad9ba6b..0883ccd 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -478,7 +478,7 @@ dyn_test() {
 		return
 	fi
 
-	if [ "${EBUILD_FORCE_TEST}" == "1" ] ; then
+	if [[ ${EBUILD_FORCE_TEST} == 1 && test =~ $PORTAGE_IUSE ]]; then
 		# If USE came from ${T}/environment then it might not have USE=test
 		# like it's supposed to here.
 		! has test ${USE} && export USE="${USE} test"

diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index ffebd22..6ca1cb5 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -1465,7 +1465,8 @@ class config(object):
 			not hasattr(self, "_ebuild_force_test_msg_shown"):
 				self._ebuild_force_test_msg_shown = True
 				writemsg(_("Forcing test.\n"), noiselevel=-1)
-		if "test" in self.features:
+		if "test" in self.features and \
+			("test" in explicit_iuse or iuse_implicit_match("test")):
 			if "test" in self.usemask and not ebuild_force_test:
 				# "test" is in IUSE and USE=test is masked, so execution
 				# of src_test() probably is not reliable. Therefore,


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/
@ 2012-09-14  7:26 Zac Medico
  0 siblings, 0 replies; 14+ messages in thread
From: Zac Medico @ 2012-09-14  7:26 UTC (permalink / raw
  To: gentoo-commits

commit:     7571867c71392b5c61b040884017c00e9d1ecb3f
Author:     Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Fri Sep 14 06:00:10 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Sep 14 07:13:31 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7571867c

Convert funcs of phase*.sh to __ prefixed namespace.

---
 bin/ebuild.sh                          |    6 +-
 bin/misc-functions.sh                  |   10 +-
 bin/phase-functions.sh                 |  196 ++++++++++++++++----------------
 bin/phase-helpers.sh                   |   24 ++--
 bin/save-ebuild-env.sh                 |   21 ++--
 pym/portage/package/ebuild/doebuild.py |    2 +-
 6 files changed, 130 insertions(+), 129 deletions(-)

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index c6f2676..2f68b2e 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -473,7 +473,7 @@ if ! has "$EBUILD_PHASE" clean cleanrm depend && \
 	# may have come from another version of ebuild.sh or something.
 	# In any case, preprocess it to prevent any potential interference.
 	# NOTE: export ${FOO}=... requires quoting, unlike normal exports
-	preprocess_ebuild_env || \
+	__preprocess_ebuild_env || \
 		die "error processing environment"
 	# Colon separated SANDBOX_* variables need to be cumulative.
 	for x in SANDBOX_DENY SANDBOX_READ SANDBOX_PREDICT SANDBOX_WRITE ; do
@@ -681,7 +681,7 @@ if [[ $EBUILD_PHASE = depend ]] ; then
 	fi
 	set +f
 else
-	# Note: readonly variables interfere with preprocess_ebuild_env(), so
+	# Note: readonly variables interfere with __preprocess_ebuild_env(), so
 	# declare them only after it has already run.
 	declare -r $PORTAGE_READONLY_METADATA $PORTAGE_READONLY_VARS
 	case "$EAPI" in
@@ -699,7 +699,7 @@ else
 			# Don't allow subprocesses to inherit the pipe which
 			# emerge uses to monitor ebuild.sh.
 			exec 9>&-
-			ebuild_main ${EBUILD_SH_ARGS}
+			__ebuild_main ${EBUILD_SH_ARGS}
 			exit 0
 		)
 		exit $?

diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index 5bc946f..fe38e23 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -1082,7 +1082,7 @@ preinst_selinux_labels() {
 		 return 1
 	fi
 	if has selinux ${FEATURES}; then
-		# SELinux file labeling (needs to always be last in dyn_preinst)
+		# SELinux file labeling (needs to always be last in __dyn_preinst)
 		# only attempt to label if setfiles is executable
 		# and 'context' is available on selinuxfs.
 		if [ -f /selinux/context -o -f /sys/fs/selinux/context ] && \
@@ -1105,7 +1105,7 @@ preinst_selinux_labels() {
 	fi
 }
 
-dyn_package() {
+__dyn_package() {
 	local PROOT
 
 	[[ " ${FEATURES} " == *" force-prefix "* ]] || \
@@ -1167,7 +1167,7 @@ dyn_package() {
 		die "Failed to create $PORTAGE_BUILDDIR/.packaged"
 }
 
-dyn_spec() {
+__dyn_spec() {
 	local sources_dir=/usr/src/rpm/SOURCES
 	mkdir -p "${sources_dir}"
 	declare -a tar_args=("${EBUILD}")
@@ -1205,7 +1205,7 @@ __END1__
 
 }
 
-dyn_rpm() {
+__dyn_rpm() {
 
 	[[ " ${FEATURES} " == *" force-prefix "* ]] || \
 		case "$EAPI" in 0|1|2) local EPREFIX= ;; esac
@@ -1215,7 +1215,7 @@ dyn_rpm() {
 	local dest_dir=${EPREFIX}/usr/src/rpm/RPMS/${machine_name}
 	addwrite ${EPREFIX}/usr/src/rpm
 	addwrite "${RPMDIR}"
-	dyn_spec
+	__dyn_spec
 	rpmbuild -bb --clean --rmsource "${PF}.spec" || die "Failed to integrate rpm spec file"
 	install -D "${dest_dir}/${PN}-${PV}-${PR}.${machine_name}.rpm" \
 		"${RPMDIR}/${CATEGORY}/${PN}-${PV}-${PR}.rpm" || \

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index 34e9da1..8585a71 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -39,7 +39,7 @@ PORTAGE_SAVED_READONLY_VARS="A CATEGORY P PF PN PR PV PVR"
 # it is saved or loaded (any mutations do not persist).
 PORTAGE_MUTABLE_FILTERED_VARS="AA HOSTNAME"
 
-# @FUNCTION: filter_readonly_variables
+# @FUNCTION: __filter_readonly_variables
 # @DESCRIPTION: [--filter-sandbox] [--allow-extra-vars]
 # Read an environment from stdin and echo to stdout while filtering variables
 # with names that are known to cause interference:
@@ -81,7 +81,7 @@ PORTAGE_MUTABLE_FILTERED_VARS="AA HOSTNAME"
 # readonly variable cause the shell to exit while executing the "source"
 # builtin command. To avoid this problem, this function filters those
 # variables out and discards them. See bug #190128.
-filter_readonly_variables() {
+__filter_readonly_variables() {
 	local x filtered_vars
 	local readonly_bash_vars="BASHOPTS BASHPID DIRSTACK EUID
 		FUNCNAME GROUPS PIPESTATUS PPID SHELLOPTS UID"
@@ -140,14 +140,14 @@ filter_readonly_variables() {
 	"${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}"/filter-bash-environment.py "${filtered_vars}" || die "filter-bash-environment.py failed"
 }
 
-# @FUNCTION: preprocess_ebuild_env
+# @FUNCTION: __preprocess_ebuild_env
 # @DESCRIPTION:
 # Filter any readonly variables from ${T}/environment, source it, and then
 # save it via save_ebuild_env(). This process should be sufficient to prevent
 # any stale variables or functions from an arbitrary environment from
 # interfering with the current environment. This is useful when an existing
 # environment needs to be loaded from a binary or installed package.
-preprocess_ebuild_env() {
+__preprocess_ebuild_env() {
 	local _portage_filter_opts="--filter-features --filter-locale --filter-path --filter-sandbox"
 
 	# If environment.raw is present, this is a signal from the python side,
@@ -156,7 +156,7 @@ preprocess_ebuild_env() {
 	# Otherwise, we don't need to filter the environment.
 	[ -f "${T}/environment.raw" ] || return 0
 
-	filter_readonly_variables $_portage_filter_opts < "${T}"/environment \
+	__filter_readonly_variables $_portage_filter_opts < "${T}"/environment \
 		>> "$T/environment.filtered" || return $?
 	unset _portage_filter_opts
 	mv "${T}"/environment.filtered "${T}"/environment || return $?
@@ -187,7 +187,7 @@ preprocess_ebuild_env() {
 	) > "${T}/environment.filtered"
 	local retval
 	if [ -e "${T}/environment.success" ] ; then
-		filter_readonly_variables --filter-features < \
+		__filter_readonly_variables --filter-features < \
 			"${T}/environment.filtered" > "${T}/environment"
 		retval=$?
 	else
@@ -197,44 +197,44 @@ preprocess_ebuild_env() {
 	return ${retval}
 }
 
-ebuild_phase() {
+__ebuild_phase() {
 	declare -F "$1" >/dev/null && qa_call $1
 }
 
-ebuild_phase_with_hooks() {
+__ebuild_phase_with_hooks() {
 	local x phase_name=${1}
 	for x in {pre_,,post_}${phase_name} ; do
-		ebuild_phase ${x}
+		__ebuild_phase ${x}
 	done
 }
 
-dyn_pretend() {
+__dyn_pretend() {
 	if [[ -e $PORTAGE_BUILDDIR/.pretended ]] ; then
 		__vecho ">>> It appears that '$PF' is already pretended; skipping."
 		__vecho ">>> Remove '$PORTAGE_BUILDDIR/.pretended' to force pretend."
 		return 0
 	fi
-	ebuild_phase pre_pkg_pretend
-	ebuild_phase pkg_pretend
+	__ebuild_phase pre_pkg_pretend
+	__ebuild_phase pkg_pretend
 	>> "$PORTAGE_BUILDDIR/.pretended" || \
 		die "Failed to create $PORTAGE_BUILDDIR/.pretended"
-	ebuild_phase post_pkg_pretend
+	__ebuild_phase post_pkg_pretend
 }
 
-dyn_setup() {
+__dyn_setup() {
 	if [[ -e $PORTAGE_BUILDDIR/.setuped ]] ; then
 		__vecho ">>> It appears that '$PF' is already setup; skipping."
 		__vecho ">>> Remove '$PORTAGE_BUILDDIR/.setuped' to force setup."
 		return 0
 	fi
-	ebuild_phase pre_pkg_setup
-	ebuild_phase pkg_setup
+	__ebuild_phase pre_pkg_setup
+	__ebuild_phase pkg_setup
 	>> "$PORTAGE_BUILDDIR/.setuped" || \
 		die "Failed to create $PORTAGE_BUILDDIR/.setuped"
-	ebuild_phase post_pkg_setup
+	__ebuild_phase post_pkg_setup
 }
 
-dyn_unpack() {
+__dyn_unpack() {
 	if [[ -f ${PORTAGE_BUILDDIR}/.unpacked ]] ; then
 		__vecho ">>> WORKDIR is up-to-date, keeping..."
 		return 0
@@ -243,16 +243,16 @@ dyn_unpack() {
 		install -m${PORTAGE_WORKDIR_MODE:-0700} -d "${WORKDIR}" || die "Failed to create dir '${WORKDIR}'"
 	fi
 	cd "${WORKDIR}" || die "Directory change failed: \`cd '${WORKDIR}'\`"
-	ebuild_phase pre_src_unpack
+	__ebuild_phase pre_src_unpack
 	__vecho ">>> Unpacking source..."
-	ebuild_phase src_unpack
+	__ebuild_phase src_unpack
 	>> "$PORTAGE_BUILDDIR/.unpacked" || \
 		die "Failed to create $PORTAGE_BUILDDIR/.unpacked"
 	__vecho ">>> Source unpacked in ${WORKDIR}"
-	ebuild_phase post_src_unpack
+	__ebuild_phase post_src_unpack
 }
 
-dyn_clean() {
+__dyn_clean() {
 	if [ -z "${PORTAGE_BUILDDIR}" ]; then
 		echo "Aborting clean phase because PORTAGE_BUILDDIR is unset!"
 		return 1
@@ -299,7 +299,7 @@ dyn_clean() {
 	true
 }
 
-abort_handler() {
+__abort_handler() {
 	local msg
 	if [ "$2" != "fail" ]; then
 		msg="${EBUILD}: ${1} aborted; exiting."
@@ -314,37 +314,37 @@ abort_handler() {
 	trap - SIGINT SIGQUIT
 }
 
-abort_prepare() {
-	abort_handler src_prepare $1
+__abort_prepare() {
+	__abort_handler src_prepare $1
 	rm -f "$PORTAGE_BUILDDIR/.prepared"
 	exit 1
 }
 
-abort_configure() {
-	abort_handler src_configure $1
+__abort_configure() {
+	__abort_handler src_configure $1
 	rm -f "$PORTAGE_BUILDDIR/.configured"
 	exit 1
 }
 
-abort_compile() {
-	abort_handler "src_compile" $1
+__abort_compile() {
+	__abort_handler "src_compile" $1
 	rm -f "${PORTAGE_BUILDDIR}/.compiled"
 	exit 1
 }
 
-abort_test() {
-	abort_handler "dyn_test" $1
+__abort_test() {
+	__abort_handler "__dyn_test" $1
 	rm -f "${PORTAGE_BUILDDIR}/.tested"
 	exit 1
 }
 
-abort_install() {
-	abort_handler "src_install" $1
+__abort_install() {
+	__abort_handler "src_install" $1
 	rm -rf "${PORTAGE_BUILDDIR}/image"
 	exit 1
 }
 
-has_phase_defined_up_to() {
+__has_phase_defined_up_to() {
 	local phase
 	for phase in unpack prepare configure compile install; do
 		has ${phase} ${DEFINED_PHASES} && return 0
@@ -354,7 +354,7 @@ has_phase_defined_up_to() {
 	return 1
 }
 
-dyn_prepare() {
+__dyn_prepare() {
 
 	if [[ -e $PORTAGE_BUILDDIR/.prepared ]] ; then
 		__vecho ">>> It appears that '$PF' is already prepared; skipping."
@@ -366,26 +366,26 @@ dyn_prepare() {
 		cd "${S}"
 	elif has $EAPI 0 1 2 3 ; then
 		cd "${WORKDIR}"
-	elif [[ -z ${A} ]] && ! has_phase_defined_up_to prepare; then
+	elif [[ -z ${A} ]] && ! __has_phase_defined_up_to prepare; then
 		cd "${WORKDIR}"
 	else
 		die "The source directory '${S}' doesn't exist"
 	fi
 
-	trap abort_prepare SIGINT SIGQUIT
+	trap __abort_prepare SIGINT SIGQUIT
 
-	ebuild_phase pre_src_prepare
+	__ebuild_phase pre_src_prepare
 	__vecho ">>> Preparing source in $PWD ..."
-	ebuild_phase src_prepare
+	__ebuild_phase src_prepare
 	>> "$PORTAGE_BUILDDIR/.prepared" || \
 		die "Failed to create $PORTAGE_BUILDDIR/.prepared"
 	__vecho ">>> Source prepared."
-	ebuild_phase post_src_prepare
+	__ebuild_phase post_src_prepare
 
 	trap - SIGINT SIGQUIT
 }
 
-dyn_configure() {
+__dyn_configure() {
 
 	if [[ -e $PORTAGE_BUILDDIR/.configured ]] ; then
 		__vecho ">>> It appears that '$PF' is already configured; skipping."
@@ -397,28 +397,28 @@ dyn_configure() {
 		cd "${S}"
 	elif has $EAPI 0 1 2 3 ; then
 		cd "${WORKDIR}"
-	elif [[ -z ${A} ]] && ! has_phase_defined_up_to configure; then
+	elif [[ -z ${A} ]] && ! __has_phase_defined_up_to configure; then
 		cd "${WORKDIR}"
 	else
 		die "The source directory '${S}' doesn't exist"
 	fi
 
-	trap abort_configure SIGINT SIGQUIT
+	trap __abort_configure SIGINT SIGQUIT
 
-	ebuild_phase pre_src_configure
+	__ebuild_phase pre_src_configure
 
 	__vecho ">>> Configuring source in $PWD ..."
-	ebuild_phase src_configure
+	__ebuild_phase src_configure
 	>> "$PORTAGE_BUILDDIR/.configured" || \
 		die "Failed to create $PORTAGE_BUILDDIR/.configured"
 	__vecho ">>> Source configured."
 
-	ebuild_phase post_src_configure
+	__ebuild_phase post_src_configure
 
 	trap - SIGINT SIGQUIT
 }
 
-dyn_compile() {
+__dyn_compile() {
 
 	if [[ -e $PORTAGE_BUILDDIR/.compiled ]] ; then
 		__vecho ">>> It appears that '${PF}' is already compiled; skipping."
@@ -430,13 +430,13 @@ dyn_compile() {
 		cd "${S}"
 	elif has $EAPI 0 1 2 3 ; then
 		cd "${WORKDIR}"
-	elif [[ -z ${A} ]] && ! has_phase_defined_up_to compile; then
+	elif [[ -z ${A} ]] && ! __has_phase_defined_up_to compile; then
 		cd "${WORKDIR}"
 	else
 		die "The source directory '${S}' doesn't exist"
 	fi
 
-	trap abort_compile SIGINT SIGQUIT
+	trap __abort_compile SIGINT SIGQUIT
 
 	if has distcc $FEATURES && has distcc-pump $FEATURES ; then
 		if [[ -z $INCLUDE_SERVER_PORT ]] || [[ ! -w $INCLUDE_SERVER_PORT ]] ; then
@@ -445,20 +445,20 @@ dyn_compile() {
 		fi
 	fi
 
-	ebuild_phase pre_src_compile
+	__ebuild_phase pre_src_compile
 
 	__vecho ">>> Compiling source in $PWD ..."
-	ebuild_phase src_compile
+	__ebuild_phase src_compile
 	>> "$PORTAGE_BUILDDIR/.compiled" || \
 		die "Failed to create $PORTAGE_BUILDDIR/.compiled"
 	__vecho ">>> Source compiled."
 
-	ebuild_phase post_src_compile
+	__ebuild_phase post_src_compile
 
 	trap - SIGINT SIGQUIT
 }
 
-dyn_test() {
+__dyn_test() {
 
 	if [[ -e $PORTAGE_BUILDDIR/.tested ]] ; then
 		__vecho ">>> It appears that ${PN} has already been tested; skipping."
@@ -472,7 +472,7 @@ dyn_test() {
 		! has test ${USE} && export USE="${USE} test"
 	fi
 
-	trap "abort_test" SIGINT SIGQUIT
+	trap "__abort_test" SIGINT SIGQUIT
 	if [ -d "${S}" ]; then
 		cd "${S}"
 	else
@@ -487,18 +487,18 @@ dyn_test() {
 	else
 		local save_sp=${SANDBOX_PREDICT}
 		addpredict /
-		ebuild_phase pre_src_test
-		ebuild_phase src_test
+		__ebuild_phase pre_src_test
+		__ebuild_phase src_test
 		>> "$PORTAGE_BUILDDIR/.tested" || \
 			die "Failed to create $PORTAGE_BUILDDIR/.tested"
-		ebuild_phase post_src_test
+		__ebuild_phase post_src_test
 		SANDBOX_PREDICT=${save_sp}
 	fi
 
 	trap - SIGINT SIGQUIT
 }
 
-dyn_install() {
+__dyn_install() {
 	[ -z "$PORTAGE_BUILDDIR" ] && die "${FUNCNAME}: PORTAGE_BUILDDIR is unset"
 	if has noauto $FEATURES ; then
 		rm -f "${PORTAGE_BUILDDIR}/.installed"
@@ -507,8 +507,8 @@ dyn_install() {
 		__vecho ">>> Remove '${PORTAGE_BUILDDIR}/.installed' to force install."
 		return 0
 	fi
-	trap "abort_install" SIGINT SIGQUIT
-	ebuild_phase pre_src_install
+	trap "__abort_install" SIGINT SIGQUIT
+	__ebuild_phase pre_src_install
 
 	_x=${ED}
 	[[ " ${FEATURES} " == *" force-prefix "* ]] || \
@@ -521,7 +521,7 @@ dyn_install() {
 		cd "${S}"
 	elif has $EAPI 0 1 2 3 ; then
 		cd "${WORKDIR}"
-	elif [[ -z ${A} ]] && ! has_phase_defined_up_to install; then
+	elif [[ -z ${A} ]] && ! __has_phase_defined_up_to install; then
 		cd "${WORKDIR}"
 	else
 		die "The source directory '${S}' doesn't exist"
@@ -541,12 +541,12 @@ dyn_install() {
 	export _E_EXEDESTTREE_=""
 	export _E_DOCDESTTREE_=""
 
-	ebuild_phase src_install
+	__ebuild_phase src_install
 	>> "$PORTAGE_BUILDDIR/.installed" || \
 		die "Failed to create $PORTAGE_BUILDDIR/.installed"
 	__vecho ">>> Completed installing ${PF} into ${D}"
 	__vecho
-	ebuild_phase post_src_install
+	__ebuild_phase post_src_install
 
 	cd "${PORTAGE_BUILDDIR}"/build-info
 	set -f
@@ -586,7 +586,7 @@ dyn_install() {
 	# local variables can leak into the saved environment.
 	unset f
 
-	save_ebuild_env --exclude-init-phases | filter_readonly_variables \
+	save_ebuild_env --exclude-init-phases | __filter_readonly_variables \
 		--filter-path --filter-sandbox --allow-extra-vars > environment
 	assert "save_ebuild_env failed"
 
@@ -601,15 +601,15 @@ dyn_install() {
 	trap - SIGINT SIGQUIT
 }
 
-dyn_preinst() {
+__dyn_preinst() {
 	if [ -z "${D}" ]; then
 		eerror "${FUNCNAME}: D is unset"
 		return 1
 	fi
-	ebuild_phase_with_hooks pkg_preinst
+	__ebuild_phase_with_hooks pkg_preinst
 }
 
-dyn_help() {
+__dyn_help() {
 	echo
 	echo "Portage"
 	echo "Copyright 1999-2010 Gentoo Foundation"
@@ -672,11 +672,11 @@ dyn_help() {
 	echo
 }
 
-# @FUNCTION: _ebuild_arg_to_phase
+# @FUNCTION: __ebuild_arg_to_phase
 # @DESCRIPTION:
 # Translate a known ebuild(1) argument into the precise
 # name of it's corresponding ebuild phase.
-_ebuild_arg_to_phase() {
+__ebuild_arg_to_phase() {
 	[ $# -ne 2 ] && die "expected exactly 2 args, got $#: $*"
 	local eapi=$1
 	local arg=$2
@@ -732,7 +732,7 @@ _ebuild_arg_to_phase() {
 	return 0
 }
 
-_ebuild_phase_funcs() {
+__ebuild_phase_funcs() {
 	[ $# -ne 2 ] && die "expected exactly 2 args, got $#: $*"
 	local eapi=$1
 	local phase_func=$2
@@ -742,7 +742,7 @@ _ebuild_phase_funcs() {
 
 	for x in pkg_nofetch src_unpack src_test ; do
 		declare -F $x >/dev/null || \
-			eval "$x() { _eapi0_$x \"\$@\" ; }"
+			eval "$x() { __eapi0_$x \"\$@\" ; }"
 	done
 
 	case "$eapi" in
@@ -752,10 +752,10 @@ _ebuild_phase_funcs() {
 			if ! declare -F src_compile >/dev/null ; then
 				case "$eapi" in
 					0)
-						src_compile() { _eapi0_src_compile "$@" ; }
+						src_compile() { __eapi0_src_compile "$@" ; }
 						;;
 					*)
-						src_compile() { _eapi1_src_compile "$@" ; }
+						src_compile() { __eapi1_src_compile "$@" ; }
 						;;
 				esac
 			fi
@@ -775,35 +775,35 @@ _ebuild_phase_funcs() {
 		*)
 
 			declare -F src_configure >/dev/null || \
-				src_configure() { _eapi2_src_configure "$@" ; }
+				src_configure() { __eapi2_src_configure "$@" ; }
 
 			declare -F src_compile >/dev/null || \
-				src_compile() { _eapi2_src_compile "$@" ; }
+				src_compile() { __eapi2_src_compile "$@" ; }
 
 			has $eapi 2 3 || declare -F src_install >/dev/null || \
-				src_install() { _eapi4_src_install "$@" ; }
+				src_install() { __eapi4_src_install "$@" ; }
 
 			if has $phase_func $default_phases ; then
 
-				_eapi2_pkg_nofetch   () { _eapi0_pkg_nofetch          "$@" ; }
-				_eapi2_src_unpack    () { _eapi0_src_unpack           "$@" ; }
-				_eapi2_src_prepare   () { true                             ; }
-				_eapi2_src_test      () { _eapi0_src_test             "$@" ; }
-				_eapi2_src_install   () { die "$FUNCNAME is not supported" ; }
+				__eapi2_pkg_nofetch   () { __eapi0_pkg_nofetch          "$@" ; }
+				__eapi2_src_unpack    () { __eapi0_src_unpack           "$@" ; }
+				__eapi2_src_prepare   () { true                             ; }
+				__eapi2_src_test      () { __eapi0_src_test             "$@" ; }
+				__eapi2_src_install   () { die "$FUNCNAME is not supported" ; }
 
 				for x in $default_phases ; do
-					eval "default_$x() { _eapi2_$x \"\$@\" ; }"
+					eval "default_$x() { __eapi2_$x \"\$@\" ; }"
 				done
 
-				eval "default() { _eapi2_$phase_func \"\$@\" ; }"
+				eval "default() { __eapi2_$phase_func \"\$@\" ; }"
 
 				case "$eapi" in
 					2|3)
 						;;
 					*)
-						eval "default_src_install() { _eapi4_src_install \"\$@\" ; }"
+						eval "default_src_install() { __eapi4_src_install \"\$@\" ; }"
 						[[ $phase_func = src_install ]] && \
-							eval "default() { _eapi4_$phase_func \"\$@\" ; }"
+							eval "default() { __eapi4_$phase_func \"\$@\" ; }"
 						;;
 				esac
 
@@ -825,7 +825,7 @@ _ebuild_phase_funcs() {
 	esac
 }
 
-ebuild_main() {
+__ebuild_main() {
 
 	# Subshell/helper die support (must export for the die helper).
 	# Since this function is typically executed in a subshell,
@@ -861,15 +861,15 @@ ebuild_main() {
 	# respect FEATURES="-ccache".
 	has ccache $FEATURES || export CCACHE_DISABLE=1
 
-	local phase_func=$(_ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE")
-	[[ -n $phase_func ]] && _ebuild_phase_funcs "$EAPI" "$phase_func"
+	local phase_func=$(__ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE")
+	[[ -n $phase_func ]] && __ebuild_phase_funcs "$EAPI" "$phase_func"
 	unset phase_func
 
 	source_all_bashrcs
 
 	case ${1} in
 	nofetch)
-		ebuild_phase_with_hooks pkg_nofetch
+		__ebuild_phase_with_hooks pkg_nofetch
 		;;
 	prerm|postrm|postinst|config|info)
 		if has "${1}" config info && \
@@ -878,17 +878,17 @@ ebuild_main() {
 		fi
 		export SANDBOX_ON="0"
 		if [ "${PORTAGE_DEBUG}" != "1" ] || [ "${-/x/}" != "$-" ]; then
-			ebuild_phase_with_hooks pkg_${1}
+			__ebuild_phase_with_hooks pkg_${1}
 		else
 			set -x
-			ebuild_phase_with_hooks pkg_${1}
+			__ebuild_phase_with_hooks pkg_${1}
 			set +x
 		fi
 		if [[ $EBUILD_PHASE == postinst ]] && [[ -n $PORTAGE_UPDATE_ENV ]]; then
 			# Update environment.bz2 in case installation phases
 			# need to pass some variables to uninstallation phases.
 			save_ebuild_env --exclude-init-phases | \
-				filter_readonly_variables --filter-path \
+				__filter_readonly_variables --filter-path \
 				--filter-sandbox --allow-extra-vars \
 				| ${PORTAGE_BZIP2_COMMAND} -c -f9 > "$PORTAGE_UPDATE_ENV"
 			assert "save_ebuild_env failed"
@@ -952,10 +952,10 @@ ebuild_main() {
 		esac
 
 		if [ "${PORTAGE_DEBUG}" != "1" ] || [ "${-/x/}" != "$-" ]; then
-			dyn_${1}
+			__dyn_${1}
 		else
 			set -x
-			dyn_${1}
+			__dyn_${1}
 			set +x
 		fi
 		export SANDBOX_ON="0"
@@ -966,10 +966,10 @@ ebuild_main() {
 		#in /etc.  If pkg_setup is in the sandbox, both our lilo and apache ebuilds break.
 		export SANDBOX_ON="0"
 		if [ "${PORTAGE_DEBUG}" != "1" ] || [ "${-/x/}" != "$-" ]; then
-			dyn_${1}
+			__dyn_${1}
 		else
 			set -x
-			dyn_${1}
+			__dyn_${1}
 			set +x
 		fi
 		;;
@@ -979,7 +979,7 @@ ebuild_main() {
 		export SANDBOX_ON="1"
 		echo "Unrecognized arg '${1}'"
 		echo
-		dyn_help
+		__dyn_help
 		exit 1
 		;;
 	esac
@@ -987,7 +987,7 @@ ebuild_main() {
 	# Save the env only for relevant phases.
 	if ! has "${1}" clean help info nofetch ; then
 		umask 002
-		save_ebuild_env | filter_readonly_variables \
+		save_ebuild_env | __filter_readonly_variables \
 			--filter-features > "$T/environment"
 		assert "save_ebuild_env failed"
 		chown portage:portage "$T/environment" &>/dev/null

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 6363366..6a249e1 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -409,7 +409,7 @@ econf() {
 
 	_hasgq() { _hasg "$@" >/dev/null ; }
 
-	local phase_func=$(_ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE")
+	local phase_func=$(__ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE")
 	if [[ -n $phase_func ]] ; then
 		if has "$EAPI" 0 1 ; then
 			[[ $phase_func != src_compile ]] && \
@@ -552,7 +552,7 @@ einstall() {
 	fi
 }
 
-_eapi0_pkg_nofetch() {
+__eapi0_pkg_nofetch() {
 	[ -z "${SRC_URI}" ] && return
 
 	elog "The following are listed in SRC_URI for ${PN}:"
@@ -562,18 +562,18 @@ _eapi0_pkg_nofetch() {
 	done
 }
 
-_eapi0_src_unpack() {
+__eapi0_src_unpack() {
 	[[ -n ${A} ]] && unpack ${A}
 }
 
-_eapi0_src_compile() {
+__eapi0_src_compile() {
 	if [ -x ./configure ] ; then
 		econf
 	fi
-	_eapi2_src_compile
+	__eapi2_src_compile
 }
 
-_eapi0_src_test() {
+__eapi0_src_test() {
 	# Since we don't want emake's automatic die
 	# support (EAPI 4 and later), and we also don't
 	# want the warning messages that it produces if
@@ -599,24 +599,24 @@ _eapi0_src_test() {
 	fi
 }
 
-_eapi1_src_compile() {
-	_eapi2_src_configure
-	_eapi2_src_compile
+__eapi1_src_compile() {
+	__eapi2_src_configure
+	__eapi2_src_compile
 }
 
-_eapi2_src_configure() {
+__eapi2_src_configure() {
 	if [[ -x ${ECONF_SOURCE:-.}/configure ]] ; then
 		econf
 	fi
 }
 
-_eapi2_src_compile() {
+__eapi2_src_compile() {
 	if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]; then
 		emake || die "emake failed"
 	fi
 }
 
-_eapi4_src_install() {
+__eapi4_src_install() {
 	if [[ -f Makefile || -f GNUmakefile || -f makefile ]] ; then
 		emake DESTDIR="${D}" install
 	fi

diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
index f2deda2..f3a723b 100644
--- a/bin/save-ebuild-env.sh
+++ b/bin/save-ebuild-env.sh
@@ -42,7 +42,7 @@ save_ebuild_env() {
 	for x in pkg_setup pkg_nofetch src_unpack src_prepare src_configure \
 		src_compile src_test src_install pkg_preinst pkg_postinst \
 		pkg_prerm pkg_postrm ; do
-		unset -f default_$x _eapi{0,1,2,3,4}_$x
+		unset -f default_$x __eapi{0,1,2,3,4}_$x
 	done
 	unset x
 
@@ -51,24 +51,25 @@ save_ebuild_env() {
 		__quiet_mode __vecho __elog_base eqawarn elog \
 		einfo einfon ewarn eerror ebegin __eend eend KV_major \
 		KV_minor KV_micro KV_to_int get_KV __1 __1 has \
-		has_phase_defined_up_to \
+		__has_phase_defined_up_to \
 		hasv hasq qa_source qa_call \
 		addread addwrite adddeny addpredict _sb_append_var \
 		use usev useq has_version portageq \
 		best_version use_with use_enable register_die_hook \
 		keepdir unpack __strip_duplicate_slashes econf einstall \
-		dyn_setup dyn_unpack dyn_clean into insinto exeinto docinto \
+		__dyn_setup __dyn_unpack __dyn_clean \
+		into insinto exeinto docinto \
 		insopts diropts exeopts libopts docompress \
-		abort_handler abort_prepare abort_configure abort_compile \
-		abort_test abort_install dyn_prepare dyn_configure \
-		dyn_compile dyn_test dyn_install \
-		dyn_preinst dyn_pretend dyn_help debug-print debug-print-function \
+		__abort_handler __abort_prepare __abort_configure __abort_compile \
+		__abort_test __abort_install __dyn_prepare dyn_configure \
+		__dyn_compile dyn_test dyn_install \
+		__dyn_preinst dyn_pretend dyn_help debug-print debug-print-function \
 		debug-print-section __helpers_die inherit EXPORT_FUNCTIONS \
 		nonfatal register_success_hook \
-		save_ebuild_env filter_readonly_variables preprocess_ebuild_env \
+		save_ebuild_env __filter_readonly_variables __preprocess_ebuild_env \
 		source_all_bashrcs \
-		ebuild_main ebuild_phase ebuild_phase_with_hooks \
-		_ebuild_arg_to_phase _ebuild_phase_funcs default \
+		__ebuild_main __ebuild_phase __ebuild_phase_with_hooks \
+		__ebuild_arg_to_phase __ebuild_phase_funcs default \
 		_hasg _hasgq _unpack_tar \
 		${QA_INTERCEPTORS}
 

diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index a6426ee..89b6050 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -1261,7 +1261,7 @@ def _spawn_actionmap(settings):
 	misc_sh_binary = os.path.join(portage_bin_path,
 		os.path.basename(MISC_SH_BINARY))
 	ebuild_sh = _shell_quote(ebuild_sh_binary) + " %s"
-	misc_sh = _shell_quote(misc_sh_binary) + " dyn_%s"
+	misc_sh = _shell_quote(misc_sh_binary) + " __dyn_%s"
 
 	# args are for the to spawn function
 	actionmap = {


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/
@ 2012-09-18  2:59 Zac Medico
  0 siblings, 0 replies; 14+ messages in thread
From: Zac Medico @ 2012-09-18  2:59 UTC (permalink / raw
  To: gentoo-commits

commit:     1d9b8968460c4bdb44daeda3454ef0ef5035c398
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 18 02:59:23 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Sep 18 02:59:23 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1d9b8968

doebuild: update environment.bz2 for pre/postinst

Also, remove unnecessary __dyn_preinst func.

---
 bin/misc-functions.sh                  |    2 +-
 bin/phase-functions.sh                 |   14 +++-----------
 bin/save-ebuild-env.sh                 |    2 +-
 pym/portage/package/ebuild/doebuild.py |   12 ++++++++++--
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index 486b8d2..1159ca5 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -1082,7 +1082,7 @@ preinst_selinux_labels() {
 		 return 1
 	fi
 	if has selinux ${FEATURES}; then
-		# SELinux file labeling (needs to always be last in __dyn_preinst)
+		# SELinux file labeling (needs to execute after preinst)
 		# only attempt to label if setfiles is executable
 		# and 'context' is available on selinuxfs.
 		if [ -f /selinux/context -o -f /sys/fs/selinux/context ] && \

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index 7048419..92e25c6 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -601,14 +601,6 @@ __dyn_install() {
 	trap - SIGINT SIGQUIT
 }
 
-__dyn_preinst() {
-	if [ -z "${D}" ]; then
-		eerror "${FUNCNAME}: D is unset"
-		return 1
-	fi
-	__ebuild_phase_with_hooks pkg_preinst
-}
-
 __dyn_help() {
 	echo
 	echo "Portage"
@@ -871,7 +863,7 @@ __ebuild_main() {
 	nofetch)
 		__ebuild_phase_with_hooks pkg_nofetch
 		;;
-	prerm|postrm|postinst|config|info)
+	prerm|postrm|preinst|postinst|config|info)
 		if has "${1}" config info && \
 			! declare -F "pkg_${1}" >/dev/null ; then
 			ewarn  "pkg_${1}() is not defined: '${EBUILD##*/}'"
@@ -884,7 +876,7 @@ __ebuild_main() {
 			__ebuild_phase_with_hooks pkg_${1}
 			set +x
 		fi
-		if [[ $EBUILD_PHASE == postinst ]] && [[ -n $PORTAGE_UPDATE_ENV ]]; then
+		if [[ -n $PORTAGE_UPDATE_ENV ]] ; then
 			# Update environment.bz2 in case installation phases
 			# need to pass some variables to uninstallation phases.
 			__save_ebuild_env --exclude-init-phases | \
@@ -960,7 +952,7 @@ __ebuild_main() {
 		fi
 		export SANDBOX_ON="0"
 		;;
-	help|pretend|setup|preinst)
+	help|pretend|setup)
 		#pkg_setup needs to be out of the sandbox for tmp file creation;
 		#for example, awking and piping a file in /tmp requires a temp file to be created
 		#in /etc.  If pkg_setup is in the sandbox, both our lilo and apache ebuilds break.

diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
index de8e1fb..7ae3938 100644
--- a/bin/save-ebuild-env.sh
+++ b/bin/save-ebuild-env.sh
@@ -63,7 +63,7 @@ __save_ebuild_env() {
 		__abort_handler __abort_prepare __abort_configure __abort_compile \
 		__abort_test __abort_install __dyn_prepare __dyn_configure \
 		__dyn_compile __dyn_test __dyn_install \
-		__dyn_preinst __dyn_pretend __dyn_help \
+		__dyn_pretend __dyn_help \
 		debug-print debug-print-function \
 		debug-print-section __helpers_die inherit EXPORT_FUNCTIONS \
 		nonfatal register_success_hook \

diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 89b6050..7200327 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -904,8 +904,16 @@ def doebuild(myebuild, mydo, _unused=None, settings=None, debug=0, listonly=0,
 		# the sandbox -- and stop now.
 		if mydo in ("config", "help", "info", "postinst",
 			"preinst", "pretend", "postrm", "prerm"):
-			return _spawn_phase(mydo, mysettings,
-				fd_pipes=fd_pipes, logfile=logfile, returnpid=returnpid)
+			if mydo in ("preinst", "postinst"):
+				env_file = os.path.join(os.path.dirname(mysettings["EBUILD"]),
+					"environment.bz2")
+				if os.path.isfile(env_file):
+					mysettings["PORTAGE_UPDATE_ENV"] = env_file
+			try:
+				return _spawn_phase(mydo, mysettings,
+					fd_pipes=fd_pipes, logfile=logfile, returnpid=returnpid)
+			finally:
+				mysettings.pop("PORTAGE_UPDATE_ENV", None)
 
 		mycpv = "/".join((mysettings["CATEGORY"], mysettings["PF"]))
 


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/
@ 2013-01-15 20:52 Zac Medico
  0 siblings, 0 replies; 14+ messages in thread
From: Zac Medico @ 2013-01-15 20:52 UTC (permalink / raw
  To: gentoo-commits

commit:     007c92003a6ef9eb6d70b06ca463805a0f4cf32f
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 15 20:52:23 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Jan 15 20:52:23 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=007c9200

doebuild: tweak handling of _unused param

---
 bin/ebuild                             |    2 +-
 pym/portage/package/ebuild/doebuild.py |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/bin/ebuild b/bin/ebuild
index 754b9a9..44b3c99 100755
--- a/bin/ebuild
+++ b/bin/ebuild
@@ -331,7 +331,7 @@ for arg in pargs:
 
 		if arg in ("digest", "manifest") and force:
 			discard_digests(ebuild, tmpsettings, portage.portdb)
-		a = portage.doebuild(ebuild, arg, portage.root, tmpsettings,
+		a = portage.doebuild(ebuild, arg, settings=tmpsettings,
 			debug=debug, tree=mytree,
 			vartree=portage.db[portage.root]['vartree'])
 	except KeyboardInterrupt:

diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index a214c39..bef1989 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -454,7 +454,7 @@ _doebuild_commands_without_builddir = (
 	'fetch', 'fetchall', 'help', 'manifest'
 )
 
-def doebuild(myebuild, mydo, _unused=None, settings=None, debug=0, listonly=0,
+def doebuild(myebuild, mydo, _unused=DeprecationWarning, settings=None, debug=0, listonly=0,
 	fetchonly=0, cleanup=0, dbkey=DeprecationWarning, use_cache=1, fetchall=0, tree=None,
 	mydbapi=None, vartree=None, prev_mtimes=None,
 	fd_pipes=None, returnpid=False):
@@ -518,10 +518,10 @@ def doebuild(myebuild, mydo, _unused=None, settings=None, debug=0, listonly=0,
 	mysettings = settings
 	myroot = settings['EROOT']
 
-	if _unused is not None and _unused != mysettings['EROOT']:
+	if _unused is not DeprecationWarning:
 		warnings.warn("The third parameter of the "
-			"portage.doebuild() is now unused. Use "
-			"settings['ROOT'] instead.",
+			"portage.doebuild() is deprecated. Instead "
+			"settings['EROOT'] is used.",
 			DeprecationWarning, stacklevel=2)
 
 	if dbkey is not DeprecationWarning:


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/
@ 2013-07-16 17:52 Arfrever Frehtes Taifersar Arahesis
  0 siblings, 0 replies; 14+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2013-07-16 17:52 UTC (permalink / raw
  To: gentoo-commits

commit:     e72b8b90542d1ed2bf53c2b9a0491795c12e63c2
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Tue Jul 16 17:50:59 2013 +0000
Commit:     Arfrever Frehtes Taifersar Arahesis <arfrever.fta <AT> gmail <DOT> com>
CommitDate: Tue Jul 16 17:50:59 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e72b8b90

Stop using PORTDIR_OVERLAY in bash part of Portage.

---
 bin/ebuild.sh                          | 34 ++++++++++++++--------------------
 bin/isolated-functions.sh              | 25 +++++++++++++++++--------
 bin/phase-functions.sh                 |  2 +-
 pym/portage/package/ebuild/doebuild.py |  2 +-
 4 files changed, 33 insertions(+), 30 deletions(-)

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index cb5fca7..fc7fd9e 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -207,8 +207,10 @@ inherit() {
 			| fmt -w 75 | while read -r ; do eqawarn "$REPLY" ; done
 	fi
 
+	local repo
+	local repo_location
 	local location
-	local olocation
+	local potential_location
 	local x
 
 	# These variables must be restored before returning.
@@ -222,8 +224,8 @@ inherit() {
 	local B_PDEPEND
 	local B_HDEPEND
 	while [ "$1" ]; do
-		location="${ECLASSDIR}/${1}.eclass"
-		olocation=""
+		location=""
+		potential_location=""
 
 		export ECLASS="$1"
 		__export_funcs_var=__export_functions_$ECLASS_DEPTH
@@ -244,24 +246,16 @@ inherit() {
 			fi
 		fi
 
-		# any future resolution code goes here
-		if [ -n "$PORTDIR_OVERLAY" ]; then
-			local overlay
-			for overlay in ${PORTDIR_OVERLAY}; do
-				olocation="${overlay}/eclass/${1}.eclass"
-				if [ -e "$olocation" ]; then
-					location="${olocation}"
-					debug-print "  eclass exists: ${location}"
-				fi
-			done
-		fi
+		for repo in $(__repo_key ${PORTAGE_REPO_NAME} masters) ${PORTAGE_REPO_NAME} $(__repo_key ${PORTAGE_REPO_NAME} eclass-overrides); do
+			repo_location="$(__repo_key ${repo} location)"
+			potential_location="${repo_location}/eclass/${1}.eclass"
+			if [[ -f ${potential_location} ]]; then
+				location="${potential_location}"
+				debug-print "  eclass exists: ${location}"
+			fi
+		done
 		debug-print "inherit: $1 -> $location"
-		[ ! -e "$location" ] && die "${1}.eclass could not be found by inherit()"
-
-		if [ "${location}" == "${olocation}" ] && \
-			! has "${location}" ${EBUILD_OVERLAY_ECLASSES} ; then
-				EBUILD_OVERLAY_ECLASSES="${EBUILD_OVERLAY_ECLASSES} ${location}"
-		fi
+		[[ -z ${location} ]] && die "${1}.eclass could not be found by inherit()"
 
 		#We need to back up the values of *DEPEND to B_*DEPEND
 		#(if set).. and then restore them after the inherit call.

diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 1f8a27e..61ed8b7 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/eapi.sh"
@@ -176,13 +176,6 @@ die() {
 	fi
 	eerror "If you need support, post the output of \`emerge --info '=$CATEGORY/$PF'\`,"
 	eerror "the complete build log and the output of \`emerge -pqv '=$CATEGORY/$PF'\`."
-	if [[ -n ${EBUILD_OVERLAY_ECLASSES} ]] ; then
-		eerror "This ebuild used the following eclasses from overlays:"
-		local x
-		for x in ${EBUILD_OVERLAY_ECLASSES} ; do
-			eerror "  ${x}"
-		done
-	fi
 	if [ "${EMERGE_FROM}" != "binary" ] && \
 		! has ${EBUILD_PHASE} prerm postrm && \
 		[ "${EBUILD#${PORTDIR}/}" == "${EBUILD}" ] ; then
@@ -482,4 +475,20 @@ has() {
 	return 1
 }
 
+__repo_key() {
+	local appropriate_section=0 exit_status=1 line saved_extglob_shopt=$(shopt -p extglob)
+	shopt -s extglob
+	while read line; do
+		[[ ${appropriate_section} == 0 && ${line} == "[$1]" ]] && appropriate_section=1 && continue
+		[[ ${appropriate_section} == 1 && ${line} == "["*"]" ]] && appropriate_section=0 && continue
+		if [[ ${appropriate_section} == 1 && ${line} == $2*( )=* ]]; then
+			echo "${line##$2*( )=*( )}"
+			exit_status=0
+			break
+		fi
+	done <<< "${PORTAGE_REPOSITORIES}"
+	eval "${saved_extglob_shopt}"
+	return ${exit_status}
+}
+
 true

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index f67879e..dc4da6a 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -29,7 +29,7 @@ PORTAGE_READONLY_VARS="D EBUILD EBUILD_PHASE EBUILD_PHASE_FUNC \
 	PORTAGE_SAVED_READONLY_VARS PORTAGE_SIGPIPE_STATUS \
 	PORTAGE_TMPDIR PORTAGE_UPDATE_ENV PORTAGE_USERNAME \
 	PORTAGE_VERBOSE PORTAGE_WORKDIR_MODE PORTAGE_XATTR_EXCLUDE \
-	PORTDIR PORTDIR_OVERLAY \
+	PORTDIR \
 	PROFILE_PATHS REPLACING_VERSIONS REPLACED_BY_VERSION T WORKDIR \
 	__PORTAGE_HELPER __PORTAGE_TEST_HARDLINK_LOCKS"
 

diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 7ffe66b..9db600e 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -305,11 +305,11 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
 	if hasattr(mydbapi, 'repositories'):
 		repo = mydbapi.repositories.get_repo_for_location(mytree)
 		mysettings['PORTDIR'] = repo.eclass_db.porttrees[0]
-		mysettings['PORTDIR_OVERLAY'] = ' '.join(repo.eclass_db.porttrees[1:])
 		mysettings['PORTAGE_REPOSITORIES'] = mydbapi.repositories.config_string()
 		mysettings.configdict["pkg"]["PORTAGE_REPO_NAME"] = repo.name
 
 	mysettings["PORTDIR"] = os.path.realpath(mysettings["PORTDIR"])
+	mysettings.pop("PORTDIR_OVERLAY", None)
 	mysettings["DISTDIR"] = os.path.realpath(mysettings["DISTDIR"])
 	mysettings["RPMDIR"]  = os.path.realpath(mysettings["RPMDIR"])
 


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/
@ 2018-02-05 19:25 Michał Górny
  0 siblings, 0 replies; 14+ messages in thread
From: Michał Górny @ 2018-02-05 19:25 UTC (permalink / raw
  To: gentoo-commits

commit:     fa3f1ba8153644e07be3215d8862522a0de12134
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat May 21 06:54:19 2016 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Feb  5 19:25:14 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=fa3f1ba8

portage.package.ebuild.config: Always export filtered USE_EXPAND vars

Ensure that all USE_EXPAND variables are always exported with filtered
USE flags inside, even if none of those flags are declared in IUSE.
This is the behavior required for EAPI 5+ by the PMS.

Since the behavior for earlier EAPIs is left undefined and having
different behavior would be confusing to users, apply it in earlier
EAPIs as well.

Bug: https://bugs.gentoo.org/582140
Closes: https://github.com/gentoo/portage/pull/254
Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/ebuild.sh                        |  8 +-----
 pym/portage/package/ebuild/config.py | 55 ++----------------------------------
 2 files changed, 4 insertions(+), 59 deletions(-)

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 4a80fdd06..d63b0a0ba 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 # Prevent aliases from causing portage to act inappropriately.
@@ -704,12 +704,6 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
 	fi
 fi
 
-# unset USE_EXPAND variables that contain only the special "*" token
-for x in ${USE_EXPAND} ; do
-	[ "${!x}" == "*" ] && unset ${x}
-done
-unset x
-
 if has nostrip ${FEATURES} ${RESTRICT} || has strip ${RESTRICT}
 then
 	export DEBUGBUILD=1

diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 35cf4f614..432520ba8 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -1359,47 +1359,7 @@ class config(object):
 					filtered_var_split.append(x)
 			var_split = filtered_var_split
 
-			if var_split:
-				value = ' '.join(var_split)
-			else:
-				# Don't export empty USE_EXPAND vars unless the user config
-				# exports them as empty.  This is required for vars such as
-				# LINGUAS, where unset and empty have different meanings.
-				# The special '*' token is understood by ebuild.sh, which
-				# will unset the variable so that things like LINGUAS work
-				# properly (see bug #459350).
-				if has_wildcard:
-					value = '*'
-				else:
-					if has_iuse:
-						already_set = False
-						# Skip the first 'env' configdict, in order to
-						# avoid infinite recursion here, since that dict's
-						# __getitem__ calls the current __getitem__.
-						for d in self._settings.lookuplist[1:]:
-							if key in d:
-								already_set = True
-								break
-
-						if not already_set:
-							for x in self._unfiltered_use:
-								if x[:prefix_len] == prefix:
-									already_set = True
-									break
-
-						if already_set:
-							value = ''
-						else:
-							value = '*'
-					else:
-						# It's not in IUSE, so just allow the variable content
-						# to pass through if it is defined somewhere.  This
-						# allows packages that support LINGUAS but don't
-						# declare it in IUSE to use the variable outside of the
-						# USE_EXPAND context.
-						value = None
-
-			return value
+			return ' '.join(var_split)
 
 	def _setcpv_recursion_gate(f):
 		"""
@@ -1775,7 +1735,7 @@ class config(object):
 			self, unfiltered_use, use, self.usemask,
 			portage_iuse, use_expand_split, self._use_expand_dict)
 
-		use_expand_iuses = {}
+		use_expand_iuses = dict((k, set()) for k in use_expand_split)
 		for x in portage_iuse:
 			x_split = x.split('_')
 			if len(x_split) == 1:
@@ -1783,18 +1743,9 @@ class config(object):
 			for i in range(len(x_split) - 1):
 				k = '_'.join(x_split[:i+1])
 				if k in use_expand_split:
-					v = use_expand_iuses.get(k)
-					if v is None:
-						v = set()
-						use_expand_iuses[k] = v
-					v.add(x)
+					use_expand_iuses[k].add(x)
 					break
 
-		# If it's not in IUSE, variable content is allowed
-		# to pass through if it is defined somewhere.  This
-		# allows packages that support LINGUAS but don't
-		# declare it in IUSE to use the variable outside of the
-		# USE_EXPAND context.
 		for k, use_expand_iuse in use_expand_iuses.items():
 			if k + '_*' in use:
 				use.update( x for x in use_expand_iuse if x not in usemask )


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-02-05 19:25 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-15 20:52 [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/ Zac Medico
  -- strict thread matches above, loose matches on Subject: below --
2018-02-05 19:25 Michał Górny
2013-07-16 17:52 Arfrever Frehtes Taifersar Arahesis
2012-09-18  2:59 Zac Medico
2012-09-14  7:26 Zac Medico
2012-09-13 18:25 Zac Medico
2012-04-22 17:56 Zac Medico
2011-11-10  3:12 Zac Medico
2011-11-09  0:21 Zac Medico
2011-11-05 18:53 Zac Medico
2011-10-15 18:38 Zac Medico
2011-09-22  0:05 Zac Medico
2011-08-28 23:32 Zac Medico
2011-05-07 22:00 Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox