/[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.90 Revision 1.120
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-2005, 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.90 2007/06/19 21:08:57 caster Exp $ 9# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.120 2008/12/29 00:16:40 caster Exp $
10 10
11# ----------------------------------------------------------------------------- 11# -----------------------------------------------------------------------------
12# @eclass-begin 12# @eclass-begin
13# @eclass-shortdesc Java Utility eclass 13# @eclass-shortdesc Java Utility eclass
14# @eclass-maintainer java@gentoo.org 14# @eclass-maintainer java@gentoo.org
57#WANT_ANT_TASKS 57#WANT_ANT_TASKS
58 58
59# ----------------------------------------------------------------------------- 59# -----------------------------------------------------------------------------
60# @variable-internal JAVA_PKG_PORTAGE_DEP 60# @variable-internal JAVA_PKG_PORTAGE_DEP
61# 61#
62# 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
63# portage with phase hooks support. 63# portage with phase hooks support but now we use a version with proper env
64# saving.
64# ----------------------------------------------------------------------------- 65# -----------------------------------------------------------------------------
65JAVA_PKG_PORTAGE_DEP=">=sys-apps/portage-2.1_pre1" 66JAVA_PKG_PORTAGE_DEP=">=sys-apps/portage-2.1.2.7"
66 67
67# ----------------------------------------------------------------------------- 68# -----------------------------------------------------------------------------
68# @variable-internal JAVA_PKG_E_DEPEND 69# @variable-internal JAVA_PKG_E_DEPEND
69# 70#
70# 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
71# 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
72# portage, that includes phase hooks. 73# so that ebuilds can use new features without depending on specific versions.
73# ----------------------------------------------------------------------------- 74# -----------------------------------------------------------------------------
74JAVA_PKG_E_DEPEND=">=dev-java/java-config-2.0.32 ${JAVA_PKG_PORTAGE_DEP}" 75JAVA_PKG_E_DEPEND=">=dev-java/java-config-2.1.6 ${JAVA_PKG_PORTAGE_DEP}"
76hasq source ${JAVA_PKG_IUSE} && JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} source? ( app-arch/zip )"
75 77
76# ----------------------------------------------------------------------------- 78# -----------------------------------------------------------------------------
77# @variable-external JAVA_PKG_ALLOW_VM_CHANGE 79# @variable-external JAVA_PKG_ALLOW_VM_CHANGE
78# @variable-default yes 80# @variable-default yes
79# 81#
194# 196#
195# @example 197# @example
196# java-pkg_doexamples demo 198# java-pkg_doexamples demo
197# java-pkg_doexamples demo/* examples/* 199# java-pkg_doexamples demo/* examples/*
198# 200#
201# @param --subdir - If the examples need a certain directory structure
199# @param $* - list of files to install 202# @param $* - list of files to install
200# ------------------------------------------------------------------------------ 203# ------------------------------------------------------------------------------
201java-pkg_doexamples() { 204java-pkg_doexamples() {
202 debug-print-function ${FUNCNAME} $* 205 debug-print-function ${FUNCNAME} $*
203 206
204 [[ ${#} -lt 1 ]] && die "At least one argument needed" 207 [[ ${#} -lt 1 ]] && die "At least one argument needed"
205 208
206 java-pkg_check-phase install 209 java-pkg_check-phase install
207 210
208 local dest=/usr/share/doc/${PF}/examples 211 local dest=/usr/share/doc/${PF}/examples
212 if [[ ${1} == --subdir ]]; then
213 local dest=${dest}/${2}
214 dodir ${dest}
215 shift 2
216 fi
217
209 if [[ ${#} = 1 && -d ${1} ]]; then 218 if [[ ${#} = 1 && -d ${1} ]]; then
210 ( # dont want to pollute calling env 219 ( # dont want to pollute calling env
211 insinto "${dest}" 220 insinto "${dest}"
212 doins -r ${1}/* 221 doins -r ${1}/*
213 ) || die "Installing examples failed" 222 ) || die "Installing examples failed"
282 done 291 done
283 292
284 java-pkg_do_write_ 293 java-pkg_do_write_
285} 294}
286 295
287
288# ------------------------------------------------------------------------------ 296# ------------------------------------------------------------------------------
289# @internal-function depend-java-query 297# @internal-function depend-java-query
290# 298#
291# Wrapper for the depend-java-query binary to enable passing USE in env. 299# Wrapper for the depend-java-query binary to enable passing USE in env.
292# Using env variables keeps this eclass working with java-config versions that 300# Using env variables keeps this eclass working with java-config versions that
437 if [[ -e "${lib}" ]] ; then 445 if [[ -e "${lib}" ]] ; then
438 # install if it isn't a symlink 446 # install if it isn't a symlink
439 if [[ ! -L "${lib}" ]] ; then 447 if [[ ! -L "${lib}" ]] ; then
440 INSDESTTREE="${JAVA_PKG_LIBDEST}" \ 448 INSDESTTREE="${JAVA_PKG_LIBDEST}" \
441 INSOPTIONS="${LIBOPTIONS}" \ 449 INSOPTIONS="${LIBOPTIONS}" \
442 doins "${lib}" || "failed to install ${lib}" 450 doins "${lib}" || die "failed to install ${lib}"
443 java-pkg_append_ JAVA_PKG_LIBRARY "${JAVA_PKG_LIBDEST}" 451 java-pkg_append_ JAVA_PKG_LIBRARY "${JAVA_PKG_LIBDEST}"
444 debug-print "Installing ${lib} to ${JAVA_PKG_LIBDEST}" 452 debug-print "Installing ${lib} to ${JAVA_PKG_LIBDEST}"
445 # otherwise make a symlink to the symlink's origin 453 # otherwise make a symlink to the symlink's origin
446 else 454 else
447 # TODO use dosym 455 # TODO use dosym
548# ------------------------------------------------------------------------------ 556# ------------------------------------------------------------------------------
549# @ebuild-function java-pkg_dojavadoc 557# @ebuild-function java-pkg_dojavadoc
550# 558#
551# Installs javadoc documentation. This should be controlled by the doc use flag. 559# Installs javadoc documentation. This should be controlled by the doc use flag.
552# 560#
561# @param $1: optional --symlink creates to symlink like this for html
562# documentation bundles.
553# @param $1: - The javadoc root directory. 563# @param $2: - The javadoc root directory.
554# 564#
555# @example: 565# @example:
556# java-pkg_dojavadoc docs/api 566# java-pkg_dojavadoc docs/api
567# java-pkg_dojavadoc --symlink apidocs docs/api
557# 568#
558# ------------------------------------------------------------------------------ 569# ------------------------------------------------------------------------------
559java-pkg_dojavadoc() { 570java-pkg_dojavadoc() {
560 debug-print-function ${FUNCNAME} $* 571 debug-print-function ${FUNCNAME} $*
572
573 # For html documentation bundles that link to Javadoc
574 local symlink
575 if [[ ${1} = --symlink ]]; then
576 symlink=${2}
577 shift 2
578 fi
579
561 local dir="$1" 580 local dir="$1"
581 local dest=/usr/share/doc/${PF}/html
562 582
563 # QA checks 583 # QA checks
564 584
565 java-pkg_check-phase install 585 java-pkg_check-phase install
566 586
570 local msg="No index.html in javadoc directory" 590 local msg="No index.html in javadoc directory"
571 ewarn "${msg}" 591 ewarn "${msg}"
572 is-java-strict && die "${msg}" 592 is-java-strict && die "${msg}"
573 fi 593 fi
574 594
595 if [[ -e ${D}/${dest}/api ]]; then
596 eerror "${dest} already exists. Will not overwrite."
597 die "${dest}"
598 fi
599
575 # Renaming to match our directory layout 600 # Renaming to match our directory layout
576 601
577 local dir_to_install="${dir}" 602 local dir_to_install="${dir}"
578 if [[ "$(basename "${dir}")" != "api" ]]; then 603 if [[ "$(basename "${dir}")" != "api" ]]; then
579 dir_to_install="${T}/api" 604 dir_to_install="${T}/api"
581 cp -r "${dir}" "${dir_to_install}" || die "cp failed" 606 cp -r "${dir}" "${dir_to_install}" || die "cp failed"
582 fi 607 fi
583 608
584 # Actual installation 609 # Actual installation
585 610
586 java-pkg_dohtml -r ${dir_to_install} 611 java-pkg_dohtml -r "${dir_to_install}"
612
613 # Let's make a symlink to the directory we have everything else under
614 dosym ${dest}/api "${JAVA_PKG_SHAREPATH}/api" || die
615
616 if [[ ${symlink} ]]; then
617 debug-print "symlinking ${dest}/{api,${symlink}}"
618 dosym ${dest}/{api,${symlink}} || die
619 fi
587} 620}
588 621
589# ------------------------------------------------------------------------------ 622# ------------------------------------------------------------------------------
590# @ebuild-function java-pkg_dosrc 623# @ebuild-function java-pkg_dosrc
591# 624#
614 647
615 [[ ${#} -lt 1 ]] && die "At least one argument needed" 648 [[ ${#} -lt 1 ]] && die "At least one argument needed"
616 649
617 if ! [[ ${DEPEND} = *app-arch/zip* ]]; then 650 if ! [[ ${DEPEND} = *app-arch/zip* ]]; then
618 local msg="${FUNCNAME} called without app-arch/zip in DEPEND" 651 local msg="${FUNCNAME} called without app-arch/zip in DEPEND"
619 if is-java-strict; then 652 java-pkg_announce-qa-violation ${msg}
620 eerror "${msg}"
621 die "${msg}"
622 else
623 echo "${msg}"
624 echo "Please report this to http://bugs.gentoo.org."
625 fi
626 fi 653 fi
627 654
628 java-pkg_init_paths_ 655 java-pkg_init_paths_
629 656
630 local zip_name="${PN}-src.zip" 657 local zip_name="${PN}-src.zip"
830# @param $opt 857# @param $opt
831# --build-only - makes the jar(s) not added into package.env DEPEND line. 858# --build-only - makes the jar(s) not added into package.env DEPEND line.
832# (assumed automatically when called inside src_test) 859# (assumed automatically when called inside src_test)
833# --with-dependencies - get jars also from requested package's dependencies 860# --with-dependencies - get jars also from requested package's dependencies
834# transitively. 861# transitively.
862# --virtual - Packages passed to this function are to be handled as virtuals
863# and will not have individual jar dependencies recorded.
835# --into $dir - symlink jar(s) into $dir (must exist) instead of . 864# --into $dir - symlink jar(s) into $dir (must exist) instead of .
836# @param $1 - Package to get jars from, or comma-separated list of packages in 865# @param $1 - Package to get jars from, or comma-separated list of packages in
837# case other parameters are not used. 866# case other parameters are not used.
838# @param $2 - jar from package. If not specified, all jars will be used. 867# @param $2 - jar from package. If not specified, all jars will be used.
839# @param $3 - When a single jar is specified, destination filename of the 868# @param $3 - When a single jar is specified, destination filename of the
844 debug-print-function ${FUNCNAME} $* 873 debug-print-function ${FUNCNAME} $*
845 874
846 local build_only="" 875 local build_only=""
847 local destdir="." 876 local destdir="."
848 local deep="" 877 local deep=""
878 local virtual=""
849 879
850 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build" 880 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build"
851 881
852 while [[ "${1}" == --* ]]; do 882 while [[ "${1}" == --* ]]; do
853 if [[ "${1}" = "--build-only" ]]; then 883 if [[ "${1}" = "--build-only" ]]; then
854 build_only="build" 884 build_only="build"
855 elif [[ "${1}" = "--with-dependencies" ]]; then 885 elif [[ "${1}" = "--with-dependencies" ]]; then
856 deep="--with-dependencies" 886 deep="--with-dependencies"
887 elif [[ "${1}" = "--virtual" ]]; then
888 virtual="true"
857 elif [[ "${1}" = "--into" ]]; then 889 elif [[ "${1}" = "--into" ]]; then
858 destdir="${2}" 890 destdir="${2}"
859 shift 891 shift
860 else 892 else
861 die "java-pkg_jar-from called with unknown parameter: ${1}" 893 die "java-pkg_jar-from called with unknown parameter: ${1}"
864 done 896 done
865 897
866 local target_pkg="${1}" target_jar="${2}" destjar="${3}" 898 local target_pkg="${1}" target_jar="${2}" destjar="${3}"
867 899
868 [[ -z ${target_pkg} ]] && die "Must specify a package" 900 [[ -z ${target_pkg} ]] && die "Must specify a package"
901
902 if [[ "${EAPI}" == "1" ]]; then
903 target_pkg="${target_pkg//:/-}"
904 fi
869 905
870 # default destjar to the target jar 906 # default destjar to the target jar
871 [[ -z "${destjar}" ]] && destjar="${target_jar}" 907 [[ -z "${destjar}" ]] && destjar="${target_jar}"
872 908
873 local error_msg="There was a problem getting the classpath for ${target_pkg}." 909 local error_msg="There was a problem getting the classpath for ${target_pkg}."
885 done 921 done
886 # setting this disables further record-jar_ calls later 922 # setting this disables further record-jar_ calls later
887 build_only="build" 923 build_only="build"
888 else 924 else
889 java-pkg_ensure-dep "${build_only}" "${target_pkg}" 925 java-pkg_ensure-dep "${build_only}" "${target_pkg}"
926 fi
927
928 # Record the entire virtual as a dependency so that
929 # no jars are missed.
930 if [[ -z "${build_only}" && -n "${virtual}" ]]; then
931 java-pkg_record-jar_ "${target_pkg}"
932 # setting this disables further record-jars_ calls later
933 build_only="build"
890 fi 934 fi
891 935
892 pushd ${destdir} > /dev/null \ 936 pushd ${destdir} > /dev/null \
893 || die "failed to change directory to ${destdir}" 937 || die "failed to change directory to ${destdir}"
894 938
977 done 1021 done
978 1022
979 [[ ${#} -ne 1 ]] && die "${FUNCNAME} takes only one argument besides --*" 1023 [[ ${#} -ne 1 ]] && die "${FUNCNAME} takes only one argument besides --*"
980 1024
981 1025
982 local classpath pkgs="${1}" 1026 local pkgs="${1}"
1027
1028 if [[ "${EAPI}" == "1" ]]; then
1029 pkgs="${pkgs//:/-}"
1030 fi
1031
983 jars="$(java-config ${deep} --classpath=${pkgs})" 1032 jars="$(java-config ${deep} --classpath=${pkgs})"
984 [[ $? != 0 || -z "${jars}" ]] && die "java-config --classpath=${pkgs} failed" 1033 [[ $? != 0 ]] && die "java-config --classpath=${pkgs} failed"
985 debug-print "${pkgs}:${jars}" 1034 debug-print "${pkgs}:${jars}"
986 1035
987 for pkg in ${pkgs//,/ }; do 1036 for pkg in ${pkgs//,/ }; do
988 java-pkg_ensure-dep "${build_only}" "${pkg}" 1037 java-pkg_ensure-dep "${build_only}" "${pkg}"
989 done 1038 done
990
991 if [[ -z "${classpath}" ]]; then
992 classpath="${jars}"
993 else
994 classpath="${classpath}:${jars}"
995 fi
996 1039
997 # Only record jars that aren't build-only 1040 # Only record jars that aren't build-only
998 if [[ -z "${build_only}" ]]; then 1041 if [[ -z "${build_only}" ]]; then
999 for pkg in ${pkgs//,/ }; do 1042 for pkg in ${pkgs//,/ }; do
1000 java-pkg_record-jar_ "${pkg}" 1043 java-pkg_record-jar_ "${pkg}"
1001 done 1044 done
1002 fi 1045 fi
1003 1046
1004 echo "${classpath}" 1047 echo "${jars}"
1005} 1048}
1006 1049
1007# ------------------------------------------------------------------------------ 1050# ------------------------------------------------------------------------------
1008# @ebuild-function java-pkg_getjar 1051# @ebuild-function java-pkg_getjar
1009# 1052#
1018# @example-return 1061# @example-return
1019# /usr/share/xerces-2/lib/xml-apis.jar 1062# /usr/share/xerces-2/lib/xml-apis.jar
1020# 1063#
1021# @param $opt 1064# @param $opt
1022# --build-only - makes the jar not added into package.env DEPEND line. 1065# --build-only - makes the jar not added into package.env DEPEND line.
1066# --virtual - Packages passed to this function are to be handled as virtuals
1067# and will not have individual jar dependencies recorded.
1023# @param $1 - package to use 1068# @param $1 - package to use
1024# @param $2 - jar to get 1069# @param $2 - jar to get
1025# ------------------------------------------------------------------------------ 1070# ------------------------------------------------------------------------------
1026java-pkg_getjar() { 1071java-pkg_getjar() {
1027 debug-print-function ${FUNCNAME} $* 1072 debug-print-function ${FUNCNAME} $*
1028 1073
1029 local build_only="" 1074 local build_only=""
1075 local virtual=""
1030 1076
1031 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build" 1077 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build"
1032 1078
1033 while [[ "${1}" == --* ]]; do 1079 while [[ "${1}" == --* ]]; do
1034 if [[ "${1}" = "--build-only" ]]; then 1080 if [[ "${1}" = "--build-only" ]]; then
1035 build_only="build" 1081 build_only="build"
1082 elif [[ "${1}" == "--virtual" ]]; then
1083 virtual="true"
1036 else 1084 else
1037 die "java-pkg_jar-from called with unknown parameter: ${1}" 1085 die "java-pkg_getjar called with unknown parameter: ${1}"
1038 fi 1086 fi
1039 shift 1087 shift
1040 done 1088 done
1041 1089
1042 [[ ${#} -ne 2 ]] && die "${FUNCNAME} takes only two arguments besides --*" 1090 [[ ${#} -ne 2 ]] && die "${FUNCNAME} takes only two arguments besides --*"
1043 1091
1044 local pkg="${1}" target_jar="${2}" jar 1092 local pkg="${1}" target_jar="${2}" jar
1093
1094 if [[ "${EAPI}" == "1" ]]; then
1095 pkg="${pkg//:/-}"
1096 fi
1097
1045 [[ -z ${pkg} ]] && die "Must specify package to get a jar from" 1098 [[ -z ${pkg} ]] && die "Must specify package to get a jar from"
1046 [[ -z ${target_jar} ]] && die "Must specify jar to get" 1099 [[ -z ${target_jar} ]] && die "Must specify jar to get"
1047 1100
1048 local error_msg="Could not find classpath for ${pkg}. Are you sure its installed?" 1101 local error_msg="Could not find classpath for ${pkg}. Are you sure its installed?"
1049 local classpath 1102 local classpath
1050 classpath=$(java-config --classpath=${pkg}) 1103 classpath=$(java-config --classpath=${pkg})
1051 [[ $? != 0 ]] && die ${error_msg} 1104 [[ $? != 0 ]] && die ${error_msg}
1052 1105
1053 java-pkg_ensure-dep "${build_only}" "${pkg}" 1106 java-pkg_ensure-dep "${build_only}" "${pkg}"
1107
1108 # Record the package(Virtual) as a dependency and then set build_only
1109 # So that individual jars are not recorded.
1110 if [[ -n "${virtual}" ]]; then
1111 java-pkg_record-jar_ "${pkg}"
1112 build_only="true"
1113 fi
1054 1114
1055 for jar in ${classpath//:/ }; do 1115 for jar in ${classpath//:/ }; do
1056 if [[ ! -f "${jar}" ]] ; then 1116 if [[ ! -f "${jar}" ]] ; then
1057 die "Installation problem with jar ${jar} in ${pkg} - is it installed?" 1117 die "Installation problem with jar ${jar} in ${pkg} - is it installed?"
1058 fi 1118 fi
1103 1163
1104 local pkgs="${1}" 1164 local pkgs="${1}"
1105 local jar="${2}" 1165 local jar="${2}"
1106 1166
1107 [[ -z "${pkgs}" ]] && die "${FUNCNAME} called with no package(s) specified" 1167 [[ -z "${pkgs}" ]] && die "${FUNCNAME} called with no package(s) specified"
1168
1169 if [[ "${EAPI}" == "1" ]]; then
1170 pkgs="${pkgs//:/-}"
1171 fi
1108 1172
1109 if [[ -z "${jar}" ]]; then 1173 if [[ -z "${jar}" ]]; then
1110 for pkg in ${pkgs//,/ }; do 1174 for pkg in ${pkgs//,/ }; do
1111 java-pkg_ensure-dep runtime "${pkg}" 1175 java-pkg_ensure-dep runtime "${pkg}"
1112 java-pkg_record-jar_ "${pkg}" 1176 java-pkg_record-jar_ "${pkg}"
1154 1218
1155 local pkgs="${1}" 1219 local pkgs="${1}"
1156 local jar="${2}" 1220 local jar="${2}"
1157 1221
1158 [[ -z "${pkgs}" ]] && die "${FUNCNAME} called with no package(s) specified" 1222 [[ -z "${pkgs}" ]] && die "${FUNCNAME} called with no package(s) specified"
1223
1224 if [[ "${EAPI}" == "1" ]]; then
1225 pkgs="${pkgs//:/-}"
1226 fi
1159 1227
1160 if [[ -z "${jar}" ]]; then 1228 if [[ -z "${jar}" ]]; then
1161 for pkg in ${pkgs//,/ }; do 1229 for pkg in ${pkgs//,/ }; do
1162 java-pkg_record-jar_ --optional "${pkg}" 1230 java-pkg_record-jar_ --optional "${pkg}"
1163 done 1231 done
1664 dodir /usr/share/ant/${TASKS_DIR} 1732 dodir /usr/share/ant/${TASKS_DIR}
1665 touch "${D}/usr/share/ant/${TASKS_DIR}/${TASK_NAME}" 1733 touch "${D}/usr/share/ant/${TASKS_DIR}/${TASK_NAME}"
1666} 1734}
1667 1735
1668# ------------------------------------------------------------------------------ 1736# ------------------------------------------------------------------------------
1669# @internal-function java-pkg_ant-tasks-from-deps
1670#
1671# Function to determine ANT_TASKS from DEPEND variable for backwards
1672# compatibility with ebuilds that don't set ANT_TASKS before calling eant() or
1673# WANT_ANT_TASKS before inheriting java-pkg-2. If the DEPEND string contains
1674# "dev-java/ant" or "dev-java/ant-tasks", then it returns "all", otherwise
1675# "none". It's not smart enough to cope with USE flag depends but that shouldn't
1676# be a problem, the worst it can do is activace all tasks when not needed.
1677# Note that this is called only with JAVA_PKG_STRICT=1, to find ebuilds with
1678# insufficient dependencies, otherwise all available tasks are used for
1679# backwards compatilbility.
1680#
1681# @return "all" or "none"
1682# ------------------------------------------------------------------------------
1683java-pkg_ant-tasks-from-deps() {
1684 local found_ant found_ant_tasks
1685
1686 for dep in ${DEPEND}
1687 do
1688 local ant="$(awk '/(dev-java\/ant)/ { if (match($1, "(dev-java/ant)((-[0-9])+|$)", m)) print m[1] }' <<< ${dep})"
1689 [[ "${ant}" == "dev-java/ant" ]] && found_ant=true
1690 [[ "${dep}" == *"ant-tasks"* ]] && found_ant_tasks=true
1691 done
1692
1693 if [[ -n "${found_ant}" || -n "${found_ant_tasks}" ]]; then
1694 java-pkg_announce-qa-violation --nodie "The ebuild DEPENDS on deprecated ant or ant-tasks"
1695 echo "all"
1696 else
1697 # ebuild doesn't set ANT_TASKS and doesn't depend on ant-tasks or ant
1698 # so we deactivate all tasks that may be installed
1699 echo "none"
1700 fi
1701}
1702
1703# ------------------------------------------------------------------------------
1704# @internal-function java-pkg_ant-tasks-depend 1737# @internal-function java-pkg_ant-tasks-depend
1705# 1738#
1706# Translates the WANT_ANT_TASKS variable into valid dependencies. 1739# Translates the WANT_ANT_TASKS variable into valid dependencies.
1707# ------------------------------------------------------------------------------ 1740# ------------------------------------------------------------------------------
1708java-pkg_ant-tasks-depend() { 1741java-pkg_ant-tasks-depend() {
1710 1743
1711 if [[ -n "${WANT_ANT_TASKS}" ]]; then 1744 if [[ -n "${WANT_ANT_TASKS}" ]]; then
1712 local DEP="" 1745 local DEP=""
1713 for i in ${WANT_ANT_TASKS} 1746 for i in ${WANT_ANT_TASKS}
1714 do 1747 do
1715 if [[ ${i} != ant-* ]]; then 1748 if [[ ${i} = ant-* ]]; then
1749 DEP="${DEP}dev-java/${i} "
1750 elif [[ ${i} = */*:* ]]; then
1751 DEP="${DEP}${i} "
1752 else
1716 echo "Invalid atom in WANT_ANT_TASKS: ${i}" 1753 echo "Invalid atom in WANT_ANT_TASKS: ${i}"
1717 return 1 1754 return 1
1718 fi 1755 fi
1719 DEP="${DEP}dev-java/${i} "
1720 done 1756 done
1721 echo ${DEP} 1757 echo ${DEP}
1722 return 0 1758 return 0
1723 else 1759 else
1724 return 0 1760 return 0
1741# ------------------------------------------------------------------------------ 1777# ------------------------------------------------------------------------------
1742ejunit() { 1778ejunit() {
1743 debug-print-function ${FUNCNAME} $* 1779 debug-print-function ${FUNCNAME} $*
1744 1780
1745 local pkgs 1781 local pkgs
1782 if [[ -f ${JAVA_PKG_DEPEND_FILE} ]]; then
1746 for atom in $(cat ${JAVA_PKG_DEPEND_FILE} | tr : ' '); do 1783 for atom in $(cat ${JAVA_PKG_DEPEND_FILE} | tr : ' '); do
1747 pkgs=${pkgs},$(echo ${atom} | sed -re "s/^.*@//") 1784 pkgs=${pkgs},$(echo ${atom} | sed -re "s/^.*@//")
1748 done 1785 done
1786 fi
1749 1787
1750 local cp=$(java-pkg_getjars --with-dependencies junit${pkgs}) 1788 local cp=$(java-pkg_getjars --with-dependencies junit${pkgs})
1751 if [[ ${1} = -cp || ${1} = -classpath ]]; then 1789 if [[ ${1} = -cp || ${1} = -classpath ]]; then
1752 cp="${2}:${cp}" 1790 cp="${2}:${cp}"
1753 shift 2 1791 shift 2
1763# ------------------------------------------------------------------------------ 1801# ------------------------------------------------------------------------------
1764# @section-end helper 1802# @section-end helper
1765# ------------------------------------------------------------------------------ 1803# ------------------------------------------------------------------------------
1766 1804
1767# ------------------------------------------------------------------------------ 1805# ------------------------------------------------------------------------------
1806# @eclass-src_prepare
1807#
1808# src_prepare Searches for bundled jars
1809# Don't call directly, but via java-pkg-2_src_prepare!
1810# ------------------------------------------------------------------------------
1811
1812java-utils-2_src_prepare() {
1813 # Remember that eant will call this unless called via Portage
1814 if [[ ! -e "${T}/java-utils-2_src_prepare-run" ]] && is-java-strict; then
1815 echo "Searching for bundled jars:"
1816 java-pkg_find-normal-jars || echo "None found."
1817 echo "Searching for bundled classes (no output if none found):"
1818 find "${WORKDIR}" -name "*.class"
1819 echo "Search done."
1820 fi
1821 touch "${T}/java-utils-2_src_prepare-run"
1822}
1823
1824# ------------------------------------------------------------------------------
1768# @section-begin build 1825# @section-begin build
1769# @section-summary Build functions 1826# @section-summary Build functions
1770# 1827#
1771# These are some functions for building a package. In particular, it consists of 1828# These are some functions for building a package. In particular, it consists of
1772# wrappers for javac and ant. 1829# wrappers for javac and ant.
1779# compiler. Will also set proper ANT_TASKS from the variable ANT_TASKS, 1836# compiler. Will also set proper ANT_TASKS from the variable ANT_TASKS,
1780# variables: 1837# variables:
1781# EANT_GENTOO_CLASSPATH - calls java-pkg_getjars for the value and adds to the 1838# EANT_GENTOO_CLASSPATH - calls java-pkg_getjars for the value and adds to the
1782# gentoo.classpath property. Be sure to call 1839# gentoo.classpath property. Be sure to call
1783# java-ant_rewrite-classpath in src_unpack. 1840# java-ant_rewrite-classpath in src_unpack.
1841# EANT_NEEDS_TOOLS - add tools.jar to the gentoo.classpath. Should only be used
1842# for build-time purposes, the dependency is not recorded to
1843# package.env!
1844# JAVA_PKG_NO_BUNDLED_SEARCH - Don't search for bundled jars or class files
1784# *ANT_TASKS - used to determine ANT_TASKS before calling Ant. 1845# *ANT_TASKS - used to determine ANT_TASKS before calling Ant.
1785# ------------------------------------------------------------------------------ 1846# ------------------------------------------------------------------------------
1786eant() { 1847eant() {
1787 debug-print-function ${FUNCNAME} $* 1848 debug-print-function ${FUNCNAME} $*
1849
1850 if [[ ${EBUILD_PHASE} = compile ]]; then
1851 java-ant-2_src_configure
1852 java-utils-2_src_prepare
1853 fi
1788 1854
1789 if ! hasq java-ant-2 ${INHERITED}; then 1855 if ! hasq java-ant-2 ${INHERITED}; then
1790 local msg="You should inherit java-ant-2 when using eant" 1856 local msg="You should inherit java-ant-2 when using eant"
1791 java-pkg_announce-qa-violation "${msg}" 1857 java-pkg_announce-qa-violation "${msg}"
1792 fi 1858 fi
1793 1859
1794 local antflags="-Dnoget=true -Dmaven.mode.offline=true" 1860 local antflags="-Dnoget=true -Dmaven.mode.offline=true -Dbuild.sysclasspath=ignore"
1795 1861
1796 java-pkg_init-compiler_ 1862 java-pkg_init-compiler_
1797 local compiler="${GENTOO_COMPILER}" 1863 local compiler="${GENTOO_COMPILER}"
1798 1864
1799 local compiler_env="${JAVA_PKG_COMPILER_DIR}/${compiler}" 1865 local compiler_env="${JAVA_PKG_COMPILER_DIR}/${compiler}"
1800
1801 local build_compiler="$(source ${compiler_env} 1>/dev/null 2>&1; echo ${ANT_BUILD_COMPILER})" 1866 local build_compiler="$(source ${compiler_env} 1>/dev/null 2>&1; echo ${ANT_BUILD_COMPILER})"
1802 if [[ "${compiler}" != "javac" && -z "${build_compiler}" ]]; then 1867 if [[ "${compiler}" != "javac" && -z "${build_compiler}" ]]; then
1803 die "ANT_BUILD_COMPILER undefined in ${compiler_env}" 1868 die "ANT_BUILD_COMPILER undefined in ${compiler_env}"
1804 fi 1869 fi
1805 1870
1811 # java-config -p 1876 # java-config -p
1812 local build_compiler_deps="$(source ${JAVA_PKG_COMPILER_DIR}/${compiler} 1>/dev/null 2>&1; echo ${ANT_BUILD_COMPILER_DEPS})" 1877 local build_compiler_deps="$(source ${JAVA_PKG_COMPILER_DIR}/${compiler} 1>/dev/null 2>&1; echo ${ANT_BUILD_COMPILER_DEPS})"
1813 if [[ -n ${build_compiler_deps} ]]; then 1878 if [[ -n ${build_compiler_deps} ]]; then
1814 antflags="${antflags} -lib $(java-config -p ${build_compiler_deps})" 1879 antflags="${antflags} -lib $(java-config -p ${build_compiler_deps})"
1815 fi 1880 fi
1816 fi
1817
1818 if is-java-strict; then
1819 einfo "Disabling system classpath for ant"
1820 antflags="${antflags} -Dbuild.sysclasspath=ignore"
1821 fi 1881 fi
1822 1882
1823 for arg in "${@}"; do 1883 for arg in "${@}"; do
1824 if [[ ${arg} = -lib ]]; then 1884 if [[ ${arg} = -lib ]]; then
1825 if is-java-strict; then 1885 if is-java-strict; then
1834 echo "more info." 1894 echo "more info."
1835 fi 1895 fi
1836 fi 1896 fi
1837 done 1897 done
1838 1898
1839 # we use this in src_* so we run ant from / 1899 # parse WANT_ANT_TASKS for atoms
1840 if ROOT=/ has_version ">=dev-java/ant-core-1.7.0"; then 1900 local want_ant_tasks
1841 # default ANT_TASKS to WANT_ANT_TASKS, if ANT_TASKS is not set explicitly 1901 for i in ${WANT_ANT_TASKS}; do
1842 ANT_TASKS="${ANT_TASKS:-${WANT_ANT_TASKS}}" 1902 if [[ ${i} = */*:* ]]; then
1843 1903 i=${i#*/}
1844 # override ANT_TASKS with JAVA_PKG_FORCE_ANT_TASKS if it's set 1904 i=${i%:0}
1845 ANT_TASKS="${JAVA_PKG_FORCE_ANT_TASKS:-${ANT_TASKS}}" 1905 want_ant_tasks+="${i/:/-} "
1846
1847 if is-java-strict; then
1848 # if ant-tasks were not set by ebuild or forced, try to determine them from depends
1849 if [[ -z "${ANT_TASKS}" ]]; then
1850 ANT_TASKS="$(java-pkg_ant-tasks-from-deps)"
1851 fi
1852 else 1906 else
1907 want_ant_tasks+="${i} "
1908 fi
1909 done
1910 # default ANT_TASKS to WANT_ANT_TASKS, if ANT_TASKS is not set explicitly
1911 ANT_TASKS="${ANT_TASKS:-${want_ant_tasks% }}"
1912
1913 # override ANT_TASKS with JAVA_PKG_FORCE_ANT_TASKS if it's set
1914 ANT_TASKS="${JAVA_PKG_FORCE_ANT_TASKS:-${ANT_TASKS}}"
1915
1853 # if ant-tasks is not set by ebuild or forced, activate all of them 1916 # if ant-tasks is not set by ebuild or forced, use none
1854 ANT_TASKS="${ANT_TASKS:-all}" 1917 ANT_TASKS="${ANT_TASKS:-none}"
1855 fi
1856 1918
1857 # at this point, ANT_TASKS should be "all", "none" or explicit list 1919 # at this point, ANT_TASKS should be "all", "none" or explicit list
1858 if [[ "${ANT_TASKS}" == "all" ]]; then 1920 if [[ "${ANT_TASKS}" == "all" ]]; then
1859 einfo "Using all available ANT_TASKS" 1921 einfo "Using all available ANT_TASKS"
1860 elif [[ "${ANT_TASKS}" == "none" ]]; then 1922 elif [[ "${ANT_TASKS}" == "none" ]]; then
1861 einfo "Disabling all optional ANT_TASKS" 1923 einfo "Disabling all optional ANT_TASKS"
1862 else 1924 else
1863 einfo "Using following ANT_TASKS: ${ANT_TASKS}" 1925 einfo "Using following ANT_TASKS: ${ANT_TASKS}"
1864 fi 1926 fi
1865 1927
1866 export ANT_TASKS 1928 export ANT_TASKS
1867 fi
1868 1929
1869 [[ -n ${JAVA_PKG_DEBUG} ]] && antflags="${antflags} --execdebug -debug" 1930 [[ -n ${JAVA_PKG_DEBUG} ]] && antflags="${antflags} --execdebug -debug"
1870 [[ -n ${PORTAGE_QUIET} ]] && antflags="${antflags} -q" 1931 [[ -n ${PORTAGE_QUIET} ]] && antflags="${antflags} -q"
1871 1932
1872 local gcp="${EANT_GENTOO_CLASSPATH}" 1933 local gcp="${EANT_GENTOO_CLASSPATH}"
1873 local getjarsarg="" 1934 local getjarsarg=""
1874 1935
1875 if [[ ${EBUILD_PHASE} = "test" ]]; then 1936 if [[ ${EBUILD_PHASE} = "test" ]]; then
1876 antflags="${antflags} -DJunit.present=true" 1937 antflags="${antflags} -DJunit.present=true"
1877 [[ ${gcp} && ${ANT_TASKS} = *ant-junit* ]] && gcp="${gcp} junit" 1938 [[ ${ANT_TASKS} = *ant-junit* ]] && gcp="${gcp} junit"
1878 getjarsarg="--with-dependencies" 1939 getjarsarg="--with-dependencies"
1879 fi 1940 fi
1880 1941
1881 local cp 1942 local cp
1882 1943
1883 for atom in ${gcp}; do 1944 for atom in ${gcp}; do
1884 cp="${cp}:$(java-pkg_getjars ${getjarsarg} ${atom})" 1945 cp="${cp}:$(java-pkg_getjars ${getjarsarg} ${atom})"
1885 done 1946 done
1886 1947
1948 [[ -n "${EANT_NEEDS_TOOLS}" ]] && cp="${cp}:$(java-config --tools)"
1949
1887 if [[ ${cp} ]]; then 1950 if [[ ${cp} ]]; then
1888 # It seems ant does not like single quotes around ${cp} 1951 # It seems ant does not like single quotes around ${cp}
1952 cp=${cp#:}
1953 [[ ${EANT_GENTOO_CLASSPATH_EXTRA} ]] && \
1954 cp="${cp}:${EANT_GENTOO_CLASSPATH_EXTRA}"
1889 antflags="${antflags} -Dgentoo.classpath=\"${cp#:}\"" 1955 antflags="${antflags} -Dgentoo.classpath=\"${cp}\""
1890 fi 1956 fi
1891 1957
1892 [[ -n ${JAVA_PKG_DEBUG} ]] && echo ant ${antflags} "${@}" 1958 [[ -n ${JAVA_PKG_DEBUG} ]] && echo ant ${antflags} "${@}"
1893 debug-print "Calling ant (GENTOO_VM: ${GENTOO_VM}): ${antflags} ${@}" 1959 debug-print "Calling ant (GENTOO_VM: ${GENTOO_VM}): ${antflags} ${@}"
1894 ant ${antflags} "${@}" || die "eant failed" 1960 ant ${antflags} "${@}" || die "eant failed"
1994# This shouldn't be used directly. Instead, java-pkg and java-pkg-opt will 2060# This shouldn't be used directly. Instead, java-pkg and java-pkg-opt will
1995# call it during each of the phases of the merge process. 2061# call it during each of the phases of the merge process.
1996# 2062#
1997# ----------------------------------------------------------------------------- 2063# -----------------------------------------------------------------------------
1998java-pkg_init() { 2064java-pkg_init() {
2065 debug-print-function ${FUNCNAME} $*
1999 unset JAVAC 2066 unset JAVAC
2000 unset JAVA_HOME 2067 unset JAVA_HOME
2068
2069 java-config --help >/dev/null || {
2070 eerror ""
2071 eerror "Can't run java-config --help"
2072 eerror "Have you upgraded python recently but haven't"
2073 eerror "run python-updater yet?"
2074 die "Can't run java-config --help"
2075 }
2001 2076
2002 # People do all kinds of weird things. 2077 # People do all kinds of weird things.
2003 # http://forums.gentoo.org/viewtopic-p-3943166.html 2078 # http://forums.gentoo.org/viewtopic-p-3943166.html
2004 local silence="${SILENCE_JAVA_OPTIONS_WARNING}" 2079 local silence="${SILENCE_JAVA_OPTIONS_WARNING}"
2005 local accept="${I_WANT_GLOBAL_JAVA_OPTIONS}" 2080 local accept="${I_WANT_GLOBAL_JAVA_OPTIONS}"
2011 ewarn "make.conf for example) to silence this warning or" 2086 ewarn "make.conf for example) to silence this warning or"
2012 ewarn "I_WANT_GLOBAL_JAVA_OPTIONS to not filter it." 2087 ewarn "I_WANT_GLOBAL_JAVA_OPTIONS to not filter it."
2013 fi 2088 fi
2014 2089
2015 if [[ -z ${accept} ]]; then 2090 if [[ -z ${accept} ]]; then
2091 # export _JAVA_OPTIONS= doesn't work because it will show up in java
2092 # -version output
2016 unset _JAVA_OPTIONS 2093 unset _JAVA_OPTIONS
2017 # phase hooks make this run many times without this 2094 # phase hooks make this run many times without this
2018 I_WANT_GLOBAL_JAVA_OPTIONS="true" 2095 I_WANT_GLOBAL_JAVA_OPTIONS="true"
2019 fi 2096 fi
2020 2097
2098 if java-pkg_func-exists ant_src_unpack; then
2099 java-pkg_announce-qa-violation "Using old ant_src_unpack. Should be src_unpack"
2100 fi
2101
2021 java-pkg_init_paths_ 2102 java-pkg_init_paths_
2022 java-pkg_switch-vm 2103 java-pkg_switch-vm
2023 PATH=${JAVA_HOME}/bin:${PATH} 2104 PATH=${JAVA_HOME}/bin:${PATH}
2024 2105
2025 # TODO we will probably want to set JAVAC and JAVACFLAGS 2106 # TODO we will probably want to set JAVAC and JAVACFLAGS
2026 2107
2027 # Do some QA checks 2108 # Do some QA checks
2028 java-pkg_check-jikes 2109 java-pkg_check-jikes
2110
2111 # Can't use unset here because Portage does not save the unset
2112 # see https://bugs.gentoo.org/show_bug.cgi?id=189417#c11
2029 2113
2030 # When users have crazy classpaths some packages can fail to compile. 2114 # When users have crazy classpaths some packages can fail to compile.
2031 # and everything should work with empty CLASSPATH. 2115 # and everything should work with empty CLASSPATH.
2032 # This also helps prevent unexpected dependencies on random things 2116 # This also helps prevent unexpected dependencies on random things
2033 # from the CLASSPATH. 2117 # from the CLASSPATH.
2034 unset CLASSPATH 2118 export CLASSPATH=
2035 2119
2036 # Unset external ANT_ stuff 2120 # Unset external ANT_ stuff
2037 unset ANT_TASKS 2121 export ANT_TASKS=
2038 unset ANT_OPTS 2122 export ANT_OPTS=
2123 export ANT_RESPECT_JAVA_HOME=
2039} 2124}
2040 2125
2041# ------------------------------------------------------------------------------ 2126# ------------------------------------------------------------------------------
2042# @function-internal java-pkg-init-compiler_ 2127# @function-internal java-pkg-init-compiler_
2043# 2128#
2134 done 2219 done
2135 2220
2136 # If it hasn't been defined already, default to javac 2221 # If it hasn't been defined already, default to javac
2137 if [[ -z ${GENTOO_COMPILER} ]]; then 2222 if [[ -z ${GENTOO_COMPILER} ]]; then
2138 if [[ -n ${compilers} ]]; then 2223 if [[ -n ${compilers} ]]; then
2139 einfo "No suitable compiler found: defaulting javac for compilation" 2224 einfo "No suitable compiler found: defaulting to JDK default for compilation"
2140 else 2225 else
2141 # probably don't need to notify users about the default. 2226 # probably don't need to notify users about the default.
2142 :;#einfo "Defaulting to javac for compilation" 2227 :;#einfo "Defaulting to javac for compilation"
2143 fi 2228 fi
2229 if java-config -g GENTOO_COMPILER 2> /dev/null; then
2230 export GENTOO_COMPILER=$(java-config -g GENTOO_COMPILER)
2231 else
2144 export GENTOO_COMPILER=javac 2232 export GENTOO_COMPILER=javac
2233 fi
2145 else 2234 else
2146 einfo "Using ${GENTOO_COMPILER} for compilation" 2235 einfo "Using ${GENTOO_COMPILER} for compilation"
2147 fi 2236 fi
2148 2237
2149} 2238}
2165 fi 2254 fi
2166 2255
2167 JAVA_PKG_SHAREPATH="${DESTTREE}/share/${JAVA_PKG_NAME}" 2256 JAVA_PKG_SHAREPATH="${DESTTREE}/share/${JAVA_PKG_NAME}"
2168 JAVA_PKG_SOURCESPATH="${JAVA_PKG_SHAREPATH}/sources/" 2257 JAVA_PKG_SOURCESPATH="${JAVA_PKG_SHAREPATH}/sources/"
2169 JAVA_PKG_ENV="${D}${JAVA_PKG_SHAREPATH}/package.env" 2258 JAVA_PKG_ENV="${D}${JAVA_PKG_SHAREPATH}/package.env"
2259 JAVA_PKG_VIRTUALS_PATH="${DESTTREE}/share/java-config-2/virtuals"
2260 JAVA_PKG_VIRTUAL_PROVIDER="${D}/${JAVA_PKG_VIRTUALS_PATH}/${JAVA_PKG_NAME}"
2170 2261
2171 [[ -z "${JAVA_PKG_JARDEST}" ]] && JAVA_PKG_JARDEST="${JAVA_PKG_SHAREPATH}/lib" 2262 [[ -z "${JAVA_PKG_JARDEST}" ]] && JAVA_PKG_JARDEST="${JAVA_PKG_SHAREPATH}/lib"
2172 [[ -z "${JAVA_PKG_LIBDEST}" ]] && JAVA_PKG_LIBDEST="${DESTTREE}/$(get_libdir)/${JAVA_PKG_NAME}" 2263 [[ -z "${JAVA_PKG_LIBDEST}" ]] && JAVA_PKG_LIBDEST="${DESTTREE}/$(get_libdir)/${JAVA_PKG_NAME}"
2173 [[ -z "${JAVA_PKG_WARDEST}" ]] && JAVA_PKG_WARDEST="${JAVA_PKG_SHAREPATH}/webapps" 2264 [[ -z "${JAVA_PKG_WARDEST}" ]] && JAVA_PKG_WARDEST="${JAVA_PKG_SHAREPATH}/webapps"
2174 2265
2198 "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" ]]; then 2289 "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" ]]; then
2199 # Create package.env 2290 # Create package.env
2200 ( 2291 (
2201 echo "DESCRIPTION=\"${DESCRIPTION}\"" 2292 echo "DESCRIPTION=\"${DESCRIPTION}\""
2202 echo "GENERATION=\"2\"" 2293 echo "GENERATION=\"2\""
2294 echo "SLOT=\"${SLOT}\""
2203 2295
2204 [[ -n "${JAVA_PKG_CLASSPATH}" ]] && echo "CLASSPATH=\"${JAVA_PKG_CLASSPATH}\"" 2296 [[ -n "${JAVA_PKG_CLASSPATH}" ]] && echo "CLASSPATH=\"${JAVA_PKG_CLASSPATH}\""
2205 [[ -n "${JAVA_PKG_LIBRARY}" ]] && echo "LIBRARY_PATH=\"${JAVA_PKG_LIBRARY}\"" 2297 [[ -n "${JAVA_PKG_LIBRARY}" ]] && echo "LIBRARY_PATH=\"${JAVA_PKG_LIBRARY}\""
2206 [[ -n "${JAVA_PROVIDE}" ]] && echo "PROVIDES=\"${JAVA_PROVIDE}\"" 2298 [[ -n "${JAVA_PROVIDE}" ]] && echo "PROVIDES=\"${JAVA_PROVIDE}\""
2207 [[ -f "${JAVA_PKG_DEPEND_FILE}" ]] \ 2299 [[ -f "${JAVA_PKG_DEPEND_FILE}" ]] \
2462 2554
2463 #TODO If you know a better solution let us know. 2555 #TODO If you know a better solution let us know.
2464 java-pkg_append_ LD_LIBRARY_PATH "$(java-config -g LDPATH)" 2556 java-pkg_append_ LD_LIBRARY_PATH "$(java-config -g LDPATH)"
2465 2557
2466 local tann="${T}/announced-vm" 2558 local tann="${T}/announced-vm"
2559 # With the hooks we should only get here once from pkg_setup but better safe than sorry
2560 # if people have for example modified eclasses some where
2467 if [[ -n "${JAVA_PKG_DEBUG}" ]] || [[ ! -f "${tann}" ]] ; then 2561 if [[ -n "${JAVA_PKG_DEBUG}" ]] || [[ ! -f "${tann}" ]] ; then
2468 # Add a check for setup/preinst phase... to avoid duplicate outputs
2469 # for when FEATURES=buildpkg
2470 if [[ ${EBUILD_PHASE} != "setup" && ${EBUILD_PHASE} != "preinst" && ${EBUILD_PHASE} != "postinst" ]];
2471 then
2472 einfo "Using: $(java-config -f)" 2562 einfo "Using: $(java-config -f)"
2473 [[ ! -f "${tann}" ]] && touch "${tann}" 2563 [[ ! -f "${tann}" ]] && touch "${tann}"
2474 fi
2475 fi 2564 fi
2476 2565
2477 else 2566 else
2478 [[ -n "${JAVA_PKG_DEBUG}" ]] && ewarn "!!! This package inherits java-pkg but doesn't depend on a JDK. -bin or broken dependency!!!" 2567 [[ -n "${JAVA_PKG_DEBUG}" ]] && ewarn "!!! This package inherits java-pkg but doesn't depend on a JDK. -bin or broken dependency!!!"
2479 fi 2568 fi
2518# not. 2607# not.
2519# @param $1 (optional) - the file to check, otherwise checks whole ${D} 2608# @param $1 (optional) - the file to check, otherwise checks whole ${D}
2520# ------------------------------------------------------------------------------ 2609# ------------------------------------------------------------------------------
2521java-pkg_verify-classes() { 2610java-pkg_verify-classes() {
2522 #$(find ${D} -type f -name '*.jar' -o -name '*.class') 2611 #$(find ${D} -type f -name '*.jar' -o -name '*.class')
2612
2613 local version_verify="/usr/bin/class-version-verify.py"
2614
2615 if [[ ! -x "${version_verify}" ]]; then
2616 version_verify="/usr/$(get_libdir)/javatoolkit/bin/class-version-verify.py"
2617 fi
2618
2619 if [[ ! -x "${version_verify}" ]]; then
2620 ewarn "Unable to perform class version checks as"
2621 ewarn "class-version-verify.py is unavailable"
2622 ewarn "Please install dev-java/javatoolkit."
2623 return
2624 fi
2625
2523 local target=$(java-pkg_get-target) 2626 local target=$(java-pkg_get-target)
2524 local result 2627 local result
2525 local log="${T}/class-version-verify.log" 2628 local log="${T}/class-version-verify.log"
2526 if [[ -n "${1}" ]]; then 2629 if [[ -n "${1}" ]]; then
2527 class-version-verify.py -v -t ${target} "${1}" > "${log}" 2630 ${version_verify} -v -t ${target} "${1}" > "${log}"
2528 result=$? 2631 result=$?
2529 else 2632 else
2530 ebegin "Verifying java class versions (target: ${target})" 2633 ebegin "Verifying java class versions (target: ${target})"
2531 class-version-verify.py -v -t ${target} -r "${D}" > "${log}" 2634 ${version_verify} -v -t ${target} -r "${D}" > "${log}"
2532 result=$? 2635 result=$?
2533 eend ${result} 2636 eend ${result}
2534 fi 2637 fi
2535 [[ -n ${JAVA_PKG_DEBUG} ]] && cat "${log}" 2638 [[ -n ${JAVA_PKG_DEBUG} ]] && cat "${log}"
2536 if [[ ${result} != 0 ]]; then 2639 if [[ ${result} != 0 ]]; then
2641is-java-strict() { 2744is-java-strict() {
2642 [[ -n ${JAVA_PKG_STRICT} ]] 2745 [[ -n ${JAVA_PKG_STRICT} ]]
2643 return $? 2746 return $?
2644} 2747}
2645 2748
2749
2646# ------------------------------------------------------------------------------ 2750# ------------------------------------------------------------------------------
2647# @eclass-end 2751# @eclass-end
2648# ------------------------------------------------------------------------------ 2752# ------------------------------------------------------------------------------

Legend:
Removed from v.1.90  
changed lines
  Added in v.1.120

  ViewVC Help
Powered by ViewVC 1.1.20