Compare commits

...

No commits in common. "openkylin/yangtze" and "pristine-tar" have entirely different histories.

16 changed files with 1 additions and 695 deletions

5
debian/changelog vendored
View File

@ -1,5 +0,0 @@
java-wrappers (0.3-ok2) yangtze; urgency=medium
* Build for openKylin.
-- zhouganqing <zhouganqing@kylinos.cn> Thu, 17 Nov 2022 14:33:31 +0800

1
debian/compat vendored
View File

@ -1 +0,0 @@
11

18
debian/control vendored
View File

@ -1,18 +0,0 @@
Source: java-wrappers
Section: java
Priority: optional
Maintainer: Openkylin Developers <packaging@lists.openkylin.top>
Build-Depends: debhelper (>= 11)
Standards-Version: 4.1.4
Vcs-Git: https://gitee.com/openkylin/java-wrappers.git
Vcs-Browser: https://gitee.com/openkylin/java-wrappers
Package: java-wrappers
Depends: unzip, ${misc:Depends}
Architecture: all
Description: wrappers for java executables
Wrapper script facilities for java executables.
.
This package can be used by packagers of java programs to
provide java runtime detection, jar lookup and a consistent
user interface (debugging, environment variables).

20
debian/copyright vendored
View File

@ -1,20 +0,0 @@
java-wrappers was written and debianized by Vincent Fourmond
Copyright 2007, 2008 by Vincent Fourmond <fourmond@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
On Debian systems, the complete text of the GNU Lesser General
Public License can be found in `/usr/share/common-licenses/LGPL-2.1'.

View File

@ -1,3 +0,0 @@
get-classpath usr/share/java-wrappers
java-wrappers.sh usr/share/java-wrappers
jvm-list.sh usr/share/java-wrappers

View File

@ -1,3 +0,0 @@
usr/share/java-wrappers/get-classpath usr/lib/java-wrappers/get-classpath
usr/share/java-wrappers/java-wrappers.sh usr/lib/java-wrappers/java-wrappers.sh
usr/share/java-wrappers/jvm-list.sh usr/lib/java-wrappers/jvm-list.sh

View File

@ -1 +0,0 @@
java-wrappers.7

4
debian/rules vendored
View File

@ -1,4 +0,0 @@
#!/usr/bin/make -f
%:
dh $@

View File

@ -1 +0,0 @@
3.0 (native)

View File

@ -1,40 +0,0 @@
#! /usr/bin/perl
# get-classpayth, copyright 2011 by Vincent Fourmond
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# This program 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
# General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
$file = shift(@ARGV);
open MANIFEST, "unzip -p \"$file\" META-INF/MANIFEST.MF | ";
my $cp = "";
while(my $line = <MANIFEST>) {
if($line =~ /Class-Path:\s*(.*)/) {
$cp = $1;
}
elsif($cp) {
if($line =~ /^ (.*)/) {
$cp .= $1;
}
else {
last;
}
}
}
close MANIFEST;
$cp =~ s/\r//g;
print "$cp\n";

View File

@ -1,198 +0,0 @@
\" Man page documenting the java-wrappers
\"
\" Copyright 2008 by Vincent Fourmond
\"
\" This documentation is free software; you can redistribute it and/or modify
\" it under the terms of the GNU General Public License as published by
\" the Free Software Foundation; either version 2 of the License, or
\" (at your option) any later version.
\" This package 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 General Public License for more details.
\" You should have received a copy of the GNU General Public License
\" along with this program; if not, write to the Free Software
\" Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
.TH JAVA-WRAPPERS 7 "2010-05-04" "Version 0.1.16" "Java wrappers"
.SH NAME
.B java-wrappers
\- capacities shared by java wrapper scripts
.SH DESCRIPTION
Most Java programs are not run directly, but through small shell
scripts that take care of various things, such as finding a suitable
Java environment and looking for libraries.
To ease the task of the maintainers, they rely on a library providing
runtime detection, library detection and other features. This manual
page describes the common features of all those scripts, and to which
point you can configure them. This is mainly done via environment
variables.
.SH ENVIRONMENT VARIABLES
.B java-wrappers
understands some environment variables:
.TP
.B JAVA_CMD
The
.I java
command that will be run. If this variable is set, it disables all
lookup for a java runtime.
.TP
.B JAVA_BINDIR
Specifies a directory that will be looked for a
.I java
or a
.I jdb
executable (depending on the setting of
.IR JAVA_DEBUGGER ).
It has precedence over
.I JAVA_HOME
but not over
.IR JAVA_CMD .
.TP
.B JAVA_HOME
A path to a Java runtime. If this variable is set, all lookup for a
Java runtime is disabled, except that if no
.I java
executable is found in the path, the command
.I java
is used.
.TP
.B JAVA_FLAVOR
A probably more easy-to-use version of the
.I JAVA_HOME
variable: instead of specifying the full path of the Java runtime, you
name it. List of available flavors can be found in the file
.IR /usr/lib/java-wrappers/jvm-list.sh .
See examples below.
.TP
.B JAVA_DEBUGGER
If this is set, the wrapper will try to pick up a Java debugger rather
than a Java interpreter. This will fail if the
.I jbd
of the runtime found is a stub.
.TP
.B JAVA_CLASSPATH
Additional classpath, will have priority over the one found by the
wrapper.
.TP
.B JAVA_ARGS
Additional arguments to the
.I java
command. They will come before all other arguments.
.TP
.B FORCE_CLASSPATH
If this variable is set, it will be
.B the only classpath\fR.
You'd better know what you are doing.
.TP
.B DEBUG_WRAPPER
This is probably the most important variable; if it set, the wrapper
will print out useful information as it goes by its business, such as
which runtime it did find, and which command is run eventually.
.TP
.B JAVA_JARPATH
The path where the wrappers will go looking for
.I jar
archives. If not set, the wrapper will look into the default
directory,
.IR /usr/share/java .
.B Warning :
the wrapper will not look anywhere else than in
.IR JAVA_JARPATH .
Setting it incorrectly will most probably result in early crashes.
.SH EXAMPLES
The examples all rely on
.BR rasterizer (1),
from the package
.B libbatik-java\fR,
but they really apply to all scripts that use java-wrappers.
Print out debugging information:
.I DEBUG_WRAPPER=1 rasterizer
Limit rasterizer's memory to 80 MB:
.I JAVA_ARGS=-Xmx80m rasterizer
Force rasterizer to run with
.BR kaffe (1):
.I JAVA_HOME=/usr/lib/kaffe rasterizer
The same, but using
.IR JAVA_BINDIR :
.I JAVA_BINDIR=/usr/lib/kaffe/bin rasterizer
Force rasterizer to run with
.BR openjdk :
.I JAVA_FLAVOR=openjdk rasterizer
Debug rasterizer with Sun's debugger, while printing debugging
information from the wrapper:
.I DEBUG_WRAPPER=1 JAVA_CMD=/usr/lib/jvm/java-6-sun/bin/jdb rasterizer
.SH BUGS
Care has been taken to make the wrappers bug-free. If that was not
the case, please file a bug report against the
.B java-wrappers
package.
If you wish to submit any problem with a Java executable relying on
.BR java-wrappers ,
please also submit the output of the command run with
.IR DEBUG_WRAPPER=1 .
It will save one mail exchange and therefore potentially reduce the
time it takes to fix the bug.
.SH DEVELOPERS
There is currently no documentation about writing a wrapper script
save the comments in
.IR /usr/lib/java-wrappers/java-wrappers.sh .
If you have to write one, we suggest you base yourself upon, for
instance, the
.I rasterizer
wrapper script, or any other one (just pick up any direct reverse
dependency of
.B java-wrappers
and look for scripts).
.SH SEE ALSO
.BR java (1),
.BR jdb (1)
.I /usr/lib/java-wrappers/java-wrappers.sh
.SH AUTHOR
.B java-wrappers
and its documentation were written by
Vincent Fourmond <fourmond@debian.org>

View File

@ -1,321 +0,0 @@
# wrappers.sh: various functions to be used by Java script wrappers
# Copyright 2008 by Vincent Fourmond <fourmond@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
# Import the list of JVMs
. /usr/lib/java-wrappers/jvm-list.sh
# Display a debugging message
java_debug() {
if [ "$DEBUG_WRAPPER" ]; then
echo "[debug] $0: $@" >&2;
fi
}
# Displays a warning
java_warning() {
echo "[warning] $0: $@" >&2;
}
# Exit with an error message
java_fail() {
echo "[error] $0: $@" >&2;
exit 1;
}
# Try to get the amount of memory available on the machine to come up
# with a decent -Xmx argument, returned as the value of the
# determined_xmx_arg (defaults in kilobytes, so you should add k
# afterwards)
determine_xmx_arg() {
# Yes, that's ugly, so what ??
mem=`free -k 2>/dev/null | head -n2 | tail -n1 | sed -r s/'[^0-9]+//' | cut -d' ' -f1`
}
# Try to find a Java runtime and set JAVA_HOME and JAVA_CMD accordingly.
# If JAVA_CMD exists, nothing is done. If JAVA_HOME exists, only that
# is searched.
#
# The full list of JVM names understood can be found in the file
# /usr/lib/java-wrappers/jvm-list.sh.
#
# More than one argument can be specified; they will be taken into account
# in that order; the first one found will be selected.
#
# If JAVA_DEBUGGER is set, we try to use jdb rather than java, if it is
# present.
#
# This information is currently *far from complete* !!!
find_java_runtime() {
if [ "$JAVA_CMD" ]; then
if which "$JAVA_CMD" > /dev/null; then
java_debug "Using already set JAVA_CMD = '$JAVA_CMD' => '"`which "$JAVA_CMD"`"'"
return 0; # Nothing to do
else
java_warning "JAVA_CMD was set to '$JAVA_CMD', but which(1) does not find it."
java_warning "Therefore ignoring JAVA_CMD"
fi
fi
if [ "$JAVA_BINDIR" ]; then
if [ "$JAVA_DEBUGGER" ] && [ -x "$JAVA_BINDIR/jdb" ]; then
JAVA_CMD="$JAVA_BINDIR/jdb"
elif [ -x "$JAVA_BINDIR/java" ]; then
JAVA_CMD="$JAVA_BINDIR/java"
fi
if [ "$JAVA_CMD" ]; then
java_debug "Using '$JAVA_CMD' from JAVA_BINDIR = '$JAVA_BINDIR'"
return 0;
else
java_warning "JAVA_BINDIR = '$JAVA_BINDIR' does not point to a java binary"
fi
fi
if [ -z "$JAVA_HOME" ]; then
# We now try to look for a reasonable JAVA_HOME.
# 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=""
# If no arguments are given, we take it as 'all'
if test -z "$1"; then
set all
fi
while test "$1"
do
if echo $1 | egrep -- '[^0-9A-Za-z_]'; then
java_warning "JVM flavor '${1}' contains illegal characters"
else
found_jvm=$(eval "echo -n \$__jvm_$1")
if [ -z "$found_jvm" ] ; then
java_warning "JVM flavor '${1:-none}' not understood"
else
DIRS="$DIRS $found_jvm"
fi
fi
shift
done
# Nothing means everything
if [ -z "$DIRS" ]; then
DIRS=$all_runtimes
fi
# First, we check if __jvm_alt is within the possible choices:
if echo "$DIRS" | fgrep "$__jvm_alt" > /dev/null ; then
JAVA_HOME="$__jvm_alt"
java_debug "Picking up the JVM designated by the alternatives system: "
java_debug " JAVA_HOME = '$JAVA_HOME'"
else
# And pick up the first one that works reasonably
for dir in $DIRS; do
if [ -x $dir/bin/java ]; then
JAVA_HOME=$dir
break;
fi
done
fi
else
java_debug "Using provided JAVA_HOME = '$JAVA_HOME'"
fi
if [ "$JAVA_HOME" ] ; then
if [ "$JAVA_DEBUGGER" ] && [ -x "$JAVA_HOME/bin/jdb" ]; then
JAVA_CMD="$JAVA_HOME/bin/jdb"
else
JAVA_CMD="$JAVA_HOME/bin/java"
fi
java_debug "Found JAVA_HOME = '$JAVA_HOME'"
java_debug "Found JAVA_CMD = '$JAVA_CMD'"
return 0 # Fine
else
java_warning "No java runtime was found"
return 1;
fi
}
# Some initializations:
if [ "$JAVA_CLASSPATH" ]; then
java_debug "Building classpath on JAVA_CLASSPATH = '$JAVA_CLASSPATH'"
else
JAVA_CLASSPATH=
fi
if [ "$JAVA_JARPATH" ]; then
java_debug "Jar lookup is done in JAVA_JARPATH = '$JAVA_JARPATH'"
else
JAVA_JARPATH=/usr/share/java
fi
# If the user provides a JAVA_FLAVOR environment variable, we
# 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}"
fi
# Same as find_java_runtime, but fails with an error if
# nothing is found.
require_java_runtime() {
find_java_runtime "$@" || \
java_fail "Unable to find an appropriate java runtime. See java_wrappers(7) for help"
}
# Looks for a jar file and returns its location as the
# found_jar variable, or fails if no jar was found.
locate_jar() {
jar="$1"
if [ -r $JAVA_JARPATH/$jar ]; then
found_jar=$JAVA_JARPATH/$jar
elif [ -r $JAVA_JARPATH/$jar.jar ]; then
found_jar=$JAVA_JARPATH/$jar.jar
elif [ -r $jar ]; then
found_jar=$jar
elif [ -r $jar.jar ]; then
found_jar=$jar.jar
else
return 1 # Not found
fi
return 0 # Found
}
# Find jars and add them to the classpath
find_jars() {
looked_for_jars=1
for jar in $@ ; do
if locate_jar $jar; then
if [ -z "$JAVA_CLASSPATH" ]; then
JAVA_CLASSPATH=$found_jar
else
JAVA_CLASSPATH=$JAVA_CLASSPATH:$found_jar
fi
else
java_warning "Unable to locate $jar in $JAVA_JARPATH"
fi
done
}
# Recursively adds the jar and its classpath to the classpath
_recurse_jar_classpath() {
if [ -r "$1" ]; then
if echo $JAVA_CLASSPATH | fgrep "$1" > /dev/null; 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
# Relative path = path relative to the location of the
# JAR file !
jar=$(dirname $1)/$jar
fi
_recurse_jar_classpath $jar;
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.
#
# This function is experimental for now, and its interface is not very
# well specified yet.
#
# It will return without problem if the target class already is in the
# classpath. It aborts with an error if a JAR file can't be found.
find_jar_classpath() {
if locate_jar "$1"; then
looked_for_jars=1
_recurse_jar_classpath $found_jar
else
java_warn "Unable to find the jar file $jar"
return 1;
fi
}
# Adds the first jar found to the classpath. Useful for alternative
# dependencies.
find_one_jar_in() {
looked_for_jars=1
for jar in $@ ; do
if locate_jar $jar; then
JAVA_CLASSPATH=$JAVA_CLASSPATH:$found_jar
return 0
fi
done
java_warning "Could fine none of $@ in $JAVA_JARPATH"
return 1
}
# Runs the program !
run_java() {
if [ -z "$JAVA_CMD" ]; then
java_warning "No JAVA_CMD set for run_java, falling back to JAVA_CMD = java"
JAVA_CMD=java
fi
# We try to conjure up a JAVA_HOME from JAVA_CMD, if the former
# is absent. Idea coming from bug #404728.
if [ -z "$JAVA_HOME" ]; then
full_cmd_path="$(readlink -f `which $JAVA_CMD`)"
JAVA_HOME="${full_cmd_path%bin/*}"
java_debug "Using JAVA_CMD to find JAVA_HOME = '$JAVA_HOME'"
fi
if [ "$FORCE_CLASSPATH" ]; then
java_debug "Using imposed classpath : FORCE_CLASSPATH = '$FORCE_CLASSPATH'";
cp="-classpath $FORCE_CLASSPATH";
elif [ "$JAVA_CLASSPATH" ]; then
cp="-classpath $JAVA_CLASSPATH";
else
cp="";
fi
# Exporting JAVA_HOME, I guess it can't hurt much, can it ?
export JAVA_HOME
java_debug "Environment variable CLASSPATH is '$CLASSPATH'"
java_debug "Runnning $JAVA_CMD $JAVA_ARGS $cp $@"
exec $JAVA_CMD $JAVA_ARGS $cp "$@"
}
# Runs a java jar.
# You don't have to use this function to run a jar, but you might find
# it useful, though.
run_jar() {
if [ "$looked_for_jars" ]; then
java_warning "It is most likely useless to use find_jar when running"
java_warning "a class with run_jar (-classpath is ignored)"
fi
if locate_jar $1; then
shift
run_java -jar "$found_jar" "$@"
else
java_fail "Unable to find jar $1 in $JAVA_JARPATH"
fi
}

Binary file not shown.

View File

@ -0,0 +1 @@
fec985b3522c1083ec62f1ba7e3efb9cd80a48a8

View File

@ -1,68 +0,0 @@
# jvm-list.sh: a list of available JVM and some shortcuts
# Copyright 2008, 2009 by Vincent Fourmond <fourmond@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...
#
# They can also be used for the JAVA_FLAVOR environment variable, see
# java-wrappers(7).
__arch=$(dpkg --print-architecture)
# default runtime
__jvm_default="/usr/lib/jvm/default-java"
# Oracle runtimes
__jvm_oracle7="/usr/lib/jvm/java-7-oracle /usr/lib/jvm/jdk-7-oracle-* /usr/lib/jvm/jre-7-oracle-*"
__jvm_oracle8="/usr/lib/jvm/java-8-oracle /usr/lib/jvm/jdk-8-oracle-* /usr/lib/jvm/jre-8-oracle-*"
__jvm_oracle9="/usr/lib/jvm/java-9-oracle /usr/lib/jvm/jdk-9-oracle-* /usr/lib/jvm/jre-9-oracle-*"
__jvm_oracle10="/usr/lib/jvm/java-10-oracle /usr/lib/jvm/jdk-10-oracle-* /usr/lib/jvm/jre-10-oracle-*"
__jvm_oracle11="/usr/lib/jvm/java-11-oracle /usr/lib/jvm/jdk-11-oracle-* /usr/lib/jvm/jre-11-oracle-*"
# Now, free runtimes:
__jvm_openjdk6="/usr/lib/jvm/java-6-openjdk-$__arch /usr/lib/jvm/java-6-openjdk"
__jvm_openjdk7="/usr/lib/jvm/java-7-openjdk-$__arch /usr/lib/jvm/java-7-openjdk"
__jvm_openjdk8="/usr/lib/jvm/java-8-openjdk-$__arch /usr/lib/jvm/java-8-openjdk"
__jvm_openjdk9="/usr/lib/jvm/java-9-openjdk-$__arch /usr/lib/jvm/java-9-openjdk"
__jvm_openjdk10="/usr/lib/jvm/java-10-openjdk-$__arch /usr/lib/jvm/java-10-openjdk"
__jvm_openjdk11="/usr/lib/jvm/java-11-openjdk-$__arch /usr/lib/jvm/java-11-openjdk"
# And a few aliases
__jvm_openjdk="$__jvm_openjdk11 $__jvm_openjdk10 $__jvm_openjdk9 $__jvm_openjdk8 $__jvm_openjdk7 $__jvm_openjdk6"
# The java* runtimes:
__jvm_java11="$__jvm_openjdk11 $__jvm_oracle11"
__jvm_java10="$__jvm_java11 $__jvm_openjdk10 $__jvm_oracle10"
__jvm_java9="$__jvm_java10 $__jvm_openjdk9 $__jvm_oracle9"
__jvm_java8="$__jvm_java9 $__jvm_openjdk8 $__jvm_oracle8"
__jvm_java7="$__jvm_java8 $__jvm_openjdk7 $__jvm_oracle7"
# -> corresponds to Provides: java6-runtime
__jvm_java6="$__jvm_java7 $__jvm_openjdk6"
# -> corresponds to Provides: java5-runtime
__jvm_java5="$__jvm_java6"
# -> corresponds to Provides: java2-runtime
__jvm_java2="$__jvm_java5"
# current java alternatives
__jvm_alt=$(readlink /etc/alternatives/java|sed -n 's!\(.*\)/bin/[^/]*$!\1!p')
# All JVMs
__jvm_all="$__jvm_default /usr/lib/jvm/*"
# Probably here should come a few meaningful global aliases.

View File

@ -1,12 +0,0 @@
#!/bin/sh
# find_runtime.sh: A small test script for find_java_runtime
# copyright 2008 by Vincent Fourmond.
# Distributed under the same terms as java-wrappers itself.
DEBUG_WRAPPER=1
. ../java-wrappers.sh
find_java_runtime
echo $JAVA_HOME