… | |
… | |
4 | # Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org> |
4 | # Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org> |
5 | # Copyright (c) 2004-2015, Gentoo Foundation |
5 | # Copyright (c) 2004-2015, 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.158 2015/04/14 14:08:34 chewi Exp $ |
9 | # $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.159 2015/04/28 20:35:40 chewi Exp $ |
10 | |
10 | |
11 | # @ECLASS: java-utils-2.eclass |
11 | # @ECLASS: java-utils-2.eclass |
12 | # @MAINTAINER: |
12 | # @MAINTAINER: |
13 | # java@gentoo.org |
13 | # java@gentoo.org |
14 | # @AUTHOR: |
14 | # @AUTHOR: |
… | |
… | |
918 | java-pkg_record-jar_ "${target_pkg}" "${jar}" |
918 | java-pkg_record-jar_ "${target_pkg}" "${jar}" |
919 | else |
919 | else |
920 | java-pkg_record-jar_ --build-only "${target_pkg}" "${jar}" |
920 | java-pkg_record-jar_ --build-only "${target_pkg}" "${jar}" |
921 | fi |
921 | fi |
922 | fi |
922 | fi |
923 | # otherwise, if the current jar is the target jar, link it |
923 | # otherwise, if the current jar is the target jar, link it |
924 | elif [[ "${jar_name}" == "${target_jar}" ]] ; then |
924 | elif [[ "${jar_name}" == "${target_jar}" ]] ; then |
925 | [[ -f "${destjar}" ]] && rm "${destjar}" |
925 | [[ -f "${destjar}" ]] && rm "${destjar}" |
926 | ln -snf "${jar}" "${destjar}" \ |
926 | ln -snf "${jar}" "${destjar}" \ |
927 | || die "Failed to make symlink from ${jar} to ${destjar}" |
927 | || die "Failed to make symlink from ${jar} to ${destjar}" |
928 | if [[ -z "${record_jar}" ]]; then |
928 | if [[ -z "${record_jar}" ]]; then |
929 | if [[ -z "${build_only}" ]]; then |
929 | if [[ -z "${build_only}" ]]; then |
930 | java-pkg_record-jar_ "${target_pkg}" "${jar}" |
930 | java-pkg_record-jar_ "${target_pkg}" "${jar}" |
931 | else |
931 | else |
932 | java-pkg_record-jar_ --build-only "${target_jar}" "${jar}" |
932 | java-pkg_record-jar_ --build-only "${target_pkg}" "${jar}" |
933 | fi |
933 | fi |
934 | fi |
934 | fi |
935 | popd > /dev/null |
935 | popd > /dev/null |
936 | return 0 |
936 | return 0 |
937 | fi |
937 | fi |
… | |
… | |
1782 | # @DESCRIPTION: |
1782 | # @DESCRIPTION: |
1783 | # pkg_preinst Searches for missing and unneeded dependencies |
1783 | # pkg_preinst Searches for missing and unneeded dependencies |
1784 | # Don't call directly, but via java-pkg-2_pkg_preinst! |
1784 | # Don't call directly, but via java-pkg-2_pkg_preinst! |
1785 | java-utils-2_pkg_preinst() { |
1785 | java-utils-2_pkg_preinst() { |
1786 | if is-java-strict; then |
1786 | if is-java-strict; then |
|
|
1787 | if [[ ! -e "${JAVA_PKG_ENV}" ]] || has ant-tasks ${INHERITED}; then |
|
|
1788 | return |
|
|
1789 | fi |
|
|
1790 | |
1787 | if has_version dev-java/java-dep-check; then |
1791 | if has_version dev-java/java-dep-check; then |
1788 | [[ -e "${JAVA_PKG_ENV}" ]] || return |
|
|
1789 | local output=$(GENTOO_VM= java-dep-check --image "${D}" "${JAVA_PKG_ENV}") |
1792 | local output=$(GENTOO_VM= java-dep-check --image "${D}" "${JAVA_PKG_ENV}") |
1790 | if [[ ${output} && has_version <=dev-java/java-dep-check-0.2 ]]; then |
1793 | [[ ${output} ]] && ewarn "${output}" |
1791 | ewarn "Possibly unneeded dependencies found in package.env:" |
|
|
1792 | for dep in ${output}; do |
|
|
1793 | ewarn "\t${dep}" |
|
|
1794 | done |
|
|
1795 | fi |
|
|
1796 | if [[ ${output} && has_version >dev-java/java-dep-check-0.2 ]]; then |
|
|
1797 | ewarn "${output}" |
|
|
1798 | fi |
|
|
1799 | else |
1794 | else |
1800 | eerror "Install dev-java/java-dep-check for dependency checking" |
1795 | eerror "Install dev-java/java-dep-check for dependency checking" |
1801 | fi |
1796 | fi |
1802 | fi |
1797 | fi |
1803 | } |
1798 | } |
… | |
… | |
1907 | local gcp="${EANT_GENTOO_CLASSPATH}" |
1902 | local gcp="${EANT_GENTOO_CLASSPATH}" |
1908 | local getjarsarg="" |
1903 | local getjarsarg="" |
1909 | |
1904 | |
1910 | if [[ ${EBUILD_PHASE} = "test" ]]; then |
1905 | if [[ ${EBUILD_PHASE} = "test" ]]; then |
1911 | antflags="${antflags} -DJunit.present=true" |
1906 | antflags="${antflags} -DJunit.present=true" |
1912 | [[ ${ANT_TASKS} = *ant-junit* ]] && gcp="${gcp} junit" |
|
|
1913 | getjarsarg="--with-dependencies" |
1907 | getjarsarg="--with-dependencies" |
|
|
1908 | |
|
|
1909 | local re="\bant-junit4?([-:]\S+)?\b" |
|
|
1910 | [[ ${ANT_TASKS} =~ ${re} ]] && gcp+=" ${BASH_REMATCH[0]}" |
1914 | else |
1911 | else |
1915 | antflags="${antflags} -Dmaven.test.skip=true" |
1912 | antflags="${antflags} -Dmaven.test.skip=true" |
1916 | fi |
1913 | fi |
1917 | |
1914 | |
1918 | local cp |
1915 | local cp |
… | |
… | |
2671 | |
2668 | |
2672 | # @FUNCTION: java-pkg_ensure-dep |
2669 | # @FUNCTION: java-pkg_ensure-dep |
2673 | # @INTERNAL |
2670 | # @INTERNAL |
2674 | # @DESCRIPTION: |
2671 | # @DESCRIPTION: |
2675 | # Check that a package being used in jarfrom, getjars and getjar is contained |
2672 | # Check that a package being used in jarfrom, getjars and getjar is contained |
2676 | # within DEPEND or RDEPEND. |
2673 | # within DEPEND or RDEPEND with the correct SLOT. See this mail for details: |
|
|
2674 | # https://archives.gentoo.org/gentoo-dev/message/dcb644f89520f4bbb61cc7bbe45fdf6e |
2677 | # @CODE |
2675 | # @CODE |
2678 | # Parameters: |
2676 | # Parameters: |
2679 | # $1 - empty - check both vars; "runtime" or "build" - check only |
2677 | # $1 - empty - check both vars; "runtime" or "build" - check only |
2680 | # RDEPEND, resp. DEPEND |
2678 | # RDEPEND, resp. DEPEND |
2681 | # $2 - Package name and slot. |
2679 | # $2 - Package name and slot. |
… | |
… | |
2693 | # line below? |
2691 | # line below? |
2694 | # |
2692 | # |
2695 | # * The target package first has any dots escaped, e.g. foo-1.2 |
2693 | # * The target package first has any dots escaped, e.g. foo-1.2 |
2696 | # becomes foo-1\.2. |
2694 | # becomes foo-1\.2. |
2697 | # |
2695 | # |
2698 | # * sed then looks at the component following the last - character, |
2696 | # * sed then looks at the component following the last - or : |
2699 | # or the whole string if there is no - character. It uses this to |
2697 | # character, or the whole string if there is no - or : |
2700 | # build a new regexp with two significant branches. |
2698 | # character. It uses this to build a new regexp with two |
|
|
2699 | # significant branches. |
2701 | # |
2700 | # |
2702 | # * The first checks for the whole target package string, optionally |
2701 | # * The first checks for the whole target package string, optionally |
2703 | # followed by a version number, and then :0. |
2702 | # followed by a version number, and then :0. |
2704 | # |
2703 | # |
2705 | # * The second checks for the first part of the target package |
2704 | # * The second checks for the first part of the target package |
2706 | # string, optionally followed by a version number, followed by the |
2705 | # string, optionally followed by a version number, followed by the |
2707 | # aforementioned component, treating that as a SLOT. |
2706 | # aforementioned component, treating that as a SLOT. |
2708 | # |
2707 | # |
2709 | local stripped_pkg=/$(sed -r 's/-?([^-]+)$/(\0(-[^:]+)?:0|(-[^:]+)?:\1)/' <<< "${target_pkg//./\\.}")\\b |
2708 | local stripped_pkg=/$(sed -r 's/[-:]?([^-:]+)$/(\0(-[^:]+)?:0|(-[^:]+)?:\1)/' <<< "${target_pkg//./\\.}")\\b |
2710 | |
2709 | |
2711 | debug-print "Matching against: ${stripped_pkg}" |
2710 | debug-print "Matching against: ${stripped_pkg}" |
|
|
2711 | |
|
|
2712 | # Uncomment the lines below once we've dealt with more of these |
|
|
2713 | # otherwise we'll be tempted to turn JAVA_PKG_STRICT off while |
|
|
2714 | # getting hit with a wave of bug reports. :( |
2712 | |
2715 | |
2713 | if [[ ${limit_to} != runtime && ! ( "${DEPEND}" =~ $stripped_pkg ) ]]; then |
2716 | if [[ ${limit_to} != runtime && ! ( "${DEPEND}" =~ $stripped_pkg ) ]]; then |
2714 | dev_error="The ebuild is attempting to use ${target_pkg}, which is not " |
2717 | dev_error="The ebuild is attempting to use ${target_pkg}, which is not " |
2715 | dev_error+="declared with a SLOT in DEPEND." |
2718 | dev_error+="declared with a SLOT in DEPEND." |
2716 | if is-java-strict; then |
2719 | # if is-java-strict; then |
2717 | die "${dev_error}" |
2720 | # die "${dev_error}" |
2718 | else |
2721 | # else |
2719 | eqawarn "${dev_error}" |
2722 | eqawarn "java-pkg_ensure-dep: ${dev_error}" |
2720 | # Uncomment this once we've dealt with more of these or |
|
|
2721 | # we'll get hit with a wave of bug reports. :( |
|
|
2722 | # eerror "Because you have ${target_pkg} installed," |
2723 | # eerror "Because you have ${target_pkg} installed," |
2723 | # eerror "the package will build without problems, but please" |
2724 | # eerror "the package will build without problems, but please" |
2724 | # eerror "report this to http://bugs.gentoo.org." |
2725 | # eerror "report this to http://bugs.gentoo.org." |
2725 | fi |
2726 | # fi |
2726 | elif [[ ${limit_to} != build && ! ( "${RDEPEND}${PDEPEND}" =~ ${stripped_pkg} ) ]]; then |
2727 | elif [[ ${limit_to} != build && ! ( "${RDEPEND}${PDEPEND}" =~ ${stripped_pkg} ) ]]; then |
2727 | dev_error="The ebuild is attempting to use ${target_pkg}, which is not " |
2728 | dev_error="The ebuild is attempting to use ${target_pkg}, which is not " |
2728 | dev_error+="declared with a SLOT in [RP]DEPEND and --build-only wasn't given." |
2729 | dev_error+="declared with a SLOT in [RP]DEPEND and --build-only wasn't given." |
2729 | if is-java-strict; then |
2730 | # if is-java-strict; then |
2730 | die "${dev_error}" |
2731 | # die "${dev_error}" |
2731 | else |
2732 | # else |
2732 | eqawarn "${dev_error}" |
2733 | eqawarn "java-pkg_ensure-dep: ${dev_error}" |
2733 | # Uncomment this once we've dealt with more of these or |
|
|
2734 | # we'll get hit with a wave of bug reports. :( |
|
|
2735 | # eerror "The package will build without problems, but may fail to run" |
2734 | # eerror "The package will build without problems, but may fail to run" |
2736 | # eerror "if you don't have ${target_pkg} installed," |
2735 | # eerror "if you don't have ${target_pkg} installed," |
2737 | # eerror "so please report this to http://bugs.gentoo.org." |
2736 | # eerror "so please report this to http://bugs.gentoo.org." |
2738 | fi |
2737 | # fi |
2739 | fi |
2738 | fi |
2740 | } |
2739 | } |
2741 | |
2740 | |
2742 | java-pkg_check-phase() { |
2741 | java-pkg_check-phase() { |
2743 | local phase=${1} |
2742 | local phase=${1} |