summaryrefslogtreecommitdiffstats
path: root/tests/old/pkgrecords.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/old/pkgrecords.py')
-rw-r--r--tests/old/pkgrecords.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/old/pkgrecords.py b/tests/old/pkgrecords.py
new file mode 100644
index 0000000..b6be005
--- /dev/null
+++ b/tests/old/pkgrecords.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python2.4
+#
+# Test for the PkgSrcRecords code
+# it segfaults for python-apt < 0.5.37
+#
+
+import sys
+
+import apt_pkg
+
+
+def main():
+ apt_pkg.init()
+ cache = apt_pkg.Cache()
+ depcache = apt_pkg.DepCache(cache)
+ depcache.init()
+ i = 0
+ print("Running PkgRecords test on all packages:")
+ for pkg in cache.packages:
+ i += 1
+ records = apt_pkg.PackageRecords(cache)
+ if len(pkg.version_list) == 0:
+ # print "no available version, cruft"
+ continue
+ version = depcache.get_candidate_ver(pkg)
+ if not version:
+ continue
+ file, index = version.file_list.pop(0)
+ if records.lookup((file, index)):
+ # print records.filename
+ records.filename
+ records.long_desc
+ print(
+ "\r%i/%i=%.3f%% "
+ % (i, cache.package_count, (float(i) / float(cache.package_count) * 100))
+ )
+
+
+if __name__ == "__main__":
+ main()
+ sys.exit(0)