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

commit:     ce501b36d7078db059c606d3b4f38637ad09528e
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Sep  1 02:52:58 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Sep  1 02:52:58 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ce501b36

xml/metadata: implement XMLParser.doctype()

Avoid deprecation warnings again, like in commit
63035acd702ab0cdaac31e33676b5a20a91eae47.

---
 bin/ebuild-helpers/doexe                         |    8 +-
 bin/ebuild-helpers/doins                         |   16 ++--
 bin/ebuild-helpers/dosed                         |    8 +-
 bin/ebuild.sh                                    |   88 +++++++++++++---------
 pym/portage/dbapi/vartree.py                     |    9 ++-
 pym/portage/package/ebuild/doebuild.py           |    4 +-
 pym/portage/tests/emerge/test_simple.py          |   45 +++++++++--
 pym/portage/tests/resolver/ResolverPlayground.py |    3 +
 pym/portage/xml/metadata.py                      |   15 +++-
 9 files changed, 136 insertions(+), 60 deletions(-)

diff --git a/bin/ebuild-helpers/doexe b/bin/ebuild-helpers/doexe
index 360800e..f44cfba 100755
--- a/bin/ebuild-helpers/doexe
+++ b/bin/ebuild-helpers/doexe
@@ -9,8 +9,10 @@ if [[ $# -lt 1 ]] ; then
 	exit 1
 fi
 
-if [[ ! -d ${D}${_E_EXEDESTTREE_} ]] ; then
-	install -d "${D}${_E_EXEDESTTREE_}"
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
+if [[ ! -d ${ED}${_E_EXEDESTTREE_} ]] ; then
+	install -d "${ED}${_E_EXEDESTTREE_}"
 fi
 
 TMP=$T/.doexe_tmp
@@ -29,7 +31,7 @@ for x in "$@" ; do
 		mysrc="${x}"
 	fi
 	if [ -e "$mysrc" ] ; then
-		install $EXEOPTIONS "$mysrc" "$D$_E_EXEDESTTREE_"
+		install $EXEOPTIONS "$mysrc" "$ED$_E_EXEDESTTREE_"
 	else
 		echo "!!! ${0##*/}: $mysrc does not exist" 1>&2
 		false

diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins
index 7dec146..1ca69a6 100755
--- a/bin/ebuild-helpers/doins
+++ b/bin/ebuild-helpers/doins
@@ -27,12 +27,14 @@ else
 	DOINSRECUR=n
 fi
 
-if [[ ${INSDESTTREE#${D}} != "${INSDESTTREE}" ]]; then
+case "$EAPI" in 0|1|2) export ED="${D}" ;; esac
+
+if [[ ${INSDESTTREE#${ED}} != "${INSDESTTREE}" ]]; then
 	vecho "-------------------------------------------------------" 1>&2
-	vecho "You should not use \${D} with helpers." 1>&2
+	vecho "You should not use \${ED} with helpers." 1>&2
 	vecho "  --> ${INSDESTTREE}" 1>&2
 	vecho "-------------------------------------------------------" 1>&2
-	helpers_die "${0##*/} used with \${D}"
+	helpers_die "${0##*/} used with \${ED}"
 	exit 1
 fi
 
@@ -49,7 +51,7 @@ export TMP=$T/.doins_tmp
 # Use separate directories to avoid potential name collisions.
 mkdir -p "$TMP"/{1,2}
 
-[[ ! -d ${D}${INSDESTTREE} ]] && dodir "${INSDESTTREE}"
+[[ ! -d ${ED}${INSDESTTREE} ]] && dodir "${INSDESTTREE}"
 
 _doins() {
 	local mysrc="$1" mydir="$2" cleanup="" rval
@@ -63,8 +65,8 @@ _doins() {
 		# $PORTAGE_ACTUAL_DISTDIR/.
 		if [ $PRESERVE_SYMLINKS = y ] && \
 			! [[ $(readlink "$mysrc") == "$PORTAGE_ACTUAL_DISTDIR"/* ]] ; then
-			rm -rf "$D$INSDESTTREE/$mydir/${mysrc##*/}" || return $?
-			cp -P "$mysrc" "$D$INSDESTTREE/$mydir/${mysrc##*/}"
+			rm -rf "${ED}$INSDESTTREE/$mydir/${mysrc##*/}" || return $?
+			cp -P "$mysrc" "${ED}$INSDESTTREE/$mydir/${mysrc##*/}"
 			return $?
 		else
 			cp "$mysrc" "$TMP/2/${mysrc##*/}" || return $?
@@ -73,7 +75,7 @@ _doins() {
 		fi
 	fi
 
-	install ${INSOPTIONS} "${mysrc}" "${D}${INSDESTTREE}/${mydir}"
+	install ${INSOPTIONS} "${mysrc}" "${ED}${INSDESTTREE}/${mydir}"
 	rval=$?
 	[[ -n ${cleanup} ]] && rm -f "${cleanup}"
 	[ $rval -ne 0 ] && echo "!!! ${0##*/}: $mysrc does not exist" 1>&2

diff --git a/bin/ebuild-helpers/dosed b/bin/ebuild-helpers/dosed
index afc949b..00cf5da 100755
--- a/bin/ebuild-helpers/dosed
+++ b/bin/ebuild-helpers/dosed
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 if [[ $# -lt 1 ]] ; then
@@ -7,12 +7,14 @@ if [[ $# -lt 1 ]] ; then
 	exit 1
 fi
 
+case "$EAPI" in 0|1|2) ED=${D} ;; esac
+
 ret=0
 file_found=0
-mysed="s:${D}::g"
+mysed="s:${ED}::g"
 
 for x in "$@" ; do
-	y=$D${x#/}
+	y=$ED${x#/}
 	if [ -e "${y}" ] ; then
 		if [ -f "${y}" ] ; then
 			file_found=1

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 23a1240..ae03df7 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -325,9 +325,11 @@ declare -a PORTAGE_DOCOMPRESS_SKIP=( /usr/share/doc/${PF}/html )
 keepdir() {
 	dodir "$@"
 	local x
+	local ed=${ED}
+	case "$EAPI" in 0|1|2) ed=${D} ;; esac
 	if [ "$1" == "-R" ] || [ "$1" == "-r" ]; then
 		shift
-		find "$@" -type d -printf "${D}%p/.keep_${CATEGORY}_${PN}-${SLOT}\n" \
+		find "$@" -type d -printf "${ed}%p/.keep_${CATEGORY}_${PN}-${SLOT}\n" \
 			| tr "\n" "\0" | \
 			while read -r -d $'\0' ; do
 				>> "$REPLY" || \
@@ -335,8 +337,8 @@ keepdir() {
 			done
 	else
 		for x in "$@"; do
-			>> "${D}${x}/.keep_${CATEGORY}_${PN}-${SLOT}" || \
-				die "Failed to create .keep in ${D}${x}"
+			>> "${ed}${x}/.keep_${CATEGORY}_${PN}-${SLOT}" || \
+				die "Failed to create .keep in ${ed}${x}"
 		done
 	fi
 }
@@ -484,6 +486,8 @@ hasg() {
 hasgq() { hasg "$@" >/dev/null ; }
 econf() {
 	local x
+	local eprefix=${EPREFIX}
+	case "$EAPI" in 0|1|2) eprefix= ;; esac
 
 	local phase_func=$(_ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE")
 	if [[ -n $phase_func ]] ; then
@@ -505,12 +509,12 @@ econf() {
 			sed -e "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" -i "$ECONF_SOURCE/configure" || \
 				die "Substition of shebang in '$ECONF_SOURCE/configure' failed"
 		fi
-		if [ -e /usr/share/gnuconfig/ ]; then
+		if [ -e "${eprefix}"/usr/share/gnuconfig/ ]; then
 			find "${WORKDIR}" -type f '(' \
 			-name config.guess -o -name config.sub ')' -print0 | \
 			while read -r -d $'\0' x ; do
-				vecho " * econf: updating ${x/${WORKDIR}\/} with /usr/share/gnuconfig/${x##*/}"
-				cp -f /usr/share/gnuconfig/"${x##*/}" "${x}"
+				vecho " * econf: updating ${x/${WORKDIR}\/} with ${eprefix}/usr/share/gnuconfig/${x##*/}"
+				cp -f "${eprefix}"/usr/share/gnuconfig/"${x##*/}" "${x}"
 			done
 		fi
 
@@ -530,7 +534,7 @@ econf() {
 		if [[ -n ${CONF_LIBDIR} ]] && ! hasgq --libdir=\* "$@" ; then
 			export CONF_PREFIX=$(hasg --exec-prefix=\* "$@")
 			[[ -z ${CONF_PREFIX} ]] && CONF_PREFIX=$(hasg --prefix=\* "$@")
-			: ${CONF_PREFIX:=/usr}
+			: ${CONF_PREFIX:=${eprefix}/usr}
 			CONF_PREFIX=${CONF_PREFIX#*=}
 			[[ ${CONF_PREFIX} != /* ]] && CONF_PREFIX="/${CONF_PREFIX}"
 			[[ ${CONF_LIBDIR} != /* ]] && CONF_LIBDIR="/${CONF_LIBDIR}"
@@ -538,15 +542,15 @@ econf() {
 		fi
 
 		set -- \
-			--prefix=/usr \
+			--prefix="${eprefix}"/usr \
 			${CBUILD:+--build=${CBUILD}} \
 			--host=${CHOST} \
 			${CTARGET:+--target=${CTARGET}} \
-			--mandir=/usr/share/man \
-			--infodir=/usr/share/info \
-			--datadir=/usr/share \
-			--sysconfdir=/etc \
-			--localstatedir=/var/lib \
+			--mandir="${eprefix}"/usr/share/man \
+			--infodir="${eprefix}"/usr/share/info \
+			--datadir="${eprefix}"/usr/share \
+			--sysconfdir="${eprefix}"/etc \
+			--localstatedir="${eprefix}"/var/lib \
 			"$@" \
 			${EXTRA_ECONF}
 		vecho "${ECONF_SOURCE}/configure" "$@"
@@ -570,6 +574,8 @@ econf() {
 einstall() {
 	# CONF_PREFIX is only set if they didn't pass in libdir above.
 	local LOCAL_EXTRA_EINSTALL="${EXTRA_EINSTALL}"
+	local ed=${ED}
+	case "$EAPI" in 0|1|2) ed=${D} ;; esac
 	LIBDIR_VAR="LIBDIR_${ABI}"
 	if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then
 		CONF_LIBDIR="${!LIBDIR_VAR}"
@@ -584,22 +590,22 @@ einstall() {
 
 	if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then
 		if [ "${PORTAGE_DEBUG}" == "1" ]; then
-			${MAKE:-make} -n prefix="${D}usr" \
-				datadir="${D}usr/share" \
-				infodir="${D}usr/share/info" \
-				localstatedir="${D}var/lib" \
-				mandir="${D}usr/share/man" \
-				sysconfdir="${D}etc" \
+			${MAKE:-make} -n prefix="${ed}usr" \
+				datadir="${ed}usr/share" \
+				infodir="${ed}usr/share/info" \
+				localstatedir="${ed}var/lib" \
+				mandir="${ed}usr/share/man" \
+				sysconfdir="${ed}etc" \
 				${LOCAL_EXTRA_EINSTALL} \
 				${MAKEOPTS} ${EXTRA_EMAKE} -j1 \
 				"$@" install
 		fi
-		${MAKE:-make} prefix="${D}usr" \
-			datadir="${D}usr/share" \
-			infodir="${D}usr/share/info" \
-			localstatedir="${D}var/lib" \
-			mandir="${D}usr/share/man" \
-			sysconfdir="${D}etc" \
+		${MAKE:-make} prefix="${ed}usr" \
+			datadir="${ed}usr/share" \
+			infodir="${ed}usr/share/info" \
+			localstatedir="${ed}var/lib" \
+			mandir="${ed}usr/share/man" \
+			sysconfdir="${ed}etc" \
 			${LOCAL_EXTRA_EINSTALL} \
 			${MAKEOPTS} ${EXTRA_EMAKE} -j1 \
 			"$@" install || die "einstall failed"
@@ -795,8 +801,10 @@ into() {
 		export DESTTREE=""
 	else
 		export DESTTREE=$1
-		if [ ! -d "${D}${DESTTREE}" ]; then
-			install -d "${D}${DESTTREE}"
+		local ed=${ED}
+		case "$EAPI" in 0|1|2) ed=${D} ;; esac
+		if [ ! -d "${ed}${DESTTREE}" ]; then
+			install -d "${ed}${DESTTREE}"
 			local ret=$?
 			if [[ $ret -ne 0 ]] ; then
 				helpers_die "${FUNCNAME[0]} failed"
@@ -811,8 +819,10 @@ insinto() {
 		export INSDESTTREE=""
 	else
 		export INSDESTTREE=$1
-		if [ ! -d "${D}${INSDESTTREE}" ]; then
-			install -d "${D}${INSDESTTREE}"
+		local ed=${ED}
+		case "$EAPI" in 0|1|2) d=${D} ;; esac
+		if [ ! -d "${ed}${INSDESTTREE}" ]; then
+			install -d "${ed}${INSDESTTREE}"
 			local ret=$?
 			if [[ $ret -ne 0 ]] ; then
 				helpers_die "${FUNCNAME[0]} failed"
@@ -827,8 +837,10 @@ exeinto() {
 		export _E_EXEDESTTREE_=""
 	else
 		export _E_EXEDESTTREE_="$1"
-		if [ ! -d "${D}${_E_EXEDESTTREE_}" ]; then
-			install -d "${D}${_E_EXEDESTTREE_}"
+		local ed=${ED}
+		case "$EAPI" in 0|1|2) d=${D} ;; esac
+		if [ ! -d "${ed}${_E_EXEDESTTREE_}" ]; then
+			install -d "${ed}${_E_EXEDESTTREE_}"
 			local ret=$?
 			if [[ $ret -ne 0 ]] ; then
 				helpers_die "${FUNCNAME[0]} failed"
@@ -843,8 +855,10 @@ docinto() {
 		export _E_DOCDESTTREE_=""
 	else
 		export _E_DOCDESTTREE_="$1"
-		if [ ! -d "${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then
-			install -d "${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
+		local ed=${ED}
+		case "$EAPI" in 0|1|2) d=${D} ;; esac
+		if [ ! -d "${ed}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then
+			install -d "${ed}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
 			local ret=$?
 			if [[ $ret -ne 0 ]] ; then
 				helpers_die "${FUNCNAME[0]} failed"
@@ -2091,17 +2105,19 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
 			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.
 			x=LIBDIR_${DEFAULT_ABI}
 			[[ -n $DEFAULT_ABI && -n ${!x} ]] && x=${!x} || x=lib
 
 			if has distcc $FEATURES ; then
-				PATH="/usr/$x/distcc/bin:$PATH"
+				PATH="${_eprefix}/usr/$x/distcc/bin:$PATH"
 				[[ -n $DISTCC_LOG ]] && addwrite "${DISTCC_LOG%/*}"
 			fi
 
 			if has ccache $FEATURES ; then
-				PATH="/usr/$x/ccache/bin:$PATH"
+				PATH="${_eprefix}/usr/$x/ccache/bin:$PATH"
 
 				if [[ -n $CCACHE_DIR ]] ; then
 					addread "$CCACHE_DIR"
@@ -2111,7 +2127,7 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
 				[[ -n $CCACHE_SIZE ]] && ccache -M $CCACHE_SIZE &> /dev/null
 			fi
 
-			unset x
+			unset x _eprefix
 
 			if [[ -n $QA_PREBUILT ]] ; then
 

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 1a38d42..0c0ed6a 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1980,10 +1980,11 @@ class dblink(object):
 			unmerge_desc["!mtime"] = _("!mtime")
 			unmerge_desc["!obj"] = _("!obj")
 			unmerge_desc["!sym"] = _("!sym")
+			unmerge_desc["!prefix"] = _("!prefix")
 
 			real_root = self.settings['ROOT']
 			real_root_len = len(real_root) - 1
-			eroot_split_len = len(self.settings["EROOT"].split(os.sep)) - 1
+			eroot = self.settings["EROOT"]
 
 			# These files are generated by emerge, so we need to remove
 			# them when they are the only thing left in a directory.
@@ -2023,6 +2024,12 @@ class dblink(object):
 
 				file_data = pkgfiles[objkey]
 				file_type = file_data[0]
+
+				# don't try to unmerge the prefix offset itself
+				if len(obj) <= len(eroot) or not obj.startswith(eroot):
+					show_unmerge("---", unmerge_desc["!prefix"], file_type, obj)
+					continue
+
 				statobj = None
 				try:
 					statobj = os.stat(obj)

diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 45b2863..7b3561e 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -268,7 +268,9 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
 	mysettings["T"] = os.path.join(mysettings["PORTAGE_BUILDDIR"], "temp")
 
 	# Prefix forward compatability
-	mysettings["ED"] = mysettings["D"]
+	eprefix_lstrip = mysettings["EPREFIX"].lstrip(os.sep)
+	mysettings["ED"] = os.path.join(
+		mysettings["D"], eprefix_lstrip).rstrip(os.sep) + os.sep
 
 	mysettings["PORTAGE_BASHRC"] = os.path.join(
 		mysettings["PORTAGE_CONFIGROOT"], EBUILD_SH_ENV_FILE)

diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py
index f6f5ab0..7715221 100644
--- a/pym/portage/tests/emerge/test_simple.py
+++ b/pym/portage/tests/emerge/test_simple.py
@@ -17,12 +17,23 @@ class SimpleEmergeTestCase(TestCase):
 
 	def testSimple(self):
 
+		install_something = """
+S="${WORKDIR}"
+src_install() {
+	einfo "installing something..."
+	insinto /usr/lib/${P}
+	echo "blah blah blah" > "${T}"/regular-file
+	doins "${T}"/regular-file
+}
+"""
+
 		ebuilds = {
 			"dev-libs/A-1": {
 				"EAPI" : "4",
 				"IUSE" : "+flag",
 				"KEYWORDS": "x86",
 				"LICENSE": "GPL-2",
+				"MISC_CONTENT": install_something,
 				"RDEPEND": "flag? ( dev-libs/B[flag] )",
 			},
 			"dev-libs/B-1": {
@@ -30,6 +41,7 @@ class SimpleEmergeTestCase(TestCase):
 				"IUSE" : "+flag",
 				"KEYWORDS": "x86",
 				"LICENSE": "GPL-2",
+				"MISC_CONTENT": install_something,
 			},
 		}
 
@@ -49,6 +61,21 @@ class SimpleEmergeTestCase(TestCase):
 				"LICENSE": "GPL-2",
 				"USE": "flag",
 			},
+			"dev-libs/depclean-me-1": {
+				"EAPI" : "4",
+				"IUSE" : "",
+				"KEYWORDS": "x86",
+				"LICENSE": "GPL-2",
+				"USE": "",
+			},
+			"app-misc/depclean-me-1": {
+				"EAPI" : "4",
+				"IUSE" : "",
+				"KEYWORDS": "x86",
+				"LICENSE": "GPL-2",
+				"RDEPEND": "dev-libs/depclean-me",
+				"USE": "",
+			},
 		}
 
 		test_args = (
@@ -58,6 +85,7 @@ class SimpleEmergeTestCase(TestCase):
 			("--pretend", "dev-libs/A"),
 			("--pretend", "--tree", "--complete-graph", "dev-libs/A"),
 			("-p", "dev-libs/B"),
+			("--oneshot", "dev-libs/B",),
 			("--oneshot", "dev-libs/A",),
 			("--noreplace", "dev-libs/A",),
 			("--pretend", "--depclean", "--verbose", "dev-libs/B"),
@@ -106,6 +134,8 @@ class SimpleEmergeTestCase(TestCase):
 			"INFOPATH" : "",
 			"PATH" : path,
 			"PORTAGE_GRPNAME" : os.environ["PORTAGE_GRPNAME"],
+			"PORTAGE_INST_GID" : str(portage.data.portage_gid),
+			"PORTAGE_INST_UID" : str(portage.data.portage_uid),
 			"PORTAGE_TMPDIR" : portage_tmpdir,
 			"PORTAGE_USERNAME" : os.environ["PORTAGE_USERNAME"],
 			"PORTDIR" : portdir,
@@ -130,15 +160,16 @@ class SimpleEmergeTestCase(TestCase):
 			for args in test_args:
 				proc = subprocess.Popen([portage._python_interpreter, "-Wd",
 					os.path.join(PORTAGE_BIN_PATH, "emerge")] + list(args),
-					env=env, stdout=subprocess.PIPE)
-				output = proc.stdout.readlines()
+					env=env)
+				#output = proc.stdout.readlines()
 				proc.wait()
-				proc.stdout.close()
-				if proc.returncode != os.EX_OK:
-					for line in output:
-						sys.stderr.write(_unicode_decode(line))
+				#proc.stdout.close()
+				#if proc.returncode != os.EX_OK:
+				#	for line in output:
+				#		sys.stderr.write(_unicode_decode(line))
 
 				self.assertEqual(os.EX_OK, proc.returncode,
 					"emerge failed with args %s" % (args,))
 		finally:
-			playground.cleanup()
+			pass
+			##playground.cleanup()

diff --git a/pym/portage/tests/resolver/ResolverPlayground.py b/pym/portage/tests/resolver/ResolverPlayground.py
index f41126b..28567b3 100644
--- a/pym/portage/tests/resolver/ResolverPlayground.py
+++ b/pym/portage/tests/resolver/ResolverPlayground.py
@@ -120,6 +120,7 @@ class ResolverPlayground(object):
 			rdepend = metadata.pop("RDEPEND", None)
 			pdepend = metadata.pop("PDEPEND", None)
 			required_use = metadata.pop("REQUIRED_USE", None)
+			misc_content = metadata.pop("MISC_CONTENT", None)
 
 			if metadata:
 				raise ValueError("metadata of ebuild '%s' contains unknown keys: %s" % (cpv, metadata.keys()))
@@ -152,6 +153,8 @@ class ResolverPlayground(object):
 				f.write('PDEPEND="' + str(pdepend) + '"\n')
 			if required_use is not None:
 				f.write('REQUIRED_USE="' + str(required_use) + '"\n')
+			if misc_content is not None:
+				f.write(misc_content)
 			f.close()
 
 	def _create_ebuild_manifests(self, ebuilds):

diff --git a/pym/portage/xml/metadata.py b/pym/portage/xml/metadata.py
index ef335e2..9e18869 100644
--- a/pym/portage/xml/metadata.py
+++ b/pym/portage/xml/metadata.py
@@ -36,10 +36,19 @@ except ImportError:
 	import xml.etree.ElementTree as etree
 
 import re
+import xml.etree.ElementTree
 import portage
 from portage import os
 from portage.util import unique_everseen
 
+class _MetadataTreeBuilder(xml.etree.ElementTree.TreeBuilder):
+	"""
+	Implements doctype() as required to avoid deprecation warnings with
+	Python >=2.7.
+	"""
+	def doctype(self, name, pubid, system):
+		pass
+
 class _Maintainer(object):
 	"""An object for representing one maintainer.
 
@@ -173,7 +182,8 @@ class MetaDataXML(object):
 		self._xml_tree = None
 
 		try:
-			self._xml_tree = etree.parse(metadata_xml_path)
+			self._xml_tree = etree.parse(metadata_xml_path,
+				parser=etree.XMLParser(target=_MetadataTreeBuilder()))
 		except ImportError:
 			pass
 
@@ -208,7 +218,8 @@ class MetaDataXML(object):
 
 		if self._herdstree is None:
 			try:
-				self._herdstree = etree.parse(self._herds_path)
+				self._herdstree = etree.parse(self._herds_path,
+					parser=etree.XMLParser(target=_MetadataTreeBuilder()))
 			except (ImportError, IOError, SyntaxError):
 				return None
 



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

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

commit:     d7579ecd27ca051d7f987102caeb53e826a6fe93
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Sep  1 02:54:19 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Sep  1 02:54:19 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d7579ecd

Revert "xml/metadata: implement XMLParser.doctype()"

This reverts commit ce501b36d7078db059c606d3b4f38637ad09528e.
This commit had lots of unintended changes included.

---
 bin/ebuild-helpers/doexe                         |    8 +-
 bin/ebuild-helpers/doins                         |   16 ++--
 bin/ebuild-helpers/dosed                         |    8 +-
 bin/ebuild.sh                                    |   88 +++++++++-------------
 pym/portage/dbapi/vartree.py                     |    9 +--
 pym/portage/package/ebuild/doebuild.py           |    4 +-
 pym/portage/tests/emerge/test_simple.py          |   45 ++---------
 pym/portage/tests/resolver/ResolverPlayground.py |    3 -
 pym/portage/xml/metadata.py                      |   15 +---
 9 files changed, 60 insertions(+), 136 deletions(-)

diff --git a/bin/ebuild-helpers/doexe b/bin/ebuild-helpers/doexe
index f44cfba..360800e 100755
--- a/bin/ebuild-helpers/doexe
+++ b/bin/ebuild-helpers/doexe
@@ -9,10 +9,8 @@ if [[ $# -lt 1 ]] ; then
 	exit 1
 fi
 
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
-
-if [[ ! -d ${ED}${_E_EXEDESTTREE_} ]] ; then
-	install -d "${ED}${_E_EXEDESTTREE_}"
+if [[ ! -d ${D}${_E_EXEDESTTREE_} ]] ; then
+	install -d "${D}${_E_EXEDESTTREE_}"
 fi
 
 TMP=$T/.doexe_tmp
@@ -31,7 +29,7 @@ for x in "$@" ; do
 		mysrc="${x}"
 	fi
 	if [ -e "$mysrc" ] ; then
-		install $EXEOPTIONS "$mysrc" "$ED$_E_EXEDESTTREE_"
+		install $EXEOPTIONS "$mysrc" "$D$_E_EXEDESTTREE_"
 	else
 		echo "!!! ${0##*/}: $mysrc does not exist" 1>&2
 		false

diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins
index 1ca69a6..7dec146 100755
--- a/bin/ebuild-helpers/doins
+++ b/bin/ebuild-helpers/doins
@@ -27,14 +27,12 @@ else
 	DOINSRECUR=n
 fi
 
-case "$EAPI" in 0|1|2) export ED="${D}" ;; esac
-
-if [[ ${INSDESTTREE#${ED}} != "${INSDESTTREE}" ]]; then
+if [[ ${INSDESTTREE#${D}} != "${INSDESTTREE}" ]]; then
 	vecho "-------------------------------------------------------" 1>&2
-	vecho "You should not use \${ED} with helpers." 1>&2
+	vecho "You should not use \${D} with helpers." 1>&2
 	vecho "  --> ${INSDESTTREE}" 1>&2
 	vecho "-------------------------------------------------------" 1>&2
-	helpers_die "${0##*/} used with \${ED}"
+	helpers_die "${0##*/} used with \${D}"
 	exit 1
 fi
 
@@ -51,7 +49,7 @@ export TMP=$T/.doins_tmp
 # Use separate directories to avoid potential name collisions.
 mkdir -p "$TMP"/{1,2}
 
-[[ ! -d ${ED}${INSDESTTREE} ]] && dodir "${INSDESTTREE}"
+[[ ! -d ${D}${INSDESTTREE} ]] && dodir "${INSDESTTREE}"
 
 _doins() {
 	local mysrc="$1" mydir="$2" cleanup="" rval
@@ -65,8 +63,8 @@ _doins() {
 		# $PORTAGE_ACTUAL_DISTDIR/.
 		if [ $PRESERVE_SYMLINKS = y ] && \
 			! [[ $(readlink "$mysrc") == "$PORTAGE_ACTUAL_DISTDIR"/* ]] ; then
-			rm -rf "${ED}$INSDESTTREE/$mydir/${mysrc##*/}" || return $?
-			cp -P "$mysrc" "${ED}$INSDESTTREE/$mydir/${mysrc##*/}"
+			rm -rf "$D$INSDESTTREE/$mydir/${mysrc##*/}" || return $?
+			cp -P "$mysrc" "$D$INSDESTTREE/$mydir/${mysrc##*/}"
 			return $?
 		else
 			cp "$mysrc" "$TMP/2/${mysrc##*/}" || return $?
@@ -75,7 +73,7 @@ _doins() {
 		fi
 	fi
 
-	install ${INSOPTIONS} "${mysrc}" "${ED}${INSDESTTREE}/${mydir}"
+	install ${INSOPTIONS} "${mysrc}" "${D}${INSDESTTREE}/${mydir}"
 	rval=$?
 	[[ -n ${cleanup} ]] && rm -f "${cleanup}"
 	[ $rval -ne 0 ] && echo "!!! ${0##*/}: $mysrc does not exist" 1>&2

diff --git a/bin/ebuild-helpers/dosed b/bin/ebuild-helpers/dosed
index 00cf5da..afc949b 100755
--- a/bin/ebuild-helpers/dosed
+++ b/bin/ebuild-helpers/dosed
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2006 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 if [[ $# -lt 1 ]] ; then
@@ -7,14 +7,12 @@ if [[ $# -lt 1 ]] ; then
 	exit 1
 fi
 
-case "$EAPI" in 0|1|2) ED=${D} ;; esac
-
 ret=0
 file_found=0
-mysed="s:${ED}::g"
+mysed="s:${D}::g"
 
 for x in "$@" ; do
-	y=$ED${x#/}
+	y=$D${x#/}
 	if [ -e "${y}" ] ; then
 		if [ -f "${y}" ] ; then
 			file_found=1

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index ae03df7..23a1240 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -325,11 +325,9 @@ declare -a PORTAGE_DOCOMPRESS_SKIP=( /usr/share/doc/${PF}/html )
 keepdir() {
 	dodir "$@"
 	local x
-	local ed=${ED}
-	case "$EAPI" in 0|1|2) ed=${D} ;; esac
 	if [ "$1" == "-R" ] || [ "$1" == "-r" ]; then
 		shift
-		find "$@" -type d -printf "${ed}%p/.keep_${CATEGORY}_${PN}-${SLOT}\n" \
+		find "$@" -type d -printf "${D}%p/.keep_${CATEGORY}_${PN}-${SLOT}\n" \
 			| tr "\n" "\0" | \
 			while read -r -d $'\0' ; do
 				>> "$REPLY" || \
@@ -337,8 +335,8 @@ keepdir() {
 			done
 	else
 		for x in "$@"; do
-			>> "${ed}${x}/.keep_${CATEGORY}_${PN}-${SLOT}" || \
-				die "Failed to create .keep in ${ed}${x}"
+			>> "${D}${x}/.keep_${CATEGORY}_${PN}-${SLOT}" || \
+				die "Failed to create .keep in ${D}${x}"
 		done
 	fi
 }
@@ -486,8 +484,6 @@ hasg() {
 hasgq() { hasg "$@" >/dev/null ; }
 econf() {
 	local x
-	local eprefix=${EPREFIX}
-	case "$EAPI" in 0|1|2) eprefix= ;; esac
 
 	local phase_func=$(_ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE")
 	if [[ -n $phase_func ]] ; then
@@ -509,12 +505,12 @@ econf() {
 			sed -e "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" -i "$ECONF_SOURCE/configure" || \
 				die "Substition of shebang in '$ECONF_SOURCE/configure' failed"
 		fi
-		if [ -e "${eprefix}"/usr/share/gnuconfig/ ]; then
+		if [ -e /usr/share/gnuconfig/ ]; then
 			find "${WORKDIR}" -type f '(' \
 			-name config.guess -o -name config.sub ')' -print0 | \
 			while read -r -d $'\0' x ; do
-				vecho " * econf: updating ${x/${WORKDIR}\/} with ${eprefix}/usr/share/gnuconfig/${x##*/}"
-				cp -f "${eprefix}"/usr/share/gnuconfig/"${x##*/}" "${x}"
+				vecho " * econf: updating ${x/${WORKDIR}\/} with /usr/share/gnuconfig/${x##*/}"
+				cp -f /usr/share/gnuconfig/"${x##*/}" "${x}"
 			done
 		fi
 
@@ -534,7 +530,7 @@ econf() {
 		if [[ -n ${CONF_LIBDIR} ]] && ! hasgq --libdir=\* "$@" ; then
 			export CONF_PREFIX=$(hasg --exec-prefix=\* "$@")
 			[[ -z ${CONF_PREFIX} ]] && CONF_PREFIX=$(hasg --prefix=\* "$@")
-			: ${CONF_PREFIX:=${eprefix}/usr}
+			: ${CONF_PREFIX:=/usr}
 			CONF_PREFIX=${CONF_PREFIX#*=}
 			[[ ${CONF_PREFIX} != /* ]] && CONF_PREFIX="/${CONF_PREFIX}"
 			[[ ${CONF_LIBDIR} != /* ]] && CONF_LIBDIR="/${CONF_LIBDIR}"
@@ -542,15 +538,15 @@ econf() {
 		fi
 
 		set -- \
-			--prefix="${eprefix}"/usr \
+			--prefix=/usr \
 			${CBUILD:+--build=${CBUILD}} \
 			--host=${CHOST} \
 			${CTARGET:+--target=${CTARGET}} \
-			--mandir="${eprefix}"/usr/share/man \
-			--infodir="${eprefix}"/usr/share/info \
-			--datadir="${eprefix}"/usr/share \
-			--sysconfdir="${eprefix}"/etc \
-			--localstatedir="${eprefix}"/var/lib \
+			--mandir=/usr/share/man \
+			--infodir=/usr/share/info \
+			--datadir=/usr/share \
+			--sysconfdir=/etc \
+			--localstatedir=/var/lib \
 			"$@" \
 			${EXTRA_ECONF}
 		vecho "${ECONF_SOURCE}/configure" "$@"
@@ -574,8 +570,6 @@ econf() {
 einstall() {
 	# CONF_PREFIX is only set if they didn't pass in libdir above.
 	local LOCAL_EXTRA_EINSTALL="${EXTRA_EINSTALL}"
-	local ed=${ED}
-	case "$EAPI" in 0|1|2) ed=${D} ;; esac
 	LIBDIR_VAR="LIBDIR_${ABI}"
 	if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then
 		CONF_LIBDIR="${!LIBDIR_VAR}"
@@ -590,22 +584,22 @@ einstall() {
 
 	if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then
 		if [ "${PORTAGE_DEBUG}" == "1" ]; then
-			${MAKE:-make} -n prefix="${ed}usr" \
-				datadir="${ed}usr/share" \
-				infodir="${ed}usr/share/info" \
-				localstatedir="${ed}var/lib" \
-				mandir="${ed}usr/share/man" \
-				sysconfdir="${ed}etc" \
+			${MAKE:-make} -n prefix="${D}usr" \
+				datadir="${D}usr/share" \
+				infodir="${D}usr/share/info" \
+				localstatedir="${D}var/lib" \
+				mandir="${D}usr/share/man" \
+				sysconfdir="${D}etc" \
 				${LOCAL_EXTRA_EINSTALL} \
 				${MAKEOPTS} ${EXTRA_EMAKE} -j1 \
 				"$@" install
 		fi
-		${MAKE:-make} prefix="${ed}usr" \
-			datadir="${ed}usr/share" \
-			infodir="${ed}usr/share/info" \
-			localstatedir="${ed}var/lib" \
-			mandir="${ed}usr/share/man" \
-			sysconfdir="${ed}etc" \
+		${MAKE:-make} prefix="${D}usr" \
+			datadir="${D}usr/share" \
+			infodir="${D}usr/share/info" \
+			localstatedir="${D}var/lib" \
+			mandir="${D}usr/share/man" \
+			sysconfdir="${D}etc" \
 			${LOCAL_EXTRA_EINSTALL} \
 			${MAKEOPTS} ${EXTRA_EMAKE} -j1 \
 			"$@" install || die "einstall failed"
@@ -801,10 +795,8 @@ into() {
 		export DESTTREE=""
 	else
 		export DESTTREE=$1
-		local ed=${ED}
-		case "$EAPI" in 0|1|2) ed=${D} ;; esac
-		if [ ! -d "${ed}${DESTTREE}" ]; then
-			install -d "${ed}${DESTTREE}"
+		if [ ! -d "${D}${DESTTREE}" ]; then
+			install -d "${D}${DESTTREE}"
 			local ret=$?
 			if [[ $ret -ne 0 ]] ; then
 				helpers_die "${FUNCNAME[0]} failed"
@@ -819,10 +811,8 @@ insinto() {
 		export INSDESTTREE=""
 	else
 		export INSDESTTREE=$1
-		local ed=${ED}
-		case "$EAPI" in 0|1|2) d=${D} ;; esac
-		if [ ! -d "${ed}${INSDESTTREE}" ]; then
-			install -d "${ed}${INSDESTTREE}"
+		if [ ! -d "${D}${INSDESTTREE}" ]; then
+			install -d "${D}${INSDESTTREE}"
 			local ret=$?
 			if [[ $ret -ne 0 ]] ; then
 				helpers_die "${FUNCNAME[0]} failed"
@@ -837,10 +827,8 @@ exeinto() {
 		export _E_EXEDESTTREE_=""
 	else
 		export _E_EXEDESTTREE_="$1"
-		local ed=${ED}
-		case "$EAPI" in 0|1|2) d=${D} ;; esac
-		if [ ! -d "${ed}${_E_EXEDESTTREE_}" ]; then
-			install -d "${ed}${_E_EXEDESTTREE_}"
+		if [ ! -d "${D}${_E_EXEDESTTREE_}" ]; then
+			install -d "${D}${_E_EXEDESTTREE_}"
 			local ret=$?
 			if [[ $ret -ne 0 ]] ; then
 				helpers_die "${FUNCNAME[0]} failed"
@@ -855,10 +843,8 @@ docinto() {
 		export _E_DOCDESTTREE_=""
 	else
 		export _E_DOCDESTTREE_="$1"
-		local ed=${ED}
-		case "$EAPI" in 0|1|2) d=${D} ;; esac
-		if [ ! -d "${ed}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then
-			install -d "${ed}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
+		if [ ! -d "${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then
+			install -d "${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
 			local ret=$?
 			if [[ $ret -ne 0 ]] ; then
 				helpers_die "${FUNCNAME[0]} failed"
@@ -2105,19 +2091,17 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
 			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.
 			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"
+				PATH="/usr/$x/distcc/bin:$PATH"
 				[[ -n $DISTCC_LOG ]] && addwrite "${DISTCC_LOG%/*}"
 			fi
 
 			if has ccache $FEATURES ; then
-				PATH="${_eprefix}/usr/$x/ccache/bin:$PATH"
+				PATH="/usr/$x/ccache/bin:$PATH"
 
 				if [[ -n $CCACHE_DIR ]] ; then
 					addread "$CCACHE_DIR"
@@ -2127,7 +2111,7 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
 				[[ -n $CCACHE_SIZE ]] && ccache -M $CCACHE_SIZE &> /dev/null
 			fi
 
-			unset x _eprefix
+			unset x
 
 			if [[ -n $QA_PREBUILT ]] ; then
 

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 0c0ed6a..1a38d42 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1980,11 +1980,10 @@ class dblink(object):
 			unmerge_desc["!mtime"] = _("!mtime")
 			unmerge_desc["!obj"] = _("!obj")
 			unmerge_desc["!sym"] = _("!sym")
-			unmerge_desc["!prefix"] = _("!prefix")
 
 			real_root = self.settings['ROOT']
 			real_root_len = len(real_root) - 1
-			eroot = self.settings["EROOT"]
+			eroot_split_len = len(self.settings["EROOT"].split(os.sep)) - 1
 
 			# These files are generated by emerge, so we need to remove
 			# them when they are the only thing left in a directory.
@@ -2024,12 +2023,6 @@ class dblink(object):
 
 				file_data = pkgfiles[objkey]
 				file_type = file_data[0]
-
-				# don't try to unmerge the prefix offset itself
-				if len(obj) <= len(eroot) or not obj.startswith(eroot):
-					show_unmerge("---", unmerge_desc["!prefix"], file_type, obj)
-					continue
-
 				statobj = None
 				try:
 					statobj = os.stat(obj)

diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 7b3561e..45b2863 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -268,9 +268,7 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
 	mysettings["T"] = os.path.join(mysettings["PORTAGE_BUILDDIR"], "temp")
 
 	# Prefix forward compatability
-	eprefix_lstrip = mysettings["EPREFIX"].lstrip(os.sep)
-	mysettings["ED"] = os.path.join(
-		mysettings["D"], eprefix_lstrip).rstrip(os.sep) + os.sep
+	mysettings["ED"] = mysettings["D"]
 
 	mysettings["PORTAGE_BASHRC"] = os.path.join(
 		mysettings["PORTAGE_CONFIGROOT"], EBUILD_SH_ENV_FILE)

diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py
index 7715221..f6f5ab0 100644
--- a/pym/portage/tests/emerge/test_simple.py
+++ b/pym/portage/tests/emerge/test_simple.py
@@ -17,23 +17,12 @@ class SimpleEmergeTestCase(TestCase):
 
 	def testSimple(self):
 
-		install_something = """
-S="${WORKDIR}"
-src_install() {
-	einfo "installing something..."
-	insinto /usr/lib/${P}
-	echo "blah blah blah" > "${T}"/regular-file
-	doins "${T}"/regular-file
-}
-"""
-
 		ebuilds = {
 			"dev-libs/A-1": {
 				"EAPI" : "4",
 				"IUSE" : "+flag",
 				"KEYWORDS": "x86",
 				"LICENSE": "GPL-2",
-				"MISC_CONTENT": install_something,
 				"RDEPEND": "flag? ( dev-libs/B[flag] )",
 			},
 			"dev-libs/B-1": {
@@ -41,7 +30,6 @@ src_install() {
 				"IUSE" : "+flag",
 				"KEYWORDS": "x86",
 				"LICENSE": "GPL-2",
-				"MISC_CONTENT": install_something,
 			},
 		}
 
@@ -61,21 +49,6 @@ src_install() {
 				"LICENSE": "GPL-2",
 				"USE": "flag",
 			},
-			"dev-libs/depclean-me-1": {
-				"EAPI" : "4",
-				"IUSE" : "",
-				"KEYWORDS": "x86",
-				"LICENSE": "GPL-2",
-				"USE": "",
-			},
-			"app-misc/depclean-me-1": {
-				"EAPI" : "4",
-				"IUSE" : "",
-				"KEYWORDS": "x86",
-				"LICENSE": "GPL-2",
-				"RDEPEND": "dev-libs/depclean-me",
-				"USE": "",
-			},
 		}
 
 		test_args = (
@@ -85,7 +58,6 @@ src_install() {
 			("--pretend", "dev-libs/A"),
 			("--pretend", "--tree", "--complete-graph", "dev-libs/A"),
 			("-p", "dev-libs/B"),
-			("--oneshot", "dev-libs/B",),
 			("--oneshot", "dev-libs/A",),
 			("--noreplace", "dev-libs/A",),
 			("--pretend", "--depclean", "--verbose", "dev-libs/B"),
@@ -134,8 +106,6 @@ src_install() {
 			"INFOPATH" : "",
 			"PATH" : path,
 			"PORTAGE_GRPNAME" : os.environ["PORTAGE_GRPNAME"],
-			"PORTAGE_INST_GID" : str(portage.data.portage_gid),
-			"PORTAGE_INST_UID" : str(portage.data.portage_uid),
 			"PORTAGE_TMPDIR" : portage_tmpdir,
 			"PORTAGE_USERNAME" : os.environ["PORTAGE_USERNAME"],
 			"PORTDIR" : portdir,
@@ -160,16 +130,15 @@ src_install() {
 			for args in test_args:
 				proc = subprocess.Popen([portage._python_interpreter, "-Wd",
 					os.path.join(PORTAGE_BIN_PATH, "emerge")] + list(args),
-					env=env)
-				#output = proc.stdout.readlines()
+					env=env, stdout=subprocess.PIPE)
+				output = proc.stdout.readlines()
 				proc.wait()
-				#proc.stdout.close()
-				#if proc.returncode != os.EX_OK:
-				#	for line in output:
-				#		sys.stderr.write(_unicode_decode(line))
+				proc.stdout.close()
+				if proc.returncode != os.EX_OK:
+					for line in output:
+						sys.stderr.write(_unicode_decode(line))
 
 				self.assertEqual(os.EX_OK, proc.returncode,
 					"emerge failed with args %s" % (args,))
 		finally:
-			pass
-			##playground.cleanup()
+			playground.cleanup()

diff --git a/pym/portage/tests/resolver/ResolverPlayground.py b/pym/portage/tests/resolver/ResolverPlayground.py
index 28567b3..f41126b 100644
--- a/pym/portage/tests/resolver/ResolverPlayground.py
+++ b/pym/portage/tests/resolver/ResolverPlayground.py
@@ -120,7 +120,6 @@ class ResolverPlayground(object):
 			rdepend = metadata.pop("RDEPEND", None)
 			pdepend = metadata.pop("PDEPEND", None)
 			required_use = metadata.pop("REQUIRED_USE", None)
-			misc_content = metadata.pop("MISC_CONTENT", None)
 
 			if metadata:
 				raise ValueError("metadata of ebuild '%s' contains unknown keys: %s" % (cpv, metadata.keys()))
@@ -153,8 +152,6 @@ class ResolverPlayground(object):
 				f.write('PDEPEND="' + str(pdepend) + '"\n')
 			if required_use is not None:
 				f.write('REQUIRED_USE="' + str(required_use) + '"\n')
-			if misc_content is not None:
-				f.write(misc_content)
 			f.close()
 
 	def _create_ebuild_manifests(self, ebuilds):

diff --git a/pym/portage/xml/metadata.py b/pym/portage/xml/metadata.py
index 9e18869..ef335e2 100644
--- a/pym/portage/xml/metadata.py
+++ b/pym/portage/xml/metadata.py
@@ -36,19 +36,10 @@ except ImportError:
 	import xml.etree.ElementTree as etree
 
 import re
-import xml.etree.ElementTree
 import portage
 from portage import os
 from portage.util import unique_everseen
 
-class _MetadataTreeBuilder(xml.etree.ElementTree.TreeBuilder):
-	"""
-	Implements doctype() as required to avoid deprecation warnings with
-	Python >=2.7.
-	"""
-	def doctype(self, name, pubid, system):
-		pass
-
 class _Maintainer(object):
 	"""An object for representing one maintainer.
 
@@ -182,8 +173,7 @@ class MetaDataXML(object):
 		self._xml_tree = None
 
 		try:
-			self._xml_tree = etree.parse(metadata_xml_path,
-				parser=etree.XMLParser(target=_MetadataTreeBuilder()))
+			self._xml_tree = etree.parse(metadata_xml_path)
 		except ImportError:
 			pass
 
@@ -218,8 +208,7 @@ class MetaDataXML(object):
 
 		if self._herdstree is None:
 			try:
-				self._herdstree = etree.parse(self._herds_path,
-					parser=etree.XMLParser(target=_MetadataTreeBuilder()))
+				self._herdstree = etree.parse(self._herds_path)
 			except (ImportError, IOError, SyntaxError):
 				return None
 



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

end of thread, other threads:[~2011-09-01  2:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-01  2:54 [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, pym/portage/package/ebuild/, pym/portage/dbapi/, Zac Medico
  -- strict thread matches above, loose matches on Subject: below --
2011-09-01  2:53 Zac Medico

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