diff options
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/java-ant-2.eclass | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/eclass/java-ant-2.eclass b/eclass/java-ant-2.eclass index 814091006df7..ac845b865508 100644 --- a/eclass/java-ant-2.eclass +++ b/eclass/java-ant-2.eclass @@ -14,7 +14,7 @@ # # Licensed under the GNU General Public License, v2 # -# $Header: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v 1.49 2010/04/29 08:40:29 caster Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v 1.50 2010/10/17 12:55:00 betelgeuse Exp $ inherit java-utils-2 @@ -37,7 +37,6 @@ inherit java-utils-2 # dev-java/ant-core into DEPEND. # construct ant-speficic DEPEND -JAVA_ANT_E_DEPEND="" # add ant-core into DEPEND, unless disabled if [[ -z "${JAVA_ANT_DISABLE_ANT_CORE_DEP}" ]]; then JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND} >=dev-java/ant-core-1.7.0" @@ -53,11 +52,13 @@ if [[ $? != 0 ]]; then fi # We need some tools from javatoolkit. We also need portage 2.1 for phase hooks -# and ant dependencies constructed above. +# and ant dependencies constructed above. Python is there for +# java-ant_remove-taskdefs JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND} - ${ANT_TASKS_DEPEND} - ${JAVA_PKG_PORTAGE_DEP} - >=dev-java/javatoolkit-0.3.0-r2" + ${ANT_TASKS_DEPEND} + ${JAVA_PKG_PORTAGE_DEP} + >=dev-java/javatoolkit-0.3.0-r2 + >=dev-lang/python-2.4" # this eclass must be inherited after java-pkg-2 or java-pkg-opt-2 # if it's java-pkg-opt-2, ant dependencies are pulled based on USE flag @@ -428,6 +429,30 @@ java-ant_rewrite-classpath() { } # ------------------------------------------------------------------------------ +# @public java-ant_remove-taskdefs +# +# Removes taskdef elements from the file +# @param $1 - the file to rewrite (defaults to build.xml) +# ------------------------------------------------------------------------------ +java-ant_remove-taskdefs() { + debug-print-function ${FUNCNAME} $* + local file=${1:-build.xml} + echo "Removing taskdefs from ${file}" + python <<EOF +import sys +from xml.dom.minidom import parse +dom = parse("${file}") +for elem in dom.getElementsByTagName('taskdef'): + elem.parentNode.removeChild(elem) + elem.unlink() +f = open("${file}", "w") +dom.writexml(f) +f.close() +EOF + [[ $? != 0 ]] && die "Removing taskdefs failed" +} + +# ------------------------------------------------------------------------------ # @public java-ant_ignore-system-classes # # Makes the available task ignore classes in the system classpath |