This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to branch master
in repository java-wrappers.

commit 201519f6899ccccbe9fef77529b83b9d0fd296f9
Author: Vincent Fourmond <fourm...@debian.org>
Date:   Tue Jul 22 21:51:47 2008 +0000

    [java-wrappers] Beginnings of a newer scheme for find_java_runtime
---
 debian/changelog             |  7 +++++
 debian/java-wrappers.install |  3 +-
 java-wrappers.sh             | 68 +++++++++-----------------------------------
 jvm-list.sh                  | 47 ++++++++++++++++++++++++++++++
 4 files changed, 70 insertions(+), 55 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 001c83f..94d77e8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+java-wrappers (0.1.7) UNRELEASED; urgency=low
+
+  * NOT RELEASED YET
+  * Rewrite of find_java_runtime in a much more flexible fashion... 
+
+ -- Vincent Fourmond <fourm...@debian.org>  Tue, 22 Jul 2008 23:49:08 +0200
+
 java-wrappers (0.1.6) unstable; urgency=low
 
   * Add openjdk6 to the list of runtime flavors
diff --git a/debian/java-wrappers.install b/debian/java-wrappers.install
index 2ed94e9..076b5e8 100644
--- a/debian/java-wrappers.install
+++ b/debian/java-wrappers.install
@@ -1 +1,2 @@
-java-wrappers.sh usr/lib/java-wrappers
\ No newline at end of file
+java-wrappers.sh usr/lib/java-wrappers
+jvm-list.sh usr/lib/java-wrappers
\ No newline at end of file
diff --git a/java-wrappers.sh b/java-wrappers.sh
index 2ee7bfa..1320a5a 100644
--- a/java-wrappers.sh
+++ b/java-wrappers.sh
@@ -15,6 +15,10 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
+# Import the list of JVMs
+
+. /usr/lib/java-wrappers/jvm-list.sh
+
 # Display a debugging message
 java_debug() {
     if [ "$DEBUG_WRAPPER" ]; then
@@ -56,36 +60,6 @@ java_fail() {
 #
 # This information is currently *far from complete* !!!
 find_java_runtime() {
-    # First, known runtimes:
-
-    sun5="/usr/lib/jvm/java-1.5.0-sun /usr/lib/j2*1.5-sun"
-    sun4="/usr/lib/j2*1.4-sun"
-    sun6="/usr/lib/jvm/java-6-sun /usr/lib/j2*1.6-sun"
-    
-    sun_java="$sun4 $sun5 $sun6"
-    
-    gcj2="/usr/lib/jvm/java-*-gcj-4.* "
-    sablevm="/usr/lib/sablevm"
-    kaffe="/usr/lib/kaffe /usr/lib/kaffe/pthreads /usr/lib/kaffe/jthreads"
-    icedtea="/usr/lib/jvm/java-7-icedtea"
-    cacao="/usr/lib/jvm/cacao"
-    
-    openjdk6="/usr/lib/jvm/java-6-openjdk"
-
-    # IBM, coming from argouml.sh
-    ibm="/usr/lib/j2*1.[456]-ibm"
-
-    # Then, classes of JVM:
-    all_runtimes="$gcj2 $cacao $sablevm $kaffe $icedtea $sun_java $ibm 
/usr/lib/jvm/*"
-
-    # Java2 runtimes:
-    java2_runtimes="$gcj2 $iced_tea $sun_java $ibm"
-
-    # Full swing runtimes:
-    full_swing_runtimes="$iced_tea $sun_java $ibm"
-
-    # Sun java apparently has some XML functions more than concurrents:
-    xml_extra="/usr/lib/jvm/java-6-sun /usr/lib/jvm/java-1.5.0-sun"
 
     if [ "$JAVA_CMD" ]; then
        if which "$JAVA_CMD" > /dev/null; then
@@ -114,34 +88,20 @@ find_java_runtime() {
     if [ -z "$JAVA_HOME" ]; then
 
         # We now try to look for a reasonable JAVA_HOME.
-        # First, narrow the choices, approximately according to what
-        # was asked
+        # First, narrow the choices according to what
+        # was asked.
+       #
+       # Please see the list of understood jvms in
+       # /usr/lib/java-wrappers/jvm-list.sh
 
        DIRS=""
        while test "$1"
        do 
-           case $1 in
-               # A java2 runtime
-               2) DIRS="$DIRS $java2_runtimes"
-                   ;;
-               swing) DIRS="$DIRS $icedtea $sun_java";
-                   ;;
-               sun) DIRS="$DIRS $sun_java"
-                   ;;
-               sunmax5) DIRS="$DIRS $sun4 $sun5"
-                   ;;
-               sunmin5) DIRS="$DIRS $sun5 $sun6"
-                   ;;
-               sun6) DIRS="$DIRS $sun6"
-                   ;;
-               fullxml) DIRS="$DIRS $xml_extra"
-                   ;;
-               icedtea) DIRS="$icedtea"
-                   ;;
-               openjdk) DIRS="$openjdk6"
-                   ;;
-               *) ;;
-           esac
+           found_jvm=$(eval "echo -n \$__jvm_$1")
+           if [ test -z "$found_jvm" ]; then
+               java_warning "JVM flavor '${1:-none}' not understood"
+           else
+               DIRS="$DIRS $found_jvm"
            shift
        done
        # Nothing means everything
diff --git a/jvm-list.sh b/jvm-list.sh
new file mode 100644
index 0000000..d76c966
--- /dev/null
+++ b/jvm-list.sh
@@ -0,0 +1,47 @@
+# jvm-list.sh: a list of available JVM and some shortcuts
+# Copyright 2008 by Vincent Fourmond <fourm...@debian.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+# All variables defined here can be used as arguments for the
+# find_java_runtime function if you strip the __jvm_ at the beginning
+# of the variable...
+
+# Sun runtimes
+__jvm_sun4="/usr/lib/j2*1.4-sun"
+__jvm_sun5="/usr/lib/jvm/java-1.5.0-sun /usr/lib/j2*1.5-sun"
+__jvm_sun6="/usr/lib/jvm/java-6-sun /usr/lib/j2*1.6-sun"
+
+# all sun runtimes
+__jvm_sun="$__jvm_sun4 $__jvm_sun5 $__jvm_sun6"
+
+# IBM runtimes. This comes from argouml.sh
+__jvm_ibm="/usr/lib/j2*1.[456]-ibm"
+
+
+# Now, free runtimes:
+__jvm_gcj2="/usr/lib/jvm/java-*-gcj-4.* "
+__jvm_sablevm="/usr/lib/sablevm"
+__jvm_kaffe="/usr/lib/kaffe /usr/lib/kaffe/pthreads /usr/lib/kaffe/jthreads"
+__jvm_icedtea="/usr/lib/jvm/java-7-icedtea"
+__jvm_cacao="/usr/lib/jvm/cacao"
+__jvm_openjdk6="/usr/lib/jvm/java-6-openjdk"
+
+# And a few aliases
+__jvm_gcj="$__jvm_gcj2"
+__jvm_openjdk="$__jvm_openjdk6"
+
+
+# Probably here should come a few meaningful global aliases.
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-java/java-wrappers.git

_______________________________________________
pkg-java-commits mailing list
pkg-java-comm...@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

Reply via email to