Implement rewrite_package_dist(target, package_index)