summaryrefslogtreecommitdiff
path: root/libre/java-common
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@parabola.nu>2014-10-13 00:57:40 -0200
committerAndré Fabian Silva Delgado <emulatorman@parabola.nu>2014-10-13 00:57:40 -0200
commitf90b5da18e958f987c30494730d4b73af31a0388 (patch)
tree23c66872e2b26415970d0262075854db2d3d3745 /libre/java-common
parent39dc767bca041d1fefd7bf2c00909a45001ef772 (diff)
downloadabslibre-f90b5da18e958f987c30494730d4b73af31a0388.tar.gz
abslibre-f90b5da18e958f987c30494730d4b73af31a0388.tar.bz2
abslibre-f90b5da18e958f987c30494730d4b73af31a0388.zip
rename java-common to java-runtime-common and add bin links to package. be quieter (FS#41883 -> https://bugs.archlinux.org/task/41883) (FS#41901 -> https://bugs.archlinux.org/task/41901)
Diffstat (limited to 'libre/java-common')
-rw-r--r--libre/java-common/PKGBUILD43
-rwxr-xr-x[-rw-r--r--]libre/java-common/bin_java-common-wrapper0
-rwxr-xr-x[-rw-r--r--]libre/java-common/bin_parabola-java30
-rw-r--r--libre/java-common/install_java-common.sh8
-rw-r--r--libre/java-common/install_java-runtime-common.sh9
-rw-r--r--libre/java-common/profile_jre.csh2
-rw-r--r--libre/java-common/profile_jre.sh2
-rwxr-xr-xlibre/java-common/test_parabola-java69
8 files changed, 68 insertions, 95 deletions
diff --git a/libre/java-common/PKGBUILD b/libre/java-common/PKGBUILD
index 88d3f66a0..a20014359 100644
--- a/libre/java-common/PKGBUILD
+++ b/libre/java-common/PKGBUILD
@@ -1,30 +1,29 @@
# Maintainer (Arch): Guillaume ALAUX <guillaume@archlinux.org>
# Maintainer: André Silva <emulatorman@parabola.nu>
-pkgname=java-common
-pkgver=1
-pkgrel=8.parabola1
-pkgdesc='Common files for Java Environments (Parabola rebranded)'
+pkgname=java-runtime-common
+pkgbase=java-common
+pkgver=2
+pkgrel=1.parabola1
+pkgdesc='Common files for Java Runtime Environments (Parabola rebranded)'
arch=('any')
-url='parabolagnulinux.org'
+url='www.parabola.nu'
license=('GPL')
checkdepends=('wget')
+conflicts=('java-common')
+replaces=('java-common')
backup=(etc/profile.d/jre.sh
etc/profile.d/jre.csh)
-# TODO remove after a while
-replaces=('java-runtime-headless-meta' 'java-runtime-meta' 'java-environment-meta')
-install=install_java-common.sh
+install=install_java-runtime-common.sh
source=(profile_jre.csh
profile_jre.sh
bin_parabola-java
test_parabola-java
- bin_java-common-wrapper
https://shunit2.googlecode.com/files/shunit2-2.1.6.tgz)
-sha256sums=('f3b7eb6ffa8bbc454250bfc3723f3fbcd1e19e314832524d0dbe5244752d3883'
- '230214ef0d8cf8939abdcf0de01b763c76e9e711c46299b028c2c3c40930565e'
- '284d7d18c4847485eaec693645afb2c0ad4bb7a4d0d42315a78b9ee3bcadb9a8'
- 'e27e85eecbd8c8bd63738c1c332397d44cf44416d2ae9203945af1fc2a51dfed'
- '16a4fde19bd34210ff2d06480085f681b4e41e85ec89853e3cafaa8377bcedfb'
+sha256sums=('769f9d2e58388aafb83f6493b0aed0b851c43ec8ffc1c23241825347a4c413ec'
+ 'e80a98ee72d0b7cb9f4471590217be21281aa7029b55bd538e963812f1b820a7'
+ '103e0cbd0dd3b11376ba61e743f481f1a720c336f7b67d09a6b189f988e2fe6e'
+ '6e0f4173d4cfaad5ab0ed953fad770ee70b355349304c3bd34043edf0b6a7ab5'
'65a313a76fd5cc1c58c9e19fbc80fc0e418a4cbfbd46d54b35ed5b6e0025d4ee')
check() {
@@ -32,11 +31,23 @@ check() {
./test_parabola-java
}
-build() {
+package() {
cd "${srcdir}"
+ install -d -m 755 "${pkgdir}/usr/lib/jvm/"
+ ln -s /dev/null "${pkgdir}/usr/lib/jvm/default"
+ ln -s /dev/null "${pkgdir}/usr/lib/jvm/default-runtime"
+
install -D -m 644 profile_jre.sh "${pkgdir}/etc/profile.d/jre.sh"
install -D -m 644 profile_jre.csh "${pkgdir}/etc/profile.d/jre.csh"
- install -D -m 755 bin_java-common-wrapper "${pkgdir}/usr/lib/java-common-wrapper"
install -D -m 755 bin_parabola-java "${pkgdir}/usr/bin/parabola-java"
+
+ install -d -m 755 "${pkgdir}/usr/bin/"
+ # Official list of binaries that Java headless runtime packages MUST provide
+ # This list is based on Parabola' default Java implementation: "OpenJDK 7 Icedtea"
+ for b in \
+ java keytool orbd pack200 policytool rmid rmiregistry servertool tnameserv unpack200;
+ do
+ ln -s /usr/lib/jvm/default-runtime/bin/${b} "${pkgdir}/usr/bin/${b}"
+ done
}
diff --git a/libre/java-common/bin_java-common-wrapper b/libre/java-common/bin_java-common-wrapper
index 19d9edaa2..19d9edaa2 100644..100755
--- a/libre/java-common/bin_java-common-wrapper
+++ b/libre/java-common/bin_java-common-wrapper
diff --git a/libre/java-common/bin_parabola-java b/libre/java-common/bin_parabola-java
index e9bcbb25f..47f410096 100644..100755
--- a/libre/java-common/bin_parabola-java
+++ b/libre/java-common/bin_parabola-java
@@ -11,9 +11,6 @@ DEFAULT_NAME=default
DEFAULT_PATH=${JVM_DIR}/${DEFAULT_NAME}
DEFAULT_NAME_JRE=default-runtime
DEFAULT_PATH_JRE=${JVM_DIR}/${DEFAULT_NAME_JRE}
-BIN_PATH=/usr/bin
-WRAPPER_PATH=/usr/lib/java-common-wrapper
-
# Utility functions
@@ -38,7 +35,11 @@ check_param_count() {
get_default_java() {
path=$(readlink -e ${DEFAULT_PATH})
- echo ${path/${JVM_DIR}\/}
+ if [ "x${path}" != "x/dev/null" ]; then
+ echo ${path/${JVM_DIR}\/}
+ else
+ echo ""
+ fi
}
get_installed_javas() {
@@ -61,20 +62,6 @@ is_java_valid() {
test "x$1" != "x${DEFAULT_NAME}" && test -x ${JVM_DIR}/$1/bin/java
}
-set_bin_links() {
- find ${DEFAULT_PATH}/bin ! -type d -perm /a=x \
- | while read bpath; do
- ln -sf ${WRAPPER_PATH} ${BIN_PATH}/$(basename ${bpath}) > /dev/null 2>&1
- done
-}
-
-unset_bin_links() {
- find -L ${BIN_PATH} -samefile ${WRAPPER_PATH} \
- | while read lpath; do
- unlink ${lpath}
- done
-}
-
# $1: Java environment name to set as default
set_default_link_to() {
new_default=$1
@@ -131,10 +118,8 @@ do_set() {
default=$(get_default_java)
if [ "x$1" != "x${default}" ] || ! is_java_valid ${default}; then
unset_default_link
- unset_bin_links
set_default_link_to $1
fi
- set_bin_links
#parent_dir=$(dirname $1)
#if is_java_valid ${parent_dir}; then
@@ -146,7 +131,6 @@ do_set() {
# $1: Java environment name to unset
do_unset() {
unset_default_link
- unset_bin_links
}
do_fix() {
@@ -156,19 +140,15 @@ do_fix() {
unset_default_link
set_default_link_to $(dirname ${default})
fi
- unset_bin_links
- set_bin_links
else
prev=$(readlink ${DEFAULT_PATH})
unset_default_link
- unset_bin_links
prev_fix=("${prev/\/jre}" "${prev}/jre")
openjdk7=('java-7-openjdk' 'java-7-openjdk/jre')
to_check=(${prev_fix[@]} ${openjdk7[@]} $(get_installed_javas))
for java in ${to_check[@]}; do
if ! is_java_valid $(get_default_java) && is_java_valid ${java}; then
set_default_link_to ${java}
- set_bin_links
fi
done
fi
diff --git a/libre/java-common/install_java-common.sh b/libre/java-common/install_java-common.sh
deleted file mode 100644
index c9910e8bf..000000000
--- a/libre/java-common/install_java-common.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-post_install() {
- echo 'Please make sure JAVA_HOME is set to /usr/lib/jvm/default'
- echo 'If not, you may have to logout and login again to set it according to /etc/profile.d/jre.sh'
-}
-
-post_upgrade() {
- post_install "$@"
-}
diff --git a/libre/java-common/install_java-runtime-common.sh b/libre/java-common/install_java-runtime-common.sh
new file mode 100644
index 000000000..0c9ae502e
--- /dev/null
+++ b/libre/java-common/install_java-runtime-common.sh
@@ -0,0 +1,9 @@
+post_install() {
+ echo 'For the complete set of Java binaries to be available in your PATH,'
+ echo 'you need to re-login or source /etc/profile.d/jre.sh'
+ echo 'Please note that this package does not support forcing JAVA_HOME as former package 'java-common' did'
+}
+
+post_upgrade() {
+ parabola-java fix
+}
diff --git a/libre/java-common/profile_jre.csh b/libre/java-common/profile_jre.csh
index 282ea964e..7cd51e95d 100644
--- a/libre/java-common/profile_jre.csh
+++ b/libre/java-common/profile_jre.csh
@@ -1,6 +1,6 @@
# Do not change this unless you want to completely by-pass Parabola' way
# of handling Java versions and vendors. Instead, please use script `parabola-java`
-setenv JAVA_HOME "/usr/lib/jvm/default"
+setenv PATH "${PATH}:/usr/lib/jvm/default/bin"
# Enable this for non-reparenting window managers
#setenv _JAVA_AWT_WM_NONREPARENTING 1
diff --git a/libre/java-common/profile_jre.sh b/libre/java-common/profile_jre.sh
index bd835f021..9e44dc9e1 100644
--- a/libre/java-common/profile_jre.sh
+++ b/libre/java-common/profile_jre.sh
@@ -1,6 +1,6 @@
# Do not change this unless you want to completely by-pass Parabola' way
# of handling Java versions and vendors. Instead, please use script `parabola-java`
-export JAVA_HOME=/usr/lib/jvm/default
+export PATH=${PATH}:/usr/lib/jvm/default/bin
# Enable this for non-reparenting window managers
#export _JAVA_AWT_WM_NONREPARENTING=1
diff --git a/libre/java-common/test_parabola-java b/libre/java-common/test_parabola-java
index 1051186d6..89b57655a 100755
--- a/libre/java-common/test_parabola-java
+++ b/libre/java-common/test_parabola-java
@@ -12,8 +12,6 @@ declare test_dir
INIT_JVM_DIR=${JVM_DIR}
INIT_DEFAULT_PATH=${DEFAULT_PATH}
INIT_DEFAULT_PATH_JRE=${DEFAULT_PATH_JRE}
-INIT_BIN_PATH=${BIN_PATH}
-INIT_WRAPPER_PATH=${WRAPPER_PATH}
# Redefining this so that tested script can be invoked without root privileges
check_root() {
@@ -31,12 +29,7 @@ setUp() {
DEFAULT_PATH=${test_dir}${INIT_DEFAULT_PATH}
DEFAULT_PATH_JRE=${test_dir}${INIT_DEFAULT_PATH_JRE}
JAVA_NAME=$(get_rand_str)
- BIN_PATH=${test_dir}${INIT_BIN_PATH}
- mkdir -p ${BIN_PATH}
- WRAPPER_PATH=${test_dir}${INIT_WRAPPER_PATH}
- mkdir -p $(dirname ${WRAPPER_PATH})
- touch ${WRAPPER_PATH}
- chmod +x ${WRAPPER_PATH}
+ mkdir -p ${JVM_DIR}
}
tearDown() {
@@ -64,13 +57,7 @@ create_valid_jdk_env() {
set_default_for_test() {
ln -s $1 ${DEFAULT_PATH}
- for binary in java keytool orbd; do
- ln -s ${WRAPPER_PATH} ${BIN_PATH}/${binary}
- done
if [ -d ${DEFAULT_PATH}/jre ]; then
- for binary in javac javah jhat; do
- ln -s ${WRAPPER_PATH} ${BIN_PATH}/${binary}
- done
ln -s $1/jre ${DEFAULT_PATH_JRE}
else
ln -s $1 ${DEFAULT_PATH_JRE}
@@ -80,8 +67,6 @@ set_default_for_test() {
assertDefaultNotSet() {
assertNull 'Default is set' "$(readlink ${DEFAULT_PATH})"
assertNull 'Default runtime is set' "$(readlink ${DEFAULT_PATH_JRE})"
- assertNull "PATH has a java binary" "$(readlink ${BIN_PATH}/java)"
- assertNull "PATH has a javac binary" "$(readlink ${BIN_PATH}/javac)"
}
assertDefaultSetTo() {
@@ -90,17 +75,6 @@ assertDefaultSetTo() {
if [ ${new_java} == */jre ]; then
assertEquals "Default runtime points at wrong Java env" "${new_java}/jre" "$(readlink ${DEFAULT_PATH_JRE})"
fi
- # For all links in /usr/bin that point at the wrapper
- for lpath in $(find -L ${BIN_PATH} -samefile ${WRAPPER_PATH}); do
- # There is a binary in the JVM bin dir
- assertTrue 'Wrong /usr/bin link' "test -x ${JVM_DIR}/${new_java}/bin/$(basename ${lpath})"
- done
- # For all executable binaries provided by the Java env
- for binary in $(find ${JVM_DIR}/${new_java}/bin -type f -perm /a=x); do
- # There is a link in /usr/bin
- bin_link=${BIN_PATH}/$(basename ${binary})
- assertEquals 'No link in /usr/bin' "${WRAPPER_PATH}" "$(readlink ${bin_link})"
- done
}
# do_status
@@ -155,6 +129,11 @@ test_do_get_without_default() {
assertNull 'Wrong result' "$(do_get)"
}
+test_do_get_without_default() {
+ set_default_for_test "/dev/null"
+ assertNull 'Wrong result' "$(do_get)"
+}
+
# do_set
test_do_set_new_invalid() {
@@ -174,15 +153,6 @@ test_do_set_current_invalid() {
assertDefaultSetTo "${JAVA_NAME}"
}
-test_do_set_same_java_missing_bin_link() {
- create_valid_jdk_env "${JAVA_NAME}"
- set_default_for_test "${JAVA_NAME}"
- unlink ${BIN_PATH}/java
- $(do_set "${JAVA_NAME}")
- assertEquals 'Wrong status returned' 0 $?
- assertDefaultSetTo "${JAVA_NAME}"
-}
-
test_do_set_with_default_already_set() {
create_valid_jre_env "${JAVA_NAME}/jre"
set_default_for_test "${JAVA_NAME}/jre"
@@ -219,6 +189,14 @@ test_do_set_cleanup_old_java_default() {
assertDefaultSetTo "${JAVA_NAME}/jre"
}
+test_do_set_devnull() {
+ create_valid_jdk_env "${JAVA_NAME}"
+ set_default_for_test "/dev/null"
+ output=$(do_set "${JAVA_NAME}/jre")
+ assertEquals 'Wrong status returned' 0 $?
+ assertDefaultSetTo "${JAVA_NAME}/jre"
+}
+
# do_unset
test_do_unset_default_not_target() {
@@ -236,6 +214,12 @@ test_do_unset_no_default_link() {
assertDefaultNotSet
}
+test_do_unset_devnull() {
+ set_default_for_test "/dev/null"
+ do_unset
+ assertDefaultNotSet
+}
+
# do_fix
test_do_fix_default_valid() {
@@ -291,14 +275,11 @@ test_do_fix_jdk_but_jre_exists() {
assertDefaultSetTo "${JAVA_NAME}/jre"
}
-test_do_fix_cleanup_old_java_default() {
- create_valid_jre_env "${JAVA_NAME}/jre"
- set_default_for_test "${JAVA_NAME}/jre"
- # Simulate installation of a jre over a jre-headless
- ln -s ${WRAPPER_PATH} ${BIN_PATH}/policytool
- output=$(do_fix "${JAVA_NAME}/jre")
- assertEquals 'Wrong status returned' 0 $?
- assertDefaultSetTo "${JAVA_NAME}/jre"
+test_do_fix_devnull() {
+ create_valid_jdk_env "${JAVA_NAME}"
+ set_default_for_test "/dev/null"
+ do_fix
+ assertDefaultSetTo "${JAVA_NAME}"
}
# load shunit2