Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 306425 - Review Prefix modifications for dev-java/ant-core
Summary: Review Prefix modifications for dev-java/ant-core
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-22 20:09 UTC by Fabian Groffen
Modified: 2010-02-28 15:27 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabian Groffen gentoo-dev 2010-02-22 20:09:06 UTC
dev-java/ant-core needs some changes for Prefix.  Please review.  Suggested changes are meant to be made to a revbumped version of said ebuilds and files.

First, the files/1.7.1-ant-r1 file needs modifications to make it Prefix aware, and to make it work with Apple's versions of the Sun Java JDK/SDK.  The 1.8.0 file has a similar patch: http://overlays.gentoo.org/proj/alt/browser/trunk/prefix-overlay/dev-java/ant-core/files/ant-core-1.8.0-ant.patch?rev=57115

--- files/1.7.1-ant-r1
+++ files/1.7.1-ant-r1
@@ -1,4 +1,4 @@
-#! /bin/bash
+#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
 
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
@@ -18,6 +18,8 @@
 #   Edited for Gentoo Linux
 #   $Header: /var/cvsroot/gentoo-x86/dev-java/ant-core/files/1.7.1-ant-r1,v 1.1 2008/11/09 00:19:14 caster Exp $
 
+EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
+
 # Extract launch and ant arguments, (see details below).
 ant_exec_args=
 no_config=false
@@ -48,9 +50,9 @@
   usejikes=$use_jikes_default
 else
   # load system-wide ant configuration (ONLY if ANT_HOME has NOT been set)
-  if [ -z "$ANT_HOME" -o "$ANT_HOME" = "/usr/share/ant" ]; then
-      if [ -f "/etc/ant.conf" ] ; then
-          . /etc/ant.conf
+  if [ -z "$ANT_HOME" -o "$ANT_HOME" = "${EPREFIX}/usr/share/ant" ]; then
+      if [ -f "${EPREFIX}/etc/ant.conf" ] ; then
+          . "${EPREFIX}"/etc/ant.conf
       fi
   fi
 
@@ -86,7 +88,7 @@
   exit 1
 fi
 
-ANT_HOME=/usr/share/ant-core
+ANT_HOME="${EPREFIX}"/usr/share/ant-core
 
 # set ANT_LIB location
 ANT_LIB="${ANT_HOME}/lib"
@@ -121,11 +123,11 @@
 if [[ "${ANT_TASKS}" == "all" ]]; then
        ANT_TASKS=""
        # but only if it exists
