find-obsolete-pkgs: Refactor to use a function

Try to separate out the logic into a separate function to make it
possible to use as a library and to add tests.

Rename 'reallyremove'

wip