java-vm-2.eclass: Replace java-config VM handling with eselect-java
authorJames Le Cuirot <chewi@gentoo.org>
Mon, 1 Jan 2018 11:31:41 +0000 (11:31 +0000)
committerJames Le Cuirot <chewi@gentoo.org>
Wed, 24 Oct 2018 21:06:51 +0000 (22:06 +0100)
The VM handling options are deprecated.

Closes: https://bugs.gentoo.org/368205
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
eclass/java-vm-2.eclass

index f6b50cfbd01a79ad0fba80fc4d387fd497ad0e2a..2ce5bce0e71be775f0cc2e3015663db68457bc9b 100644 (file)
@@ -74,17 +74,9 @@ java-vm-2_pkg_setup() {
 # invalid. Also update mime database.
 
 java-vm-2_pkg_postinst() {
-       # Note that we cannot rely on java-config here, as it will silently recognize
-       # e.g. icedtea6-bin as valid system VM if icedtea6 is set but invalid (e.g. due
-       # to the migration to icedtea-6)
-       if [[ ! -L "${EROOT}${JAVA_VM_SYSTEM}" ]]; then
-               java_set_default_vm_
-       else
-               local current_vm_path=$(readlink "${EROOT}${JAVA_VM_SYSTEM}")
-               local current_vm=$(basename "${ROOT}${current_vm_path}")
-               if [[ ! -L "${EROOT}${JAVA_VM_DIR}/${current_vm}" ]]; then
-                       java_set_default_vm_
-               fi
+       if [[ ! -d ${EROOT}${JAVA_VM_SYSTEM} ]]; then
+               eselect java-vm set system "${VMHANDLE}"
+               einfo "${P} set as the default system-vm."
        fi
 
        xdg_desktop_database_update
@@ -98,10 +90,10 @@ java-vm-2_pkg_postinst() {
 # Warn user if removing system-vm.
 
 java-vm-2_pkg_prerm() {
-       if [[ "$(GENTOO_VM="" java-config -f 2>/dev/null)" == "${VMHANDLE}" && -z "${REPLACED_BY_VERSION}" ]]; then
-               ewarn "It appears you are removing your system-vm!"
-               ewarn "Please run java-config -L to list available VMs,"
-               ewarn "then use java-config -S to set a new system-vm!"
+       if [[ $(GENTOO_VM= java-config -f 2>/dev/null) == ${VMHANDLE} && -z ${REPLACED_BY_VERSION} ]]; then
+               ewarn "It appears you are removing your system-vm! Please run"
+               ewarn "\"eselect java-vm list\" to list available VMs, then use"
+               ewarn "\"eselect java-vm set system\" to set a new system-vm!"
        fi
 }
 
@@ -117,18 +109,6 @@ java-vm-2_pkg_postrm() {
 }
 
 
-# @FUNCTION: java_set_default_vm_
-# @INTERNAL
-# @DESCRIPTION:
-# Set system-vm.
-
-java_set_default_vm_() {
-       java-config-2 --set-system-vm="${VMHANDLE}"
-
-       einfo " ${P} set as the default system-vm."
-}
-
-
 # @FUNCTION: get_system_arch
 # @DESCRIPTION:
 # Get Java specific arch name.