Improved the `pkg_to_mapping` function

I think direct the use of high-efficiency than the use of variable function to get