packagesdb - Refactor out get_rdep_dict() from calc_rrdep_counts().

Also, cache the dictionary for performance.
packagesdb - Use get_package() in get_rdep_dict() to resolve virtual pkgs.

Along with some associated cleanup.
lib/db: Package: rename count member variables

managing these will be moved to PackagesDB

Signed-off-by: Andreas Beckmann <anbe@debian.org>
packagesdb - Add routine to calc rdep metrics by package as needed.
packagesdb - Add rdep metric accessors at the PackagesDB level.
Use the on-demand versions of the rdep metric calls.
packagesdb - Remove the Package-level interface for rdep metrics.
lib/db: drop the now obsolete public compute_package_states()

Signed-off-by: Andreas Beckmann <anbe@debian.org>
piuparts-report.py - Avoid sorting passed files by block count.

There was still a case where a full accounting of rdep metrics was
called for - the sort of successfully-tested in piuparts-report.
Avoid the sort call to block_count if we know it is not going to
affect the sort.

With this change, piuparts-reports now runs at 35 seconds per section.
piuparts-report.py - Refactor with_count in write_state_pages().
Changelog entry for rdep metric rework.
packagesdb - Add rdep chain length metric calc.

Provide a means for detecting packages which support a long chain
of reverse dependencies, so that testing priorities can concentrate
on whittling them down.
packagesdb - Prioritize by rdep chain len in reserve()

Use the rdep_chain_len metric to proportionally prioritize packages
returned by reserve() according to the length of the longest reverse
dependency chain length.