Properly reflect newly-available packages in check_db

Fixes #12466.
Remove unnecessary sort
Merge pull request #12472 from terminalmage/issue12466

Properly reflect newly-available packages in check_db