[josm] 12/14: Update josm executable to support OpenJDK 8 & 9 too.

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Fri Oct 30 14:40:40 UTC 2015


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

sebastic pushed a commit to branch master
in repository josm.

commit 4e2c7678bbe8f7d63ffebfa8dc19eb9c757847c9
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Fri Oct 30 15:23:47 2015 +0100

    Update josm executable to support OpenJDK 8 & 9 too.
---
 debian/changelog                          |  1 +
 debian/josm.sh                            | 39 --------------
 debian/patches/08-josm-alternatives.patch | 86 +++++++++++++++++++++++++++++++
 debian/patches/series                     |  1 +
 debian/rules                              |  4 +-
 5 files changed, 91 insertions(+), 40 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 6d56e45..ccca62c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ josm (0.0.svn8969+dfsg-1) UNRELEASED; urgency=medium
 
   * New tested snapshot.
   * Drop patch applied upstream, refresh remaining patches.
+  * Update josm executable to support OpenJDK 8 & 9 too.
 
  -- Bas Couwenberg <sebastic at debian.org>  Fri, 30 Oct 2015 12:03:03 +0100
 
diff --git a/debian/josm.sh b/debian/josm.sh
deleted file mode 100644
index 6bc86c4..0000000
--- a/debian/josm.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-# Simple wrapper script used to start JOSM in Debian
-set -e
-
-# First, the alternative (if known to work) or users preference as defined by $JAVA_HOME. Next, use OpenJDK or Sun's proprietary JDK.
-# Override to a specific one using $JAVACMD
-ALTERNATIVE_JDK="`readlink -n -f /etc/alternatives/java`"
-
-# Let's get the current architecture -- needed for multiarchified Java
-ARCH="`dpkg --print-architecture`"
-
-# If OpenJDK is only available headless, do not try it
-if dpkg --get-selections 'openjdk-*-jre' | grep install$ > /dev/null ; then
-	JAVA_CMDS="$JAVA_HOME/bin/java /usr/lib/jvm/java-7-openjdk-$ARCH/bin/java"
-else
-	JAVA_CMDS="$JAVA_HOME/bin/java"
-fi
-
-JAVA_OPTS="$JAVA_OPTS -Djava.net.useSystemProxies=true"
-
-for jcmd in $JAVA_CMDS; do
-	if [ "z$ALTERNATIVE_JDK" = "z`readlink -n -f $jcmd`" ] && [ -z "${JAVACMD}" ]; then
-        JAVACMD="$jcmd"
-    fi
-done
-
-for jcmd in $JAVA_CMDS; do
-    if [ -x "$jcmd" -a -z "${JAVACMD}" ]; then
-        JAVACMD="$jcmd"
-    fi
-done
-
-if [ "$JAVACMD" ]; then
-    echo "Using $JAVACMD to execute josm." || true
-    exec $JAVACMD $JAVA_OPTS -jar /usr/share/josm/josm.jar "$@"
-else
-    echo "No valid JVM found to run JOSM." || true
-    exit 1
-fi
diff --git a/debian/patches/08-josm-alternatives.patch b/debian/patches/08-josm-alternatives.patch
new file mode 100644
index 0000000..74fd7a4
--- /dev/null
+++ b/debian/patches/08-josm-alternatives.patch
@@ -0,0 +1,86 @@
+Description: Simplify java alternatives testing.
+ Test JDK versions in order of preference: JDK 8, 7, 9.
+ When no (non-headless) OpenJDK package is installed, test for the Oracle JDK versions.
+ Break out of testing loops when a suitable java command is found.
+Author: Bas Couwenberg <sebastic at debian.org>
+Forwarded: https://josm.openstreetmap.de/ticket/12033
+
+--- a/linux/tested/usr/bin/josm
++++ b/linux/tested/usr/bin/josm
+@@ -11,52 +11,36 @@ ARCH="`dpkg --print-architecture 2> /dev
+ 
+ # If OpenJDK is only available headless, do not try it
+ if dpkg --get-selections 'openjdk-*-jre' | grep install$ > /dev/null ; then
+-	JAVA9_CMDS="/usr/lib/jvm/java-9-openjdk/bin/java /usr/lib/jvm/java-9-openjdk-$ARCH/bin/java /usr/lib/jvm/java-9-oracle/bin/java"
+-	JAVA8_CMDS="/usr/lib/jvm/java-8-openjdk/bin/java /usr/lib/jvm/java-8-openjdk-$ARCH/bin/java /usr/lib/jvm/java-8-oracle/bin/java"
+-	JAVA7_CMDS="$JAVA_HOME/bin/java /usr/lib/jvm/java-7-openjdk/bin/java /usr/lib/jvm/java-7-openjdk-$ARCH/bin/java /usr/lib/jvm/java-7-oracle/bin/java"
++	JAVA_CMDS="$JAVA_HOME/bin/java"
++	JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-8-openjdk/bin/java /usr/lib/jvm/java-8-openjdk-$ARCH/bin/java /usr/lib/jvm/java-8-oracle/bin/java"
++	JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-7-openjdk/bin/java /usr/lib/jvm/java-7-openjdk-$ARCH/bin/java /usr/lib/jvm/java-7-oracle/bin/java"
++	JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-9-openjdk/bin/java /usr/lib/jvm/java-9-openjdk-$ARCH/bin/java /usr/lib/jvm/java-9-oracle/bin/java"
+ else
+-	JAVA9_CMDS="/usr/lib/jvm/java-9-oracle/bin/java"
+-	JAVA8_CMDS="/usr/lib/jvm/java-8-oracle/bin/java"
+-	JAVA7_CMDS="$JAVA_HOME/bin/java /usr/lib/jvm/java-7-oracle/bin/java /usr/bin/java"
++	JAVA_CMDS="$JAVA_HOME/bin/java /usr/bin/java"
++	JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-8-oracle/bin/java"
++	JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-7-oracle/bin/java"
++	JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-9-oracle/bin/java"
+ fi
+ 
+ JAVA_OPTS="-Djosm.restart=true -Djava.net.useSystemProxies=true $JAVA_OPTS"
+ 
+-for jcmd in $JAVA8_CMDS; do
+-	if [ "z$ALTERNATIVE_JDK" = "z`readlink -n -f $jcmd`" ] && [ -z "${JAVACMD}" ]; then
+-        JAVACMD="$jcmd"
+-    fi
+-done
+-
+-for jcmd in $JAVA8_CMDS; do
+-    if [ -x "$jcmd" -a -z "${JAVACMD}" ]; then
+-        JAVACMD="$jcmd"
+-    fi
+-done
+-
+-for jcmd in $JAVA7_CMDS; do
+-	if [ "z$ALTERNATIVE_JDK" = "z`readlink -n -f $jcmd`" ] && [ -z "${JAVACMD}" ]; then
+-        JAVACMD="$jcmd"
+-    fi
+-done
+-
+-for jcmd in $JAVA7_CMDS; do
+-    if [ -x "$jcmd" -a -z "${JAVACMD}" ]; then
+-        JAVACMD="$jcmd"
+-    fi
+-done
+-
+-for jcmd in $JAVA9_CMDS; do
+-	if [ "z$ALTERNATIVE_JDK" = "z`readlink -n -f $jcmd`" ] && [ -z "${JAVACMD}" ]; then
+-        JAVACMD="$jcmd"
+-    fi
+-done
++if [ -z "${JAVACMD}" ]; then
++    for jcmd in $JAVA_CMDS; do
++        if [ "z$ALTERNATIVE_JDK" = "z`readlink -n -f $jcmd`" ] && [ -z "${JAVACMD}" ]; then
++            JAVACMD="$jcmd"
++            break
++        fi
++    done
++fi
+ 
+-for jcmd in $JAVA9_CMDS; do
+-    if [ -x "$jcmd" -a -z "${JAVACMD}" ]; then
+-        JAVACMD="$jcmd"
+-    fi
+-done
++if [ -z "${JAVACMD}" ]; then
++    for jcmd in $JAVA_CMDS; do
++        if [ -x "$jcmd" -a -z "${JAVACMD}" ]; then
++            JAVACMD="$jcmd"
++            break
++        fi
++    done
++fi
+ 
+ if [ "$JAVACMD" ]; then
+     echo "Using $JAVACMD to execute josm." || true
diff --git a/debian/patches/series b/debian/patches/series
index cc73016..6954d6a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,3 +6,4 @@
 05-fix_version.patch
 06-move_data_out_of_jar.patch
 07-use_system_fonts.patch
+08-josm-alternatives.patch
diff --git a/debian/rules b/debian/rules
index cfdb47c..634d0a0 100755
--- a/debian/rules
+++ b/debian/rules
@@ -36,9 +36,11 @@ override_dh_auto_build:
 
 override_dh_auto_install:
 	dh_auto_install
+
 	install -m 644 $(CURDIR)/dist/josm-custom.jar $(CURDIR)/debian/josm/usr/share/josm/josm-${DEB_UPSTREAM_VERSION}.jar
 	dh_link usr/share/josm/josm-${DEB_UPSTREAM_VERSION}.jar usr/share/josm/josm.jar
-	install -m 755 $(CURDIR)/debian/josm.sh $(CURDIR)/debian/josm/usr/bin/josm
+
+	install -m 755 $(CURDIR)/linux/tested/usr/bin/josm $(CURDIR)/debian/josm/usr/bin/josm
 
 	for size in 48x48 32x32 16x16; do \
 		install -o root -g root -d $(CURDIR)/debian/josm/usr/share/icons/hicolor/$${size}/apps ; \

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



More information about the Pkg-grass-devel mailing list