Fix package_name and final_dmg inconsistency if safe name != name

If the project name has characters such as "-" in, package_name wasn't
resolving to what was created in the final output. This fix ties the two functions
together to avoid that, and also work with other packagers than "pkg".