summaryrefslogtreecommitdiff
path: root/tests/pkgproblemresolver.py
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2009-01-13 17:22:27 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2009-01-13 17:22:27 +0100
commit38d602dc83006c51dfe4ed594d691ea9b0679498 (patch)
treeb7aedfba82c44cad6c3012f879b5d6d7e8ad1425 /tests/pkgproblemresolver.py
parent12cf58d12b969010f3d98b2974d72bbb950b775f (diff)
parent614897f798d9f16591fbd29ebe2a6c5674102d2d (diff)
downloadpython-apt-38d602dc83006c51dfe4ed594d691ea9b0679498.tar.gz
* apt/*.py:
- Almost complete cleanup of the code - Remove inconsistent use of tabs and spaces (Closes: #505443) - Improved documentation * apt/debfile.py: - Drop get*() methods, as they are deprecated and were never in a stable release - Make DscSrcPackage working * apt/gtk/widgets.py: - Fix the code and document the signals * Introduce new documentation build with Sphinx - Contains style Guide (Closes: #481562) - debian/rules: Build the documentation here - setup.py: Remove pydoc building and add new docs. - debian/examples: Include examples from documentation - debian/python-apt.docs: + Change html/ to build/doc/html. + Add build/doc/text for the text-only documentation * setup.py: - Only create build/data when building, not all the time - Remove build/mo and build/data on clean -a * debian/control: - Remove the Conflicts on python2.3-apt, python2.4-apt, as they are only needed for oldstable (sarge) - Build-Depend on python-sphinx (>= 0.5) * aptsources/distinfo.py: - Allow @ in mirror urls (Closes: #478171) (LP: #223097) * Merge Ben Finney's whitespace changes (Closes: #481563) * Merge Ben Finney's do not use has_key() (Closes: #481878) * Do not use deprecated form of raise statement (Closes: #494259) * Add support for PkgRecords.SHA256Hash (Closes: #456113)
Diffstat (limited to 'tests/pkgproblemresolver.py')
-rw-r--r--tests/pkgproblemresolver.py113
1 files changed, 57 insertions, 56 deletions
diff --git a/tests/pkgproblemresolver.py b/tests/pkgproblemresolver.py
index 27747e43..a21d8d9d 100644
--- a/tests/pkgproblemresolver.py
+++ b/tests/pkgproblemresolver.py
@@ -1,69 +1,70 @@
#!/usr/bin/env python2.4
#
# Test for the DepCache code
-#
+#
import apt_pkg
import sys
+
def main():
- apt_pkg.init()
- cache = apt_pkg.GetCache()
- depcache = apt_pkg.GetDepCache(cache)
- depcache.Init()
- i=0
- all=cache.PackageCount
- print "Running DepCache test on all packages"
- print "(trying to install each and then mark it keep again):"
- # first, get all pkgs
- for pkg in cache.Packages:
- i += 1
- x = pkg.Name
- # then get each version
- ver =depcache.GetCandidateVer(pkg)
- if ver != None:
- depcache.MarkInstall(pkg)
- if depcache.BrokenCount > 0:
- fixer = apt_pkg.GetPkgProblemResolver(depcache)
- fixer.Clear(pkg)
- fixer.Protect(pkg)
- # we first try to resolve the problem
- # with the package that should be installed
- # protected
- try:
- fixer.Resolve(True)
- except SystemError:
- # the pkg seems to be broken, the
- # returns a exception
- fixer.Clear(pkg)
- fixer.Resolve(True)
- if not depcache.MarkedInstall(pkg):
- print "broken in archive: %s " % pkg.Name
- fixer = None
- if depcache.InstCount == 0:
- if depcache.IsUpgradable(pkg):
- print "Error marking %s for install" % x
- for p in cache.Packages:
- if depcache.MarkedInstall(p) or depcache.MarkedUpgrade(p):
- depcache.MarkKeep(p)
- if depcache.InstCount != 0:
- print "Error undoing the selection for %s" % x
- print "\r%i/%i=%.3f%% " % (i,all,(float(i)/float(all)*100)),
+ apt_pkg.init()
+ cache = apt_pkg.GetCache()
+ depcache = apt_pkg.GetDepCache(cache)
+ depcache.Init()
+ i=0
+ all=cache.PackageCount
+ print "Running DepCache test on all packages"
+ print "(trying to install each and then mark it keep again):"
+ # first, get all pkgs
+ for pkg in cache.Packages:
+ i += 1
+ x = pkg.Name
+ # then get each version
+ ver =depcache.GetCandidateVer(pkg)
+ if ver is not None:
+ depcache.MarkInstall(pkg)
+ if depcache.BrokenCount > 0:
+ fixer = apt_pkg.GetPkgProblemResolver(depcache)
+ fixer.Clear(pkg)
+ fixer.Protect(pkg)
+ # we first try to resolve the problem
+ # with the package that should be installed
+ # protected
+ try:
+ fixer.Resolve(True)
+ except SystemError:
+ # the pkg seems to be broken, the
+ # returns a exception
+ fixer.Clear(pkg)
+ fixer.Resolve(True)
+ if not depcache.MarkedInstall(pkg):
+ print "broken in archive: %s " % pkg.Name
+ fixer = None
+ if depcache.InstCount == 0:
+ if depcache.IsUpgradable(pkg):
+ print "Error marking %s for install" % x
+ for p in cache.Packages:
+ if depcache.MarkedInstall(p) or depcache.MarkedUpgrade(p):
+ depcache.MarkKeep(p)
+ if depcache.InstCount != 0:
+ print "Error undoing the selection for %s" % x
+ print "\r%i/%i=%.3f%% " % (i, all, (float(i) / float(all) * 100)),
- print
- print "Trying Upgrade:"
- depcache.Upgrade()
- print "To install: %s " % depcache.InstCount
- print "To remove: %s " % depcache.DelCount
- print "Kept back: %s " % depcache.KeepCount
+ print
+ print "Trying Upgrade:"
+ depcache.Upgrade()
+ print "To install: %s " % depcache.InstCount
+ print "To remove: %s " % depcache.DelCount
+ print "Kept back: %s " % depcache.KeepCount
- print "Trying DistUpgrade:"
- depcache.Upgrade(True)
- print "To install: %s " % depcache.InstCount
- print "To remove: %s " % depcache.DelCount
- print "Kept back: %s " % depcache.KeepCount
+ print "Trying DistUpgrade:"
+ depcache.Upgrade(True)
+ print "To install: %s " % depcache.InstCount
+ print "To remove: %s " % depcache.DelCount
+ print "Kept back: %s " % depcache.KeepCount
if __name__ == "__main__":
- main()
- sys.exit(0)
+ main()
+ sys.exit(0)