[pkg-java] r13503 - in trunk/java-wrappers: . debian

Vincent Fourmond fourmond at alioth.debian.org
Mon Apr 4 18:35:35 UTC 2011


Author: fourmond
Date: 2011-04-04 18:35:33 +0000 (Mon, 04 Apr 2011)
New Revision: 13503

Modified:
   trunk/java-wrappers/debian/changelog
   trunk/java-wrappers/java-wrappers.sh
Log:
[java-wrappers] Finalize the form of find_jar_classpath

Modified: trunk/java-wrappers/debian/changelog
===================================================================
--- trunk/java-wrappers/debian/changelog	2011-04-04 15:26:31 UTC (rev 13502)
+++ trunk/java-wrappers/debian/changelog	2011-04-04 18:35:33 UTC (rev 13503)
@@ -1,3 +1,11 @@
+java-wrappers (0.1.21) experimental; urgency=low
+
+  * Final form of the find_jar_classpath function that now only performs
+    path expansion for the argument, but not for the elements found in the
+    manifests that should be full paths anyway.
+
+ -- Vincent Fourmond <fourmond at debian.org>  Mon, 04 Apr 2011 20:31:36 +0200
+
 java-wrappers (0.1.20) experimental; urgency=low
 
   * Adding unzip as we need it to get the classpath correctly...

Modified: trunk/java-wrappers/java-wrappers.sh
===================================================================
--- trunk/java-wrappers/java-wrappers.sh	2011-04-04 15:26:31 UTC (rev 13502)
+++ trunk/java-wrappers/java-wrappers.sh	2011-04-04 18:35:33 UTC (rev 13503)
@@ -171,7 +171,7 @@
 
 
 # If the user provides a JAVA_FLAVOR environment variable, we
-# force the runtime to be the given flavor, such as for fund_java_runtime
+# force the runtime to be the given flavor, such as for find_java_runtime
 if [ "$JAVA_FLAVOR" ]; then
     find_java_runtime "$JAVA_FLAVOR" || \
 	java_warning "Could not find runtime for user-supplied flavor '${JAVA_FLAVOR}"
@@ -215,6 +215,27 @@
     done
 }
 
+# Recursively adds the jar and its classpath to the classpath
+_recurse_jar_classpath() {
+    if [ -r "$1" ]; then
+	if echo $JAVA_CLASSPATH | fgrep "$1"; then
+	    return 0;
+	fi
+	JAVA_CLASSPATH=$JAVA_CLASSPATH:$1
+	java_debug "Looking at classpath of jar: '$1'"
+	for jar in $(/usr/lib/java-wrappers/get-classpath "$1"); do
+	    if [ "${jar##/}" = "$jar" ]; then
+		java_warning "jar file $1 contains relative classpath element: $jar"
+	    else
+		_recurse_jar_classpath $jar;
+	    fi
+	done
+    else
+	java_debug "Unable to find file $1 that may be needed"
+	return 1;
+    fi
+}
+
 # This function tries to mimick the behaviour of the -jar option of
 # the java executable, by adding the target jar and all its classpath
 # recursively.
@@ -227,15 +248,9 @@
 find_jar_classpath() {
     if locate_jar "$1"; then
 	looked_for_jars=1
-	if echo $JAVA_CLASSPATH | grep found_jar; then
-	    return 0;
-	fi
-	JAVA_CLASSPATH=$JAVA_CLASSPATH:$found_jar
-	for jar in $(/usr/lib/java-wrappers/get-classpath $found_jar); do
-	    find_jar_classpath $jar;
-	done
+	_recurse_jar_classpath $found_jar
     else
-	java_warning "Unable to locate the necessary jar file $jar"
+	java_warn "Unable to find the jar file $jar"
 	return 1;
     fi
 }




More information about the pkg-java-commits mailing list