diff options
author | William L. Thomson Jr <wlt@o-sinc.com> | 2016-09-09 19:20:50 -0400 |
---|---|---|
committer | James Le Cuirot <chewi@gentoo.org> | 2016-10-17 16:15:07 +0100 |
commit | a2ad06c3336b93f78b31cbd28aa42a8f292fce11 (patch) | |
tree | 56491e356d8a07df81ea9025cb6835a55cde9999 /eclass/java-utils-2.eclass | |
parent | media-gfx/wings: Version bump. (diff) | |
download | gentoo-a2ad06c3336b93f78b31cbd28aa42a8f292fce11.tar.gz gentoo-a2ad06c3336b93f78b31cbd28aa42a8f292fce11.tar.bz2 gentoo-a2ad06c3336b93f78b31cbd28aa42a8f292fce11.zip |
java-utils-2.eclass: Added new function java-pkg_gen-cp
Java package generate classpath will create a classpath based on special
variable CP_DEPEND in the ebuild. This allows for automatic classpath
creation based on depends. Reduces chance of error in ebuild with slots
in deps not matching slots in classpath variable, etc. Not to most
elegant. Elected for multiple passes using bash vs external sed or awk.
Closes: https://github.com/gentoo/gentoo/pull/2286
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Diffstat (limited to 'eclass/java-utils-2.eclass')
-rw-r--r-- | eclass/java-utils-2.eclass | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass index 9e0d2d561a30..61b338a30f64 100644 --- a/eclass/java-utils-2.eclass +++ b/eclass/java-utils-2.eclass @@ -2886,3 +2886,28 @@ java-pkg_clean() { find "${@}" '(' -name '*.class' -o -name '*.jar' ')' -type f -delete -print || die fi } + +# @FUNCTION: java-pkg_gen-cp +# @INTERNAL +# @DESCRIPTION: +# Java package generate classpath will create a classpath based on +# special variable CP_DEPEND in the ebuild. +# +# @CODE +# Parameters: +# $1 - classpath variable either EANT_GENTOO_CLASSPATH or JAVA_GENTOO_CLASSPATH +# @CODE +java-pkg_gen-cp() { + debug-print-function ${FUNCNAME} "${@}" + + if [[ ${CP_DEPEND} ]]; then + local cp="${!1}" + local p + for p in ${CP_DEPEND}; do + p="${p/-[0-9]*:/-}" + cp="${cp} ${p#*/}" + done + cp="${cp//:/-}" + [[ ${cp} ]] && export ${1}="${cp//-0/}" + fi +} |