+std::string StepConfigure::GetPkgIdFromFile() {
+ auto app_query_interface = pkgmgr_->GetAppQueryInterface();
+ if (!app_query_interface)
+ return "";
+
+ return app_query_interface->GetPkgId(
+ pkgmgr_->GetRequestInfo(context_->index.get()));
+}
+
+bool StepConfigure::CheckInvalidBackendUsage() {
+ if (context_->pkgid.get().empty())
+ return true;
+
+ PkgQueryInterface pkg_query(context_->pkgid.get().c_str(),
+ context_->uid.get());
+ if (!pkg_query.IsValid()) {
+ LOG(INFO) << "pkg[" << context_->pkgid.get()
+ << "] is not installed, skip checking backend with installed pkg";
+ return true;
+ }
+
+ const std::string& backend_type = context_->pkg_type.get();
+ std::string installed_pkg_type = pkg_query.Type();
+ if (installed_pkg_type == kRpmPkgType)
+ installed_pkg_type = kRpmInstaller;
+
+ if (installed_pkg_type != backend_type) {
+ LOG(ERROR) << "Wrong use of backend : package's type [" << pkg_query.Type()
+ << "] mismatched backend [" << backend_type << "]";
+ return false;
+ }
+
+ return true;
+}
+