diff options
author | Vlastimil Babka <caster@gentoo.org> | 2010-04-20 20:30:55 +0000 |
---|---|---|
committer | Vlastimil Babka <caster@gentoo.org> | 2010-04-20 20:30:55 +0000 |
commit | bdea532f1b4c72ebd369a4560864771bbdc25ccb (patch) | |
tree | 6202c26fd6754c6537e8a0de50d20933a00f176f | |
parent | Support for package name globbing, bug #315123. (diff) | |
download | java-config-bdea532f1b4c72ebd369a4560864771bbdc25ccb.tar.gz java-config-bdea532f1b4c72ebd369a4560864771bbdc25ccb.tar.bz2 java-config-bdea532f1b4c72ebd369a4560864771bbdc25ccb.zip |
Try system-vm as a build VM before falling back to jdk-defaults.conf - bug #315039.
svn path=/projects/java-config-2/trunk/; revision=8167
-rw-r--r-- | src/java_config_2/EnvironmentManager.py | 7 | ||||
-rw-r--r-- | src/java_config_2/VersionManager.py | 19 |
2 files changed, 22 insertions, 4 deletions
diff --git a/src/java_config_2/EnvironmentManager.py b/src/java_config_2/EnvironmentManager.py index c460f59..c9b778f 100644 --- a/src/java_config_2/EnvironmentManager.py +++ b/src/java_config_2/EnvironmentManager.py @@ -260,6 +260,13 @@ class EnvironmentManager(object): def system_vm_link(self): return '/etc/java-config-2/current-system-vm' + def system_vm_name(self): + link = self.system_vm_link() + if os.path.islink(link): + return basename(os.readlink(link)) + else: + return None + def clean_classpath(self, targets): for target in targets: if os.path.isfile(target['file']): diff --git a/src/java_config_2/VersionManager.py b/src/java_config_2/VersionManager.py index 82aa4d4..3e568e0 100644 --- a/src/java_config_2/VersionManager.py +++ b/src/java_config_2/VersionManager.py @@ -54,20 +54,31 @@ class VersionManager: atom_parser = re.compile(r"([<>=]*)virtual/(jre|jdk)[-:]([0-9\.*]+)") virtuals_parser = re.compile(r"([<>=~]+)?java-virtuals/([\w\-\.:]+)") package_parser = re.compile(r"([\w\-]+)/([\w\-]+)(?:\:(\d+))?") - pref_files = ['/etc/java-config-2/build/jdk.conf', '/usr/share/java-config-2/config/jdk-defaults.conf'] + user_pref_file = '/etc/java-config-2/build/jdk.conf' + default_pref_file = '/usr/share/java-config-2/config/jdk-defaults.conf' _prefs = None def __init__(self): pass def get_prefs(self): + from java_config_2.EnvironmentManager import EnvironmentManager + envman = EnvironmentManager() + if self._prefs: return self._prefs else: self._prefs = [] - for file in self.pref_files: - if os.path.exists(file): - self._prefs += PrefsFileParser(file).get_config() + # first try the build preferences + if os.path.exists(self.user_pref_file): + self._prefs += PrefsFileParser(self.user_pref_file).get_config() + # then try system vm + sys_vm = envman.system_vm_name() + if sys_vm is not None: + self._prefs.append(['*', [sys_vm]]) + # then try the build defaults + if os.path.exists(self.default_pref_file): + self._prefs += PrefsFileParser(self.default_pref_file).get_config() return self._prefs def parse_depend(self, atoms): |