/[gentoo-x86]/eclass/java-utils-2.eclass
Gentoo

Diff of /eclass/java-utils-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.84 Revision 1.150
1# Base eclass for Java packages 1# Base eclass for Java packages
2# 2#
3# Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org> 3# Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org>
4# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org> 4# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
5# Copyright (c) 2004-2005, Gentoo Foundation 5# Copyright (c) 2004-2011, Gentoo Foundation
6# 6#
7# Licensed under the GNU General Public License, v2 7# Licensed under the GNU General Public License, v2
8# 8#
9# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.84 2007/05/06 09:47:36 betelgeuse Exp $ 9# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.150 2012/03/13 10:05:46 sera Exp $
10
11 10
12# ----------------------------------------------------------------------------- 11# -----------------------------------------------------------------------------
13# @eclass-begin 12# @eclass-begin
14# @eclass-shortdesc Java Utility eclass 13# @eclass-shortdesc Java Utility eclass
15# @eclass-maintainer java@gentoo.org 14# @eclass-maintainer java@gentoo.org
58#WANT_ANT_TASKS 57#WANT_ANT_TASKS
59 58
60# ----------------------------------------------------------------------------- 59# -----------------------------------------------------------------------------
61# @variable-internal JAVA_PKG_PORTAGE_DEP 60# @variable-internal JAVA_PKG_PORTAGE_DEP
62# 61#
63# The version of portage we need to function properly. At this moment it's 62# The version of portage we need to function properly. Previously it was
64# portage with phase hooks support. 63# portage with phase hooks support but now we use a version with proper env
64# saving. For EAPI 2 we have new enough stuff so let's have cleaner deps.
65# ----------------------------------------------------------------------------- 65# -----------------------------------------------------------------------------
66JAVA_PKG_PORTAGE_DEP=">=sys-apps/portage-2.1_pre1" 66has "${EAPI}" 0 1 && JAVA_PKG_PORTAGE_DEP=">=sys-apps/portage-2.1.2.7"
67 67
68# ----------------------------------------------------------------------------- 68# -----------------------------------------------------------------------------
69# @variable-internal JAVA_PKG_E_DEPEND 69# @variable-internal JAVA_PKG_E_DEPEND
70# 70#
71# This is a convience variable to be used from the other java eclasses. This is 71# This is a convience variable to be used from the other java eclasses. This is
72# the version of java-config we want to use. We also need a recent version 72# the version of java-config we want to use. Usually the latest stable version
73# portage, that includes phase hooks. 73# so that ebuilds can use new features without depending on specific versions.
74# ----------------------------------------------------------------------------- 74# -----------------------------------------------------------------------------
75JAVA_PKG_E_DEPEND=">=dev-java/java-config-2.0.31 ${JAVA_PKG_PORTAGE_DEP}" 75JAVA_PKG_E_DEPEND=">=dev-java/java-config-2.1.9-r1 ${JAVA_PKG_PORTAGE_DEP}"
76has source ${JAVA_PKG_IUSE} && JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} source? ( app-arch/zip )"
77
78# -----------------------------------------------------------------------------
79# @variable-preinherit JAVA_PKG_WANT_BOOTCLASSPATH
80#
81# The version of bootclasspath the package needs to work. Translates to a proper
82# dependency. The bootclasspath has to be obtained by java-ant_rewrite-bootclasspath
83# -----------------------------------------------------------------------------
84
85if [[ -n "${JAVA_PKG_WANT_BOOTCLASSPATH}" ]]; then
86 if [[ "${JAVA_PKG_WANT_BOOTCLASSPATH}" == "1.5" ]]; then
87 JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} >=dev-java/gnu-classpath-0.98-r1:0.98"
88 else
89 eerror "Unknown value of JAVA_PKG_WANT_BOOTCLASSPATH"
90 # since die in global scope doesn't work, this will make repoman fail
91 JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} BAD_JAVA_PKG_WANT_BOOTCLASSPATH"
92 fi
93fi
76 94
77# ----------------------------------------------------------------------------- 95# -----------------------------------------------------------------------------
78# @variable-external JAVA_PKG_ALLOW_VM_CHANGE 96# @variable-external JAVA_PKG_ALLOW_VM_CHANGE
79# @variable-default yes 97# @variable-default yes
80# 98#
93# Should only be used for testing and debugging. 111# Should only be used for testing and debugging.
94# 112#
95# @example Use sun-jdk-1.5 to emerge foo 113# @example Use sun-jdk-1.5 to emerge foo
96# JAVA_PKG_FORCE_VM=sun-jdk-1.5 emerge foo 114# JAVA_PKG_FORCE_VM=sun-jdk-1.5 emerge foo
97# 115#
116# -----------------------------------------------------------------------------
117
118# -----------------------------------------------------------------------------
119# @variable-external JAVA_PKG_WANT_BUILD_VM
120#
121# A list of VM handles to choose a build VM from. If the list contains the
122# currently active VM use that one, otherwise step through the list till a
123# usable/installed VM is found.
124#
125# This allows to use an explicit list of JDKs in DEPEND instead of a virtual.
126# Users of this variable must make sure at least one of the listed handles is
127# covered by DEPEND.
128# Requires JAVA_PKG_WANT_SOURCE and JAVA_PKG_WANT_TARGET to be set as well.
98# ----------------------------------------------------------------------------- 129# -----------------------------------------------------------------------------
99 130
100# ----------------------------------------------------------------------------- 131# -----------------------------------------------------------------------------
101# @variable-external JAVA_PKG_WANT_SOURCE 132# @variable-external JAVA_PKG_WANT_SOURCE
102# 133#
195# 226#
196# @example 227# @example
197# java-pkg_doexamples demo 228# java-pkg_doexamples demo
198# java-pkg_doexamples demo/* examples/* 229# java-pkg_doexamples demo/* examples/*
199# 230#
231# @param --subdir - If the examples need a certain directory structure
200# @param $* - list of files to install 232# @param $* - list of files to install
201# ------------------------------------------------------------------------------ 233# ------------------------------------------------------------------------------
202java-pkg_doexamples() { 234java-pkg_doexamples() {
203 debug-print-function ${FUNCNAME} $* 235 debug-print-function ${FUNCNAME} $*
204 236
205 [[ ${#} -lt 1 ]] && die "At least one argument needed" 237 [[ ${#} -lt 1 ]] && die "At least one argument needed"
206 238
207 java-pkg_check-phase install 239 java-pkg_check-phase install
208 240
209 local dest=/usr/share/doc/${PF}/examples 241 local dest=/usr/share/doc/${PF}/examples
242 if [[ ${1} == --subdir ]]; then
243 local dest=${dest}/${2}
244 dodir ${dest}
245 shift 2
246 fi
247
210 if [[ ${#} = 1 && -d ${1} ]]; then 248 if [[ ${#} = 1 && -d ${1} ]]; then
211 ( # dont want to pollute calling env 249 ( # dont want to pollute calling env
212 insinto "${dest}" 250 insinto "${dest}"
213 doins -r ${1}/* 251 doins -r ${1}/*
214 ) || die "Installing examples failed" 252 ) || die "Installing examples failed"
216 ( # dont want to pollute calling env 254 ( # dont want to pollute calling env
217 insinto "${dest}" 255 insinto "${dest}"
218 doins -r "$@" 256 doins -r "$@"
219 ) || die "Installing examples failed" 257 ) || die "Installing examples failed"
220 fi 258 fi
259
260 # Let's make a symlink to the directory we have everything else under
261 dosym "${dest}" "${JAVA_PKG_SHAREPATH}/examples" || die
221} 262}
222 263
223# ----------------------------------------------------------------------------- 264# -----------------------------------------------------------------------------
224# @ebuild-function java-pkg_dojar 265# @ebuild-function java-pkg_dojar
225# 266#
283 done 324 done
284 325
285 java-pkg_do_write_ 326 java-pkg_do_write_
286} 327}
287 328
288
289# ------------------------------------------------------------------------------ 329# ------------------------------------------------------------------------------
290# @internal-function depend-java-query 330# @internal-function depend-java-query
291# 331#
292# Wrapper for the depend-java-query binary to enable passing USE in env. 332# Wrapper for the depend-java-query binary to enable passing USE in env.
293# Using env variables keeps this eclass working with java-config versions that 333# Using env variables keeps this eclass working with java-config versions that
358 if [[ ${jar} = *\** ]]; then 398 if [[ ${jar} = *\** ]]; then
359 eerror "The argument ${jar} to ${FUNCNAME}" 399 eerror "The argument ${jar} to ${FUNCNAME}"
360 eerror "has * in it. If you want it to glob in" 400 eerror "has * in it. If you want it to glob in"
361 eerror '${D} add ${D} to the argument.' 401 eerror '${D} add ${D} to the argument.'
362 fi 402 fi
403 debug-print "${jar} or ${D}${jar} not found"
363 die "${jar} does not exist" 404 die "${jar} does not exist"
364 fi 405 fi
365 done 406 done
366 407
367 java-pkg_do_write_ 408 java-pkg_do_write_
422# @param $@ - JNI libraries to install 463# @param $@ - JNI libraries to install
423# ------------------------------------------------------------------------------ 464# ------------------------------------------------------------------------------
424java-pkg_doso() { 465java-pkg_doso() {
425 debug-print-function ${FUNCNAME} $* 466 debug-print-function ${FUNCNAME} $*
426 467
427 [[ ${#} -lt 1 ]] && "At least one argument required for ${FUNCNAME}"
428 java-pkg_check-phase install 468 java-pkg_check-phase install
429 469
430 [[ ${#} -lt 1 ]] && die "At least one argument required for ${FUNCNAME}" 470 [[ ${#} -lt 1 ]] && die "${FUNCNAME} requires at least one argument"
431 471
432 java-pkg_init_paths_ 472 java-pkg_init_paths_
433 473
434 local lib 474 local lib
435 # for each lib 475 # for each lib
438 if [[ -e "${lib}" ]] ; then 478 if [[ -e "${lib}" ]] ; then
439 # install if it isn't a symlink 479 # install if it isn't a symlink
440 if [[ ! -L "${lib}" ]] ; then 480 if [[ ! -L "${lib}" ]] ; then
441 INSDESTTREE="${JAVA_PKG_LIBDEST}" \ 481 INSDESTTREE="${JAVA_PKG_LIBDEST}" \
442 INSOPTIONS="${LIBOPTIONS}" \ 482 INSOPTIONS="${LIBOPTIONS}" \
443 doins "${lib}" || "failed to install ${lib}" 483 doins "${lib}" || die "failed to install ${lib}"
444 java-pkg_append_ JAVA_PKG_LIBRARY "${JAVA_PKG_LIBDEST}" 484 java-pkg_append_ JAVA_PKG_LIBRARY "${JAVA_PKG_LIBDEST}"
445 debug-print "Installing ${lib} to ${JAVA_PKG_LIBDEST}" 485 debug-print "Installing ${lib} to ${JAVA_PKG_LIBDEST}"
446 # otherwise make a symlink to the symlink's origin 486 # otherwise make a symlink to the symlink's origin
447 else 487 else
448 # TODO use dosym 488 dosym "$(readlink "${lib}")" "${JAVA_PKG_LIBDEST}/${lib##*/}"
449 ln -s "$(readlink "${lib}")" \
450 "${D}${JAVA_PKG_LIBDEST}/$(basename "${lib}")"
451 debug-print "${lib} is a symlink, linking accordanly" 489 debug-print "${lib} is a symlink, linking accordantly"
452 fi 490 fi
453 # otherwise die 491 # otherwise die
454 else 492 else
455 die "${lib} does not exist" 493 die "${lib} does not exist"
456 fi 494 fi
472java-pkg_regso() { 510java-pkg_regso() {
473 debug-print-function ${FUNCNAME} $* 511 debug-print-function ${FUNCNAME} $*
474 512
475 java-pkg_check-phase install 513 java-pkg_check-phase install
476 514
477 [[ ${#} -lt 1 ]] && "at least one argument needed" 515 [[ ${#} -lt 1 ]] && die "${FUNCNAME} requires at least one argument"
478 516
479 java-pkg_init_paths_ 517 java-pkg_init_paths_
480 518
481 local lib target_dir 519 local lib target_dir
482 for lib in "$@" ; do 520 for lib in "$@" ; do
549# ------------------------------------------------------------------------------ 587# ------------------------------------------------------------------------------
550# @ebuild-function java-pkg_dojavadoc 588# @ebuild-function java-pkg_dojavadoc
551# 589#
552# Installs javadoc documentation. This should be controlled by the doc use flag. 590# Installs javadoc documentation. This should be controlled by the doc use flag.
553# 591#
592# @param $1: optional --symlink creates to symlink like this for html
593# documentation bundles.
554# @param $1: - The javadoc root directory. 594# @param $2: - The javadoc root directory.
555# 595#
556# @example: 596# @example:
557# java-pkg_dojavadoc docs/api 597# java-pkg_dojavadoc docs/api
598# java-pkg_dojavadoc --symlink apidocs docs/api
558# 599#
559# ------------------------------------------------------------------------------ 600# ------------------------------------------------------------------------------
560java-pkg_dojavadoc() { 601java-pkg_dojavadoc() {
561 debug-print-function ${FUNCNAME} $* 602 debug-print-function ${FUNCNAME} $*
603
604 # For html documentation bundles that link to Javadoc
605 local symlink
606 if [[ ${1} = --symlink ]]; then
607 symlink=${2}
608 shift 2
609 fi
610
562 local dir="$1" 611 local dir="$1"
612 local dest=/usr/share/doc/${PF}/html
563 613
564 # QA checks 614 # QA checks
565 615
566 java-pkg_check-phase install 616 java-pkg_check-phase install
567 617
571 local msg="No index.html in javadoc directory" 621 local msg="No index.html in javadoc directory"
572 ewarn "${msg}" 622 ewarn "${msg}"
573 is-java-strict && die "${msg}" 623 is-java-strict && die "${msg}"
574 fi 624 fi
575 625
626 if [[ -e ${D}/${dest}/api ]]; then
627 eerror "${dest} already exists. Will not overwrite."
628 die "${dest}"
629 fi
630
576 # Renaming to match our directory layout 631 # Renaming to match our directory layout
577 632
578 local dir_to_install="${dir}" 633 local dir_to_install="${dir}"
579 if [[ "$(basename "${dir}")" != "api" ]]; then 634 if [[ "$(basename "${dir}")" != "api" ]]; then
580 dir_to_install="${T}/api" 635 dir_to_install="${T}/api"
582 cp -r "${dir}" "${dir_to_install}" || die "cp failed" 637 cp -r "${dir}" "${dir_to_install}" || die "cp failed"
583 fi 638 fi
584 639
585 # Actual installation 640 # Actual installation
586 641
587 java-pkg_dohtml -r ${dir_to_install} 642 java-pkg_dohtml -r "${dir_to_install}"
643
644 # Let's make a symlink to the directory we have everything else under
645 dosym ${dest}/api "${JAVA_PKG_SHAREPATH}/api" || die
646
647 if [[ ${symlink} ]]; then
648 debug-print "symlinking ${dest}/{api,${symlink}}"
649 dosym ${dest}/{api,${symlink}} || die
650 fi
588} 651}
589 652
590# ------------------------------------------------------------------------------ 653# ------------------------------------------------------------------------------
591# @ebuild-function java-pkg_dosrc 654# @ebuild-function java-pkg_dosrc
592# 655#
615 678
616 [[ ${#} -lt 1 ]] && die "At least one argument needed" 679 [[ ${#} -lt 1 ]] && die "At least one argument needed"
617 680
618 if ! [[ ${DEPEND} = *app-arch/zip* ]]; then 681 if ! [[ ${DEPEND} = *app-arch/zip* ]]; then
619 local msg="${FUNCNAME} called without app-arch/zip in DEPEND" 682 local msg="${FUNCNAME} called without app-arch/zip in DEPEND"
620 if is-java-strict; then 683 java-pkg_announce-qa-violation ${msg}
621 eerror "${msg}"
622 die "${msg}"
623 else
624 echo "${msg}"
625 echo "Please report this to http://bugs.gentoo.org."
626 fi
627 fi 684 fi
628 685
629 java-pkg_init_paths_ 686 java-pkg_init_paths_
630 687
631 local zip_name="${PN}-src.zip" 688 local zip_name="${PN}-src.zip"
831# @param $opt 888# @param $opt
832# --build-only - makes the jar(s) not added into package.env DEPEND line. 889# --build-only - makes the jar(s) not added into package.env DEPEND line.
833# (assumed automatically when called inside src_test) 890# (assumed automatically when called inside src_test)
834# --with-dependencies - get jars also from requested package's dependencies 891# --with-dependencies - get jars also from requested package's dependencies
835# transitively. 892# transitively.
893# --virtual - Packages passed to this function are to be handled as virtuals
894# and will not have individual jar dependencies recorded.
836# --into $dir - symlink jar(s) into $dir (must exist) instead of . 895# --into $dir - symlink jar(s) into $dir (must exist) instead of .
837# @param $1 - Package to get jars from, or comma-separated list of packages in 896# @param $1 - Package to get jars from, or comma-separated list of packages in
838# case other parameters are not used. 897# case other parameters are not used.
839# @param $2 - jar from package. If not specified, all jars will be used. 898# @param $2 - jar from package. If not specified, all jars will be used.
840# @param $3 - When a single jar is specified, destination filename of the 899# @param $3 - When a single jar is specified, destination filename of the
845 debug-print-function ${FUNCNAME} $* 904 debug-print-function ${FUNCNAME} $*
846 905
847 local build_only="" 906 local build_only=""
848 local destdir="." 907 local destdir="."
849 local deep="" 908 local deep=""
909 local virtual=""
910 local record_jar=""
850 911
851 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build" 912 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build"
852 913
853 while [[ "${1}" == --* ]]; do 914 while [[ "${1}" == --* ]]; do
854 if [[ "${1}" = "--build-only" ]]; then 915 if [[ "${1}" = "--build-only" ]]; then
855 build_only="build" 916 build_only="build"
856 elif [[ "${1}" = "--with-dependencies" ]]; then 917 elif [[ "${1}" = "--with-dependencies" ]]; then
857 deep="--with-dependencies" 918 deep="--with-dependencies"
919 elif [[ "${1}" = "--virtual" ]]; then
920 virtual="true"
858 elif [[ "${1}" = "--into" ]]; then 921 elif [[ "${1}" = "--into" ]]; then
859 destdir="${2}" 922 destdir="${2}"
860 shift 923 shift
861 else 924 else
862 die "java-pkg_jar-from called with unknown parameter: ${1}" 925 die "java-pkg_jar-from called with unknown parameter: ${1}"
865 done 928 done
866 929
867 local target_pkg="${1}" target_jar="${2}" destjar="${3}" 930 local target_pkg="${1}" target_jar="${2}" destjar="${3}"
868 931
869 [[ -z ${target_pkg} ]] && die "Must specify a package" 932 [[ -z ${target_pkg} ]] && die "Must specify a package"
933
934 if [[ "${EAPI}" == "1" ]]; then
935 target_pkg="${target_pkg//:/-}"
936 fi
870 937
871 # default destjar to the target jar 938 # default destjar to the target jar
872 [[ -z "${destjar}" ]] && destjar="${target_jar}" 939 [[ -z "${destjar}" ]] && destjar="${target_jar}"
873 940
874 local error_msg="There was a problem getting the classpath for ${target_pkg}." 941 local error_msg="There was a problem getting the classpath for ${target_pkg}."
883 for pkg in ${target_pkg//,/ }; do 950 for pkg in ${target_pkg//,/ }; do
884 java-pkg_ensure-dep "${build_only}" "${pkg}" 951 java-pkg_ensure-dep "${build_only}" "${pkg}"
885 [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${pkg}" 952 [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${pkg}"
886 done 953 done
887 # setting this disables further record-jar_ calls later 954 # setting this disables further record-jar_ calls later
888 build_only="build" 955 record_jar="true"
889 else 956 else
890 java-pkg_ensure-dep "${build_only}" "${target_pkg}" 957 java-pkg_ensure-dep "${build_only}" "${target_pkg}"
958 fi
959
960 # Record the entire virtual as a dependency so that
961 # no jars are missed.
962 if [[ -z "${build_only}" && -n "${virtual}" ]]; then
963 java-pkg_record-jar_ "${target_pkg}"
964 # setting this disables further record-jars_ calls later
965 record_jar="true"
891 fi 966 fi
892 967
893 pushd ${destdir} > /dev/null \ 968 pushd ${destdir} > /dev/null \
894 || die "failed to change directory to ${destdir}" 969 || die "failed to change directory to ${destdir}"
895 970
903 # If no specific target jar was indicated, link it 978 # If no specific target jar was indicated, link it
904 if [[ -z "${target_jar}" ]] ; then 979 if [[ -z "${target_jar}" ]] ; then
905 [[ -f "${target_jar}" ]] && rm "${target_jar}" 980 [[ -f "${target_jar}" ]] && rm "${target_jar}"
906 ln -snf "${jar}" \ 981 ln -snf "${jar}" \
907 || die "Failed to make symlink from ${jar} to ${jar_name}" 982 || die "Failed to make symlink from ${jar} to ${jar_name}"
983 if [[ -z "${record_jar}" ]]; then
984 if [[ -z "${build_only}" ]]; then
908 [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${target_pkg}" "${jar}" 985 java-pkg_record-jar_ "${target_pkg}" "${jar}"
986 else
987 java-pkg_record-jar_ --build-only "${target_pkg}" "${jar}"
988 fi
989 fi
909 # otherwise, if the current jar is the target jar, link it 990 # otherwise, if the current jar is the target jar, link it
910 elif [[ "${jar_name}" == "${target_jar}" ]] ; then 991 elif [[ "${jar_name}" == "${target_jar}" ]] ; then
911 [[ -f "${destjar}" ]] && rm "${destjar}" 992 [[ -f "${destjar}" ]] && rm "${destjar}"
912 ln -snf "${jar}" "${destjar}" \ 993 ln -snf "${jar}" "${destjar}" \
913 || die "Failed to make symlink from ${jar} to ${destjar}" 994 || die "Failed to make symlink from ${jar} to ${destjar}"
995 if [[ -z "${record_jar}" ]]; then
996 if [[ -z "${build_only}" ]]; then
914 [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${target_pkg}" "${jar}" 997 java-pkg_record-jar_ "${target_pkg}" "${jar}"
998 else
999 java-pkg_record-jar_ --build-only "${target_jar}" "${jar}"
1000 fi
1001 fi
915 popd > /dev/null 1002 popd > /dev/null
916 return 0 1003 return 0
917 fi 1004 fi
918 done 1005 done
919 popd > /dev/null 1006 popd > /dev/null
978 done 1065 done
979 1066
980 [[ ${#} -ne 1 ]] && die "${FUNCNAME} takes only one argument besides --*" 1067 [[ ${#} -ne 1 ]] && die "${FUNCNAME} takes only one argument besides --*"
981 1068
982 1069
983 local classpath pkgs="${1}" 1070 local pkgs="${1}"
1071
1072 if [[ "${EAPI}" == "1" ]]; then
1073 pkgs="${pkgs//:/-}"
1074 fi
1075
984 jars="$(java-config ${deep} --classpath=${pkgs})" 1076 jars="$(java-config ${deep} --classpath=${pkgs})"
985 [[ $? != 0 || -z "${jars}" ]] && die "java-config --classpath=${pkgs} failed" 1077 [[ $? != 0 ]] && die "java-config --classpath=${pkgs} failed"
986 debug-print "${pkgs}:${jars}" 1078 debug-print "${pkgs}:${jars}"
987 1079
988 for pkg in ${pkgs//,/ }; do 1080 for pkg in ${pkgs//,/ }; do
989 java-pkg_ensure-dep "${build_only}" "${pkg}" 1081 java-pkg_ensure-dep "${build_only}" "${pkg}"
990 done 1082 done
991 1083
992 if [[ -z "${classpath}" ]]; then 1084 for pkg in ${pkgs//,/ }; do
993 classpath="${jars}"
994 else
995 classpath="${classpath}:${jars}"
996 fi
997
998 # Only record jars that aren't build-only
999 if [[ -z "${build_only}" ]]; then 1085 if [[ -z "${build_only}" ]]; then
1000 for pkg in ${pkgs//,/ }; do
1001 java-pkg_record-jar_ "${pkg}" 1086 java-pkg_record-jar_ "${pkg}"
1087 else
1088 java-pkg_record-jar_ --build-only "${pkg}"
1089 fi
1002 done 1090 done
1003 fi
1004 1091
1005 echo "${classpath}" 1092 echo "${jars}"
1006} 1093}
1007 1094
1008# ------------------------------------------------------------------------------ 1095# ------------------------------------------------------------------------------
1009# @ebuild-function java-pkg_getjar 1096# @ebuild-function java-pkg_getjar
1010# 1097#
1019# @example-return 1106# @example-return
1020# /usr/share/xerces-2/lib/xml-apis.jar 1107# /usr/share/xerces-2/lib/xml-apis.jar
1021# 1108#
1022# @param $opt 1109# @param $opt
1023# --build-only - makes the jar not added into package.env DEPEND line. 1110# --build-only - makes the jar not added into package.env DEPEND line.
1111# --virtual - Packages passed to this function are to be handled as virtuals
1112# and will not have individual jar dependencies recorded.
1024# @param $1 - package to use 1113# @param $1 - package to use
1025# @param $2 - jar to get 1114# @param $2 - jar to get
1026# ------------------------------------------------------------------------------ 1115# ------------------------------------------------------------------------------
1027java-pkg_getjar() { 1116java-pkg_getjar() {
1028 debug-print-function ${FUNCNAME} $* 1117 debug-print-function ${FUNCNAME} $*
1029 1118
1030 local build_only="" 1119 local build_only=""
1120 local virtual=""
1121 local record_jar=""
1031 1122
1032 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build" 1123 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build"
1033 1124
1034 while [[ "${1}" == --* ]]; do 1125 while [[ "${1}" == --* ]]; do
1035 if [[ "${1}" = "--build-only" ]]; then 1126 if [[ "${1}" = "--build-only" ]]; then
1036 build_only="build" 1127 build_only="build"
1128 elif [[ "${1}" == "--virtual" ]]; then
1129 virtual="true"
1037 else 1130 else
1038 die "java-pkg_jar-from called with unknown parameter: ${1}" 1131 die "java-pkg_getjar called with unknown parameter: ${1}"
1039 fi 1132 fi
1040 shift 1133 shift
1041 done 1134 done
1042 1135
1043 [[ ${#} -ne 2 ]] && die "${FUNCNAME} takes only two arguments besides --*" 1136 [[ ${#} -ne 2 ]] && die "${FUNCNAME} takes only two arguments besides --*"
1044 1137
1045 local pkg="${1}" target_jar="${2}" jar 1138 local pkg="${1}" target_jar="${2}" jar
1139
1140 if [[ "${EAPI}" == "1" ]]; then
1141 pkg="${pkg//:/-}"
1142 fi
1143
1046 [[ -z ${pkg} ]] && die "Must specify package to get a jar from" 1144 [[ -z ${pkg} ]] && die "Must specify package to get a jar from"
1047 [[ -z ${target_jar} ]] && die "Must specify jar to get" 1145 [[ -z ${target_jar} ]] && die "Must specify jar to get"
1048 1146
1049 local error_msg="Could not find classpath for ${pkg}. Are you sure its installed?" 1147 local error_msg="Could not find classpath for ${pkg}. Are you sure its installed?"
1050 local classpath 1148 local classpath
1051 classpath=$(java-config --classpath=${pkg}) 1149 classpath=$(java-config --classpath=${pkg})
1052 [[ $? != 0 ]] && die ${error_msg} 1150 [[ $? != 0 ]] && die ${error_msg}
1053 1151
1054 java-pkg_ensure-dep "${build_only}" "${pkg}" 1152 java-pkg_ensure-dep "${build_only}" "${pkg}"
1055 1153
1154 # Record the package(Virtual) as a dependency and then set build_only
1155 # So that individual jars are not recorded.
1156 if [[ -n "${virtual}" ]]; then
1157 if [[ -z "${build_only}" ]]; then
1158 java-pkg_record-jar_ "${pkg}"
1159 else
1160 java-pkg_record-jar_ --build-only "${pkg}"
1161 fi
1162 record_jar="true"
1163 fi
1164
1056 for jar in ${classpath//:/ }; do 1165 for jar in ${classpath//:/ }; do
1057 if [[ ! -f "${jar}" ]] ; then 1166 if [[ ! -f "${jar}" ]] ; then
1058 die "Installation problem with jar ${jar} in ${pkg} - is it installed?" 1167 die "Installation problem with jar ${jar} in ${pkg} - is it installed?"
1059 fi 1168 fi
1060 1169
1061 if [[ "$(basename ${jar})" == "${target_jar}" ]] ; then 1170 if [[ "$(basename ${jar})" == "${target_jar}" ]] ; then
1062 # Only record jars that aren't build-only 1171 # Only record jars that aren't build-only
1063 [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${pkg}" "${jar}" 1172 if [[ -z "${record_jar}" ]]; then
1173 if [[ -z "${build_only}" ]]; then
1174 java-pkg_record-jar_ "${pkg}" "${jar}"
1175 else
1176 java-pkg_record-jar_ --build-only "${pkg}" "${jar}"
1177 fi
1178 fi
1064 echo "${jar}" 1179 echo "${jar}"
1065 return 0 1180 return 0
1066 fi 1181 fi
1067 done 1182 done
1068 1183
1077# from a package, into package.env DEPEND line. Can only be called in 1192# from a package, into package.env DEPEND line. Can only be called in
1078# src_install phase. 1193# src_install phase.
1079# Intended for binary packages where you don't need to symlink the jars or get 1194# Intended for binary packages where you don't need to symlink the jars or get
1080# their classpath during build. As such, the dependencies only need to be 1195# their classpath during build. As such, the dependencies only need to be
1081# specified in ebuild's RDEPEND, and should be omitted in DEPEND. 1196# specified in ebuild's RDEPEND, and should be omitted in DEPEND.
1082# Get the classpath provided by any number of packages.
1083# 1197#
1084# @param $1 - comma-separated list of packages, or a single package 1198# @param $1 - comma-separated list of packages, or a single package
1085# @param $2 - if param $1 is a single package, optionally specify the jar 1199# @param $2 - if param $1 is a single package, optionally specify the jar
1086# to depend on 1200# to depend on
1087# 1201#
1105 1219
1106 local pkgs="${1}" 1220 local pkgs="${1}"
1107 local jar="${2}" 1221 local jar="${2}"
1108 1222
1109 [[ -z "${pkgs}" ]] && die "${FUNCNAME} called with no package(s) specified" 1223 [[ -z "${pkgs}" ]] && die "${FUNCNAME} called with no package(s) specified"
1224
1225 if [[ "${EAPI}" == "1" ]]; then
1226 pkgs="${pkgs//:/-}"
1227 fi
1110 1228
1111 if [[ -z "${jar}" ]]; then 1229 if [[ -z "${jar}" ]]; then
1112 for pkg in ${pkgs//,/ }; do 1230 for pkg in ${pkgs//,/ }; do
1113 java-pkg_ensure-dep runtime "${pkg}" 1231 java-pkg_ensure-dep runtime "${pkg}"
1114 java-pkg_record-jar_ "${pkg}" 1232 java-pkg_record-jar_ "${pkg}"
1118 die "${FUNCNAME} called with both package list and jar name" 1236 die "${FUNCNAME} called with both package list and jar name"
1119 java-pkg_ensure-dep runtime "${pkgs}" 1237 java-pkg_ensure-dep runtime "${pkgs}"
1120 java-pkg_record-jar_ "${pkgs}" "${jar}" 1238 java-pkg_record-jar_ "${pkgs}" "${jar}"
1121 fi 1239 fi
1122 1240
1123 java-pkg_do_write_ 1241 java-pkg_do_write_
1124} 1242}
1243
1244# ------------------------------------------------------------------------------
1245# @ebuild-function java-pkg_register-optional-dependency
1246#
1247# Registers optional runtime dependency on a package, list of packages, or a
1248# single jar from a package, into package.env OPTIONAL_DEPEND line. Can only be
1249# called in src_install phase.
1250# Intended for packages that can use other packages when those are in classpath.
1251# Will be put on classpath by launcher if they are installed. Typical case is
1252# JDBC implementations for various databases. It's better than having USE flag
1253# for each implementation triggering hard dependency.
1254#
1255# @param $1 - comma-separated list of packages, or a single package
1256# @param $2 - if param $1 is a single package, optionally specify the jar
1257# to depend on
1258#
1259# Example: Record the optional dependency on some jdbc providers
1260# java-pkg_register-optional-dependency jdbc-jaybird,jtds-1.2,jdbc-mysql
1261#
1262# Note: Passing both list of packages as the first parameter AND specifying the
1263# jar as the second is not allowed and will cause the function to die. We assume
1264# that there's more chance one passes such combination as a mistake, than that
1265# there are more packages providing identically named jar without class
1266# collisions.
1267# ------------------------------------------------------------------------------
1268java-pkg_register-optional-dependency() {
1269 debug-print-function ${FUNCNAME} $*
1270
1271 java-pkg_check-phase install
1272
1273 [[ ${#} -gt 2 ]] && die "${FUNCNAME} takes at most two arguments"
1274
1275 local pkgs="${1}"
1276 local jar="${2}"
1277
1278 [[ -z "${pkgs}" ]] && die "${FUNCNAME} called with no package(s) specified"
1279
1280 if [[ "${EAPI}" == "1" ]]; then
1281 pkgs="${pkgs//:/-}"
1282 fi
1283
1284 if [[ -z "${jar}" ]]; then
1285 for pkg in ${pkgs//,/ }; do
1286 java-pkg_record-jar_ --optional "${pkg}"
1287 done
1288 else
1289 [[ ${pkgs} == *,* ]] && \
1290 die "${FUNCNAME} called with both package list and jar name"
1291 java-pkg_record-jar_ --optional "${pkgs}" "${jar}"
1292 fi
1293
1294 java-pkg_do_write_
1295}
1296
1297# ------------------------------------------------------------------------------
1298# @ebuild-function java-pkg_register-environment-variable
1299#
1300# Register an arbitrary environment variable into package.env. The gjl launcher
1301# for this package or any package depending on this will export it into
1302# environement before executing java command.
1303# Must only be called in src_install phase.
1304#
1305# @param $1 - variable name
1306# @param $2 - variable value
1307# ------------------------------------------------------------------------------
1308JAVA_PKG_EXTRA_ENV="${T}/java-pkg-extra-env"
1309JAVA_PKG_EXTRA_ENV_VARS=""
1310java-pkg_register-environment-variable() {
1311 debug-print-function ${FUNCNAME} $*
1312
1313 java-pkg_check-phase install
1314
1315 [[ ${#} != 2 ]] && die "${FUNCNAME} takes two arguments"
1316
1317 echo "${1}=\"${2}\"" >> ${JAVA_PKG_EXTRA_ENV}
1318 JAVA_PKG_EXTRA_ENV_VARS="${JAVA_PKG_EXTRA_ENV_VARS} ${1}"
1319
1320 java-pkg_do_write_
1321}
1322
1323# ------------------------------------------------------------------------------
1324# @ebuild-function java-pkg_get-bootclasspath
1325#
1326# Returns classpath of a given bootclasspath-providing package version.
1327#
1328# @param $1 - the version of bootclasspath (e.g. 1.5), 'auto' for bootclasspath
1329# of the current JDK
1330# ------------------------------------------------------------------------------
1331
1332java-pkg_get-bootclasspath() {
1333 local version="${1}"
1334
1335 local bcp
1336 case "${version}" in
1337 auto)
1338 bcp="$(java-config -g BOOTCLASSPATH)"
1339 ;;
1340 1.5)
1341 bcp="$(java-pkg_getjars --build-only gnu-classpath-0.98)"
1342 ;;
1343 *)
1344 eerror "unknown parameter of java-pkg_get-bootclasspath"
1345 die "unknown parameter of java-pkg_get-bootclasspath"
1346 ;;
1347 esac
1348
1349 echo "${bcp}"
1350}
1351
1125 1352
1126# This function reads stdin, and based on that input, figures out how to 1353# This function reads stdin, and based on that input, figures out how to
1127# populate jars from the filesystem. 1354# populate jars from the filesystem.
1128# Need to figure out a good way of making use of this, ie be able to use a 1355# Need to figure out a good way of making use of this, ie be able to use a
1129# string that was built instead of stdin 1356# string that was built instead of stdin
1167# @section-begin helper 1394# @section-begin helper
1168# @section-summary Helper functions 1395# @section-summary Helper functions
1169# 1396#
1170# Various other functions to use from an ebuild 1397# Various other functions to use from an ebuild
1171# ------------------------------------------------------------------------------ 1398# ------------------------------------------------------------------------------
1172
1173# ------------------------------------------------------------------------------
1174# @ebuild-function java-pkg_need
1175#
1176# Adds virtual dependencies, which can optionally be controlled by a USE flag.
1177# Currently supported virtuals are:
1178# javamail
1179# jdbc-stdext
1180# jaf
1181# jdbc-rowset
1182# jms
1183#
1184# @param $1 - Optionally indicate that the dependencies are controlled by
1185# a use flag by specifying '--use' Requires $2.
1186# @param $2 - USE flag which will enable the dependencies.
1187# @param $@ - virtual packages to add depenedencies for
1188# ------------------------------------------------------------------------------
1189# TODO rewrite to parse a line based declaration file instead -- karltk
1190#java-pkg_need() {
1191# debug-print-function ${FUNCNAME} $*
1192# local useflag
1193# if [[ ${1} == "--use" ]]; then
1194# useflag="${2}"
1195# shift 2
1196# fi
1197#
1198# if [[ -z ${1} ]]; then
1199# die "Must specify at least one virtual package."
1200# fi
1201#
1202# local depstr newdepstr
1203#
1204# for virtual in ${@}; do
1205# if has ${virtual} ${JAVA_PKG_VNEED}; then
1206# debug-print "Already registered virtual ${virtual}"
1207# continue
1208# fi
1209# case ${virtual} in
1210# javamail)
1211# debug-print "java-pkg_need: adding javamail dependencies"
1212# newdepstr="|| ( dev-java/gnu-javamail dev-java/sun-javamail-bin )"
1213# ;;
1214# jdbc-stdext)
1215# debug-print "java-pkg_need: adding jdbc-stdext dependencies"
1216# newdepstr="|| ( >=virtual/jdk-1.4 dev-java/jdbc2-stdext )"
1217# ;;
1218# jaf)
1219# debug-print "java-pkg_need: adding jaf dependencies"
1220# newdepstr="|| ( dev-java/gnu-jaf dev-java/sun-jaf-bin )"
1221# ;;
1222# jdbc-rowset)
1223# debug-print "java-pkg_need: adding jdbc-rowset dependencies"
1224# newdepstr="|| ( >=virtual/jdk-1.5 dev-java/sun-jdbc-rowset )"
1225# ;;
1226# jms)
1227# debug-print "java-pkg_need: adding jms dependencies"
1228# newdepstr="|| ( dev-java/sun-jms dev-java/openjms )"
1229# ;;
1230# *)
1231# die "Invalid virtual: ${virtual}"
1232# esac
1233#
1234# export JAVA_PKG_VNEED="${JAVA_PKG_VNEED} ${virtual}"
1235#
1236# if [[ -n ${useflag} ]]; then
1237# depstr="${depstr} ${useflag}? ( ${newdepstr} )"
1238# else
1239# depstr="${depstr} ${newdepstr}"
1240# fi
1241# done
1242#
1243# [[ -z ${JAVA_PKG_NV_DEPEND} ]] && export JAVA_PKG_NV_DEPEND="${DEPEND}"
1244# [[ -z ${JAVA_PKG_NV_RDEPEND} ]] && export JAVA_PKG_NV_RDEPEND="${RDEPEND}"
1245#
1246# export DEPEND="${DEPEND} ${depstr}"
1247# export RDEPEND="${RDEPEND} ${depstr}"
1248#}
1249 1399
1250# ------------------------------------------------------------------------------ 1400# ------------------------------------------------------------------------------
1251# @ebuild-function java-pkg_find-normal-jars 1401# @ebuild-function java-pkg_find-normal-jars
1252# 1402#
1253# Find the files with suffix .jar file in the given directory or $WORKDIR 1403# Find the files with suffix .jar file in the given directory or $WORKDIR
1419java-pkg_get-current-vm() { 1569java-pkg_get-current-vm() {
1420 echo ${GENTOO_VM} 1570 echo ${GENTOO_VM}
1421} 1571}
1422 1572
1423java-pkg_current-vm-matches() { 1573java-pkg_current-vm-matches() {
1424 hasq $(java-pkg_get-current-vm) ${@} 1574 has $(java-pkg_get-current-vm) ${@}
1425 return $? 1575 return $?
1426} 1576}
1427 1577
1428# ------------------------------------------------------------------------------ 1578# ------------------------------------------------------------------------------
1429# @ebuild-function java-pkg_get-source 1579# @ebuild-function java-pkg_get-source
1544 die "No GCJ support found!" 1694 die "No GCJ support found!"
1545 fi 1695 fi
1546} 1696}
1547 1697
1548java-pkg_ensure-test() { 1698java-pkg_ensure-test() {
1549 if hasq test ${FEATURES} && ! hasq -test ${FEATURES} \ 1699 if has test ${FEATURES} && ! has -test ${FEATURES} \
1550 && hasq test ${IUSE} && ! use test; 1700 && has test ${IUSE} && ! use test;
1551 then 1701 then
1552 eerror "You specified FEATURES=test, but USE=test is needed" 1702 eerror "You specified FEATURES=test, but USE=test is needed"
1553 eerror "to pull in the additional dependencies for testing" 1703 eerror "to pull in the additional dependencies for testing"
1554 die "Need USE=test enabled" 1704 die "Need USE=test enabled"
1555 fi 1705 fi
1591 dodir /usr/share/ant/${TASKS_DIR} 1741 dodir /usr/share/ant/${TASKS_DIR}
1592 touch "${D}/usr/share/ant/${TASKS_DIR}/${TASK_NAME}" 1742 touch "${D}/usr/share/ant/${TASKS_DIR}/${TASK_NAME}"
1593} 1743}
1594 1744
1595# ------------------------------------------------------------------------------ 1745# ------------------------------------------------------------------------------
1596# @internal-function java-pkg_ant-tasks-from-deps
1597#
1598# Function to determine ANT_TASKS from DEPEND variable for backwards
1599# compatibility with ebuilds that don't set ANT_TASKS before calling eant() or
1600# WANT_ANT_TASKS before inheriting java-pkg-2. If the DEPEND string contains
1601# "dev-java/ant" or "dev-java/ant-tasks", then it returns "all", otherwise
1602# "none". It's not smart enough to cope with USE flag depends but that shouldn't
1603# be a problem, the worst it can do is activace all tasks when not needed.
1604# Note that this is called only with JAVA_PKG_STRICT=1, to find ebuilds with
1605# insufficient dependencies, otherwise all available tasks are used for
1606# backwards compatilbility.
1607#
1608# @return "all" or "none"
1609# ------------------------------------------------------------------------------
1610java-pkg_ant-tasks-from-deps() {
1611 local found_ant found_ant_tasks
1612
1613 for dep in ${DEPEND}
1614 do
1615 local ant="$(awk '/(dev-java\/ant)/ { if (match($1, "(dev-java/ant)((-[0-9])+|$)", m)) print m[1] }' <<< ${dep})"
1616 [[ "${ant}" == "dev-java/ant" ]] && found_ant=true
1617 [[ "${dep}" == *"ant-tasks"* ]] && found_ant_tasks=true
1618 done
1619
1620 if [[ -n "${found_ant}" || -n "${found_ant_tasks}" ]]; then
1621 java-pkg_announce-qa-violation --nodie "The ebuild DEPENDS on deprecated ant or ant-tasks"
1622 echo "all"
1623 else
1624 # ebuild doesn't set ANT_TASKS and doesn't depend on ant-tasks or ant
1625 # so we deactivate all tasks that may be installed
1626 echo "none"
1627 fi
1628}
1629
1630# ------------------------------------------------------------------------------
1631# @internal-function java-pkg_ant-tasks-depend 1746# @internal-function java-pkg_ant-tasks-depend
1632# 1747#
1633# Translates the WANT_ANT_TASKS variable into valid dependencies. 1748# Translates the WANT_ANT_TASKS variable into valid dependencies.
1634# ------------------------------------------------------------------------------ 1749# ------------------------------------------------------------------------------
1635java-pkg_ant-tasks-depend() { 1750java-pkg_ant-tasks-depend() {
1637 1752
1638 if [[ -n "${WANT_ANT_TASKS}" ]]; then 1753 if [[ -n "${WANT_ANT_TASKS}" ]]; then
1639 local DEP="" 1754 local DEP=""
1640 for i in ${WANT_ANT_TASKS} 1755 for i in ${WANT_ANT_TASKS}
1641 do 1756 do
1642 if [[ ${i} != ant-* ]]; then 1757 if [[ ${i} = ant-* ]]; then
1758 DEP="${DEP}dev-java/${i} "
1759 elif [[ ${i} = */*:* ]]; then
1760 DEP="${DEP}${i} "
1761 else
1643 echo "Invalid atom in WANT_ANT_TASKS: ${i}" 1762 echo "Invalid atom in WANT_ANT_TASKS: ${i}"
1644 return 1 1763 return 1
1645 fi 1764 fi
1646 DEP="${DEP}dev-java/${i} "
1647 done 1765 done
1648 echo ${DEP} 1766 echo ${DEP}
1649 return 0 1767 return 0
1650 else 1768 else
1651 return 0 1769 return 0
1652 fi 1770 fi
1653} 1771}
1654 1772
1773
1774# ------------------------------------------------------------------------------
1775# @internal-function ejunit_
1776#
1777# Internal Junit wrapper function. Makes it easier to run the tests and checks for
1778# dev-java/junit in DEPEND. Launches the tests using junit.textui.TestRunner.
1779#
1780# @param $1 - junit package (junit or junit-4)
1781# @param $2 - -cp or -classpath
1782# @param $3 - classpath; junit and recorded dependencies get appended
1783# @param $@ - the rest of the parameters are passed to java
1784ejunit_() {
1785 debug-print-function ${FUNCNAME} $*
1786
1787 local pkgs
1788 if [[ -f ${JAVA_PKG_DEPEND_FILE} ]]; then
1789 for atom in $(cat ${JAVA_PKG_DEPEND_FILE} | tr : ' '); do
1790 pkgs=${pkgs},$(echo ${atom} | sed -re "s/^.*@//")
1791 done
1792 fi
1793
1794 local junit=${1}
1795 shift 1
1796
1797 local cp=$(java-pkg_getjars --with-dependencies ${junit}${pkgs})
1798 if [[ ${1} = -cp || ${1} = -classpath ]]; then
1799 cp="${2}:${cp}"
1800 shift 2
1801 else
1802 cp=".:${cp}"
1803 fi
1804
1805 local runner=junit.textui.TestRunner
1806 if [[ "${junit}" == "junit-4" ]] ; then
1807 runner=org.junit.runner.JUnitCore
1808 fi
1809 debug-print "Calling: java -cp \"${cp}\" -Djava.awt.headless=true ${runner} ${@}"
1810 java -cp "${cp}" -Djava.awt.headless=true ${runner} "${@}" || die "Running junit failed"
1811}
1812
1655# ------------------------------------------------------------------------------ 1813# ------------------------------------------------------------------------------
1656# @ebuild-function ejunit 1814# @ebuild-function ejunit
1657# 1815#
1658# Junit wrapper function. Makes it easier to run the tests and checks for 1816# Junit wrapper function. Makes it easier to run the tests and checks for
1659# dev-java/junit in DEPEND. Launches the tests using junit.textui.TestRunner. 1817# dev-java/junit in DEPEND. Launches the tests using org.junit.runner.JUnitCore.
1660# 1818#
1661# Examples: 1819# Examples:
1662# ejunit -cp build/classes org.blinkenlights.jid3.test.AllTests 1820# ejunit -cp build/classes org.blinkenlights.jid3.test.AllTests
1663# ejunit org.blinkenlights.jid3.test.AllTests 1821# ejunit org.blinkenlights.jid3.test.AllTests
1822# ejunit org.blinkenlights.jid3.test.FirstTest \
1823# org.blinkenlights.jid3.test.SecondTest
1664# 1824#
1665# @param $1 - -cp or -classpath 1825# @param $1 - -cp or -classpath
1666# @param $2 - classpath, junit gets appended 1826# @param $2 - classpath; junit and recorded dependencies get appended
1667# @param $@ - the rest of the parameters are passed to java 1827# @param $@ - the rest of the parameters are passed to java
1668# ------------------------------------------------------------------------------ 1828# ------------------------------------------------------------------------------
1669ejunit() { 1829ejunit() {
1670 debug-print-function ${FUNCNAME} $* 1830 debug-print-function ${FUNCNAME} $*
1671 1831
1672 local cp 1832 ejunit_ "junit" "${@}"
1673 if [[ ${1} = -cp || ${1} = -classpath ]]; then 1833}
1674 cp=${2}:$(java-pkg_getjars --build-only junit)
1675 shift 2
1676 else
1677 cp=$(java-pkg_getjars --build-only junit):.
1678 fi
1679 1834
1680 local runner=junit.textui.TestRunner 1835# ------------------------------------------------------------------------------
1681 debug-print "Calling: java -cp \"${cp}\" -Djava.awt.headless=true ${runner} ${@}" 1836# @ebuild-function ejunit4
1682 java -cp "${cp}" -Djava.awt.headless=true ${runner} "${@}" || die "Running junit failed" 1837#
1838# Junit4 wrapper function. Makes it easier to run the tests and checks for
1839# dev-java/junit:4 in DEPEND. Launches the tests using junit.textui.TestRunner.
1840#
1841# Examples:
1842# ejunit4 -cp build/classes org.blinkenlights.jid3.test.AllTests
1843# ejunit4 org.blinkenlights.jid3.test.AllTests
1844# ejunit4 org.blinkenlights.jid3.test.FirstTest \
1845# org.blinkenlights.jid3.test.SecondTest
1846#
1847# @param $1 - -cp or -classpath
1848# @param $2 - classpath; junit and recorded dependencies get appended
1849# @param $@ - the rest of the parameters are passed to java
1850# ------------------------------------------------------------------------------
1851ejunit4() {
1852 debug-print-function ${FUNCNAME} $*
1853
1854 ejunit_ "junit-4" "${@}"
1683} 1855}
1684 1856
1685# ------------------------------------------------------------------------------ 1857# ------------------------------------------------------------------------------
1686# @section-end helper 1858# @section-end helper
1687# ------------------------------------------------------------------------------ 1859# ------------------------------------------------------------------------------
1860
1861# ------------------------------------------------------------------------------
1862# @eclass-src_prepare
1863#
1864# src_prepare Searches for bundled jars
1865# Don't call directly, but via java-pkg-2_src_prepare!
1866# ------------------------------------------------------------------------------
1867
1868java-utils-2_src_prepare() {
1869 [[ ${EBUILD_PHASE} == prepare ]] &&
1870 java-pkg_func-exists java_prepare && java_prepare
1871
1872 # Remember that eant will call this unless called via Portage
1873 if [[ ! -e "${T}/java-utils-2_src_prepare-run" ]] && is-java-strict; then
1874 echo "Searching for bundled jars:"
1875 java-pkg_find-normal-jars || echo "None found."
1876 echo "Searching for bundled classes (no output if none found):"
1877 find "${WORKDIR}" -name "*.class"
1878 echo "Search done."
1879 fi
1880 touch "${T}/java-utils-2_src_prepare-run"
1881}
1882
1883# ------------------------------------------------------------------------------
1884# @eclass-pkg_preinst
1885#
1886# pkg_preinst Searches for missing and unneeded dependencies
1887# Don't call directly, but via java-pkg-2_pkg_preinst!
1888# ------------------------------------------------------------------------------
1889
1890java-utils-2_pkg_preinst() {
1891 if is-java-strict; then
1892 if has_version dev-java/java-dep-check; then
1893 [[ -e "${JAVA_PKG_ENV}" ]] || return
1894 local output=$(GENTOO_VM= java-dep-check --image "${D}" "${JAVA_PKG_ENV}")
1895 if [[ ${output} && has_version <=dev-java/java-dep-check-0.2 ]]; then
1896 ewarn "Possibly unneeded dependencies found in package.env:"
1897 for dep in ${output}; do
1898 ewarn "\t${dep}"
1899 done
1900 fi
1901 if [[ ${output} && has_version >dev-java/java-dep-check-0.2 ]]; then
1902 ewarn "${output}"
1903 fi
1904 else
1905 eerror "Install dev-java/java-dep-check for dependency checking"
1906 fi
1907 fi
1908}
1688 1909
1689# ------------------------------------------------------------------------------ 1910# ------------------------------------------------------------------------------
1690# @section-begin build 1911# @section-begin build
1691# @section-summary Build functions 1912# @section-summary Build functions
1692# 1913#
1701# compiler. Will also set proper ANT_TASKS from the variable ANT_TASKS, 1922# compiler. Will also set proper ANT_TASKS from the variable ANT_TASKS,
1702# variables: 1923# variables:
1703# EANT_GENTOO_CLASSPATH - calls java-pkg_getjars for the value and adds to the 1924# EANT_GENTOO_CLASSPATH - calls java-pkg_getjars for the value and adds to the
1704# gentoo.classpath property. Be sure to call 1925# gentoo.classpath property. Be sure to call
1705# java-ant_rewrite-classpath in src_unpack. 1926# java-ant_rewrite-classpath in src_unpack.
1927# EANT_NEEDS_TOOLS - add tools.jar to the gentoo.classpath. Should only be used
1928# for build-time purposes, the dependency is not recorded to
1929# package.env!
1706# *ANT_TASKS - used to determine ANT_TASKS before calling Ant. 1930# *ANT_TASKS - used to determine ANT_TASKS before calling Ant.
1707# ------------------------------------------------------------------------------ 1931# ------------------------------------------------------------------------------
1708eant() { 1932eant() {
1709 debug-print-function ${FUNCNAME} $* 1933 debug-print-function ${FUNCNAME} $*
1710 1934
1935 if [[ ${EBUILD_PHASE} = compile ]]; then
1936 java-ant-2_src_configure
1937 java-utils-2_src_prepare
1938 fi
1939
1711 if ! hasq java-ant-2 ${INHERITED}; then 1940 if ! has java-ant-2 ${INHERITED}; then
1712 local msg="You should inherit java-ant-2 when using eant" 1941 local msg="You should inherit java-ant-2 when using eant"
1713 java-pkg_announce-qa-violation "${msg}" 1942 java-pkg_announce-qa-violation "${msg}"
1714 fi 1943 fi
1715 1944
1716 local antflags="-Dnoget=true -Dmaven.mode.offline=true" 1945 local antflags="-Dnoget=true -Dmaven.mode.offline=true -Dbuild.sysclasspath=ignore"
1717 1946
1718 java-pkg_init-compiler_ 1947 java-pkg_init-compiler_
1719 local compiler="${GENTOO_COMPILER}" 1948 local compiler="${GENTOO_COMPILER}"
1720 1949
1721 local compiler_env="${JAVA_PKG_COMPILER_DIR}/${compiler}" 1950 local compiler_env="${JAVA_PKG_COMPILER_DIR}/${compiler}"
1722
1723 local build_compiler="$(source ${compiler_env} 1>/dev/null 2>&1; echo ${ANT_BUILD_COMPILER})" 1951 local build_compiler="$(source ${compiler_env} 1>/dev/null 2>&1; echo ${ANT_BUILD_COMPILER})"
1724 if [[ "${compiler}" != "javac" && -z "${build_compiler}" ]]; then 1952 if [[ "${compiler}" != "javac" && -z "${build_compiler}" ]]; then
1725 die "ANT_BUILD_COMPILER undefined in ${compiler_env}" 1953 die "ANT_BUILD_COMPILER undefined in ${compiler_env}"
1726 fi 1954 fi
1727 1955
1733 # java-config -p 1961 # java-config -p
1734 local build_compiler_deps="$(source ${JAVA_PKG_COMPILER_DIR}/${compiler} 1>/dev/null 2>&1; echo ${ANT_BUILD_COMPILER_DEPS})" 1962 local build_compiler_deps="$(source ${JAVA_PKG_COMPILER_DIR}/${compiler} 1>/dev/null 2>&1; echo ${ANT_BUILD_COMPILER_DEPS})"
1735 if [[ -n ${build_compiler_deps} ]]; then 1963 if [[ -n ${build_compiler_deps} ]]; then
1736 antflags="${antflags} -lib $(java-config -p ${build_compiler_deps})" 1964 antflags="${antflags} -lib $(java-config -p ${build_compiler_deps})"
1737 fi 1965 fi
1738 fi
1739
1740 if is-java-strict; then
1741 einfo "Disabling system classpath for ant"
1742 antflags="${antflags} -Dbuild.sysclasspath=ignore"
1743 fi 1966 fi
1744 1967
1745 for arg in "${@}"; do 1968 for arg in "${@}"; do
1746 if [[ ${arg} = -lib ]]; then 1969 if [[ ${arg} = -lib ]]; then
1747 if is-java-strict; then 1970 if is-java-strict; then
1756 echo "more info." 1979 echo "more info."
1757 fi 1980 fi
1758 fi 1981 fi
1759 done 1982 done
1760 1983
1761 if has_version ">=dev-java/ant-core-1.7.0"; then 1984 # parse WANT_ANT_TASKS for atoms
1762 # default ANT_TASKS to WANT_ANT_TASKS, if ANT_TASKS is not set explicitly 1985 local want_ant_tasks
1763 ANT_TASKS="${ANT_TASKS:-${WANT_ANT_TASKS}}" 1986 for i in ${WANT_ANT_TASKS}; do
1764 1987 if [[ ${i} = */*:* ]]; then
1765 # override ANT_TASKS with JAVA_PKG_FORCE_ANT_TASKS if it's set 1988 i=${i#*/}
1766 ANT_TASKS="${JAVA_PKG_FORCE_ANT_TASKS:-${ANT_TASKS}}" 1989 i=${i%:0}
1767 1990 want_ant_tasks+="${i/:/-} "
1768 if is-java-strict; then
1769 # if ant-tasks were not set by ebuild or forced, try to determine them from depends
1770 if [[ -z "${ANT_TASKS}" ]]; then
1771 ANT_TASKS="$(java-pkg_ant-tasks-from-deps)"
1772 fi
1773 else 1991 else
1992 want_ant_tasks+="${i} "
1993 fi
1994 done
1995 # default ANT_TASKS to WANT_ANT_TASKS, if ANT_TASKS is not set explicitly
1996 ANT_TASKS="${ANT_TASKS:-${want_ant_tasks% }}"
1997
1998 # override ANT_TASKS with JAVA_PKG_FORCE_ANT_TASKS if it's set
1999 ANT_TASKS="${JAVA_PKG_FORCE_ANT_TASKS:-${ANT_TASKS}}"
2000
1774 # if ant-tasks is not set by ebuild or forced, activate all of them 2001 # if ant-tasks is not set by ebuild or forced, use none
1775 ANT_TASKS="${ANT_TASKS:-all}" 2002 ANT_TASKS="${ANT_TASKS:-none}"
1776 fi
1777 2003
1778 # at this point, ANT_TASKS should be "all", "none" or explicit list 2004 # at this point, ANT_TASKS should be "all", "none" or explicit list
1779 if [[ "${ANT_TASKS}" == "all" ]]; then 2005 if [[ "${ANT_TASKS}" == "all" ]]; then
1780 einfo "Using all available ANT_TASKS" 2006 einfo "Using all available ANT_TASKS"
1781 elif [[ "${ANT_TASKS}" == "none" ]]; then 2007 elif [[ "${ANT_TASKS}" == "none" ]]; then
1782 einfo "Disabling all optional ANT_TASKS" 2008 einfo "Disabling all optional ANT_TASKS"
1783 else 2009 else
1784 einfo "Using following ANT_TASKS: ${ANT_TASKS}" 2010 einfo "Using following ANT_TASKS: ${ANT_TASKS}"
1785 fi 2011 fi
1786 2012
1787 export ANT_TASKS 2013 export ANT_TASKS
1788 fi
1789 2014
1790 [[ -n ${JAVA_PKG_DEBUG} ]] && antflags="${antflags} --execdebug -debug" 2015 [[ -n ${JAVA_PKG_DEBUG} ]] && antflags="${antflags} --execdebug -debug"
1791 [[ -n ${PORTAGE_QUIET} ]] && antflags="${antflags} -q" 2016 [[ -n ${PORTAGE_QUIET} ]] && antflags="${antflags} -q"
1792 2017
1793 local gcp="${EANT_GENTOO_CLASSPATH}" 2018 local gcp="${EANT_GENTOO_CLASSPATH}"
1794 local getjarsarg="" 2019 local getjarsarg=""
1795 2020
1796 if [[ ${EBUILD_PHASE} = "test" ]]; then 2021 if [[ ${EBUILD_PHASE} = "test" ]]; then
1797 antflags="${antflags} -DJunit.present=true" 2022 antflags="${antflags} -DJunit.present=true"
1798 [[ ${gcp} && ${ANT_TASKS} = *ant-junit* ]] && gcp="${gcp} junit" 2023 [[ ${ANT_TASKS} = *ant-junit* ]] && gcp="${gcp} junit"
1799 getjarsarg="--with-dependencies" 2024 getjarsarg="--with-dependencies"
2025 else
2026 antflags="${antflags} -Dmaven.test.skip=true"
1800 fi 2027 fi
1801 2028
1802 local cp 2029 local cp
1803 2030
1804 for atom in ${gcp}; do 2031 for atom in ${gcp}; do
1805 cp="${cp}:$(java-pkg_getjars ${getjarsarg} ${atom})" 2032 cp="${cp}:$(java-pkg_getjars ${getjarsarg} ${atom})"
1806 done 2033 done
1807 2034
2035 [[ -n "${EANT_NEEDS_TOOLS}" ]] && cp="${cp}:$(java-config --tools)"
2036
1808 if [[ ${cp} ]]; then 2037 if [[ ${cp} ]]; then
1809 # It seems ant does not like single quotes around ${cp} 2038 # It seems ant does not like single quotes around ${cp}
2039 cp=${cp#:}
2040 [[ ${EANT_GENTOO_CLASSPATH_EXTRA} ]] && \
2041 cp="${cp}:${EANT_GENTOO_CLASSPATH_EXTRA}"
1810 antflags="${antflags} -Dgentoo.classpath=\"${cp#:}\"" 2042 antflags="${antflags} -Dgentoo.classpath=\"${cp}\""
1811 fi 2043 fi
1812 2044
1813 [[ -n ${JAVA_PKG_DEBUG} ]] && echo ant ${antflags} "${@}" 2045 [[ -n ${JAVA_PKG_DEBUG} ]] && echo ant ${antflags} "${@}"
1814 debug-print "Calling ant (GENTOO_VM: ${GENTOO_VM}): ${antflags} ${@}" 2046 debug-print "Calling ant (GENTOO_VM: ${GENTOO_VM}): ${antflags} ${@}"
1815 ant ${antflags} "${@}" || die "eant failed" 2047 ant ${antflags} "${@}" || die "eant failed"
1915# This shouldn't be used directly. Instead, java-pkg and java-pkg-opt will 2147# This shouldn't be used directly. Instead, java-pkg and java-pkg-opt will
1916# call it during each of the phases of the merge process. 2148# call it during each of the phases of the merge process.
1917# 2149#
1918# ----------------------------------------------------------------------------- 2150# -----------------------------------------------------------------------------
1919java-pkg_init() { 2151java-pkg_init() {
2152 debug-print-function ${FUNCNAME} $*
2153
2154 # Don't set up build environment if installing from binary. #206024 #258423
2155 [[ "${MERGE_TYPE}" == "binary" ]] && return
2156 # Also try Portage's nonstandard EMERGE_FROM for old EAPIs, if it doesn't
2157 # work nothing is lost.
2158 has ${EAPI:-0} 0 1 2 3 && [[ "${EMERGE_FROM}" == "binary" ]] && return
2159
1920 unset JAVAC 2160 unset JAVAC
1921 unset JAVA_HOME 2161 unset JAVA_HOME
2162
2163 java-config --help >/dev/null || {
2164 eerror ""
2165 eerror "Can't run java-config --help"
2166 eerror "Have you upgraded python recently but haven't"
2167 eerror "run python-updater yet?"
2168 die "Can't run java-config --help"
2169 }
1922 2170
1923 # People do all kinds of weird things. 2171 # People do all kinds of weird things.
1924 # http://forums.gentoo.org/viewtopic-p-3943166.html 2172 # http://forums.gentoo.org/viewtopic-p-3943166.html
1925 local silence="${SILENCE_JAVA_OPTIONS_WARNING}" 2173 local silence="${SILENCE_JAVA_OPTIONS_WARNING}"
1926 local accept="${I_WANT_GLOBAL_JAVA_OPTIONS}" 2174 local accept="${I_WANT_GLOBAL_JAVA_OPTIONS}"
1932 ewarn "make.conf for example) to silence this warning or" 2180 ewarn "make.conf for example) to silence this warning or"
1933 ewarn "I_WANT_GLOBAL_JAVA_OPTIONS to not filter it." 2181 ewarn "I_WANT_GLOBAL_JAVA_OPTIONS to not filter it."
1934 fi 2182 fi
1935 2183
1936 if [[ -z ${accept} ]]; then 2184 if [[ -z ${accept} ]]; then
2185 # export _JAVA_OPTIONS= doesn't work because it will show up in java
2186 # -version output
1937 unset _JAVA_OPTIONS 2187 unset _JAVA_OPTIONS
1938 # phase hooks make this run many times without this 2188 # phase hooks make this run many times without this
1939 I_WANT_GLOBAL_JAVA_OPTIONS="true" 2189 I_WANT_GLOBAL_JAVA_OPTIONS="true"
1940 fi 2190 fi
1941 2191
2192 if java-pkg_func-exists ant_src_unpack; then
2193 java-pkg_announce-qa-violation "Using old ant_src_unpack. Should be src_unpack"
2194 fi
2195
1942 java-pkg_init_paths_ 2196 java-pkg_init_paths_
1943 java-pkg_switch-vm 2197 java-pkg_switch-vm
1944 PATH=${JAVA_HOME}/bin:${PATH} 2198 PATH=${JAVA_HOME}/bin:${PATH}
1945 2199
1946 # TODO we will probably want to set JAVAC and JAVACFLAGS 2200 # TODO we will probably want to set JAVAC and JAVACFLAGS
1947 2201
1948 # Do some QA checks 2202 # Do some QA checks
1949 java-pkg_check-jikes 2203 java-pkg_check-jikes
2204
2205 # Can't use unset here because Portage does not save the unset
2206 # see https://bugs.gentoo.org/show_bug.cgi?id=189417#c11
1950 2207
1951 # When users have crazy classpaths some packages can fail to compile. 2208 # When users have crazy classpaths some packages can fail to compile.
1952 # and everything should work with empty CLASSPATH. 2209 # and everything should work with empty CLASSPATH.
1953 # This also helps prevent unexpected dependencies on random things 2210 # This also helps prevent unexpected dependencies on random things
1954 # from the CLASSPATH. 2211 # from the CLASSPATH.
1955 unset CLASSPATH 2212 export CLASSPATH=
1956 2213
1957 # Unset external ANT_ stuff 2214 # Unset external ANT_ stuff
1958 unset ANT_TASKS 2215 export ANT_TASKS=
1959 unset ANT_OPTS 2216 export ANT_OPTS=
2217 export ANT_RESPECT_JAVA_HOME=
1960} 2218}
1961 2219
1962# ------------------------------------------------------------------------------ 2220# ------------------------------------------------------------------------------
1963# @function-internal java-pkg-init-compiler_ 2221# @function-internal java-pkg-init-compiler_
1964# 2222#
2055 done 2313 done
2056 2314
2057 # If it hasn't been defined already, default to javac 2315 # If it hasn't been defined already, default to javac
2058 if [[ -z ${GENTOO_COMPILER} ]]; then 2316 if [[ -z ${GENTOO_COMPILER} ]]; then
2059 if [[ -n ${compilers} ]]; then 2317 if [[ -n ${compilers} ]]; then
2060 einfo "No suitable compiler found: defaulting javac for compilation" 2318 einfo "No suitable compiler found: defaulting to JDK default for compilation"
2061 else 2319 else
2062 # probably don't need to notify users about the default. 2320 # probably don't need to notify users about the default.
2063 :;#einfo "Defaulting to javac for compilation" 2321 :;#einfo "Defaulting to javac for compilation"
2064 fi 2322 fi
2323 if java-config -g GENTOO_COMPILER 2> /dev/null; then
2324 export GENTOO_COMPILER=$(java-config -g GENTOO_COMPILER)
2325 else
2065 export GENTOO_COMPILER=javac 2326 export GENTOO_COMPILER=javac
2327 fi
2066 else 2328 else
2067 einfo "Using ${GENTOO_COMPILER} for compilation" 2329 einfo "Using ${GENTOO_COMPILER} for compilation"
2068 fi 2330 fi
2069 2331
2070} 2332}
2086 fi 2348 fi
2087 2349
2088 JAVA_PKG_SHAREPATH="${DESTTREE}/share/${JAVA_PKG_NAME}" 2350 JAVA_PKG_SHAREPATH="${DESTTREE}/share/${JAVA_PKG_NAME}"
2089 JAVA_PKG_SOURCESPATH="${JAVA_PKG_SHAREPATH}/sources/" 2351 JAVA_PKG_SOURCESPATH="${JAVA_PKG_SHAREPATH}/sources/"
2090 JAVA_PKG_ENV="${D}${JAVA_PKG_SHAREPATH}/package.env" 2352 JAVA_PKG_ENV="${D}${JAVA_PKG_SHAREPATH}/package.env"
2353 JAVA_PKG_VIRTUALS_PATH="${DESTTREE}/share/java-config-2/virtuals"
2354 JAVA_PKG_VIRTUAL_PROVIDER="${D}/${JAVA_PKG_VIRTUALS_PATH}/${JAVA_PKG_NAME}"
2091 2355
2092 [[ -z "${JAVA_PKG_JARDEST}" ]] && JAVA_PKG_JARDEST="${JAVA_PKG_SHAREPATH}/lib" 2356 [[ -z "${JAVA_PKG_JARDEST}" ]] && JAVA_PKG_JARDEST="${JAVA_PKG_SHAREPATH}/lib"
2093 [[ -z "${JAVA_PKG_LIBDEST}" ]] && JAVA_PKG_LIBDEST="${DESTTREE}/$(get_libdir)/${JAVA_PKG_NAME}" 2357 [[ -z "${JAVA_PKG_LIBDEST}" ]] && JAVA_PKG_LIBDEST="${DESTTREE}/$(get_libdir)/${JAVA_PKG_NAME}"
2094 [[ -z "${JAVA_PKG_WARDEST}" ]] && JAVA_PKG_WARDEST="${JAVA_PKG_SHAREPATH}/webapps" 2358 [[ -z "${JAVA_PKG_WARDEST}" ]] && JAVA_PKG_WARDEST="${JAVA_PKG_SHAREPATH}/webapps"
2095 2359
2108# Writes the package.env out to disk. 2372# Writes the package.env out to disk.
2109# 2373#
2110# ------------------------------------------------------------------------------ 2374# ------------------------------------------------------------------------------
2111# TODO change to do-write, to match everything else 2375# TODO change to do-write, to match everything else
2112java-pkg_do_write_() { 2376java-pkg_do_write_() {
2377 debug-print-function ${FUNCNAME} $*
2113 java-pkg_init_paths_ 2378 java-pkg_init_paths_
2114 # Create directory for package.env 2379 # Create directory for package.env
2115 dodir "${JAVA_PKG_SHAREPATH}" 2380 dodir "${JAVA_PKG_SHAREPATH}"
2116 if [[ -n "${JAVA_PKG_CLASSPATH}" || -n "${JAVA_PKG_LIBRARY}" || -f "${JAVA_PKG_DEPEND}" ]]; then 2381 if [[ -n "${JAVA_PKG_CLASSPATH}" || -n "${JAVA_PKG_LIBRARY}" || -f \
2382 "${JAVA_PKG_DEPEND_FILE}" || -f \
2383 "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" ]]; then
2117 # Create package.env 2384 # Create package.env
2118 ( 2385 (
2119 echo "DESCRIPTION=\"${DESCRIPTION}\"" 2386 echo "DESCRIPTION=\"${DESCRIPTION}\""
2120 echo "GENERATION=\"2\"" 2387 echo "GENERATION=\"2\""
2388 echo "SLOT=\"${SLOT}\""
2389 echo "CATEGORY=\"${CATEGORY}\""
2390 echo "PVR=\"${PVR}\""
2121 2391
2122 [[ -n "${JAVA_PKG_CLASSPATH}" ]] && echo "CLASSPATH=\"${JAVA_PKG_CLASSPATH}\"" 2392 [[ -n "${JAVA_PKG_CLASSPATH}" ]] && echo "CLASSPATH=\"${JAVA_PKG_CLASSPATH}\""
2123 [[ -n "${JAVA_PKG_LIBRARY}" ]] && echo "LIBRARY_PATH=\"${JAVA_PKG_LIBRARY}\"" 2393 [[ -n "${JAVA_PKG_LIBRARY}" ]] && echo "LIBRARY_PATH=\"${JAVA_PKG_LIBRARY}\""
2124 [[ -n "${JAVA_PROVIDE}" ]] && echo "PROVIDES=\"${JAVA_PROVIDE}\"" 2394 [[ -n "${JAVA_PROVIDE}" ]] && echo "PROVIDES=\"${JAVA_PROVIDE}\""
2125 [[ -f "${JAVA_PKG_DEPEND}" ]] && echo "DEPEND=\"$(cat ${JAVA_PKG_DEPEND} | uniq | tr '\n' ':')\"" 2395 [[ -f "${JAVA_PKG_DEPEND_FILE}" ]] \
2396 && echo "DEPEND=\"$(sort -u "${JAVA_PKG_DEPEND_FILE}" | tr '\n' ':')\""
2397 [[ -f "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" ]] \
2398 && echo "OPTIONAL_DEPEND=\"$(sort -u "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" | tr '\n' ':')\""
2126 echo "VM=\"$(echo ${RDEPEND} ${DEPEND} | sed -e 's/ /\n/g' | sed -n -e '/virtual\/\(jre\|jdk\)/ { p;q }')\"" # TODO cleanup ! 2399 echo "VM=\"$(echo ${RDEPEND} ${DEPEND} | sed -e 's/ /\n/g' | sed -n -e '/virtual\/\(jre\|jdk\)/ { p;q }')\"" # TODO cleanup !
2400 [[ -f "${JAVA_PKG_BUILD_DEPEND_FILE}" ]] \
2401 && echo "BUILD_DEPEND=\"$(sort -u "${JAVA_PKG_BUILD_DEPEND_FILE}" | tr '\n' ':')\""
2127 ) > "${JAVA_PKG_ENV}" 2402 ) > "${JAVA_PKG_ENV}"
2128 2403
2129 # register target/source 2404 # register target/source
2130 local target="$(java-pkg_get-target)" 2405 local target="$(java-pkg_get-target)"
2131 local source="$(java-pkg_get-source)" 2406 local source="$(java-pkg_get-source)"
2141 2416
2142 2417
2143 echo "MERGE_VM=\"${GENTOO_VM}\"" >> "${JAVA_PKG_ENV}" 2418 echo "MERGE_VM=\"${GENTOO_VM}\"" >> "${JAVA_PKG_ENV}"
2144 [[ -n ${GENTOO_COMPILER} ]] && echo "MERGE_COMPILER=\"${GENTOO_COMPILER}\"" >> "${JAVA_PKG_ENV}" 2419 [[ -n ${GENTOO_COMPILER} ]] && echo "MERGE_COMPILER=\"${GENTOO_COMPILER}\"" >> "${JAVA_PKG_ENV}"
2145 2420
2421 # extra env variables
2422 if [[ -n "${JAVA_PKG_EXTRA_ENV_VARS}" ]]; then
2423 cat "${JAVA_PKG_EXTRA_ENV}" >> "${JAVA_PKG_ENV}" || die
2424 # nested echo to remove leading/trailing spaces
2425 echo "ENV_VARS=\"$(echo ${JAVA_PKG_EXTRA_ENV_VARS})\"" \
2426 >> "${JAVA_PKG_ENV}" || die
2427 fi
2428
2146 # Strip unnecessary leading and trailing colons 2429 # Strip unnecessary leading and trailing colons
2147 # TODO try to cleanup if possible 2430 # TODO try to cleanup if possible
2148 sed -e "s/=\":/=\"/" -e "s/:\"$/\"/" -i "${JAVA_PKG_ENV}" || die "Did you forget to call java_init ?" 2431 sed -e "s/=\":/=\"/" -e "s/:\"$/\"/" -i "${JAVA_PKG_ENV}" || die "Did you forget to call java_init ?"
2432 else
2433 debug-print "JAVA_PKG_CLASSPATH, JAVA_PKG_LIBRARY, JAVA_PKG_DEPEND_FILE"
2434 debug-print "or JAVA_PKG_OPTIONAL_DEPEND_FILE not defined so can't"
2435 debug-print "write package.env."
2149 fi 2436 fi
2150} 2437}
2151 2438
2152# ------------------------------------------------------------------------------ 2439# ------------------------------------------------------------------------------
2153# @internal-function java-pkg_record-jar_ 2440# @internal-function java-pkg_record-jar_
2154# 2441#
2155# Record a dependency to the package.env 2442# Record an (optional) dependency to the package.env
2156# 2443# @param --optional - record dependency as optional
2444# @param --build - record dependency as build_only
2445# @param $1 - package to record
2446# @param $2 - (optional) jar of package to record
2157# ------------------------------------------------------------------------------ 2447# ------------------------------------------------------------------------------
2158JAVA_PKG_DEPEND="${T}/java-pkg-depend" 2448JAVA_PKG_DEPEND_FILE="${T}/java-pkg-depend"
2449JAVA_PKG_OPTIONAL_DEPEND_FILE="${T}/java-pkg-optional-depend"
2450JAVA_PKG_BUILD_DEPEND_FILE="${T}/java-pkg-build-depend"
2159 2451
2160java-pkg_record-jar_() { 2452java-pkg_record-jar_() {
2161 debug-print-function ${FUNCNAME} $* 2453 debug-print-function ${FUNCNAME} $*
2454
2455 local depend_file="${JAVA_PKG_DEPEND_FILE}"
2456 case "${1}" in
2457 "--optional") depend_file="${JAVA_PKG_OPTIONAL_DEPEND_FILE}"; shift;;
2458 "--build-only") depend_file="${JAVA_PKG_BUILD_DEPEND_FILE}"; shift;;
2459 esac
2162 2460
2163 local pkg=${1} jar=${2} append 2461 local pkg=${1} jar=${2} append
2164 if [[ -z "${jar}" ]]; then 2462 if [[ -z "${jar}" ]]; then
2165 append="${pkg}" 2463 append="${pkg}"
2166 else 2464 else
2167 append="$(basename ${jar})@${pkg}" 2465 append="$(basename ${jar})@${pkg}"
2168 fi 2466 fi
2169 2467
2170 echo ${append} >> ${JAVA_PKG_DEPEND} 2468 echo "${append}" >> "${depend_file}"
2171} 2469}
2172 2470
2173# ------------------------------------------------------------------------------ 2471# ------------------------------------------------------------------------------
2174# @internal-function java-pkg_append_ 2472# @internal-function java-pkg_append_
2175# 2473#
2219# 2517#
2220# @return 0 - function is declared 2518# @return 0 - function is declared
2221# @return 1 - function is undeclared 2519# @return 1 - function is undeclared
2222# ------------------------------------------------------------------------------ 2520# ------------------------------------------------------------------------------
2223java-pkg_func-exists() { 2521java-pkg_func-exists() {
2224 if [[ -n "$(declare -f ${1})" ]]; then 2522 declare -F ${1} > /dev/null
2225 return 0
2226 else
2227 return 1
2228 fi
2229} 2523}
2230 2524
2231# ------------------------------------------------------------------------------ 2525# ------------------------------------------------------------------------------
2232# @internal-function java-pkg_setup-vm 2526# @internal-function java-pkg_setup-vm
2233# 2527#
2234# Sets up the environment for a specific VM 2528# Sets up the environment for a specific VM
2235# 2529#
2236# ------------------------------------------------------------------------------ 2530# ------------------------------------------------------------------------------
2237java-pkg_setup-vm() { 2531java-pkg_setup-vm() {
2238 debug-print-function ${FUNCNAME} $* 2532 debug-print-function ${FUNCNAME} $*
2239
2240 export LANG="C" LC_ALL="C"
2241 2533
2242 local vendor="$(java-pkg_get-vm-vendor)" 2534 local vendor="$(java-pkg_get-vm-vendor)"
2243 if [[ "${vendor}" == "sun" ]] && java-pkg_is-vm-version-ge "1.5" ; then 2535 if [[ "${vendor}" == "sun" ]] && java-pkg_is-vm-version-ge "1.5" ; then
2244 addpredict "/dev/random" 2536 addpredict "/dev/random"
2245 elif [[ "${vendor}" == "ibm" ]]; then 2537 elif [[ "${vendor}" == "ibm" ]]; then
2246 addpredict "/proc/self/maps" 2538 addpredict "/proc/self/maps"
2247 addpredict "/proc/cpuinfo" 2539 addpredict "/proc/cpuinfo"
2540 addpredict "/proc/self/coredump_filter"
2541 elif [[ "${vendor}" == "oracle" ]]; then
2542 addpredict "/dev/random"
2543 addpredict "/proc/self/coredump_filter"
2544 elif [[ "${vendor}" == icedtea* ]] && java-pkg_is-vm-version-ge "1.7" ; then
2545 addpredict "/dev/random"
2546 addpredict "/proc/self/coredump_filter"
2248 elif [[ "${vendor}" == "jrockit" ]]; then 2547 elif [[ "${vendor}" == "jrockit" ]]; then
2249 addpredict "/proc/cpuinfo" 2548 addpredict "/proc/cpuinfo"
2250 fi 2549 fi
2251} 2550}
2252 2551
2253# ------------------------------------------------------------------------------ 2552# ------------------------------------------------------------------------------
2254# @internal-function java-pkg_needs-vm 2553# @internal-function java-pkg_needs-vm
2255# 2554#
2256# Does the current package depend on virtual/jdk? 2555# Does the current package depend on virtual/jdk or does it set
2556# JAVA_PKG_WANT_BUILD_VM?
2257# 2557#
2258# @return 0 - Package depends on virtual/jdk 2558# @return 0 - Package depends on virtual/jdk
2259# @return 1 - Package does not depend on virtual/jdk 2559# @return 1 - Package does not depend on virtual/jdk
2260# ------------------------------------------------------------------------------ 2560# ------------------------------------------------------------------------------
2261java-pkg_needs-vm() { 2561java-pkg_needs-vm() {
2262 debug-print-function ${FUNCNAME} $* 2562 debug-print-function ${FUNCNAME} $*
2263 2563
2264 if [[ -n "$(echo ${DEPEND} | sed -e '\:virtual/jdk:!d')" ]]; then 2564 if [[ -n "$(echo ${JAVA_PKG_NV_DEPEND:-${DEPEND}} | sed -e '\:virtual/jdk:!d')" ]]; then
2265 return 0 2565 return 0
2266 fi 2566 fi
2567
2568 [[ -n "${JAVA_PKG_WANT_BUILD_VM}" ]] && return 0
2267 2569
2268 return 1 2570 return 1
2269} 2571}
2270 2572
2271# ------------------------------------------------------------------------------ 2573# ------------------------------------------------------------------------------
2297# ------------------------------------------------------------------------------ 2599# ------------------------------------------------------------------------------
2298java-pkg_get-vm-version() { 2600java-pkg_get-vm-version() {
2299 debug-print-function ${FUNCNAME} $* 2601 debug-print-function ${FUNCNAME} $*
2300 2602
2301 java-config -g PROVIDES_VERSION 2603 java-config -g PROVIDES_VERSION
2604}
2605
2606# ------------------------------------------------------------------------------
2607# @internal-function java-pkg_build-vm-from-handle
2608#
2609# Selects a build vm from a list of vm handles. First checks for the system-vm
2610# beeing usable, then steps through the listed handles till a suitable vm is
2611# found.
2612#
2613# @return - VM handle of an available JDK
2614# ------------------------------------------------------------------------------
2615java-pkg_build-vm-from-handle() {
2616 debug-print-function ${FUNCNAME} "$*"
2617
2618 local vm
2619 vm=$(java-pkg_get-current-vm)
2620 if [[ $? != 0 ]]; then
2621 eerror "${FUNCNAME}: Failed to get active vm"
2622 return 1
2623 fi
2624
2625 if has ${vm} ${JAVA_PKG_WANT_BUILD_VM}; then
2626 echo ${vm}
2627 return 0
2628 fi
2629
2630 for vm in ${JAVA_PKG_WANT_BUILD_VM}; do
2631 if java-config-2 --select-vm=${vm} 2>/dev/null; then
2632 echo ${vm}
2633 return 0
2634 fi
2635 done
2636
2637 eerror "${FUNCNAME}: No vm found for handles: ${JAVA_PKG_WANT_BUILD_VM}"
2638 return 1
2302} 2639}
2303 2640
2304# ------------------------------------------------------------------------------ 2641# ------------------------------------------------------------------------------
2305# @internal-function java-pkg_switch-vm 2642# @internal-function java-pkg_switch-vm
2306# 2643#
2317 # If you're forcing the VM, I hope you know what your doing... 2654 # If you're forcing the VM, I hope you know what your doing...
2318 debug-print "JAVA_PKG_FORCE_VM used: ${JAVA_PKG_FORCE_VM}" 2655 debug-print "JAVA_PKG_FORCE_VM used: ${JAVA_PKG_FORCE_VM}"
2319 export GENTOO_VM="${JAVA_PKG_FORCE_VM}" 2656 export GENTOO_VM="${JAVA_PKG_FORCE_VM}"
2320 # if we're allowed to switch the vm... 2657 # if we're allowed to switch the vm...
2321 elif [[ "${JAVA_PKG_ALLOW_VM_CHANGE}" == "yes" ]]; then 2658 elif [[ "${JAVA_PKG_ALLOW_VM_CHANGE}" == "yes" ]]; then
2322 debug-print "depend-java-query: NV_DEPEND: ${JAVA_PKG_NV_DEPEND:-${DEPEND}} VNEED: ${JAVA_PKG_VNEED}" 2659 # if there is an explicit list of handles to choose from
2323 if [[ -n ${JAVA_PKG_VNEED} ]]; then 2660 if [[ -n "${JAVA_PKG_WANT_BUILD_VM}" ]]; then
2324 GENTOO_VM="$(depend-java-query --need-virtual "${JAVA_PKG_VNEED}" --get-vm "${JAVA_PKG_NV_DEPEND:-${DEPEND}}")" 2661 debug-print "JAVA_PKG_WANT_BUILD_VM used: ${JAVA_PKG_WANT_BUILD_VM}"
2662 GENTOO_VM=$(java-pkg_build-vm-from-handle)
2663 if [[ $? != 0 ]]; then
2664 eerror "${FUNCNAME}: No VM found for handles: ${JAVA_PKG_WANT_BUILD_VM}"
2665 die "${FUNCNAME}: Failed to determine VM for building"
2666 fi
2667 # JAVA_PKG_WANT_SOURCE and JAVA_PKG_WANT_TARGET are required as
2668 # they can't be deduced from handles.
2669 if [[ -z "${JAVA_PKG_WANT_SOURCE}" ]]; then
2670 eerror "JAVA_PKG_WANT_BUILD_VM specified but not JAVA_PKG_WANT_SOURCE"
2671 die "Specify JAVA_PKG_WANT_SOURCE"
2672 fi
2673 if [[ -z "${JAVA_PKG_WANT_TARGET}" ]]; then
2674 eerror "JAVA_PKG_WANT_BUILD_VM specified but not JAVA_PKG_WANT_TARGET"
2675 die "Specify JAVA_PKG_WANT_TARGET"
2676 fi
2677 # otherwise determine a vm from dep string
2325 else 2678 else
2679 debug-print "depend-java-query: NV_DEPEND: ${JAVA_PKG_NV_DEPEND:-${DEPEND}}"
2326 GENTOO_VM="$(depend-java-query --get-vm "${JAVA_PKG_NV_DEPEND:-${DEPEND}}")" 2680 GENTOO_VM="$(depend-java-query --get-vm "${JAVA_PKG_NV_DEPEND:-${DEPEND}}")"
2681 if [[ -z "${GENTOO_VM}" || "${GENTOO_VM}" == "None" ]]; then
2682 eerror "Unable to determine VM for building from dependencies:"
2683 echo "NV_DEPEND: ${JAVA_PKG_NV_DEPEND:-${DEPEND}}"
2684 die "Failed to determine VM for building."
2685 fi
2327 fi 2686 fi
2328 if [[ -z "${GENTOO_VM}" || "${GENTOO_VM}" == "None" ]]; then
2329 eerror "Unable to determine VM for building from dependencies:"
2330 echo "NV_DEPEND: ${JAVA_PKG_NV_DEPEND:-${DEPEND}}"
2331 echo "VNEED: ${JAVA_PKG_VNEED}"
2332 die "Failed to determine VM for building."
2333 else
2334 export GENTOO_VM 2687 export GENTOO_VM
2335 fi
2336 # otherwise just make sure the current VM is sufficient 2688 # otherwise just make sure the current VM is sufficient
2337 else 2689 else
2338 java-pkg_ensure-vm-version-sufficient 2690 java-pkg_ensure-vm-version-sufficient
2339 fi 2691 fi
2340 debug-print "Using: $(java-config -f)" 2692 debug-print "Using: $(java-config -f)"
2356 2708
2357 #TODO If you know a better solution let us know. 2709 #TODO If you know a better solution let us know.
2358 java-pkg_append_ LD_LIBRARY_PATH "$(java-config -g LDPATH)" 2710 java-pkg_append_ LD_LIBRARY_PATH "$(java-config -g LDPATH)"
2359 2711
2360 local tann="${T}/announced-vm" 2712 local tann="${T}/announced-vm"
2713 # With the hooks we should only get here once from pkg_setup but better safe than sorry
2714 # if people have for example modified eclasses some where
2361 if [[ -n "${JAVA_PKG_DEBUG}" ]] || [[ ! -f "${tann}" ]] ; then 2715 if [[ -n "${JAVA_PKG_DEBUG}" ]] || [[ ! -f "${tann}" ]] ; then
2362 # Add a check for setup/preinst phase... to avoid duplicate outputs
2363 # for when FEATURES=buildpkg
2364 if [[ ${EBUILD_PHASE} != "setup" && ${EBUILD_PHASE} != "preinst" && ${EBUILD_PHASE} != "postinst" ]];
2365 then
2366 einfo "Using: $(java-config -f)" 2716 einfo "Using: $(java-config -f)"
2367 [[ ! -f "${tann}" ]] && touch "${tann}" 2717 [[ ! -f "${tann}" ]] && touch "${tann}"
2368 fi
2369 fi 2718 fi
2370 2719
2371 else 2720 else
2372 [[ -n "${JAVA_PKG_DEBUG}" ]] && ewarn "!!! This package inherits java-pkg but doesn't depend on a JDK. -bin or broken dependency!!!" 2721 [[ -n "${JAVA_PKG_DEBUG}" ]] && ewarn "!!! This package inherits java-pkg but doesn't depend on a JDK. -bin or broken dependency!!!"
2373 fi 2722 fi
2378# 2727#
2379# Enhanced die for Java packages, which displays some information that may be 2728# Enhanced die for Java packages, which displays some information that may be
2380# useful for debugging bugs on bugzilla. 2729# useful for debugging bugs on bugzilla.
2381# ------------------------------------------------------------------------------ 2730# ------------------------------------------------------------------------------
2382#register_die_hook java-pkg_die 2731#register_die_hook java-pkg_die
2383if ! hasq java-pkg_die ${EBUILD_DEATH_HOOKS}; then 2732if ! has java-pkg_die ${EBUILD_DEATH_HOOKS}; then
2384 EBUILD_DEATH_HOOKS="${EBUILD_DEATH_HOOKS} java-pkg_die" 2733 EBUILD_DEATH_HOOKS="${EBUILD_DEATH_HOOKS} java-pkg_die"
2385fi 2734fi
2386 2735
2387java-pkg_die() { 2736java-pkg_die() {
2388 echo "!!! When you file a bug report, please include the following information:" >&2 2737 echo "!!! When you file a bug report, please include the following information:" >&2
2412# not. 2761# not.
2413# @param $1 (optional) - the file to check, otherwise checks whole ${D} 2762# @param $1 (optional) - the file to check, otherwise checks whole ${D}
2414# ------------------------------------------------------------------------------ 2763# ------------------------------------------------------------------------------
2415java-pkg_verify-classes() { 2764java-pkg_verify-classes() {
2416 #$(find ${D} -type f -name '*.jar' -o -name '*.class') 2765 #$(find ${D} -type f -name '*.jar' -o -name '*.class')
2766
2767 local version_verify="/usr/bin/class-version-verify.py"
2768
2769 if [[ ! -x "${version_verify}" ]]; then
2770 version_verify="/usr/$(get_libdir)/javatoolkit/bin/class-version-verify.py"
2771 fi
2772
2773 if [[ ! -x "${version_verify}" ]]; then
2774 ewarn "Unable to perform class version checks as"
2775 ewarn "class-version-verify.py is unavailable"
2776 ewarn "Please install dev-java/javatoolkit."
2777 return
2778 fi
2779
2417 local target=$(java-pkg_get-target) 2780 local target=$(java-pkg_get-target)
2418 local result 2781 local result
2419 local log="${T}/class-version-verify.log" 2782 local log="${T}/class-version-verify.log"
2420 if [[ -n "${1}" ]]; then 2783 if [[ -n "${1}" ]]; then
2421 class-version-verify.py -v -t ${target} "${1}" > "${log}" 2784 ${version_verify} -v -t ${target} "${1}" > "${log}"
2422 result=$? 2785 result=$?
2423 else 2786 else
2424 ebegin "Verifying java class versions (target: ${target})" 2787 ebegin "Verifying java class versions (target: ${target})"
2425 class-version-verify.py -v -t ${target} -r "${D}" > "${log}" 2788 ${version_verify} -v -t ${target} -r "${D}" > "${log}"
2426 result=$? 2789 result=$?
2427 eend ${result} 2790 eend ${result}
2428 fi 2791 fi
2429 [[ -n ${JAVA_PKG_DEBUG} ]] && cat "${log}" 2792 [[ -n ${JAVA_PKG_DEBUG} ]] && cat "${log}"
2430 if [[ ${result} != 0 ]]; then 2793 if [[ ${result} != 0 ]]; then
2440# Check that a package being used in jarfrom, getjars and getjar is contained 2803# Check that a package being used in jarfrom, getjars and getjar is contained
2441# within DEPEND or RDEPEND. 2804# within DEPEND or RDEPEND.
2442# @param $1 - empty - check both vars; "runtime" or "build" - check only 2805# @param $1 - empty - check both vars; "runtime" or "build" - check only
2443# RDEPEND, resp. DEPEND 2806# RDEPEND, resp. DEPEND
2444# @param $2 - Package name and slot. 2807# @param $2 - Package name and slot.
2808
2445java-pkg_ensure-dep() { 2809java-pkg_ensure-dep() {
2446 debug-print-function ${FUNCNAME} $* 2810 debug-print-function ${FUNCNAME} $*
2447 2811
2448 local limit_to="${1}" 2812 local limit_to="${1}"
2449 local target_pkg="${2}" 2813 local target_pkg="${2}"
2450 local dev_error="" 2814 local dev_error=""
2451 2815
2816 # remove the version specification, which may include globbing (* and [123])
2452 local stripped_pkg=$(echo "${target_pkg}" | sed \ 2817 local stripped_pkg=$(echo "${target_pkg}" | sed \
2453 's/-[0-9]*\(\.[0-9]\)*$//') 2818 's/-\([0-9*]*\(\[[0-9]*\]\)*\)*\(\.\([0-9*]*\(\[[0-9]*\]\)*\)*\)*$//')
2819
2820 debug-print "Matching against: ${stripped_pkg}"
2454 2821
2455 if [[ ${limit_to} != runtime && ! ( "${DEPEND}" =~ "$stripped_pkg" ) ]]; then 2822 if [[ ${limit_to} != runtime && ! ( "${DEPEND}" =~ "$stripped_pkg" ) ]]; then
2456 dev_error="The ebuild is attempting to use ${target_pkg} that is not" 2823 dev_error="The ebuild is attempting to use ${target_pkg} that is not"
2457 dev_error="${dev_error} declared in DEPEND." 2824 dev_error="${dev_error} declared in DEPEND."
2458 if is-java-strict; then 2825 if is-java-strict; then
2826 eerror "${dev_error}"
2459 die "${dev_error}" 2827 die "${dev_error}"
2460 elif [[ ${BASH_SUBSHELL} = 0 ]]; then 2828 elif [[ ${BASH_SUBSHELL} = 0 ]]; then
2461 eerror "${dev_error}" 2829 eerror "${dev_error}"
2462 elog "Because you have this package installed the package will" 2830 elog "Because you have this package installed the package will"
2463 elog "build without problems, but please report this to" 2831 elog "build without problems, but please report this to"
2464 elog "http://bugs.gentoo.org" 2832 elog "http://bugs.gentoo.org"
2465 fi 2833 fi
2466 fi 2834 fi
2467 2835
2836 if [[ ${limit_to} != build ]]; then
2468 if [[ ${limit_to} != build && ! ( ${RDEPEND} =~ "${stripped_pkg}" ) ]]; then 2837 if [[ ! ( ${RDEPEND} =~ "${stripped_pkg}" ) ]]; then
2838 if [[ ! ( ${PDEPEND} =~ "${stripped_pkg}" ) ]]; then
2469 dev_error="The ebuild is attempting to use ${target_pkg}," 2839 dev_error="The ebuild is attempting to use ${target_pkg},"
2470 dev_error="${dev_error} without specifying --build-only, that is not declared in RDEPEND." 2840 dev_error="${dev_error} without specifying --build-only, that is not declared in RDEPEND"
2841 dev_error="${dev_error} or PDEPEND."
2471 if is-java-strict; then 2842 if is-java-strict; then
2843 eerror "${dev_error}"
2472 die "${dev_error}" 2844 die "${dev_error}"
2473 elif [[ ${BASH_SUBSHELL} = 0 ]]; then 2845 elif [[ ${BASH_SUBSHELL} = 0 ]]; then
2474 eerror "${dev_error}" 2846 eerror "${dev_error}"
2475 elog "The package will build without problems, but may fail to run" 2847 elog "The package will build without problems, but may fail to run"
2476 elog "if you don't have ${target_pkg} installed, so please report" 2848 elog "if you don't have ${target_pkg} installed, so please report"
2477 elog "this to http://bugs.gentoo.org" 2849 elog "this to http://bugs.gentoo.org"
2850 fi
2851 fi
2478 fi 2852 fi
2479 fi 2853 fi
2480} 2854}
2481 2855
2482# ------------------------------------------------------------------------------ 2856# ------------------------------------------------------------------------------
2499 java-pkg_announce-qa-violation "installing versioned jar '${jar}'" 2873 java-pkg_announce-qa-violation "installing versioned jar '${jar}'"
2500 fi 2874 fi
2501} 2875}
2502 2876
2503java-pkg_check-jikes() { 2877java-pkg_check-jikes() {
2504 if hasq jikes ${IUSE}; then 2878 if has jikes ${IUSE}; then
2505 java-pkg_announce-qa-violation "deprecated USE flag 'jikes' in IUSE" 2879 java-pkg_announce-qa-violation "deprecated USE flag 'jikes' in IUSE"
2506 fi 2880 fi
2507} 2881}
2508 2882
2509java-pkg_announce-qa-violation() { 2883java-pkg_announce-qa-violation() {
2525is-java-strict() { 2899is-java-strict() {
2526 [[ -n ${JAVA_PKG_STRICT} ]] 2900 [[ -n ${JAVA_PKG_STRICT} ]]
2527 return $? 2901 return $?
2528} 2902}
2529 2903
2904
2530# ------------------------------------------------------------------------------ 2905# ------------------------------------------------------------------------------
2531# @eclass-end 2906# @eclass-end
2532# ------------------------------------------------------------------------------ 2907# ------------------------------------------------------------------------------

Legend:
Removed from v.1.84  
changed lines
  Added in v.1.150

  ViewVC Help
Powered by ViewVC 1.1.20