2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <pkgmgr-info.h>
18 #include <pkgmgr_installer_info.h>
23 #include "pkgmgr_parser_plugin_interface.h"
39 #include "ni_common.h"
40 #include "db_manager.h"
41 #include "tac_common.h"
42 #include "path_manager.h"
43 #include "plugin_manager.h"
48 #define LOG_TAG "DOTNET_INSTALLER_PLUGIN"
51 #error "CROSSGEN_PATH is missed"
55 #define __STR(x) __XSTR(x)
56 static const char* __NATIVE_LIB_DIR = __STR(NATIVE_LIB_DIR);
57 static const char* __CROSSGEN_PATH = __STR(CROSSGEN_PATH);
58 static const char* __DOTNET_DIR = __STR(DOTNET_DIR);
60 #ifdef UNIQUE_DEFAULT_BASE_ADDR_SUPPORT
61 static const char* __SYSTEM_BASE_FILE = __STR(SYSTEM_BASE_FILE);
67 static int __interval = 0;
68 static PathManager* __pm = nullptr;
70 static void waitInterval()
72 // by the recommand, ignore small value for performance.
73 if (__interval > 10000) {
74 fprintf(stdout, "sleep %d usec\n", __interval);
79 static std::string getNIFilePath(const std::string& dllPath)
81 size_t index = dllPath.find_last_of(".");
82 if (index == std::string::npos) {
83 fprintf(stderr, "File doesnot contain extension. fail to get NI file name\n");
86 std::string fName = dllPath.substr(0, index);
87 std::string fExt = dllPath.substr(index, dllPath.length());
89 // crossgen generate file with lower case extension only
90 std::transform(fExt.begin(), fExt.end(), fExt.begin(), ::tolower);
91 std::string niPath = fName + ".ni" + fExt;
96 static std::string getAppNIFilePath(const std::string& niPath)
99 std::string niDirPath;
100 std::string prevPath;
102 size_t index = niPath.find_last_of("/");
103 if (index != std::string::npos) {
104 prevPath = niPath.substr(0, index);
105 fileName = niPath.substr(index + 1, niPath.length());
111 niDirPath = concatPath(prevPath, APP_NI_SUB_DIR);
113 if (!isFile(niDirPath)) {
114 if (mkdir(niDirPath.c_str(), 0755) == 0) {
115 copySmackAndOwnership(prevPath, niDirPath);
117 fprintf(stderr, "Fail to create app ni directory (%s)\n", niDirPath.c_str());
121 return concatPath(niDirPath, fileName);
124 static bool checkNIExistence(const std::string& path)
126 std::string f = getNIFilePath(path);
135 // native image of System.Private.CoreLib.dll should have to overwrite
136 // original file to support new coreclr
137 if (path.find("System.Private.CoreLib.dll") != std::string::npos) {
138 std::string coreLibBackup = path + ".Backup";
139 if (isFile(coreLibBackup)) {
147 #ifdef UNIQUE_DEFAULT_BASE_ADDR_SUPPORT
148 static uintptr_t getFileSize(const std::string& path)
152 if (stat(path.c_str(), &sb) == 0) {
159 // Get next base address to be used for system ni image from file
160 // __SYSTEM_BASE_FILE should be checked for existance before calling this function
161 static uintptr_t getNextBaseAddrFromFile()
163 FILE *pFile = fopen(__SYSTEM_BASE_FILE, "r");
165 fprintf(stderr, "Failed to open %s\n", __SYSTEM_BASE_FILE);
172 while (fscanf(pFile, "%u %u", &addr, &size) != EOF) {
180 // Get next base address to be used for system ni image
181 static uintptr_t getNextBaseAddr()
183 uintptr_t baseAddr = 0;
185 if (!isFile(__SYSTEM_BASE_FILE)) {
186 // This is the starting address for all default base addresses
187 baseAddr = DEFAULT_BASE_ADDR_START;
189 baseAddr = getNextBaseAddrFromFile();
191 // Round to a multple of 64K (see ZapImage::CalculateZapBaseAddress in CoreCLR)
192 uintptr_t BASE_ADDRESS_ALIGNMENT = 0xffff;
193 baseAddr = (baseAddr + BASE_ADDRESS_ALIGNMENT) & ~BASE_ADDRESS_ALIGNMENT;
199 // Save base address of system ni image to file
200 static void updateBaseAddrFile(const std::string& absNIPath, uintptr_t baseAddr)
202 uintptr_t niSize = getFileSize(absNIPath);
204 fprintf(stderr, "File %s doesn't exist\n", absNIPath.c_str());
208 // Write new entry to the file
209 FILE *pFile = fopen(__SYSTEM_BASE_FILE, "a");
211 fprintf(stderr, "Failed to open %s\n", __SYSTEM_BASE_FILE);
215 fprintf(pFile, "%u %u\n", baseAddr, niSize);
219 // check if dll is listed in TPA
220 static bool isTPADll(const std::string& dllPath)
222 std::string absPath = getBaseName(getAbsolutePath(dllPath));
224 std::vector<std::string> paths = __pm->getPlatformAssembliesPaths();
225 for (unsigned int i = 0; i < paths.size(); i++) {
226 if (paths[i].find(getBaseName(absPath)) != std::string::npos) {
235 // baseAddr should be checked in file before getting here
236 static ni_error_e crossgen(const std::string& dllPath, const std::string& appPath, DWORD flags)
238 if (!isFile(dllPath)) {
239 fprintf(stderr, "dll file is not exist : %s\n", dllPath.c_str());
240 return NI_ERROR_NO_SUCH_FILE;
243 if (!isManagedAssembly(dllPath)) {
244 //fprintf(stderr, "Input file is not a dll file : %s\n", dllPath.c_str());
245 return NI_ERROR_INVALID_PARAMETER;
248 if (checkNIExistence(dllPath)) {
249 //fprintf(stderr, "Already ni file is exist for %s\n", dllPath.c_str());
250 return NI_ERROR_ALREADY_EXIST;
253 std::string absDllPath = getAbsolutePath(dllPath);
254 std::string absNIPath = getNIFilePath(dllPath);
256 if (absNIPath.empty()) {
257 fprintf(stderr, "Fail to get ni file name\n");
258 return NI_ERROR_UNKNOWN;
261 bool isAppNI = flags & NI_FLAGS_APPNI;
262 if (isAppNI && strstr(absNIPath.c_str(), __DOTNET_DIR) == NULL) {
263 absNIPath = getAppNIFilePath(absNIPath);
266 #ifdef UNIQUE_DEFAULT_BASE_ADDR_SUPPORT
267 uintptr_t baseAddr = 0;
269 if (isTPADll(dllPath)) {
270 baseAddr = getNextBaseAddr();
276 return NI_ERROR_UNKNOWN;
280 waitpid(pid, &status, 0);
281 if (WIFEXITED(status)) {
282 // Do not use checkNIExistence() function to check whether ni file created or not.
283 // checkNIExistence() return false for System.Private.Corelib.dll
284 if (isFile(absNIPath)) {
285 copySmackAndOwnership(absDllPath, absNIPath);
286 std::string absPdbPath = replaceAll(absDllPath, ".dll", ".pdb");
287 std::string pdbFilePath = replaceAll(absNIPath, ".ni.dll", ".pdb");
288 if (isFile(absPdbPath) && (absPdbPath != pdbFilePath)) {
289 if (!copyFile(absPdbPath, pdbFilePath)) {
290 fprintf(stderr, "Failed to copy a .pdb file\n");
292 copySmackAndOwnership(absPdbPath, pdbFilePath);
295 #ifdef UNIQUE_DEFAULT_BASE_ADDR_SUPPORT
297 updateBaseAddrFile(absNIPath, baseAddr);
300 return NI_ERROR_NONE;
302 fprintf(stderr, "Fail to create native image for %s\n", dllPath.c_str());
303 return NI_ERROR_NO_SUCH_FILE;
307 std::string jitPath = __pm->getRuntimePath() + "/libclrjit.so";
308 std::vector<const char*> argv = {
311 "/JITPath", jitPath.c_str()
314 bool compat = flags & NI_FLAGS_COMPATIBILITY;
315 argv.push_back(compat ? "/Platform_Assemblies_Pathes" : "/p");
316 std::vector<std::string> paths = __pm->getPlatformAssembliesPaths();
317 std::string platformAssembliesPaths;
318 for (const auto &path : paths) {
319 if (!platformAssembliesPaths.empty()) {
320 platformAssembliesPaths += ":";
322 platformAssembliesPaths += path;
324 argv.push_back(platformAssembliesPaths.c_str());
326 bool enableR2R = flags & NI_FLAGS_ENABLER2R;
328 argv.push_back("/FragileNonVersionable");
331 if (flags & NI_FLAGS_VERBOSE) {
332 argv.push_back("/verbose");
335 if (flags & NI_FLAGS_INSTRUMENT) {
336 argv.push_back("/Tuning");
339 #ifdef UNIQUE_DEFAULT_BASE_ADDR_SUPPORT
340 char baseAddrString[11] = {0};
342 argv.push_back("/BaseAddress");
343 snprintf(baseAddrString, 11, "0x%08x", baseAddr);
344 argv.push_back(baseAddrString);
348 argv.push_back("/App_Paths");
349 std::string absAppPath;
350 if (!appPath.empty()) {
351 absAppPath = appPath;
353 absAppPath = getBaseName(absDllPath);
355 argv.push_back(absAppPath.c_str());
357 argv.push_back("/out");
358 argv.push_back(absNIPath.c_str());
360 argv.push_back(absDllPath.c_str());
361 argv.push_back(nullptr);
363 fprintf(stdout, "+ %s (%s)\n", absDllPath.c_str(), enableR2R ? "R2R" : "FNV");
365 execv(__CROSSGEN_PATH, const_cast<char* const*>(argv.data()));
369 return NI_ERROR_NONE;
372 // callback function of "pkgmgrinfo_appinfo_metadata_filter_foreach"
373 static int appAotCb(pkgmgrinfo_appinfo_h handle, void *userData)
377 DWORD *pFlags = (DWORD*)userData;
379 ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgId);
380 if (ret != PMINFO_R_OK) {
381 fprintf(stderr, "Failed to get pkgid\n");
385 if (removeNIUnderPkgRoot(pkgId) != NI_ERROR_NONE) {
386 fprintf(stderr, "Failed to remove previous dlls from [%s]\n", pkgId);
390 if (createNIUnderPkgRoot(pkgId, *pFlags) != NI_ERROR_NONE) {
391 fprintf(stderr, "Failed to generate NI file [%s]\n", pkgId);
394 fprintf(stdout, "Complete make application to native image\n");
400 static bool isCoreLibPrepared(DWORD flags)
402 if (flags & NI_FLAGS_ENABLER2R) {
406 std::string coreLibBackup = concatPath(__pm->getRuntimePath(), "System.Private.CoreLib.dll.Backup");
407 if (isFile(coreLibBackup)) {
410 fprintf(stderr, "The native image of System.Private.CoreLib does not exist\n"
411 "Run the command to create the native image\n"
412 "# dotnettool --ni-dll /usr/share/dotnet.tizen/netcoreapp/System.Private.CoreLib.dll\n\n");
417 static bool hasCoreLibNI()
421 std::string ildasm = concatPath(__pm->getRuntimePath(), "ildasm");
422 std::string coreLib = concatPath(__pm->getRuntimePath(), "System.Private.CoreLib.dll");
423 std::string cmd = ildasm + " " + coreLib + " | grep '\\.corflags'";
424 fp = popen(cmd.c_str(), "r");
426 while (fgets(buff, sizeof(buff), fp) != NULL) {
427 buff[strlen(buff) - 1] = '\0';
429 std::string corflag = replaceAll(buff, ".corflags", "");
430 corflag.erase(std::remove(corflag.begin(), corflag.end(), ' '), corflag.end());
431 // CorFlags.ILLibrary=0x00000004 (.ni.dll)
432 if (!strcmp(corflag.substr(0, 10).c_str(), "0x00000004")) {
441 static ni_error_e createCoreLibNI(DWORD flags)
443 std::string coreLib = concatPath(__pm->getRuntimePath(), "System.Private.CoreLib.dll");
444 std::string niCoreLib = concatPath(__pm->getRuntimePath(), "System.Private.CoreLib.ni.dll");
445 std::string coreLibBackup = concatPath(__pm->getRuntimePath(), "System.Private.CoreLib.dll.Backup");
447 if (!isFile(coreLibBackup) && !hasCoreLibNI()) {
448 if (!crossgen(coreLib, std::string(), flags)) {
449 if (rename(coreLib.c_str(), coreLibBackup.c_str())) {
450 fprintf(stderr, "Failed to rename System.Private.CoreLib.dll\n");
451 return NI_ERROR_CORE_NI_FILE;
453 if (rename(niCoreLib.c_str(), coreLib.c_str())) {
454 fprintf(stderr, "Failed to rename System.Private.CoreLib.ni.dll\n");
455 return NI_ERROR_CORE_NI_FILE;
458 fprintf(stderr, "Failed to create native image for %s\n", coreLib.c_str());
459 return NI_ERROR_CORE_NI_FILE;
462 return NI_ERROR_NONE;
465 ni_error_e initNICommon()
467 #if defined(__arm__) || defined(__aarch64__)
468 // get interval value
469 const static std::string intervalFile = concatPath(__NATIVE_LIB_DIR, "crossgen_interval.txt");
470 std::ifstream inFile(intervalFile);
472 fprintf(stdout, "crossgen_interval.txt is found\n");
473 inFile >> __interval;
476 if (initializePluginManager("normal")) {
477 fprintf(stderr, "Fail to initialize PluginManager\n");
478 return NI_ERROR_UNKNOWN;
482 __pm = new PathManager();
483 } catch (const std::exception& e) {
484 fprintf(stderr, "Failed to create PathManager");
485 return NI_ERROR_UNKNOWN;
488 char* pluginDllPaths = pluginGetDllPath();
489 if (pluginDllPaths) {
490 __pm->addPlatformAssembliesPaths(pluginDllPaths);
493 return NI_ERROR_NONE;
495 fprintf(stderr, "crossgen supports arm/arm64 architecture only. skip ni file generation\n");
496 return NI_ERROR_NOT_SUPPORTED;
500 void finalizeNICommon()
504 finalizePluginManager();
510 ni_error_e createNIPlatform(DWORD flags)
512 if (createCoreLibNI(flags) != NI_ERROR_NONE) {
513 return NI_ERROR_CORE_NI_FILE;
516 return createNIUnderDirs(__pm->getRuntimePath() + ":" + __pm->getTizenFXPath(), flags);
519 ni_error_e createNIDll(const std::string& dllPath, DWORD flags)
521 if (dllPath.find("System.Private.CoreLib.dll") != std::string::npos) {
522 return createCoreLibNI(flags);
525 if (!isCoreLibPrepared(flags)) {
526 return NI_ERROR_CORE_NI_FILE;
529 return crossgen(dllPath, std::string(), flags);
532 ni_error_e createNIUnderDirs(const std::string& rootPaths, DWORD flags)
534 if (!isCoreLibPrepared(flags)) {
535 return NI_ERROR_CORE_NI_FILE;
538 auto convert = [&rootPaths, flags](const std::string& path, const std::string& filename) {
539 // if path is symlink, donot generate crossgen
540 if (!crossgen(path, rootPaths.c_str(), flags)) {
545 std::vector<std::string> targetPaths;
546 splitPath(rootPaths, targetPaths);
547 for (const auto &path : targetPaths) {
548 // TAC directory should be handled specially because that contains symlink of native image file.
549 if (strstr(path.c_str(), TAC_SYMLINK_SUB_DIR) != NULL) {
550 if (!isDirectory(path)) {
553 // make native image symlink if not exist under tac directory
555 for (auto& symlinkAssembly : bf::recursive_directory_iterator(path)) {
556 std::string symPath = symlinkAssembly.path().string();
557 if (!isManagedAssembly(symPath)) {
561 // if there is symlink and original file for native image, skip generation
562 std::string symNIPath = symPath.substr(0, symPath.rfind(".dll")) + ".ni.dll";
563 if (isFile(symNIPath)) {
567 // if original native image not exist, generate native image
568 std::string originPath = bf::read_symlink(symPath).string();
569 std::string originNIPath = originPath.substr(0, originPath.rfind(".dll")) + ".ni.dll";
570 if (!isFile(originNIPath)) {
571 if (!crossgen(originPath, path.c_str(), flags)) {
576 // if no symlink file exist, create symlink
577 if (!isFile(symNIPath)) {
578 bf::create_symlink(originNIPath, symNIPath);
579 copySmackAndOwnership(symPath.c_str(), symNIPath.c_str(), true);
580 fprintf(stdout, "%s symbolic link file generated successfully.\n", symNIPath.c_str());
581 _INFO("%s symbolic link file generated successfully.", symNIPath.c_str());
584 } catch (const bf::filesystem_error& error) {
585 fprintf(stderr, "Failed to recursive directory: %s\n", error.what());
586 return NI_ERROR_UNKNOWN;
589 scanFilesInDirectory(path, convert, 0);
593 return NI_ERROR_NONE;
596 ni_error_e createNIUnderPkgRoot(const std::string& pkgId, DWORD flags)
598 std::string rootPath = getRootPath(pkgId);
599 if (rootPath.empty()) {
600 fprintf(stderr, "Failed to get root path from [%s]\n", pkgId.c_str());
601 return NI_ERROR_INVALID_PACKAGE;
604 __pm->setAppRootPath(rootPath);
606 flags |= NI_FLAGS_APPNI;
608 // create native image under bin and lib directory
609 // tac directory is skipped in the createNIUnderDirs.
610 return createNIUnderDirs(__pm->getAppPaths(), flags);
613 void removeNIPlatform()
615 std::string coreLib = concatPath(__pm->getRuntimePath(), "System.Private.CoreLib.dll");
616 std::string coreLibBackup = concatPath(__pm->getRuntimePath(), "System.Private.CoreLib.dll.Backup");
618 if (hasCoreLibNI()) {
619 if (!isFile(coreLibBackup)) {
623 if (remove(coreLib.c_str())) {
624 fprintf(stderr, "Failed to remove System.Private.CoreLib native image file\n");
626 if (rename(coreLibBackup.c_str(), coreLib.c_str())) {
627 fprintf(stderr, "Failed to rename System.Private.CoreLib.Backup to origin\n");
631 #ifdef UNIQUE_DEFAULT_BASE_ADDR_SUPPORT
632 if (isFile(__SYSTEM_BASE_FILE)) {
633 if (remove(__SYSTEM_BASE_FILE)) {
634 fprintf(stderr, "Failed to remove %s\n", __SYSTEM_BASE_FILE);
639 removeNIUnderDirs(__pm->getRuntimePath() + ":" + __pm->getTizenFXPath());
642 void removeNIUnderDirs(const std::string& rootPaths)
644 auto convert = [](const std::string& path, const std::string& filename) {
645 if (isNativeImage(path)) {
646 if (remove(path.c_str())) {
647 fprintf(stderr, "Failed to remove %s\n", path.c_str());
652 std::vector<std::string> paths;
653 splitPath(rootPaths, paths);
654 for (const auto &path : paths) {
655 scanFilesInDirectory(path, convert, -1);
659 ni_error_e removeNIUnderPkgRoot(const std::string& pkgId)
661 std::string rootPath = getRootPath(pkgId);
662 if (rootPath.empty()) {
663 fprintf(stderr, "Failed to get root path from [%s]\n", pkgId.c_str());
664 return NI_ERROR_INVALID_PACKAGE;
667 __pm->setAppRootPath(rootPath);
669 // getAppNIPaths returns bin/.native_image, lib/.native_image and .tac_symlink.
670 std::string appNIPaths = __pm->getAppNIPaths();
671 std::vector<std::string> paths;
672 splitPath(appNIPaths, paths);
673 for (const auto &path : paths) {
674 // Only the native image inside the TAC should be removed.
675 if (strstr(path.c_str(), TAC_SYMLINK_SUB_DIR) != NULL) {
676 removeNIUnderDirs(path);
678 if (isDirectory(path)) {
679 if (!removeAll(path.c_str())) {
680 fprintf(stderr, "Failed to remove app ni dir [%s]\n", path.c_str());
686 return NI_ERROR_NONE;
689 ni_error_e regenerateAppNI(DWORD flags)
691 if (!isCoreLibPrepared(flags)) {
692 return NI_ERROR_CORE_NI_FILE;
696 pkgmgrinfo_appinfo_metadata_filter_h handle;
698 ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
699 if (ret != PMINFO_R_OK)
700 return NI_ERROR_UNKNOWN;
702 ret = pkgmgrinfo_appinfo_metadata_filter_add(handle, AOT_METADATA_KEY, METADATA_VALUE);
703 if (ret != PMINFO_R_OK) {
704 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
705 return NI_ERROR_UNKNOWN;
708 ret = pkgmgrinfo_appinfo_metadata_filter_foreach(handle, appAotCb, &flags);
709 if (ret != PMINFO_R_OK) {
710 fprintf(stderr, "Failed pkgmgrinfo_appinfo_metadata_filter_foreach\n");
711 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
712 return NI_ERROR_UNKNOWN;
715 fprintf(stdout, "Success pkgmgrinfo_appinfo_metadata_filter_foreach\n");
717 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
718 return NI_ERROR_NONE;
721 // callback function of "pkgmgrinfo_appinfo_metadata_filter_foreach"
722 static int regenTacCb(pkgmgrinfo_appinfo_h handle, void *userData)
725 DWORD *pFlags = (DWORD*)userData;
727 int ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgId);
728 if (ret != PMINFO_R_OK || pkgId == NULL) {
729 fprintf(stderr, "Failed to get pkgid\n");
733 sqlite3 *tac_db = openDB(TAC_APP_LIST_DB);
735 fprintf(stderr, "Sqlite open error\n");
738 sqlite3_exec(tac_db, "BEGIN;", NULL, NULL, NULL);
740 char *sql = sqlite3_mprintf("SELECT * FROM TAC WHERE PKGID = %Q;", pkgId);
741 std::vector<std::string> nugets = selectDB(tac_db, sql);
749 std::string nugetPaths;
750 for (const auto &nuget : nugets) {
751 if (!nugetPaths.empty()) {
754 nugetPaths += concatPath(__DOTNET_DIR, nuget);
757 auto convert = [&nugetPaths, pFlags](const std::string& path, const std::string& filename) {
758 if (strstr(path.c_str(), TAC_SHA_256_INFO) != NULL)
760 if (!crossgen(path, nugetPaths.c_str(), *pFlags)) {
765 for (auto& nuget : nugets) {
766 scanFilesInDirectory(concatPath(__DOTNET_DIR, nuget), convert, -1);
772 ni_error_e regenerateTACNI(DWORD flags)
774 if (!isCoreLibPrepared(flags)) {
775 return NI_ERROR_CORE_NI_FILE;
778 removeNIUnderDirs(__DOTNET_DIR);
780 pkgmgrinfo_appinfo_metadata_filter_h handle;
781 int ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
782 if (ret != PMINFO_R_OK) {
783 return NI_ERROR_UNKNOWN;
786 ret = pkgmgrinfo_appinfo_metadata_filter_add(handle, TAC_METADATA_KEY, METADATA_VALUE);
787 if (ret != PMINFO_R_OK) {
788 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
789 return NI_ERROR_UNKNOWN;
792 ret = pkgmgrinfo_appinfo_metadata_filter_foreach(handle, regenTacCb, &flags);
793 if (ret != PMINFO_R_OK) {
794 fprintf(stderr, "Failed pkgmgrinfo_appinfo_metadata_filter_foreach\n");
795 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
796 return NI_ERROR_UNKNOWN;
798 fprintf(stdout, "Success pkgmgrinfo_appinfo_metadata_filter_foreach\n");
800 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
802 return NI_ERROR_NONE;