--- package.py.orig 2010-04-14 17:57:15.000000000 +0200 +++ package.py 2010-05-16 14:37:28.464295086 +0200 @@ -1019,21 +1019,15 @@ # sources.list # otherwise we fall back to the binary version number src_records = apt_pkg.SourceRecords() - src_rec = src_records.lookup(src_pkg) - if src_rec: - src_ver = src_records.version - #if apt_pkg.VersionCompare(binver, srcver) > 0: - # srcver = binver - if not src_ver: - src_ver = bin_ver - #print "srcver: %s" % src_ver - section = src_records.section - #print "srcsect: %s" % section - else: - # fail into the error handler - raise SystemError except SystemError: - src_ver = bin_ver + pass + else: + while src_records.lookup(src_pkg): + if not src_records.version or \ + apt_pkg.version_compare(bin_ver, src_records.version) > 0: + continue + section = src_records.section + src_ver = src_records.version section_split = section.split("/", 1) if len(section_split) > 1: