1 |
commit: b444f958864524357c7462ff7267af429d7e23aa |
2 |
Author: James Le Cuirot <chewi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Oct 24 21:08:23 2018 +0000 |
4 |
Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Oct 24 21:08:23 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/java-config.git/commit/?id=b444f958 |
7 |
|
8 |
Drop deprecated features to set system and user VMs |
9 |
|
10 |
This is done with eselect java-vm now. |
11 |
|
12 |
man/java-config-2.1 | 28 ++--------------- |
13 |
src/java-config-2 | 53 +-------------------------------- |
14 |
src/java_config_2/EnvironmentManager.py | 18 ----------- |
15 |
3 files changed, 4 insertions(+), 95 deletions(-) |
16 |
|
17 |
diff --git a/man/java-config-2.1 b/man/java-config-2.1 |
18 |
index 9518e70..e5c2785 100644 |
19 |
--- a/man/java-config-2.1 |
20 |
+++ b/man/java-config-2.1 |
21 |
@@ -8,8 +8,7 @@ java-config - The Java configuration tool for Gentoo |
22 |
.PP |
23 |
.I java-config |
24 |
Is used to query/set properties of your system's Java environment. It can be |
25 |
-used to list available VMs, java packages, set system default JVM and set user |
26 |
-default JVM. |
27 |
+used to list available VMs and java packages. |
28 |
.PP |
29 |
In addition, it is used by Portage as a common interface to querying |
30 |
properties about the various JVMs. |
31 |
@@ -61,21 +60,10 @@ List available Java packages. Used for selection by |
32 |
.I --classpath |
33 |
.TP |
34 |
\fB-L, --list-available-vms\fI |
35 |
-Lists available JVMs. Used with |
36 |
-.I --set-system-vm |
37 |
-and |
38 |
-.I -set-user-vm |
39 |
-. |
40 |
-.TP |
41 |
-\fB-S <vm-id>, --set-system-vm=<vm-id>\fI |
42 |
-Sets the system-wide default JVM. |
43 |
-.TP |
44 |
-\fB-s <vm-id>, --set-user-vm=<vm-id>\fI |
45 |
-Sets the user-specific JVM by putting all necessary env vars into |
46 |
-.I $HOME/.gentoo/java-env . |
47 |
+Lists available JVMs. |
48 |
.TP |
49 |
\fB-f, --show-active-vm\fI |
50 |
-Show the JVM that's currently active, as set via --set-system-vm or --set-user-vm. |
51 |
+Show the JVM that's currently active, as set by eselect java-vm. |
52 |
.TP |
53 |
\fB-n, --nocolor\fI |
54 |
Turn off all colors. |
55 |
@@ -98,16 +86,6 @@ Value to retieve from packages package.env file, specified by --package. |
56 |
\fB--get-virtual-providers=PACKAGE(S)\fI |
57 |
Return a list of packages that provide a virtual. |
58 |
|
59 |
-.SH "NOTES" |
60 |
-You can get the <vm-id> that is used with |
61 |
-.I --set-system-vm=<vm-id> |
62 |
-and |
63 |
-.I --set-user-vm=<vm-id> |
64 |
-in the output of |
65 |
-.I java-config --list-available-vms |
66 |
-inside the brackets. Ex. [blackdown-jdk-1.4.1] and you can use this to |
67 |
-set your default Java Virtual Machine. |
68 |
- |
69 |
.SH "MAINTAINER" |
70 |
java@g.o |
71 |
.SH "AUTHORS" |
72 |
|
73 |
diff --git a/src/java-config-2 b/src/java-config-2 |
74 |
index bf7c48d..d542d66 100755 |
75 |
--- a/src/java-config-2 |
76 |
+++ b/src/java-config-2 |
77 |
@@ -1,7 +1,7 @@ |
78 |
#!/@GENTOO_PORTAGE_EPREFIX@usr/bin/python -E |
79 |
# -*- coding: UTF-8 -*- |
80 |
|
81 |
-# Copyright 2004-2013 Gentoo Foundation |
82 |
+# Copyright 2004-2018 Gentoo Authors |
83 |
# Distributed under the terms of the GNU General Public License v2 |
84 |
|
85 |
from java_config_2.OutputFormatter import OutputFormatter |
86 |
@@ -170,40 +170,6 @@ def print_environment(option, opt, value, parser): |
87 |
fatalError("Could not find a vm matching: %s" % value) |
88 |
manager.create_env_entry(vm, printer, "%s=%s") |
89 |
|
90 |
-def set_system_vm(option, opt, value, parser): |
91 |
- deprecation_notice() |
92 |
- vm = manager.get_vm(value) |
93 |
- if not vm: |
94 |
- fatalError("Could not find a vm matching: %s" % value) |
95 |
- try: |
96 |
- manager.set_system_vm(vm) |
97 |
- printer._print("Now using %s as your generation-2 system JVM" % (vm) ) |
98 |
- if vm.is_build_only(): |
99 |
- printer._printWarning("%s is marked as a build-only JVM. Using this vm is not recommended. " % (vm)) |
100 |
- except PermissionError: |
101 |
- fatalError("You do not have enough permissions to set the system VM!") |
102 |
- except EnvironmentUndefinedError: |
103 |
- fatalError("The selected VM is missing critical environment variables.") |
104 |
- except InvalidConfigError as e: |
105 |
- fatalError("Target file already exists and is not a symlink: %s" % e.file) |
106 |
- |
107 |
-def set_user_vm(option, opt, value, parser): |
108 |
- deprecation_notice() |
109 |
- vm = manager.get_vm(value) |
110 |
- if not vm: |
111 |
- fatalError("Could not find a vm matching: %s" % value) |
112 |
- if os.getuid() is 0: |
113 |
- fatalError("The user 'root' should always use the System VM") |
114 |
- try: |
115 |
- manager.set_user_vm(vm) |
116 |
- printer._print("Now using %s as your user JVM" % (vm)) |
117 |
- if vm.is_build_only(): |
118 |
- printer._printWarning("%s is marked as a build-only JVM. Using this vm is not recommended. " % (vm)) |
119 |
- except PermissionError: |
120 |
- fatalError("You do not have enough permissions to set the VM!") |
121 |
- except InvalidConfigError as e: |
122 |
- fatalError("Target file already exists and is not a symlink: %s" % e.file) |
123 |
- |
124 |
def select_vm(option, opt, value, parser): |
125 |
if not value: return |
126 |
vm = manager.get_vm(value) |
127 |
@@ -211,9 +177,6 @@ def select_vm(option, opt, value, parser): |
128 |
fatalError("The vm could not be found") |
129 |
manager.set_active_vm(manager.get_vm(value)) |
130 |
|
131 |
-def deprecation_notice(): |
132 |
- printer._printWarning("Setting user and system vm using java-config is deprecated, use eselect java-vm instead.") |
133 |
- |
134 |
def fatalError(msg): |
135 |
printer._printError(msg) |
136 |
sys.exit(1) |
137 |
@@ -318,20 +281,6 @@ Please contact the Gentoo Java Herd <java@g.o> with problems.""" |
138 |
help="Return a list of packages that provide a virtual") |
139 |
parser.add_option_group(group) |
140 |
|
141 |
- # Deprecated |
142 |
- group = OptionGroup(parser, "Deprecated", |
143 |
- "Use eselect java-vm instead. Report usability issues " |
144 |
- "so they can be taken care of.") |
145 |
- group.add_option("-S", "--set-system-vm", |
146 |
- action="callback", callback=set_system_vm, |
147 |
- type="string", dest="vm", |
148 |
- help="Set the default Java VM for the system") |
149 |
- group.add_option("-s", "--set-user-vm", |
150 |
- action="callback", callback=set_user_vm, |
151 |
- type="string", dest="vm", |
152 |
- help="Set the default Java VM for the user") |
153 |
- parser.add_option_group(group) |
154 |
- |
155 |
if len(sys.argv) < 2: |
156 |
parser.print_help() |
157 |
else: |
158 |
|
159 |
diff --git a/src/java_config_2/EnvironmentManager.py b/src/java_config_2/EnvironmentManager.py |
160 |
index def2b7f..9e64e4e 100644 |
161 |
--- a/src/java_config_2/EnvironmentManager.py |
162 |
+++ b/src/java_config_2/EnvironmentManager.py |
163 |
@@ -228,24 +228,6 @@ class EnvironmentManager(object): |
164 |
except EnvironmentUndefinedError: |
165 |
raise EnvironmentUndefinedError |
166 |
|
167 |
- def set_user_vm(self, vm): |
168 |
- self.set_vm(vm, self.user_vm_link()) |
169 |
- |
170 |
- def set_system_vm(self, vm): |
171 |
- self.set_vm(vm, self.system_vm_link()) |
172 |
- |
173 |
- def set_vm(self, vm, target): |
174 |
- sym_dir = dirname(target) |
175 |
- if not os.path.isdir(sym_dir): |
176 |
- os.makedirs(sym_dir) |
177 |
- |
178 |
- if os.path.islink(target): |
179 |
- os.remove(target) |
180 |
- elif os.path.exists(target): |
181 |
- raise InvalidConfigError(target) |
182 |
- |
183 |
- os.symlink(self.eroot + '/usr/lib/jvm/'+vm.name(),target) |
184 |
- |
185 |
def vm_links(self): |
186 |
# Don't try to use user-vm if HOME is undefined |
187 |
if os.environ.get('HOME') == None: |