migrate detect_pkgs