New devel script extract_pkg_ids

Based on recipe from @goxberry in #2526