if (createNIUnderPkgRoot(pkgId, pOptions) != NI_ERROR_NONE) {
_SERR("Failed to generate NI file [%s]", pkgId);
return NI_ERROR_UNKNOWN;
- } else {
- _SOUT("Complete make native image for pkg (%s)", pkgId);
}
+ _SOUT("Complete make native image for pkg (%s)", pkgId);
return NI_ERROR_NONE;
}
pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
return readonly;
}
-#if 0
-// callback function of "pkgmgrinfo_appinfo_metadata_filter_foreach"
-static int appAotCb(pkgmgrinfo_appinfo_h handle, void *userData)
-{
- char *pkgId = NULL;
- int ret = 0;
- ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgId);
- if (ret != PMINFO_R_OK) {
- _SERR("Failed to get pkgid");
- return -1;
- }
-
- NIOption **pOptions = (NIOption**)userData;
- if (isReadOnlyPkg(pkgId) && (*pOptions)->flags & NI_FLAGS_SKIP_RO_APP) {
- return 0;
- }
-
- return removeAndCreateNI(pkgId, *pOptions);
-}
-
-// callback function of "pkgmgrinfo_pkginfo_metadata_filter_foreach"
-static int pkgAotCb(pkgmgrinfo_pkginfo_h handle, void *userData)
-{
- char *pkgId = NULL;
- int ret = 0;
- NIOption **pOptions = (NIOption**)userData;
-
- ret = pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgId);
- if (ret != PMINFO_R_OK) {
- _SERR("Failed to get pkgid");
- return -1;
- }
- return removeAndCreateNI(pkgId, *pOptions);
-}
-#endif
// callback function of "pkgmgrinfo_appinfo_metadata_filter_foreach"
static int appAotCb(pkgmgrinfo_appinfo_h handle, void *userData)
{
ni_error_e createNIUnderPkgRoot(const std::string& pkgId, NIOption* opt)
{
- ni_error_e ret;
-
if (!isR2RImage(concatPath(__pm->getRuntimePath(), "System.Private.CoreLib.dll"))) {
_SERR("The native image of System.Private.CoreLib does not exist.\n"
"Run the command to create the native image\n"
splitPath(extraDllPaths, opt->extraRefPath);
}
+ std::string targetDirs;
if (isRPK(pkgId)) {
opt->flags &= ~NI_FLAGS_APPNI;
std::string paths = getResourcePaths(rootPath);
- if (!paths.empty()) {
- ret = createNIUnderDirs(paths, opt);
- } else {
+ if (paths.empty()) {
_SERR("Failed to get rpk paths from [%s]", pkgId.c_str());
- ret = NI_ERROR_UNKNOWN;
+ return NI_ERROR_UNKNOWN;
}
+ targetDirs = paths;
} else {
__pm->setAppRootPath(rootPath);
opt->flags &= ~NI_FLAGS_APP_UNDER_RO_AREA;
}
- // create native image under bin and lib directory
- // tac directory is skipped in the createNIUnderDirs.
- ret = createNIUnderDirs(__pm->getAppPaths(), opt);
+ targetDirs = __pm->getAppPaths();
}
- return ret;
+ return createNIUnderDirs(targetDirs, opt);
}
void removeNIPlatform()
pkgmgrinfo_pkg_list_cb pkg_cb,
void *user_data)
{
+ uid_t uid = 0;
int ret = 0;
- ret = pkgmgrinfo_pkginfo_metadata_filter_foreach(handle, pkg_cb, user_data);
+ if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+ _ERR("Failed to get UID");
+ return -1;
+ }
+
+ ret = pkgmgrinfo_pkginfo_usr_metadata_filter_foreach(handle, pkg_cb, user_data, uid);
if (ret != PMINFO_R_OK) {
_ERR("Failed to execute the metadata filter query (%d)", ret);
return -1;