Refactor has_package test for simpler version matching