diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-01-09 12:49:46 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-01-09 12:49:46 +0100 |
| commit | d0f4399d9d20879c903d0925e81e61968bbaed7d (patch) | |
| tree | 915cd0c3772b471674a20a26188d7f022f8c74c2 /DistUpgrade | |
| parent | 2deb9251afd7896a3206a94a0fba393657a85891 (diff) | |
| download | python-apt-d0f4399d9d20879c903d0925e81e61968bbaed7d.tar.gz | |
* fix the BrokenFix() code, add try: except around the Dist-Upgrade code
Diffstat (limited to 'DistUpgrade')
| -rw-r--r-- | DistUpgrade/DistUpgradeControler.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index 8e588132..8f0ac128 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -59,8 +59,7 @@ class MyCache(apt.Cache): def fixBroken(self): """ try to fix broken dependencies on the system, may throw SystemError when it can't""" - resolver = apt_pkg.GetPkgProblemResolver(self._depcache) - resolver.Resolve() + return self._depcache.FixBroken() class DistUpgradeControler(object): def __init__(self, distUpgradeView): @@ -83,6 +82,7 @@ class DistUpgradeControler(object): def sanityCheck(self): if self.cache.isBroken: try: + print "Have broken pkgs, trying to fix them" self.cache.fixBroken() except SystemError: self._view.error(_("Broken packages"), @@ -112,7 +112,7 @@ class DistUpgradeControler(object): for key in metapkgs: deps_found = True for pkg in metapkgs[key]: - deps_found |= self.cache[pkg].isInstalled + deps_found &= self.cache.has_key(pkg) and self.cache[pkg].isInstalled if deps_found: print "guessing '%s' as missing meta-pkg" % key try: @@ -253,10 +253,18 @@ class DistUpgradeControler(object): self.cache.update(progress) def askDistUpgrade(self): - # add missing pkgs (like {ubuntu,kubuntu,edubuntu}-desktop) - for pkg in self.missingPkgs: - self.cache[pkg].markInstall() - self.cache.upgrade(True) + try: + # first upgrade (and make sure this way that the cache is ok) + self.cache.upgrade(True) + # then add missing pkgs (like {ubuntu,kubuntu,edubuntu}-desktop) + for pkg in self.missingPkgs: + self.cache[pkg].markInstall() + except SystemError: + # FIXME: change the text to something more useful + return self._view.error(_("Could not calculate the upgrade"), + _("A unresolvable problem occured while " + "calculating the upgrade. Please report " + "this as a bug. ") changes = self.cache.getChanges() res = self._view.confirmChanges(changes,self.cache.requiredDownload) return res |
