|
|
24ba5b |
From be3d32fe7a2b59f682e27022931a27fa552d052d Mon Sep 17 00:00:00 2001
|
|
|
24ba5b |
From: Jakub Filak <jfilak@redhat.com>
|
|
|
24ba5b |
Date: Tue, 17 Jun 2014 14:51:08 +0200
|
|
|
24ba5b |
Subject: [PATCH] Add abrt-java-connector bits
|
|
|
24ba5b |
|
|
|
24ba5b |
Honor JAVACMD_OPTS with a path to the abrt connector agent when:
|
|
|
24ba5b |
1. JAVA_ABRT environment variable does not hold 'off'
|
|
|
24ba5b |
2. the connector's library exists
|
|
|
24ba5b |
3. abrtd is running
|
|
|
24ba5b |
|
|
|
24ba5b |
We have to use JAVACMD_OTPS variable instead of FLAGS and OPTIONS
|
|
|
24ba5b |
because applications (i.e. ant) migth use the following workflow:
|
|
|
24ba5b |
. /usr/share/java-utils/java-functions
|
|
|
24ba5b |
set_javacmd
|
|
|
24ba5b |
$JAVACMD MyClass
|
|
|
24ba5b |
|
|
|
24ba5b |
FLAGS and OPTIONS variables are used only from run() function.
|
|
|
24ba5b |
|
|
|
24ba5b |
Use architecture-independent location of abrt-java-connector
|
|
|
24ba5b |
|
|
|
24ba5b |
The connector's library has been moved to architecture-independent
|
|
|
24ba5b |
directory /usr/lib/abrt-java-connector/, because Java does not
|
|
|
24ba5b |
officially support multilib and having the connector installed the arch
|
|
|
24ba5b |
specific directory was causing us problems if Java package doesn't match
|
|
|
24ba5b |
host architecture (e.g. Java i386 on host x86_64).
|
|
|
24ba5b |
|
|
|
24ba5b |
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
|
|
24ba5b |
|
|
|
24ba5b |
Use wrapper script to inject extra JVM arguments (rhbz#1153652)
|
|
|
24ba5b |
|
|
|
24ba5b |
Add JAVA_ABRT=off to java.conf template
|
|
|
24ba5b |
|
|
|
24ba5b |
Log injecting ABRT agent
|
|
|
24ba5b |
---
|
|
|
24ba5b |
build | 2 ++
|
|
|
24ba5b |
configure | 6 ++++++
|
|
|
24ba5b |
etc/java.conf | 4 ++++
|
|
|
24ba5b |
install | 1 +
|
|
|
24ba5b |
java-utils/java-functions | 22 ++++++++++++++++++++--
|
|
|
24ba5b |
java-utils/java-wrapper | 8 ++++++++
|
|
|
24ba5b |
6 files changed, 41 insertions(+), 2 deletions(-)
|
|
|
24ba5b |
create mode 100644 java-utils/java-wrapper
|
|
|
24ba5b |
|
|
|
24ba5b |
diff --git a/build b/build
|
|
|
24ba5b |
index 23cbb90..4e974c0 100755
|
|
|
24ba5b |
--- a/build
|
|
|
24ba5b |
+++ b/build
|
|
|
24ba5b |
@@ -61,7 +61,9 @@ expand()
|
|
|
24ba5b |
-e "s|%{jvmdir}|${jvmdir}|" \
|
|
|
24ba5b |
-e "s|%{m2home}|${m2home}|" \
|
|
|
24ba5b |
-e "s|%{prefix}|${prefix}|" \
|
|
|
24ba5b |
+ -e "s|%{rundir}|${rundir}|" \
|
|
|
24ba5b |
-e "s|%{sysconfdir}|${sysconfdir}|" \
|
|
|
24ba5b |
+ -e "s|%{abrtlibdir}|${abrtlibdir}|" \
|
|
|
24ba5b |
"${1}" >"${target}"
|
|
|
24ba5b |
}
|
|
|
24ba5b |
|
|
|
24ba5b |
diff --git a/configure b/configure
|
|
|
24ba5b |
index 3288fda..4f22ceb 100755
|
|
|
24ba5b |
--- a/configure
|
|
|
24ba5b |
+++ b/configure
|
|
|
24ba5b |
@@ -35,8 +35,10 @@ set -e
|
|
|
24ba5b |
vars="
|
|
|
24ba5b |
bindir
|
|
|
24ba5b |
datadir
|
|
|
24ba5b |
+localstatedir
|
|
|
24ba5b |
mandir
|
|
|
24ba5b |
prefix
|
|
|
24ba5b |
+rundir
|
|
|
24ba5b |
sysconfdir
|
|
|
24ba5b |
rpmconfigdir
|
|
|
24ba5b |
|
|
|
24ba5b |
@@ -58,6 +60,7 @@ jvmsysconfdir
|
|
|
24ba5b |
mavendepmapdir
|
|
|
24ba5b |
mavendepmapfragdir
|
|
|
24ba5b |
mavenpomdir
|
|
|
24ba5b |
+abrtlibdir
|
|
|
24ba5b |
"
|
|
|
24ba5b |
|
|
|
24ba5b |
vars_re=$(echo $vars | sed 's/ /\\|/g')
|
|
|
24ba5b |
@@ -68,11 +71,14 @@ eval $(for _; do echo "$_"; done |
|
|
|
24ba5b |
test -z "${prefix}" && prefix="/usr/local"
|
|
|
24ba5b |
test -z "${bindir}" && bindir="${prefix}/bin"
|
|
|
24ba5b |
test -z "${datadir}" && datadir="${prefix}/share"
|
|
|
24ba5b |
+test -z "${localstatedir}" && localstatedir="${prefix}/var"
|
|
|
24ba5b |
test -z "${mandir}" && mandir="${datadir}/man"
|
|
|
24ba5b |
+test -z "${rundir}" && rundir="${localstatedir}/run"
|
|
|
24ba5b |
test -z "${sysconfdir}" && sysconfdir="${prefix}/etc"
|
|
|
24ba5b |
test -z "${rpmconfigdir}" && rpmconfigdir="${prefix}/lib/rpm"
|
|
|
24ba5b |
|
|
|
24ba5b |
test -z "${m2home}" && m2home="${datadir}/xmvn"
|
|
|
24ba5b |
+test -z "${abrtlibdir}" && abrtlibdir="${prefix}/lib/abrt-java-connector"
|
|
|
24ba5b |
|
|
|
24ba5b |
eval $(sed -n 's/^%_\('"$vars_re"'\)\ *\(.*\)$/\1="\2"/;T;s/%{_\(.*}\)/${\1/;p' etc/macros.jpackage)
|
|
|
24ba5b |
|
|
|
24ba5b |
diff --git a/etc/java.conf b/etc/java.conf
|
|
|
24ba5b |
index fa0a989..042e9ad 100644
|
|
|
24ba5b |
--- a/etc/java.conf
|
|
|
24ba5b |
+++ b/etc/java.conf
|
|
|
24ba5b |
@@ -22,3 +22,7 @@ JVM_ROOT=%{jvmdir}
|
|
|
24ba5b |
|
|
|
24ba5b |
# Options to pass to the java interpreter
|
|
|
24ba5b |
#JAVACMD_OPTS=
|
|
|
24ba5b |
+
|
|
|
24ba5b |
+# You can disable ABRT Java Connector by setting JAVA_ABRT to "off".
|
|
|
24ba5b |
+# See: https://github.com/jfilak/abrt-java-connector/
|
|
|
24ba5b |
+#JAVA_ABRT=off
|
|
|
24ba5b |
diff --git a/install b/install
|
|
|
24ba5b |
index d0b941a..33690ed 100755
|
|
|
24ba5b |
--- a/install
|
|
|
24ba5b |
+++ b/install
|
|
|
24ba5b |
@@ -118,6 +118,7 @@ inst_config etc/font.properties "${javaconfdir}"
|
|
|
24ba5b |
inst_config target/java.conf "${javaconfdir}"
|
|
|
24ba5b |
|
|
|
24ba5b |
inst_data target/java-functions "${javadir}-utils"
|
|
|
24ba5b |
+inst_exec java-utils/java-wrapper "${javadir}-utils"
|
|
|
24ba5b |
inst_data java-utils/maven_depmap.py "${javadir}-utils"
|
|
|
24ba5b |
inst_data java-utils/pom_editor.sh "${javadir}-utils"
|
|
|
24ba5b |
|
|
|
24ba5b |
diff --git a/java-utils/java-functions b/java-utils/java-functions
|
|
|
24ba5b |
index dc8aa1b..e9a763a 100644
|
|
|
24ba5b |
--- a/java-utils/java-functions
|
|
|
24ba5b |
+++ b/java-utils/java-functions
|
|
|
24ba5b |
@@ -109,6 +109,14 @@ _load_java_conf()
|
|
|
24ba5b |
if [ -n "${java_opts_save}" ]; then
|
|
|
24ba5b |
JAVACMD_OPTS="${java_opts_save}"
|
|
|
24ba5b |
fi
|
|
|
24ba5b |
+
|
|
|
24ba5b |
+ if [ "_${JAVA_ABRT}" != "_off" -a -f "%{abrtlibdir}/libabrt-java-connector.so" -a -f "%{rundir}/abrt/abrtd.pid" ]; then
|
|
|
24ba5b |
+ _log "ABRT Java connector was enabled"
|
|
|
24ba5b |
+ _log "Using ABRT Java agent: %{abrtlibdir}/libabrt-java-connector.so"
|
|
|
24ba5b |
+ JAVACMD_OPTS="${JAVACMD_OPTS} -agentpath:%{abrtlibdir}/libabrt-java-connector.so=abrt=on"
|
|
|
24ba5b |
+ else
|
|
|
24ba5b |
+ _log "ABRT Java connector is disabled"
|
|
|
24ba5b |
+ fi
|
|
|
24ba5b |
}
|
|
|
24ba5b |
|
|
|
24ba5b |
|
|
|
24ba5b |
@@ -224,7 +232,12 @@ set_javacmd()
|
|
|
24ba5b |
JAVACMD="${JAVA_HOME}/${cmd}"
|
|
|
24ba5b |
if [ -x "${JAVACMD}" ]; then
|
|
|
24ba5b |
_log "Using configured JAVACMD: $JAVACMD"
|
|
|
24ba5b |
- JAVACMD="${JAVACMD}${JAVACMD_OPTS:+ }${JAVACMD_OPTS}"
|
|
|
24ba5b |
+ if [ -n "${JAVACMD_OPTS}" ]; then
|
|
|
24ba5b |
+ _log "Using java-wrapper with extra options: ${JAVACMD_OPTS}"
|
|
|
24ba5b |
+ export _JP_JAVACMD="${JAVACMD}"
|
|
|
24ba5b |
+ export _JP_JAVACMD_OPTS="${JAVACMD_OPTS}"
|
|
|
24ba5b |
+ JAVACMD="%{javadir}-utils/java-wrapper"
|
|
|
24ba5b |
+ fi
|
|
|
24ba5b |
return 0
|
|
|
24ba5b |
fi
|
|
|
24ba5b |
done
|
|
|
24ba5b |
@@ -232,7 +245,12 @@ set_javacmd()
|
|
|
24ba5b |
JAVACMD=$(which java 2>/dev/null || :)
|
|
|
24ba5b |
if [ -x "${JAVACMD}" ]; then
|
|
|
24ba5b |
_log "Using JAVACMD from PATH: $JAVACMD"
|
|
|
24ba5b |
- JAVACMD="${JAVACMD}${JAVACMD_OPTS:+ }${JAVACMD_OPTS}"
|
|
|
24ba5b |
+ if [ -n "${JAVACMD_OPTS}" ]; then
|
|
|
24ba5b |
+ _log "Using java-wrapper with extra options: ${JAVACMD_OPTS}"
|
|
|
24ba5b |
+ export _JP_JAVACMD="${JAVACMD}"
|
|
|
24ba5b |
+ export _JP_JAVACMD_OPTS="${JAVACMD_OPTS}"
|
|
|
24ba5b |
+ JAVACMD="%{javadir}-utils/java-wrapper"
|
|
|
24ba5b |
+ fi
|
|
|
24ba5b |
return 0
|
|
|
24ba5b |
fi
|
|
|
24ba5b |
|
|
|
24ba5b |
diff --git a/java-utils/java-wrapper b/java-utils/java-wrapper
|
|
|
24ba5b |
new file mode 100644
|
|
|
24ba5b |
index 0000000..29b3143
|
|
|
24ba5b |
--- /dev/null
|
|
|
24ba5b |
+++ b/java-utils/java-wrapper
|
|
|
24ba5b |
@@ -0,0 +1,8 @@
|
|
|
24ba5b |
+#!/bin/sh
|
|
|
24ba5b |
+
|
|
|
24ba5b |
+JAVACMD="${_JP_JAVACMD}"
|
|
|
24ba5b |
+JAVACMD_OPTS="${_JP_JAVACMD_OPTS}"
|
|
|
24ba5b |
+unset _JP_JAVACMD
|
|
|
24ba5b |
+unset _JP_JAVACMD_OPTS
|
|
|
24ba5b |
+
|
|
|
24ba5b |
+exec "${JAVACMD}" ${JAVACMD_OPTS} "${@}"
|
|
|
24ba5b |
--
|
|
|
24ba5b |
2.4.3
|
|
|
24ba5b |
|