Use unified function to detect cached package name

Now cached file is defined by function `pkg_repo_cached_name` that gets
package and tries to find where in the cache it can be found.
Add workaround to not refetch all packages.