Bug 61357 - Fix port: java/jakarta-commons-cli
Summary: Fix port: java/jakarta-commons-cli
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: java (show other bugs)
Version: 5.1-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Ernst de Haan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-14 12:00 UTC by Hervé Quiroz
Modified: 2004-04-20 20:50 UTC (History)
0 users

See Also:


Attachments
port-commons-cli-PORTDOCS.diff (4.44 KB, patch)
2004-01-20 14:17 UTC, Hervé Quiroz
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hervé Quiroz 2004-01-14 12:00:26 UTC
Short story: java/jakarta-commons-cli won't build as commons-lang is not in the
classpath and there is a problem with dependency fetching (which I suspect is
related to Ant rather than commons-cli).


Now the long story:

When I tried to upgrade my java/jakarta-commons-cli port I had a build error.
So I tried to build it directly with Ant as a normal user and I get errors
while fetching dependencies. I am able to fetch them using wget so I wonder if
someone already experienced such a problem.

Anyway, here is the output just in case:

> Buildfile: build.xml
>
> init:
> 
> get-deps:
>       [get] Getting: http://www.ibiblio.org/maven/commons-logging/jars/commons-logging-1.0.jar
>       [get] Error getting http://www.ibiblio.org/maven/commons-logging/jars/commons-logging-1.0.jar to /export/andouillette/home/rv/src/commons-cli-1.0/lib/commons-logging-1.0.jar
>       [get] Getting: http://www.ibiblio.org/maven/commons-lang/jars/commons-lang-SNAPSHOT.jar
>       [get] Error getting http://www.ibiblio.org/maven/commons-lang/jars/commons-lang-SNAPSHOT.jar to /export/andouillette/home/rv/src/commons-cli-1.0/lib/commons-lang-SNAPSHOT.jar
>       [get] Getting: http://www.ibiblio.org/maven/junit/jars/junit-3.7.jar
>       [get] Error getting http://www.ibiblio.org/maven/junit/jars/junit-3.7.jar to /export/andouillette/home/rv/src/commons-cli-1.0/lib/junit-3.7.jar
> 
> jar:
> 
> BUILD SUCCESSFUL
> Total time: 1 second

But then I realized that the build is successful as user (using jdk-1.4.2) but
not as root while building the port (using 1.4.2 also).  I've just realized
that the problem comes from my classpath that is set to "all JARs in
${JAVAJARDIR}" as user but not as root. The most important point here being
that building commons-cli requires commons-lang...

Now we've got two way of dealing with it:

 - Install from binary version and set commons-lang as RUN_DEPENDS

 - Build from source but then add commons-lang in BUILD_DEPENDS and
   RUN_DEPENDS and add ${JAVAJARDIR}/commons-lang.jar in the classpath
   while building the port.

 - Build from source but fix the dependency fetching. However IMHO fecthing
   additional dependencies at build time is not good. First because of
   redundancy (in this case JUnit and commons-lang may already be installed as
   a port), and then because with this scheme you cannot build a "distfiles"
   distribution CD-ROM so you can build ports while disconnected from the
   network.

I prefer the first one but I'm not the maintainer. And that would resolve the
Javadoc/pkg-plist issue...

I suspect dependency fetching problems may have something to do with the new
version of Ant (1.6.0)... in which case we should probably send another
different PR to work on this particular issue.

Fix: 

Nothing yet, as we need to know what the opinion of the maintainer. I can
submit a fix in either case however.
How-To-Repeat: 
unset CLASSPATH
cd /usr/ports/java/jakarta-commons-cli
make build
Comment 1 Hervé Quiroz 2004-01-19 13:32:09 UTC
Okay, I have a fix with PORTDOCS macro (for Javadoc issues) and Ant
classpath issues. Unfortunately, I'm too late to submit the patch right
now. I'll commit tomorrow (hopefuly).

Herve
Comment 2 Hervé Quiroz 2004-01-20 14:17:42 UTC
Here is the patch.

