diff options
author | Alistair Bush <ali_bush@gentoo.org> | 2009-12-03 11:17:55 +0000 |
---|---|---|
committer | Alistair Bush <ali_bush@gentoo.org> | 2009-12-03 11:17:55 +0000 |
commit | 29b701eddc640066c02bcb4c97332a54358c49d9 (patch) | |
tree | 2122a1864a76a844de0807f8e521dccb40c3f937 | |
parent | Add check for when name is None or ''. This case means we have no preference (diff) | |
download | java-config-29b701eddc640066c02bcb4c97332a54358c49d9.tar.gz java-config-29b701eddc640066c02bcb4c97332a54358c49d9.tar.bz2 java-config-29b701eddc640066c02bcb4c97332a54358c49d9.zip |
Improve error messaging when we can't find a vm.
svn path=/projects/java-config-2/trunk/; revision=8000
-rw-r--r-- | src/java_config_2/VersionManager.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/java_config_2/VersionManager.py b/src/java_config_2/VersionManager.py index b6a2c15..6a9c08f 100644 --- a/src/java_config_2/VersionManager.py +++ b/src/java_config_2/VersionManager.py @@ -52,13 +52,8 @@ class VersionManager: if len(matches) > 0: for match in matches: - #if highest_pkg_target and self.version_cmp(match[2], highest_pkg_target) < 0: - # continue matched_atoms.append({'equality':match[0], 'type':match[1], 'version':match[2]}) - #if len(matched_atoms) == 0 and pkg_name and highest_pkg_target: - # raise Exception("Couldn't find a suitable VM due to dependency %s having a required target of %s" % (pkg_name, highest_pkg_target)) - matched_atoms.sort() matched_atoms.reverse() @@ -231,7 +226,19 @@ class VersionManager: else: return gvm # nothing found - raise Exception("Couldn't find suitable VM. Possible invalid dependency string.") + error = "Couldn't find suitable VM. Possible invalid dependency string." + if pkg_name or need_virtual: + error += "\nDue to " + if pkg_name and highest_pkg_target: + error += pkg_name + " requiring a target of " + highest_pkg_target + " but the virtual machines constrained by " + for atom in matched_atoms: + error += atom['equality'] + "virtual/" + atom['type'] + "-" + atom['version'] + ' ' + if need_virtual: + error += " and/or\n" + if need_virtual: + error += "this package requiring virtual(s) " + need_virtual + + raise Exception(error) def find_vm(self, vmProviderString, atom, min_package_target, allow_build_only = True): |