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.
Merge pull request #5473 from terminalmage/quickfix

Switch to pkg.compare for version comparison