/[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.128 Revision 1.129
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.128 2009/06/02 07:02:01 ali_bush Exp $ 9# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.129 2009/06/07 08:22:42 ali_bush 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
872 872
873 local build_only="" 873 local build_only=""
874 local destdir="." 874 local destdir="."
875 local deep="" 875 local deep=""
876 local virtual="" 876 local virtual=""
877 local record_jar=""
877 878
878 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build" 879 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build"
879 880
880 while [[ "${1}" == --* ]]; do 881 while [[ "${1}" == --* ]]; do
881 if [[ "${1}" = "--build-only" ]]; then 882 if [[ "${1}" = "--build-only" ]]; then
916 for pkg in ${target_pkg//,/ }; do 917 for pkg in ${target_pkg//,/ }; do
917 java-pkg_ensure-dep "${build_only}" "${pkg}" 918 java-pkg_ensure-dep "${build_only}" "${pkg}"
918 [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${pkg}" 919 [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${pkg}"
919 done 920 done
920 # setting this disables further record-jar_ calls later 921 # setting this disables further record-jar_ calls later
921 build_only="build" 922 record_jar="true"
922 else 923 else
923 java-pkg_ensure-dep "${build_only}" "${target_pkg}" 924 java-pkg_ensure-dep "${build_only}" "${target_pkg}"
924 fi 925 fi
925 926
926 # Record the entire virtual as a dependency so that 927 # Record the entire virtual as a dependency so that
927 # no jars are missed. 928 # no jars are missed.
928 if [[ -z "${build_only}" && -n "${virtual}" ]]; then 929 if [[ -z "${build_only}" && -n "${virtual}" ]]; then
929 java-pkg_record-jar_ "${target_pkg}" 930 java-pkg_record-jar_ "${target_pkg}"
930 # setting this disables further record-jars_ calls later 931 # setting this disables further record-jars_ calls later
931 build_only="build" 932 record_jar="true"
932 fi 933 fi
933 934
934 pushd ${destdir} > /dev/null \ 935 pushd ${destdir} > /dev/null \
935 || die "failed to change directory to ${destdir}" 936 || die "failed to change directory to ${destdir}"
936 937
944 # If no specific target jar was indicated, link it 945 # If no specific target jar was indicated, link it
945 if [[ -z "${target_jar}" ]] ; then 946 if [[ -z "${target_jar}" ]] ; then
946 [[ -f "${target_jar}" ]] && rm "${target_jar}" 947 [[ -f "${target_jar}" ]] && rm "${target_jar}"
947 ln -snf "${jar}" \ 948 ln -snf "${jar}" \
948 || die "Failed to make symlink from ${jar} to ${jar_name}" 949 || die "Failed to make symlink from ${jar} to ${jar_name}"
950 if [[ -z "${record_jar}" ]]; then
951 if [[ -z "${build_only}" ]]; then
949 [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${target_pkg}" "${jar}" 952 java-pkg_record-jar_ "${target_pkg}" "${jar}"
953 else
954 java-pkg_record-jar_ --build-only "${target_pkg}" "${jar}"
955 fi
956 fi
950 # otherwise, if the current jar is the target jar, link it 957 # otherwise, if the current jar is the target jar, link it
951 elif [[ "${jar_name}" == "${target_jar}" ]] ; then 958 elif [[ "${jar_name}" == "${target_jar}" ]] ; then
952 [[ -f "${destjar}" ]] && rm "${destjar}" 959 [[ -f "${destjar}" ]] && rm "${destjar}"
953 ln -snf "${jar}" "${destjar}" \ 960 ln -snf "${jar}" "${destjar}" \
954 || die "Failed to make symlink from ${jar} to ${destjar}" 961 || die "Failed to make symlink from ${jar} to ${destjar}"
962 if [[ -z "${record_jar}" ]]; then
963 if [[ -z "${build_only}" ]]; then
955 [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${target_pkg}" "${jar}" 964 java-pkg_record-jar_ "${target_pkg}" "${jar}"
965 else
966 java-pkg_record-jar_ --build-only "${target_jar}" "${jar}"
967 fi
968 fi
956 popd > /dev/null 969 popd > /dev/null
957 return 0 970 return 0
958 fi 971 fi
959 done 972 done
960 popd > /dev/null 973 popd > /dev/null
1033 1046
1034 for pkg in ${pkgs//,/ }; do 1047 for pkg in ${pkgs//,/ }; do
1035 java-pkg_ensure-dep "${build_only}" "${pkg}" 1048 java-pkg_ensure-dep "${build_only}" "${pkg}"
1036 done 1049 done
1037 1050
1038 # Only record jars that aren't build-only 1051 for pkg in ${pkgs//,/ }; do
1039 if [[ -z "${build_only}" ]]; then 1052 if [[ -z "${build_only}" ]]; then
1040 for pkg in ${pkgs//,/ }; do
1041 java-pkg_record-jar_ "${pkg}" 1053 java-pkg_record-jar_ "${pkg}"
1054 else
1055 java-pkg_record-jar_ --build-only "${pkg}"
1056 fi
1042 done 1057 done
1043 fi
1044 1058
1045 echo "${jars}" 1059 echo "${jars}"
1046} 1060}
1047 1061
1048# ------------------------------------------------------------------------------ 1062# ------------------------------------------------------------------------------
1069java-pkg_getjar() { 1083java-pkg_getjar() {
1070 debug-print-function ${FUNCNAME} $* 1084 debug-print-function ${FUNCNAME} $*
1071 1085
1072 local build_only="" 1086 local build_only=""
1073 local virtual="" 1087 local virtual=""
1088 local record_jar=""
1074 1089
1075 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build" 1090 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="build"
1076 1091
1077 while [[ "${1}" == --* ]]; do 1092 while [[ "${1}" == --* ]]; do
1078 if [[ "${1}" = "--build-only" ]]; then 1093 if [[ "${1}" = "--build-only" ]]; then
1104 java-pkg_ensure-dep "${build_only}" "${pkg}" 1119 java-pkg_ensure-dep "${build_only}" "${pkg}"
1105 1120
1106 # Record the package(Virtual) as a dependency and then set build_only 1121 # Record the package(Virtual) as a dependency and then set build_only
1107 # So that individual jars are not recorded. 1122 # So that individual jars are not recorded.
1108 if [[ -n "${virtual}" ]]; then 1123 if [[ -n "${virtual}" ]]; then
1124 if [[ -z "${build_only}" ]]; then
1109 java-pkg_record-jar_ "${pkg}" 1125 java-pkg_record-jar_ "${pkg}"
1110 build_only="true" 1126 else
1127 java-pkg_record-jar_ --build-only "${pkg}"
1128 fi
1129 record_jar="true"
1111 fi 1130 fi
1112 1131
1113 for jar in ${classpath//:/ }; do 1132 for jar in ${classpath//:/ }; do
1114 if [[ ! -f "${jar}" ]] ; then 1133 if [[ ! -f "${jar}" ]] ; then
1115 die "Installation problem with jar ${jar} in ${pkg} - is it installed?" 1134 die "Installation problem with jar ${jar} in ${pkg} - is it installed?"
1116 fi 1135 fi
1117 1136
1118 if [[ "$(basename ${jar})" == "${target_jar}" ]] ; then 1137 if [[ "$(basename ${jar})" == "${target_jar}" ]] ; then
1119 # Only record jars that aren't build-only 1138 # Only record jars that aren't build-only
1120 [[ -z "${build_only}" ]] && java-pkg_record-jar_ "${pkg}" "${jar}" 1139 if [[ -z "${record_jar}" ]]; then
1140 if [[ -z "${build_only}" ]]; then
1141 java-pkg_record-jar_ "${pkg}" "${jar}"
1142 else
1143 java-pkg_record-jar_ --build-only "${pkg}" "${jar}"
1144 fi
1145 fi
1121 echo "${jar}" 1146 echo "${jar}"
1122 return 0 1147 return 0
1123 fi 1148 fi
1124 done 1149 done
1125 1150
2241 # Create package.env 2266 # Create package.env
2242 ( 2267 (
2243 echo "DESCRIPTION=\"${DESCRIPTION}\"" 2268 echo "DESCRIPTION=\"${DESCRIPTION}\""
2244 echo "GENERATION=\"2\"" 2269 echo "GENERATION=\"2\""
2245 echo "SLOT=\"${SLOT}\"" 2270 echo "SLOT=\"${SLOT}\""
2271 echo "CATEGORY=\"${CATEGORY}\""
2272 echo "PVR=\"${PVR}\""
2246 2273
2247 [[ -n "${JAVA_PKG_CLASSPATH}" ]] && echo "CLASSPATH=\"${JAVA_PKG_CLASSPATH}\"" 2274 [[ -n "${JAVA_PKG_CLASSPATH}" ]] && echo "CLASSPATH=\"${JAVA_PKG_CLASSPATH}\""
2248 [[ -n "${JAVA_PKG_LIBRARY}" ]] && echo "LIBRARY_PATH=\"${JAVA_PKG_LIBRARY}\"" 2275 [[ -n "${JAVA_PKG_LIBRARY}" ]] && echo "LIBRARY_PATH=\"${JAVA_PKG_LIBRARY}\""
2249 [[ -n "${JAVA_PROVIDE}" ]] && echo "PROVIDES=\"${JAVA_PROVIDE}\"" 2276 [[ -n "${JAVA_PROVIDE}" ]] && echo "PROVIDES=\"${JAVA_PROVIDE}\""
2250 [[ -f "${JAVA_PKG_DEPEND_FILE}" ]] \ 2277 [[ -f "${JAVA_PKG_DEPEND_FILE}" ]] \
2251 && echo "DEPEND=\"$(cat "${JAVA_PKG_DEPEND_FILE}" | uniq | tr '\n' ':')\"" 2278 && echo "DEPEND=\"$(cat "${JAVA_PKG_DEPEND_FILE}" | uniq | tr '\n' ':')\""
2252 [[ -f "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" ]] \ 2279 [[ -f "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" ]] \
2253 && echo "OPTIONAL_DEPEND=\"$(cat "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" | uniq | tr '\n' ':')\"" 2280 && echo "OPTIONAL_DEPEND=\"$(cat "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" | uniq | tr '\n' ':')\""
2254 echo "VM=\"$(echo ${RDEPEND} ${DEPEND} | sed -e 's/ /\n/g' | sed -n -e '/virtual\/\(jre\|jdk\)/ { p;q }')\"" # TODO cleanup ! 2281 echo "VM=\"$(echo ${RDEPEND} ${DEPEND} | sed -e 's/ /\n/g' | sed -n -e '/virtual\/\(jre\|jdk\)/ { p;q }')\"" # TODO cleanup !
2282 [[ -f "${JAVA_PKG_BUILD_DEPEND_FILE}" ]] \
2283 && echo "BUILD_DEPEND=\"$(cat "${JAVA_PKG_BUILD_DEPEND_FILE}" | uniq | tr '\n' ':')\""
2255 ) > "${JAVA_PKG_ENV}" 2284 ) > "${JAVA_PKG_ENV}"
2256 2285
2257 # register target/source 2286 # register target/source
2258 local target="$(java-pkg_get-target)" 2287 local target="$(java-pkg_get-target)"
2259 local source="$(java-pkg_get-source)" 2288 local source="$(java-pkg_get-source)"
2292# ------------------------------------------------------------------------------ 2321# ------------------------------------------------------------------------------
2293# @internal-function java-pkg_record-jar_ 2322# @internal-function java-pkg_record-jar_
2294# 2323#
2295# Record an (optional) dependency to the package.env 2324# Record an (optional) dependency to the package.env
2296# @param --optional - record dependency as optional 2325# @param --optional - record dependency as optional
2326# @param --build - record dependency as build_only
2297# @param $1 - package to record 2327# @param $1 - package to record
2298# @param $2 - (optional) jar of package to record 2328# @param $2 - (optional) jar of package to record
2299# ------------------------------------------------------------------------------ 2329# ------------------------------------------------------------------------------
2300JAVA_PKG_DEPEND_FILE="${T}/java-pkg-depend" 2330JAVA_PKG_DEPEND_FILE="${T}/java-pkg-depend"
2301JAVA_PKG_OPTIONAL_DEPEND_FILE="${T}/java-pkg-optional-depend" 2331JAVA_PKG_OPTIONAL_DEPEND_FILE="${T}/java-pkg-optional-depend"
2332JAVA_PKG_BUILD_DEPEND_FILE="${T}/java-pkg-build-depend"
2302 2333
2303java-pkg_record-jar_() { 2334java-pkg_record-jar_() {
2304 debug-print-function ${FUNCNAME} $* 2335 debug-print-function ${FUNCNAME} $*
2305 2336
2306 local depend_file="${JAVA_PKG_DEPEND_FILE}" 2337 local depend_file="${JAVA_PKG_DEPEND_FILE}"
2307 if [[ "${1}" == "--optional" ]]; then 2338 case "${1}" in
2308 depend_file="${JAVA_PKG_OPTIONAL_DEPEND_FILE}" 2339 "--optional") depend_file="${JAVA_PKG_OPTIONAL_DEPEND_FILE}"; shift;;
2309 shift 2340 "--build-only") depend_file="${JAVA_PKG_BUILD_DEPEND_FILE}"; shift;;
2310 fi 2341 esac
2311 2342
2312 local pkg=${1} jar=${2} append 2343 local pkg=${1} jar=${2} append
2313 if [[ -z "${jar}" ]]; then 2344 if [[ -z "${jar}" ]]; then
2314 append="${pkg}" 2345 append="${pkg}"
2315 else 2346 else

Legend:
Removed from v.1.128  
changed lines
  Added in v.1.129

  ViewVC Help
Powered by ViewVC 1.1.20