summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorVlastimil Babka <caster@gentoo.org>2011-10-21 11:05:01 +0000
committerVlastimil Babka <caster@gentoo.org>2011-10-21 11:05:01 +0000
commitdafccd24cc747cd8d2a1c3b8b06aff7691c6cde3 (patch)
tree5df001c666e43ff365405773ab154873d0f2a204 /eclass
parentFix url, bug #387763 wrt Vladimir Berezhnoy. (diff)
downloadhistorical-dafccd24cc747cd8d2a1c3b8b06aff7691c6cde3.tar.gz
historical-dafccd24cc747cd8d2a1c3b8b06aff7691c6cde3.tar.bz2
historical-dafccd24cc747cd8d2a1c3b8b06aff7691c6cde3.zip
Add java-ant_remove-taskdef()s --name parameter that removes only tasks of given name. Patch by Ralph Sennhauser <gentoo.sera@bluewin.ch>, bug #387983.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/java-ant-2.eclass18
1 files changed, 13 insertions, 5 deletions
diff --git a/eclass/java-ant-2.eclass b/eclass/java-ant-2.eclass
index 9d148571a9d7..f56cdc07dec6 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.51 2011/07/08 11:35:01 ssuominen Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v 1.52 2011/10/21 11:05:01 caster Exp $
inherit java-utils-2
@@ -431,20 +431,28 @@ java-ant_rewrite-classpath() {
# ------------------------------------------------------------------------------
# @public java-ant_remove-taskdefs
#
-# Removes taskdef elements from the file
+# Removes (named) taskdef elements from the file.
+# Options:
+# --name NAME : only remove taskdef with name NAME.
# @param $1 - the file to rewrite (defaults to build.xml)
# ------------------------------------------------------------------------------
java-ant_remove-taskdefs() {
debug-print-function ${FUNCNAME} $*
- local file=${1:-build.xml}
+ local task_name
+ if [[ "${1}" == --name ]]; then
+ task_name="${2}"
+ shift 2
+ fi
+ 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()
+ if (len("${task_name}") == 0 or elem.getAttribute("name") == "${task_name}"):
+ elem.parentNode.removeChild(elem)
+ elem.unlink()
f = open("${file}", "w")
dom.writexml(f)
f.close()