Switch to pkg.compare for version comparison

perform_cmp is really only supposed to be used under-the-hood, while
pkg.compare makes for easier-to-read code.