-       if [[ -d /usr/share/ant/tasks ]]; then
-               ANT_TASKS="${ANT_TASKS} "/usr/share/ant/tasks/*
+       if [[ -d "${EPREFIX}"/usr/share/ant/tasks ]]; then
+               ANT_TASKS="${ANT_TASKS} ${EPREFIX}"/usr/share/ant/tasks/*
        fi
-       if [[ -d /usr/share/ant/tasks-1.7.1 ]]; then
-               ANT_TASKS="${ANT_TASKS} "/usr/share/ant/tasks-1.7.1/*
+       if [[ -d "${EPREFIX}"/usr/share/ant/tasks-1.7.1 ]]; then
+               ANT_TASKS="${ANT_TASKS} ${EPREFIX}"/usr/share/ant/tasks-1.7.1/*
        fi
 # if set to "none", make ANT_TASKS empty list
 elif [[ "${ANT_TASKS}" == "none" ]]; then
@@ -158,7 +160,7 @@
 
 if [[ -n "${TOOLS_JAR}" ]] ; then
   LOCALCLASSPATH="$LOCALCLASSPATH:${TOOLS_JAR}"
-else
+elif [[ $(java-config -f) != apple-jdk-bin* ]] ; then
   echo "Warning: Unable to determine tools.jar location."
   echo "  If build fails because sun.* classes could not be found,"
   echo "  Make sure you are using a JDK, not JRE as your user/system VM."

The changes require eprefixify to be run over the file, which results in most modifications necessary to the ebuild:

--- ant-core-1.7.1-r4.ebuild
+++ ant-core-1.7.1-r4.ebuild
@@ -2,14 +2,14 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Header: /var/cvsroot/gentoo-x86/dev-java/ant-core/ant-core-1.7.1-r4.ebuild,v 1.5 2009/07/04 14:26:21 ranger Exp $
 
-EAPI="2"
+EAPI=3
 
 # don't depend on itself
 JAVA_ANT_DISABLE_ANT_CORE_DEP=true
 # rewriting build.xml files for the testcases has no reason atm
 JAVA_PKG_BSFIX_ALL=no
 JAVA_PKG_IUSE="doc source"
-inherit java-pkg-2 java-ant-2
+inherit java-pkg-2 java-ant-2 eutils prefix
 
 MY_P="apache-ant-${PV}"
 
@@ -31,6 +31,10 @@
 S="${WORKDIR}/${MY_P}"
 
 src_prepare() {
+       epatch "${FILESDIR}"/${PN}-1.7.0-prefix.patch
+       cp "${FILESDIR}/${PV}-ant-r1" "${S}"/ || die "failed to copy wrapper"
+       eprefixify "${S}"/${PV}-ant-r1
+
        # remove bundled xerces
        rm -v lib/*.jar || die
 
@@ -69,7 +73,8 @@
                dosym /usr/share/${PN}/lib/${jar} /usr/share/ant/lib/${jar}
        done
 
-       newbin "${FILESDIR}/${PV}-ant-r1" ant || die "failed to install wrapper"
+       newbin "${S}/${PV}-ant-r1" ant || die "failed to install wrapper"
+
        dodir /usr/share/${PN}/bin
        for each in antRun runant.pl runant.py complete-ant-cmd.pl ; do
                dobin "${S}/src/script/${each}"
@@ -81,7 +86,7 @@
        doins -r dist/etc
        dosym /usr/share/${PN}/etc /usr/share/ant/etc
 
-       echo "ANT_HOME=\"/usr/share/ant\"" > "${T}/20ant"
+       echo "ANT_HOME=\"${EPREFIX}/usr/share/ant\"" > "${T}/20ant"
        doenvd "${T}/20ant" || die "failed to install env.d file"
 
        dodoc README WHATSNEW KEYS

The 1.8.0 ebuild has slightly less modifications due to the ant file already being in a modifyable place.

--- ant-core-1.8.0.ebuild
+++ ant-core-1.8.0.ebuild
@@ -2,14 +2,14 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Header: /var/cvsroot/gentoo-x86/dev-java/ant-core/ant-core-1.8.0.ebuild,v 1.1 2010/02/21 00:34:34 caster Exp $
 
-EAPI="2"
+EAPI="3"
 
 # don't depend on itself
 JAVA_ANT_DISABLE_ANT_CORE_DEP=true
 # rewriting build.xml files for the testcases has no reason atm
 JAVA_PKG_BSFIX_ALL=no
 JAVA_PKG_IUSE="doc source"
-inherit java-pkg-2 java-ant-2
+inherit java-pkg-2 java-ant-2 eutils prefix
 
 MY_P="apache-ant-${PV}"
 
@@ -31,6 +31,12 @@
 S="${WORKDIR}/${MY_P}"
 
 src_prepare() {
+       epatch "${FILESDIR}"/${PN}-1.7.0-prefix.patch
+       pushd "${WORKDIR}" > /dev/null
+       epatch "${FILESDIR}"/${P}-ant.patch
+       eprefixify ant
+       popd > /dev/null
+
        # remove bundled xerces
        rm -v lib/*.jar || die
 
@@ -78,7 +84,7 @@
        doins -r dist/etc
        dosym /usr/share/${PN}/etc /usr/share/ant/etc
 
-       echo "ANT_HOME=\"/usr/share/ant\"" > "${T}/20ant"
+       echo "ANT_HOME=\"${EPREFIX}/usr/share/ant\"" > "${T}/20ant"
        doenvd "${T}/20ant" || die "failed to install env.d file"
 
        dodoc NOTICE README WHATSNEW KEYS || die

Last but not least, the 1.7.0-prefix patch can be found here: http://overlays.gentoo.org/proj/alt/browser/trunk/prefix-overlay/dev-java/ant-core/files/ant-core-1.7.0-prefix.patch?rev=57115
Comment 1 Petteri Räty (RETIRED) gentoo-dev 2010-02-24 00:07:11 UTC
Shouldn't eprexify work with ../ant etc so that the pushd / popd isn't needed?
Comment 2 Fabian Groffen gentoo-dev 2010-02-24 07:21:48 UTC
Yeah, but epatch doesn't.  If that one goes "upstream", the popd/pushd isn't necessary as you pointed out.
Comment 3 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2010-02-28 14:38:29 UTC
Bumped 1.7.1-r5 and 1.8.0-r1, including prefix KEYWORDS from the overlay.
Comment 4 Fabian Groffen gentoo-dev 2010-02-28 15:27:09 UTC
it looks pretty good, thanks!