diff options
author | Vlastimil Babka <caster@gentoo.org> | 2011-10-21 11:05:01 +0000 |
---|---|---|
committer | Vlastimil Babka <caster@gentoo.org> | 2011-10-21 11:05:01 +0000 |
commit | 8684e9a9235a29e53a46ef528e68de70359bc2a1 (patch) | |
tree | 46976c1ecded543a6dd4085d81331f92f0a0187d /eclass/java-ant-2.eclass | |
parent | Fix url, bug #387763 wrt Vladimir Berezhnoy. (diff) | |
download | gentoo-2-8684e9a9235a29e53a46ef528e68de70359bc2a1.tar.gz gentoo-2-8684e9a9235a29e53a46ef528e68de70359bc2a1.tar.bz2 gentoo-2-8684e9a9235a29e53a46ef528e68de70359bc2a1.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/java-ant-2.eclass')
-rw-r--r-- | eclass/java-ant-2.eclass | 18 |
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() |