summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog7
-rwxr-xr-xdoc/examples/build-deps.py23
2 files changed, 23 insertions, 7 deletions
diff --git a/debian/changelog b/debian/changelog
index c57dcc9f..33bc5d25 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+python-apt (0.6.14) unstable; urgency=low
+
+ * doc/examples/build-deps.py:
+ - fixed/improved (thanks to Martin Michlmayr, closes: #321507)
+
+ --
+
python-apt (0.6.13) unstable; urgency=low
* support for depcache added
diff --git a/doc/examples/build-deps.py b/doc/examples/build-deps.py
index c00e60e6..c8e8d6af 100755
--- a/doc/examples/build-deps.py
+++ b/doc/examples/build-deps.py
@@ -2,11 +2,12 @@
import apt_pkg
import sys
-
+import sets # only needed for python2.3, python2.4 supports this naively
def get_source_pkg(pkg, records, depcache):
- # FIXME: use candidate version here
version = depcache.GetCandidateVer(pkg)
+ if not version:
+ return None
file, index = version.FileList.pop(0)
records.Lookup((file, index))
if records.SourcePkg != "":
@@ -21,18 +22,26 @@ cache = apt_pkg.GetCache()
depcache = apt_pkg.GetDepCache(cache)
depcache.Init()
records = apt_pkg.GetPkgRecords(cache)
-srcrecords = apt_pkg.GetPkgSrcRecords()
+srcrecords = apt_pkg.GetPkgSrcRecords(cache)
# base package that we use for build-depends calculation
if len(sys.argv) < 2:
- print "need a pkgname as argument"
-base = cache[sys.argv[1]]
-all_build_depends = set()
+ print "need a package name as argument"
+ sys.exit(1)
+try:
+ base = cache[sys.argv[1]]
+except KeyError:
+ print "No package %s found" % sys.argv[1]
+ sys.exit(1)
+all_build_depends = sets.Set()
-depends = base.CurrentVer.DependsList
+depends = depcache.GetCandidateVer(base).DependsList
for dep in depends["Depends"]:
pkg = dep[0].TargetPkg
srcpkg_name = get_source_pkg(pkg, records, depcache)
+ if not srcpkg_name:
+ print "Can't find source package for '%s'" % pkg.Name
+ continue
srcrec = srcrecords.Lookup(srcpkg_name)
if srcrec:
#print srcrecords.Package