/[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.76 Revision 1.77
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.76 2007/04/20 16:17:49 caster Exp $ 9# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.77 2007/04/24 10:26:33 caster Exp $
10 10
11 11
12# ----------------------------------------------------------------------------- 12# -----------------------------------------------------------------------------
13# @eclass-begin 13# @eclass-begin
14# @eclass-shortdesc Java Utility eclass 14# @eclass-shortdesc Java Utility eclass
849 849
850 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="true" 850 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="true"
851 851
852 while [[ "${1}" == --* ]]; do 852 while [[ "${1}" == --* ]]; do
853 if [[ "${1}" = "--build-only" ]]; then 853 if [[ "${1}" = "--build-only" ]]; then
854 build_only="true" 854 build_only="build"
855 elif [[ "${1}" = "--with-dependencies" ]]; then 855 elif [[ "${1}" = "--with-dependencies" ]]; then
856 deep="--with-dependencies" 856 deep="--with-dependencies"
857 elif [[ "${1}" = "--into" ]]; then 857 elif [[ "${1}" = "--into" ]]; then
858 destdir="${2}" 858 destdir="${2}"
859 shift 859 shift
961 961
962 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="true" 962 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="true"
963 963
964 while [[ "${1}" == --* ]]; do 964 while [[ "${1}" == --* ]]; do
965 if [[ "${1}" = "--build-only" ]]; then 965 if [[ "${1}" = "--build-only" ]]; then
966 build_only="true" 966 build_only="build"
967 elif [[ "${1}" = "--with-dependencies" ]]; then 967 elif [[ "${1}" = "--with-dependencies" ]]; then
968 deep="--with-dependencies" 968 deep="--with-dependencies"
969 else 969 else
970 die "java-pkg_jar-from called with unknown parameter: ${1}" 970 die "java-pkg_jar-from called with unknown parameter: ${1}"
971 fi 971 fi
1029 1029
1030 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="true" 1030 [[ "${EBUILD_PHASE}" == "test" ]] && build_only="true"
1031 1031
1032 while [[ "${1}" == --* ]]; do 1032 while [[ "${1}" == --* ]]; do
1033 if [[ "${1}" = "--build-only" ]]; then 1033 if [[ "${1}" = "--build-only" ]]; then
1034 build_only="true" 1034 build_only="build"
1035 else 1035 else
1036 die "java-pkg_jar-from called with unknown parameter: ${1}" 1036 die "java-pkg_jar-from called with unknown parameter: ${1}"
1037 fi 1037 fi
1038 shift 1038 shift
1039 done 1039 done
1064 fi 1064 fi
1065 done 1065 done
1066 1066
1067 die "Could not find ${target_jar} in ${pkg}" 1067 die "Could not find ${target_jar} in ${pkg}"
1068 return 1 1068 return 1
1069}
1070
1071# ------------------------------------------------------------------------------
1072# @ebuild-function java-pkg_register-dependency
1073#
1074# Registers runtime dependency on a package, list of packages, or a single jar
1075# from a package, into package.env DEPEND line. Can only be called in
1076# src_install phase.
1077# Intended for binary packages where you don't need to symlink the jars or get
1078# their classpath during build. As such, the dependencies only need to be
1079# specified in ebuild's RDEPEND, and should be omitted in DEPEND.
1080# Get the classpath provided by any number of packages.
1081#
1082# @param $1 - comma-separated list of packages, or a single package
1083# @param $2 - if param $1 is a single package, optionally specify the jar
1084# to depend on
1085#
1086# Example: Record the dependency on whole xerces-2 and xalan,
1087# java-pkg_register-dependency xerces-2,xalan
1088# Example: Record the dependency on ant.jar from ant-core
1089# java-pkg_register-dependency ant-core ant.jar
1090#
1091# Note: Passing both list of packages as the first parameter AND specifying the
1092# jar as the second is not allowed and will cause the function to die. We assume
1093# that there's more chance one passes such combination as a mistake, than that
1094# there are more packages providing identically named jar without class
1095# collisions.
1096# ------------------------------------------------------------------------------
1097java-pkg_register-dependency() {
1098 debug-print-function ${FUNCNAME} $*
1099
1100 java-pkg_check-phase install
1101
1102 [[ ${#} -gt 2 ]] && die "${FUNCNAME} takes at most two arguments"
1103
1104 local pkgs="${1}"
1105 local jar="${2}"
1106
1107 [[ -z "${pkgs}" ]] && die "${FUNCNAME} called with no package(s) specified"
1108
1109 if [[ -z "${jar}" ]]; then
1110 for pkg in ${pkgs//,/ }; do
1111 java-pkg_ensure-dep runtime "${pkg}"
1112 java-pkg_record-jar_ "${pkg}"
1113 done
1114 else
1115 [[ ${pkgs} == *,* ]] && \
1116 die "${FUNCNAME} called with both package list and jar name"
1117 java-pkg_ensure-dep runtime "${pkgs}"
1118 java-pkg_record-jar_ "${pkgs}" "${jar}"
1119 fi
1120
1121 java-pkg_do_write_
1069} 1122}
1070 1123
1071# This function reads stdin, and based on that input, figures out how to 1124# This function reads stdin, and based on that input, figures out how to
1072# populate jars from the filesystem. 1125# populate jars from the filesystem.
1073# Need to figure out a good way of making use of this, ie be able to use a 1126# Need to figure out a good way of making use of this, ie be able to use a
2358 2411
2359# ---------------------------------------------------------------------------- 2412# ----------------------------------------------------------------------------
2360# @internal-function java-pkg_ensure-dep 2413# @internal-function java-pkg_ensure-dep
2361# Check that a package being used in jarfrom, getjars and getjar is contained 2414# Check that a package being used in jarfrom, getjars and getjar is contained
2362# within DEPEND or RDEPEND. 2415# within DEPEND or RDEPEND.
2363# @param $1 - Is the package a runtime dependency 2416# @param $1 - empty - check both vars; "runtime" or "build" - check only
2417# RDEPEND, resp. DEPEND
2364# @param $2 - Package name and slot. 2418# @param $2 - Package name and slot.
2365
2366java-pkg_ensure-dep() { 2419java-pkg_ensure-dep() {
2367 debug-print-function ${FUNCNAME} $* 2420 debug-print-function ${FUNCNAME} $*
2368 2421
2369 local build_only="${1}" 2422 local limit_to="${1}"
2370 local target_pkg="${2}" 2423 local target_pkg="${2}"
2371 local dev_error="" 2424 local dev_error=""
2372 2425
2373 local stripped_pkg=$(echo "${target_pkg}" | sed \ 2426 local stripped_pkg=$(echo "${target_pkg}" | sed \
2374 's/-[0-9]*\(\.[0-9]\)*$//') 2427 's/-[0-9]*\(\.[0-9]\)*$//')
2375 2428
2376 if [[ ! ( "${DEPEND}" =~ "$stripped_pkg" ) ]]; then 2429 if [[ ${limit_to} != runtime && ! ( "${DEPEND}" =~ "$stripped_pkg" ) ]]; then
2377 dev_error="The ebuild is attempting to use ${target_pkg} that is not" 2430 dev_error="The ebuild is attempting to use ${target_pkg} that is not"
2378 dev_error="${dev_error} declared in DEPEND." 2431 dev_error="${dev_error} declared in DEPEND."
2379 if is-java-strict; then 2432 if is-java-strict; then
2380 die "${dev_error}" 2433 die "${dev_error}"
2381 elif [[ ${BASH_SUBSHELL} = 0 ]]; then 2434 elif [[ ${BASH_SUBSHELL} = 0 ]]; then
2384 elog "build without problems, but please report this to" 2437 elog "build without problems, but please report this to"
2385 elog "http://bugs.gentoo.org" 2438 elog "http://bugs.gentoo.org"
2386 fi 2439 fi
2387 fi 2440 fi
2388 2441
2389 if [[ -z ${build_only} && ! ( ${RDEPEND} =~ "${stripped_pkg}" ) ]]; then 2442 if [[ ${limit_to} != build && ! ( ${RDEPEND} =~ "${stripped_pkg}" ) ]]; then
2390 dev_error="The ebuild is attempting to use ${target_pkg}," 2443 dev_error="The ebuild is attempting to use ${target_pkg},"
2391 dev_error="${dev_error} without specifying --build-only, that is not declared in RDEPEND." 2444 dev_error="${dev_error} without specifying --build-only, that is not declared in RDEPEND."
2392 if is-java-strict; then 2445 if is-java-strict; then
2393 die "${dev_error}" 2446 die "${dev_error}"
2394 elif [[ ${BASH_SUBSHELL} = 0 ]]; then 2447 elif [[ ${BASH_SUBSHELL} = 0 ]]; then
2395 eerror "${dev_error}" 2448 eerror "${dev_error}"
2396 elog "Because you have this package installed the package will" 2449 elog "The package will build without problems, but may fail to run"
2397 elog "build without problems, but please report this to" 2450 elog "if you don't have ${target_pkg} installed, so please report"
2398 elog "http://bugs.gentoo.org" 2451 elog "this to http://bugs.gentoo.org"
2399 fi 2452 fi
2400 fi 2453 fi
2401} 2454}
2402 2455
2403# ------------------------------------------------------------------------------ 2456# ------------------------------------------------------------------------------

Legend:
Removed from v.1.76  
changed lines
  Added in v.1.77

  ViewVC Help
Powered by ViewVC 1.1.20