What it changes:

  - use the PORTDOCS macro to build dynamically pkg-plist (no more
	Javadoc 1.3/1.4 issues hopefully, and pkg-plist is now one line
	long)
  - define the ANT_INCLUDE_SHARED_JARS variable so Ant now correctly
	gets JARs from ${JAVAJARDIR}

No need for a binary port after all.

Herve
Comment 3 Greg Lewis freebsd_committer freebsd_triage 2004-01-20 17:44:24 UTC
Responsible Changed
From-To: freebsd-java->znerd

Over to maintainer.
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2004-04-04 19:42:04 UTC
State Changed
From-To: open->feedback

Does the maintainer approve of the changes in this PR?
Comment 5 Ernst de Haan freebsd_committer freebsd_triage 2004-04-15 22:14:01 UTC
State Changed
From-To: feedback->closed

Committed, thanks!
Comment 6 Oliver Eikemeier 2004-04-16 03:40:42 UTC
PORTDOCS must be relative to DOCSDIR.

-Oliver
Comment 7 Hervé Quiroz 2004-04-16 08:03:33 UTC
On Fri, Apr 16, 2004 at 04:40:42AM +0200, Oliver Eikemeier wrote:
> PORTDOCS must be relative to DOCSDIR.
> 
> -Oliver

Indeed.

Here is a patch:

- Fix PORTDOCS
- bsd.java.mk 2.0 compliant
- Removed pkg-plist
- Done some cleanning (PLIST_SUB statement)

Herve


diff -ur jakarta-commons-cli.original/Makefile jakarta-commons-cli/Makefile
--- jakarta-commons-cli.original/Makefile	Fri Apr 16 08:50:05 2004
+++ jakarta-commons-cli/Makefile	Fri Apr 16 08:56:10 2004
@@ -20,10 +20,10 @@
 BUILD_DEPENDS=	${ANT}:${PORTSDIR}/devel/apache-ant \
 		${LOCALBASE}/share/java/classes/commons-lang.jar:${PORTSDIR}/java/jakarta-commons-lang
 
-USE_JAVA=	1.2+
+USE_JAVA=	yes
+JAVA_VERSION=	1.2+
 WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}
 
-PLIST_SUB+=	T=${TARGET_DIR:S/^${PREFIX}\///}
 ANT?=		${LOCALBASE}/bin/ant
 .if defined(NOPORTDOCS)
 ANT_TARGET=	jar -Dnoget
@@ -34,9 +34,10 @@
 JARDIR=		${JAVASHAREDIR}/classes
 JARFILE=	${PORTNAME}-${PORTVERSION}-beta-2-dev.jar
 DESTJARFILE=	${PORTNAME}.jar
+PLIST_FILES+=   ${JAVAJARDIR:S,^${PREFIX}/,,}/${DESTJARFILE}
 
 .if !defined(NOPORTDOCS)
-PORTDOCS=	${WRKSRC}/target/docs/apidocs
+PORTDOCS=	apidocs LICENSE.txt
 .endif
 
 do-build:
@@ -51,7 +52,8 @@
 .if !defined(NOPORTDOCS)
 	@${ECHO} -n ">> Installing documentation in ${DOCSDIR}..."
 	@${MKDIR} ${DOCSDIR}
-	@${CP} -r ${WRKSRC}/target/docs/apidocs/* ${DOCSDIR}
+	@${CP} -r ${WRKSRC}/target/docs/apidocs ${DOCSDIR}/
+	@${CP} -r ${WRKSRC}/LICENSE.txt ${DOCSDIR}/
 	@${ECHO} " [ DONE ]"
 .endif
 
Only in jakarta-commons-cli.original: pkg-plist
Comment 8 Ernst de Haan freebsd_committer freebsd_triage 2004-04-16 10:00:41 UTC
State Changed
From-To: closed->open

Re-opened.
Comment 9 Ernst de Haan freebsd_committer freebsd_triage 2004-04-20 20:47:48 UTC
State Changed
From-To: open->closed

Committed, thanks!