aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Le Cuirot <chewi@gentoo.org>2018-10-24 22:08:23 +0100
committerJames Le Cuirot <chewi@gentoo.org>2018-10-24 22:08:23 +0100
commitb444f958864524357c7462ff7267af429d7e23aa (patch)
treebddf3abf18b39a74ff47b04800d86ccd8fb6a003
parentremove whitespace (diff)
downloadjava-config-master.tar.gz
java-config-master.tar.bz2
java-config-master.zip
Drop deprecated features to set system and user VMsHEADmaster
This is done with eselect java-vm now.
-rw-r--r--man/java-config-2.128
-rwxr-xr-xsrc/java-config-253
-rw-r--r--src/java_config_2/EnvironmentManager.py18
3 files changed, 4 insertions, 95 deletions
diff --git a/man/java-config-2.1 b/man/java-config-2.1
index 9518e70..e5c2785 100644
--- a/man/java-config-2.1
+++ b/man/java-config-2.1
@@ -8,8 +8,7 @@ java-config - The Java configuration tool for Gentoo
.PP
.I java-config
Is used to query/set properties of your system's Java environment. It can be
-used to list available VMs, java packages, set system default JVM and set user
-default JVM.
+used to list available VMs and java packages.
.PP
In addition, it is used by Portage as a common interface to querying
properties about the various JVMs.
@@ -61,21 +60,10 @@ List available Java packages. Used for selection by
.I --classpath
.TP
\fB-L, --list-available-vms\fI
-Lists available JVMs. Used with
-.I --set-system-vm
-and
-.I -set-user-vm
-.
-.TP
-\fB-S <vm-id>, --set-system-vm=<vm-id>\fI
-Sets the system-wide default JVM.
-.TP
-\fB-s <vm-id>, --set-user-vm=<vm-id>\fI
-Sets the user-specific JVM by putting all necessary env vars into
-.I $HOME/.gentoo/java-env .
+Lists available JVMs.
.TP
\fB-f, --show-active-vm\fI
-Show the JVM that's currently active, as set via --set-system-vm or --set-user-vm.
+Show the JVM that's currently active, as set by eselect java-vm.
.TP
\fB-n, --nocolor\fI
Turn off all colors.
@@ -98,16 +86,6 @@ Value to retieve from packages package.env file, specified by --package.
\fB--get-virtual-providers=PACKAGE(S)\fI
Return a list of packages that provide a virtual.
-.SH "NOTES"
-You can get the <vm-id> that is used with
-.I --set-system-vm=<vm-id>
-and
-.I --set-user-vm=<vm-id>
-in the output of
-.I java-config --list-available-vms
-inside the brackets. Ex. [blackdown-jdk-1.4.1] and you can use this to
-set your default Java Virtual Machine.
-
.SH "MAINTAINER"
java@gentoo.org
.SH "AUTHORS"
diff --git a/src/java-config-2 b/src/java-config-2
index bf7c48d..d542d66 100755
--- a/src/java-config-2
+++ b/src/java-config-2
@@ -1,7 +1,7 @@
#!/@GENTOO_PORTAGE_EPREFIX@usr/bin/python -E
# -*- coding: UTF-8 -*-
-# Copyright 2004-2013 Gentoo Foundation
+# Copyright 2004-2018 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
from java_config_2.OutputFormatter import OutputFormatter
@@ -170,40 +170,6 @@ def print_environment(option, opt, value, parser):
fatalError("Could not find a vm matching: %s" % value)
manager.create_env_entry(vm, printer, "%s=%s")
-def set_system_vm(option, opt, value, parser):
- deprecation_notice()
- vm = manager.get_vm(value)
- if not vm:
- fatalError("Could not find a vm matching: %s" % value)
- try:
- manager.set_system_vm(vm)
- printer._print("Now using %s as your generation-2 system JVM" % (vm) )
- if vm.is_build_only():
- printer._printWarning("%s is marked as a build-only JVM. Using this vm is not recommended. " % (vm))
- except PermissionError:
- fatalError("You do not have enough permissions to set the system VM!")
- except EnvironmentUndefinedError:
- fatalError("The selected VM is missing critical environment variables.")
- except InvalidConfigError as e:
- fatalError("Target file already exists and is not a symlink: %s" % e.file)
-
-def set_user_vm(option, opt, value, parser):
- deprecation_notice()
- vm = manager.get_vm(value)
- if not vm:
- fatalError("Could not find a vm matching: %s" % value)
- if os.getuid() is 0:
- fatalError("The user 'root' should always use the System VM")
- try:
- manager.set_user_vm(vm)
- printer._print("Now using %s as your user JVM" % (vm))
- if vm.is_build_only():
- printer._printWarning("%s is marked as a build-only JVM. Using this vm is not recommended. " % (vm))
- except PermissionError:
- fatalError("You do not have enough permissions to set the VM!")
- except InvalidConfigError as e:
- fatalError("Target file already exists and is not a symlink: %s" % e.file)
-
def select_vm(option, opt, value, parser):
if not value: return
vm = manager.get_vm(value)
@@ -211,9 +177,6 @@ def select_vm(option, opt, value, parser):
fatalError("The vm could not be found")
manager.set_active_vm(manager.get_vm(value))
-def deprecation_notice():
- printer._printWarning("Setting user and system vm using java-config is deprecated, use eselect java-vm instead.")
-
def fatalError(msg):
printer._printError(msg)
sys.exit(1)
@@ -318,20 +281,6 @@ Please contact the Gentoo Java Herd <java@gentoo.org> with problems."""
help="Return a list of packages that provide a virtual")
parser.add_option_group(group)
- # Deprecated
- group = OptionGroup(parser, "Deprecated",
- "Use eselect java-vm instead. Report usability issues "
- "so they can be taken care of.")
- group.add_option("-S", "--set-system-vm",
- action="callback", callback=set_system_vm,
- type="string", dest="vm",
- help="Set the default Java VM for the system")
- group.add_option("-s", "--set-user-vm",
- action="callback", callback=set_user_vm,
- type="string", dest="vm",
- help="Set the default Java VM for the user")
- parser.add_option_group(group)
-
if len(sys.argv) < 2:
parser.print_help()
else:
diff --git a/src/java_config_2/EnvironmentManager.py b/src/java_config_2/EnvironmentManager.py
index def2b7f..9e64e4e 100644
--- a/src/java_config_2/EnvironmentManager.py
+++ b/src/java_config_2/EnvironmentManager.py
@@ -228,24 +228,6 @@ class EnvironmentManager(object):
except EnvironmentUndefinedError:
raise EnvironmentUndefinedError
- def set_user_vm(self, vm):
- self.set_vm(vm, self.user_vm_link())
-
- def set_system_vm(self, vm):
- self.set_vm(vm, self.system_vm_link())
-
- def set_vm(self, vm, target):
- sym_dir = dirname(target)
- if not os.path.isdir(sym_dir):
- os.makedirs(sym_dir)
-
- if os.path.islink(target):
- os.remove(target)
- elif os.path.exists(target):
- raise InvalidConfigError(target)
-
- os.symlink(self.eroot + '/usr/lib/jvm/'+vm.name(),target)
-
def vm_links(self):
# Don't try to use user-vm if HOME is undefined
if os.environ.get('HOME') == None: