When iterating through repos to check for database access, igore the
ones which aren't enabled.

Add boolean flag to pkg_count_repos: if true, only count the active
repos.

Fixes #598