add better name of package when guessing when getting an nvr

The better name guessing is actually a direct translation of the brew.parse
python method.

FIXME: This method is actually duplicated from package.rb . Remove duplication
in another time.