From 39cd71e9f918aa7696dda106445d203fea14ebcc Mon Sep 17 00:00:00 2001 From: "junsuk77.oh" Date: Mon, 5 Aug 2013 15:27:48 +0900 Subject: [PATCH] Sync to the latest code Change-Id: I2a9c06dfa1af86742e27750761b83a4152159494 Signed-off-by: junsuk77.oh --- CMakeLists.txt | 2 + category_parser_list.txt.in | 1 + mdparser_list.txt.in | 3 +- packaging/pkgmgr-info.spec | 3 +- parser/pkgmgr_parser.c | 270 ++++++++++++++++++++++++++++++++++++++++++-- parser/pkgmgr_parser.h | 1 + parser/pkgmgr_parser_db.c | 113 ++++++++---------- parser_path.conf.in | 1 + src/pkgmgr-info.c | 40 ++++--- 9 files changed, 344 insertions(+), 90 deletions(-) create mode 100644 category_parser_list.txt.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 64c6a0c..17404ba 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,9 +57,11 @@ configure_file(parser_path.conf.in parser_path.conf @ONLY) configure_file(pkgmgr-info.manifest.in pkgmgr-info.manifest @ONLY) configure_file(pkgmgr-parser.manifest.in pkgmgr-parser.manifest @ONLY) configure_file(mdparser_list.txt.in mdparser_list.txt @ONLY) +configure_file(category_parser_list.txt.in category_parser_list.txt @ONLY) INSTALL(TARGETS pkgmgr-info DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-info.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/pkgmgr-info.h DESTINATION include) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/parser_path.conf DESTINATION ${PREFIX}/etc/package-manager/) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mdparser_list.txt DESTINATION ${PREFIX}/etc/package-manager/parserlib/metadata) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/category_parser_list.txt DESTINATION ${PREFIX}/etc/package-manager/parserlib/category) diff --git a/category_parser_list.txt.in b/category_parser_list.txt.in new file mode 100644 index 0000000..4fb833c --- /dev/null +++ b/category_parser_list.txt.in @@ -0,0 +1 @@ +http://tizen.org/category/antivirus \ No newline at end of file diff --git a/mdparser_list.txt.in b/mdparser_list.txt.in index eb9e96e..d7587fd 100644 --- a/mdparser_list.txt.in +++ b/mdparser_list.txt.in @@ -1,3 +1,4 @@ http://developer.samsung.com/tizen/metadata/sticker http://developer.samsung.com/tizen/metadata/ttsengine -http://developer.samsung.com/tizen/metadata/downloadable_filters \ No newline at end of file +http://developer.samsung.com/tizen/metadata/downloadable_filters +http://developer.samsung.com/tizen/metadata/dictionary \ No newline at end of file diff --git a/packaging/pkgmgr-info.spec b/packaging/pkgmgr-info.spec index 234747b..f46a038 100755 --- a/packaging/pkgmgr-info.spec +++ b/packaging/pkgmgr-info.spec @@ -1,6 +1,6 @@ Name: pkgmgr-info Summary: Packager Manager infomation api for package -Version: 0.0.129 +Version: 0.0.134 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 @@ -85,6 +85,7 @@ chsmack -a '_' /usr/etc/package-manager %{_prefix}/etc/package-manager/preload/xml.xsd %{_prefix}/etc/package-manager/parser_path.conf %{_prefix}/etc/package-manager/parserlib/metadata/mdparser_list.txt +%{_prefix}/etc/package-manager/parserlib/category/category_parser_list.txt %files parser-devel %defattr(-,root,root,-) diff --git a/parser/pkgmgr_parser.c b/parser/pkgmgr_parser.c index 325ced8..7f875d0 100755 --- a/parser/pkgmgr_parser.c +++ b/parser/pkgmgr_parser.c @@ -47,6 +47,9 @@ #define MDPARSER_LIST "/usr/etc/package-manager/parserlib/metadata/mdparser_list.txt" #define MDPARSER_NAME "mdparser:" +#define CATEGORY_PARSER_LIST "/usr/etc/package-manager/parserlib/category/category_parser_list.txt" +#define CATEGORY_PARSER_NAME "categoryparser:" + #define PKG_TAG_LEN_MAX 128 /* operation_type */ @@ -68,6 +71,10 @@ typedef struct { const char *value; } __metadata_t; +typedef struct { + const char *name; +} __category_t; + const char *package; static int __ps_process_label(xmlTextReaderPtr reader, label_x *label); @@ -288,7 +295,53 @@ static char *__get_mdparser_plugin(const char *type) fclose(fp); if (path == NULL) { - DBGE("no matching backendlib\n"); + DBGE("no matching [%s] [%s]\n", MDPARSER_NAME,type); + return NULL; + } + + snprintf(temp_path, sizeof(temp_path) - 1, "%slib%s.so", path, type); + + return strdup(temp_path); +} + +static char *__get_category_parser_plugin(const char *type) +{ + FILE *fp = NULL; + char buffer[1024] = { 0 }; + char temp_path[1024] = { 0 }; + char *path = NULL; + + if (type == NULL) { + DBGE("invalid argument\n"); + return NULL; + } + + fp = fopen(PKG_PARSER_CONF_PATH, "r"); + if (fp == NULL) { + DBGE("no matching mdparser\n"); + return NULL; + } + + while (fgets(buffer, sizeof(buffer), fp) != NULL) { + if (buffer[0] == '#') + continue; + + __str_trim(buffer); + + if ((path = strstr(buffer, CATEGORY_PARSER_NAME)) != NULL) { + path = path + strlen(CATEGORY_PARSER_NAME); + + break; + } + + memset(buffer, 0x00, 1024); + } + + if (fp != NULL) + fclose(fp); + + if (path == NULL) { + DBGE("no matching [%s] [%s]\n", CATEGORY_PARSER_NAME,type); return NULL; } @@ -338,7 +391,6 @@ static char *__get_parser_plugin(const char *type) } snprintf(temp_path, sizeof(temp_path) - 1, "%slib%s.so", path, type); - DBG("[%s]\n", temp_path); return strdup(temp_path); } @@ -368,7 +420,7 @@ static int __ps_run_mdparser(GList *md_list, const char *tag, lib_path = __get_mdparser_plugin(tag); if (!lib_path) { - DBGE("__get_mdparser_plugin fail\n"); + DBGE("get %s parser fail\n", tag); goto END; } @@ -397,6 +449,60 @@ END: return ret; } +static int __ps_run_category_parser(GList *category_list, const char *tag, + ACTION_TYPE action, const char *pkgid, const char *appid) +{ + char *lib_path = NULL; + void *lib_handle = NULL; + int (*category_parser_plugin) (const char *, const char *, GList *); + int ret = -1; + char *ac = NULL; + + switch (action) { + case ACTION_INSTALL: + ac = "PKGMGR_CATEGORY_PARSER_PLUGIN_INSTALL"; + break; + case ACTION_UPGRADE: + ac = "PKGMGR_CATEGORY_PARSER_PLUGIN_UPGRADE"; + break; + case ACTION_UNINSTALL: + ac = "PKGMGR_CATEGORY_PARSER_PLUGIN_UNINSTALL"; + break; + default: + goto END; + } + + lib_path = __get_category_parser_plugin(tag); + if (!lib_path) { + DBGE("get %s parser fail\n", tag); + goto END; + } + + if ((lib_handle = dlopen(lib_path, RTLD_LAZY)) == NULL) { + DBGE("dlopen is failed lib_path[%s]\n", lib_path); + goto END; + } + + if ((category_parser_plugin = + dlsym(lib_handle, ac)) == NULL || dlerror() != NULL) { + DBGE("can not find symbol[%s] \n",ac); + goto END; + } + + ret = category_parser_plugin(pkgid, appid, category_list); + if (ret < 0) + DBG("[appid = %s, libpath = %s plugin fail\n", appid, lib_path); + else + DBG("[appid = %s, libpath = %s plugin success\n", appid, lib_path); + +END: + if (lib_path) + free(lib_path); + if (lib_handle) + dlclose(lib_handle); + return ret; +} + static int __ps_run_parser(xmlDocPtr docPtr, const char *tag, ACTION_TYPE action, const char *pkgid) { @@ -497,6 +603,27 @@ static void __mdparser_clear_dir_list(GList* dir_list) } } +static void __category_parser_clear_dir_list(GList* dir_list) +{ + GList *list = NULL; + __category_t* detail = NULL; + + if (dir_list) { + list = g_list_first(dir_list); + while (list) { + detail = (__category_t *)list->data; + if (detail) { + if (detail->name) + free(detail->name); + + free(detail); + } + list = g_list_next(list); + } + g_list_free(dir_list); + } +} + static int __run_mdparser_prestep (manifest_x *mfx, char *md_key, ACTION_TYPE action) { int ret = -1; @@ -514,7 +641,6 @@ static int __run_mdparser_prestep (manifest_x *mfx, char *md_key, ACTION_TYPE ac DBG("md_tag is NULL\n"); return -1; } - DBG("md_tag = %s\n", md_tag); while(up != NULL) { @@ -558,9 +684,9 @@ static int __run_mdparser_prestep (manifest_x *mfx, char *md_key, ACTION_TYPE ac if (tag_exist) { ret = __ps_run_mdparser(md_list, md_tag, action, mfx->package, up->appid); if (ret < 0) - DBG("mdparser failed[%d]\n", ret); + DBG("mdparser failed[%d] for tag[%s]\n", ret, md_tag); else - DBG("mdparser success, done[%d]\n", ret); + DBG("mdparser success for tag[%s]\n", md_tag); } __mdparser_clear_dir_list(md_list); md_list = NULL; @@ -578,6 +704,77 @@ END: return ret; } +static int __run_category_parser_prestep (manifest_x *mfx, char *category_key, ACTION_TYPE action) +{ + int ret = -1; + int tag_exist = 0; + char buffer[1024] = { 0, }; + uiapplication_x *up = mfx->uiapplication; + category_x *category = NULL; + char *category_tag = NULL; + + GList *category_list = NULL; + __category_t *category_detail = NULL; + + category_tag = __get_tag_by_key(category_key); + if (category_tag == NULL) { + DBG("md_tag is NULL\n"); + return -1; + } + + while(up != NULL) + { + category = up->category; + while (category != NULL) + { + //get glist of meatdata key and value combination + memset(buffer, 0x00, 1024); + snprintf(buffer, 1024, "%s/", category_key); + if ((category->name) && (strncmp(category->name, category_key, strlen(category_key)) == 0)) { + category_detail = (__category_t*) calloc(1, sizeof(__category_t)); + if (category_detail == NULL) { + DBG("Memory allocation failed\n"); + goto END; + } + + category_detail->name = (char*) calloc(1, sizeof(char)*(strlen(category->name)+2)); + if (category_detail->name == NULL) { + DBG("Memory allocation failed\n"); + free(category_detail); + goto END; + } + snprintf(category_detail->name, (strlen(category->name)+1), "%s", category->name); + + category_list = g_list_append(category_list, (gpointer)category_detail); + tag_exist = 1; + } + category = category->next; + } + + //send glist to parser when tags for metadata plugin parser exist. + if (tag_exist) { + ret = __ps_run_category_parser(category_list, category_tag, action, mfx->package, up->appid); + if (ret < 0) + DBG("category_parser failed[%d] for tag[%s]\n", ret, category_tag); + else + DBG("category_parser success for tag[%s]\n", category_tag); + } + __category_parser_clear_dir_list(category_list); + category_list = NULL; + tag_exist = 0; + up = up->next; + } + + return 0; +END: + __category_parser_clear_dir_list(category_list); + + if (category_tag) + free(category_tag); + + return ret; +} + static int __run_parser_prestep(xmlTextReaderPtr reader, ACTION_TYPE action, const char *pkgid) { int ret = -1; @@ -809,12 +1006,12 @@ static void __plugin_send_tag(const char *tag, ACTION_TYPE action, PLUGIN_PROCES } if ((lib_handle = dlopen(lib_path, RTLD_LAZY)) == NULL) { - DBGE("dlopen is failed lib_path[%s]\n", lib_path); + DBGE("dlopen is failed lib_path[%s] for tag[%s]\n", lib_path, tag); goto END; } if ((plugin_install = dlsym(lib_handle, ac)) == NULL || dlerror() != NULL) { - DBGE("can not find symbol[%s] \n", ac); + DBGE("can not find symbol[%s] for tag[%s] \n", ac, tag); goto END; } @@ -1996,8 +2193,6 @@ int __ps_process_mdparser(manifest_x *mfx, ACTION_TYPE action) while (fgets(md_key, sizeof(md_key), fp) != NULL) { __str_trim(md_key); - DBG("md_key = %s\n", md_key); - ret = __run_mdparser_prestep(mfx, md_key, action); memset(md_key, 0x00, sizeof(md_key)); @@ -2009,6 +2204,31 @@ int __ps_process_mdparser(manifest_x *mfx, ACTION_TYPE action) return 0; } +int __ps_process_category_parser(manifest_x *mfx, ACTION_TYPE action) +{ + int ret = -1; + FILE *fp = NULL; + char category_key[PKG_STRING_LEN_MAX] = { 0 }; + + fp = fopen(CATEGORY_PARSER_LIST, "r"); + if (fp == NULL) { + DBG("no category parser list\n"); + return -1; + } + + while (fgets(category_key, sizeof(category_key), fp) != NULL) { + __str_trim(category_key); + ret = __run_category_parser_prestep(mfx, category_key, action); + + memset(category_key, 0x00, sizeof(category_key)); + } + + if (fp != NULL) + fclose(fp); + + return 0; +} + static int __ps_process_allowed(xmlTextReaderPtr reader, allowed_x *allowed) { xmlTextReaderRead(reader); @@ -3727,6 +3947,7 @@ static int __process_manifest(xmlTextReaderPtr reader, manifest_x * mfx) mfx->removable = strdup("True"); mfx->readonly = strdup("False"); mfx->update = strdup("False"); + mfx->system = strdup("False"); char buf[PKG_STRING_LEN_MAX] = {'\0'}; char *val = NULL; time_t current_time; @@ -4255,6 +4476,9 @@ static int __add_preload_info(manifest_x * mfx, const char *manifest) free((void *)mfx->removable); mfx->removable = strdup("False"); + free((void *)mfx->system); + mfx->system = strdup("True"); + return 0; } @@ -4376,6 +4600,10 @@ API void pkgmgr_parser_free_manifest_xml(manifest_x *mfx) free((void *)mfx->update); mfx->update = NULL; } + if (mfx->system) { + free((void *)mfx->system); + mfx->system = NULL; + } if (mfx->type) { free((void *)mfx->type); mfx->type = NULL; @@ -4629,6 +4857,10 @@ API int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char if (ret == -1) DBG("Creating metadata parser failed\n"); + ret = __ps_process_category_parser(mfx, ACTION_INSTALL); + if (ret == -1) + DBG("Creating category parser failed\n"); + ret = __ps_make_nativeapp_desktop(mfx, NULL, 0); if (ret == -1) DBG("Creating desktop file failed\n"); @@ -4653,6 +4885,7 @@ API int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *con manifest_x *mfx = NULL; int ret = -1; bool preload = false; + bool system = false; char *csc_path = NULL; pkgmgrinfo_pkginfo_h handle = NULL; @@ -4680,6 +4913,15 @@ API int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *con mfx->preload = strdup("true"); } + ret = pkgmgrinfo_pkginfo_is_system(handle, &system); + if (ret != PMINFO_R_OK) + DBG("pkgmgrinfo_pkginfo_is_system failed\n"); + + if (system) { + free((void *)mfx->system); + mfx->system = strdup("true"); + } + ret = pkgmgrinfo_pkginfo_get_csc_path(handle, &csc_path); if (ret != PMINFO_R_OK) DBG("pkgmgrinfo_pkginfo_get_csc_path failed\n"); @@ -4700,6 +4942,10 @@ API int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *con if (ret == -1) DBG("Upgrade metadata parser failed\n"); + ret = __ps_process_category_parser(mfx, ACTION_UPGRADE); + if (ret == -1) + DBG("Creating category parser failed\n"); + ret = __ps_make_nativeapp_desktop(mfx, manifest, 1); if (ret == -1) DBG("Creating desktop file failed\n"); @@ -4738,6 +4984,10 @@ API int pkgmgr_parser_parse_manifest_for_uninstallation(const char *manifest, ch if (ret == -1) DBG("Removing metadata parser failed\n"); + ret = __ps_process_category_parser(mfx, ACTION_UNINSTALL); + if (ret == -1) + DBG("Creating category parser failed\n"); + ret = pkgmgr_parser_delete_manifest_info_from_db(mfx); if (ret == -1) DBG("DB Delete failed\n"); diff --git a/parser/pkgmgr_parser.h b/parser/pkgmgr_parser.h index e9c4d55..85cb41c 100755 --- a/parser/pkgmgr_parser.h +++ b/parser/pkgmgr_parser.h @@ -456,6 +456,7 @@ typedef struct manifest_x { const char *readonly; /**< package readonly flag*/ const char *update; /**< package update flag*/ const char *appsetting; /**< package app setting flag*/ + const char *system; /**< package system flag*/ const char *type; /**< package type*/ const char *package_size; /**< package size for external installation*/ const char *installed_time; /**< installed time after finishing of installation*/ diff --git a/parser/pkgmgr_parser_db.c b/parser/pkgmgr_parser_db.c index c3a90c7..de46f96 100755 --- a/parser/pkgmgr_parser_db.c +++ b/parser/pkgmgr_parser_db.c @@ -37,11 +37,7 @@ #define MAX_QUERY_LEN 4096 sqlite3 *pkgmgr_parser_db; sqlite3 *pkgmgr_cert_db; -GList *pkglocale = NULL; -GList *applocale = NULL; -GList *appicon = NULL; -GList *appimage = NULL; -char *prev = NULL; + #define QUERY_CREATE_TABLE_PACKAGE_INFO "create table if not exists package_info " \ "(package text primary key not null, " \ @@ -55,6 +51,7 @@ char *prev = NULL; "package_update text DEFAULT 'false', " \ "package_appsetting text DEFAULT 'false', " \ "package_nodisplay text DEFAULT 'false', " \ + "package_system text DEFAULT 'false', " \ "author_name text, " \ "author_email text, " \ "author_href text," \ @@ -256,8 +253,6 @@ static int __exec_query(char *query); static void __extract_data(gpointer data, label_x *lbl, license_x *lcn, icon_x *icn, description_x *dcn, author_x *ath, char **label, char **license, char **icon, char **description, char **author); static gint __comparefunc(gconstpointer a, gconstpointer b, gpointer userdata); -static void __trimfunc1(gpointer data, gpointer userdata); -static void __trimfunc2(gpointer data, gpointer userdata); static GList *__create_locale_list(GList *locale, label_x *lbl, license_x *lcn, icon_x *icn, description_x *dcn, author_x *ath); static void __preserve_guestmode_visibility_value(manifest_x *mfx); static int __guestmode_visibility_cb(void *data, int ncols, char **coltxt, char **colname); @@ -455,52 +450,31 @@ static void __printfunc(gpointer data, gpointer userdata) DBG("%s ", (char*)data); } -static void __trimfunc1(gpointer data, gpointer userdata) -{ - if (prev) { - if (strcmp((char *)data, prev) == 0) { - pkglocale = g_list_remove(pkglocale, data); - } else - prev = (char *)data; - } - else - prev = (char *)data; -} - -static void __trimfunc2(gpointer data, gpointer userdata) +static void __trimfunc(GList* trim_list) { - if (prev) { - if (strcmp((char *)data, prev) == 0) { - applocale = g_list_remove(applocale, data); - } else - prev = (char *)data; - } - else - prev = (char *)data; -} - -static void __trimfunc3(gpointer data, gpointer userdata) -{ - if (prev) { - if (strcmp((char *)data, prev) == 0) { - appicon = g_list_remove(appicon, data); - } else - prev = (char *)data; - } - else - prev = (char *)data; -} - -static void __trimfunc4(gpointer data, gpointer userdata) -{ - if (prev) { - if (strcmp((char *)data, prev) == 0) { - appimage = g_list_remove(appimage, data); - } else - prev = (char *)data; + char *trim_data = NULL; + char *prev = NULL; + + GList *list = NULL; + list = g_list_first(trim_list); + + while (list) { + trim_data = (char *)list->data; + if (trim_data) { + if (prev) { + if (strcmp(trim_data, prev) == 0) { + trim_list = g_list_remove(trim_list, trim_data); + list = g_list_first(trim_list); + prev = NULL; + continue; + } else + prev = trim_data; + } + else + prev = trim_data; + } + list = g_list_next(list); } - else - prev = (char *)data; } static gint __comparefunc(gconstpointer a, gconstpointer b, gpointer userdata) @@ -660,6 +634,12 @@ static void __insert_uiapplication_locale_info(gpointer data, gpointer userdata) "('%q', '%q', '%q', '%q', '%q', '%q', '%q')", up->package, (char*)data, label, icon, NULL, NULL, NULL); ret = __exec_query_no_msg(query); + + if (icon != NULL) { + sqlite3_snprintf(MAX_QUERY_LEN, query, "update package_localized_info set package_icon='%s' "\ + "where package='%s' and package_locale='%s'", icon, up->package, (char*)data); + ret = __exec_query_no_msg(query); + } } } @@ -1478,6 +1458,12 @@ static int __insert_manifest_info_in_db(manifest_x *mfx) const char *auth_name = NULL; const char *auth_email = NULL; const char *auth_href = NULL; + + GList *pkglocale = NULL; + GList *applocale = NULL; + GList *appicon = NULL; + GList *appimage = NULL; + if (ath) { if (ath->text) auth_name = ath->text; @@ -1505,11 +1491,11 @@ static int __insert_manifest_info_in_db(manifest_x *mfx) } snprintf(query, MAX_QUERY_LEN, "insert into package_info(package, package_type, package_version, install_location, package_size, " \ - "package_removable, package_preload, package_readonly, package_update, package_appsetting, package_nodisplay, " \ + "package_removable, package_preload, package_readonly, package_update, package_appsetting, package_nodisplay, package_system," \ "author_name, author_email, author_href, installed_time, installed_storage, storeclient_id, mainapp_id, package_url, root_path, csc_path) " \ - "values('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\ + "values('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\ mfx->package, type, mfx->version, mfx->installlocation, mfx->package_size, mfx->removable, mfx->preload, - mfx->readonly, mfx->update, mfx->appsetting, mfx->nodisplay_setting, + mfx->readonly, mfx->update, mfx->appsetting, mfx->nodisplay_setting, mfx->system, auth_name, auth_email, auth_href, mfx->installed_time, mfx->installed_storage, mfx->storeclient_id, mfx->mainapp_id, mfx->package_url, path, mfx->csc_path); ret = __exec_query(query); if (ret == -1) { @@ -1557,11 +1543,12 @@ static int __insert_manifest_info_in_db(manifest_x *mfx) if (ret == -1) return -1; - /*Insert the package locale and app locale info */ + /*Insert the package locale*/ pkglocale = __create_locale_list(pkglocale, lbl, lcn, icn, dcn, ath); - g_list_foreach(pkglocale, __trimfunc1, NULL); - prev = NULL; + /*remove duplicated data in pkglocale*/ + __trimfunc(pkglocale); + /*Insert the app locale info */ while(up != NULL) { applocale = __create_locale_list(applocale, up->label, NULL, up->icon, NULL, NULL); @@ -1572,8 +1559,8 @@ static int __insert_manifest_info_in_db(manifest_x *mfx) applocale = __create_locale_list(applocale, sp->label, NULL, sp->icon, NULL, NULL); sp = sp->next; } - g_list_foreach(applocale, __trimfunc2, NULL); - prev = NULL; + /*remove duplicated data in applocale*/ + __trimfunc(applocale); /*Insert the app icon info */ while(up_icn != NULL) @@ -1581,8 +1568,8 @@ static int __insert_manifest_info_in_db(manifest_x *mfx) appicon = __create_icon_list(appicon, up_icn->icon); up_icn = up_icn->next; } - g_list_foreach(appicon, __trimfunc3, NULL); - prev = NULL; + /*remove duplicated data in appicon*/ + __trimfunc(appicon); /*Insert the image info */ while(up_image != NULL) @@ -1590,8 +1577,8 @@ static int __insert_manifest_info_in_db(manifest_x *mfx) appimage = __create_image_list(appimage, up_image->image); up_image = up_image->next; } - g_list_foreach(appimage, __trimfunc4, NULL); - prev = NULL; + /*remove duplicated data in appimage*/ + __trimfunc(appimage); /*g_list_foreach(pkglocale, __printfunc, NULL);*/ /*DBG("\n");*/ diff --git a/parser_path.conf.in b/parser_path.conf.in index 04f5153..a54cc0a 100755 --- a/parser_path.conf.in +++ b/parser_path.conf.in @@ -3,3 +3,4 @@ parserlib:/usr/etc/package-manager/parserlib/ mdparser:/usr/etc/package-manager/parserlib/metadata/ +categoryparser:/usr/etc/package-manager/parserlib/category/ diff --git a/src/pkgmgr-info.c b/src/pkgmgr-info.c index 763b5f6..0883a71 100755 --- a/src/pkgmgr-info.c +++ b/src/pkgmgr-info.c @@ -1075,6 +1075,11 @@ static int __pkginfo_cb(void *data, int ncols, char **coltxt, char **colname) info->manifest_info->update= strdup(coltxt[i]); else info->manifest_info->update = NULL; + } else if (strcmp(colname[i], "package_system") == 0 ){ + if (coltxt[i]) + info->manifest_info->system= strdup(coltxt[i]); + else + info->manifest_info->system = NULL; } else if (strcmp(colname[i], "package_appsetting") == 0 ){ if (coltxt[i]) info->manifest_info->appsetting = strdup(coltxt[i]); @@ -3330,16 +3335,17 @@ API int pkgmgrinfo_pkginfo_is_system(pkgmgrinfo_pkginfo_h handle, bool *system) retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n"); retvm_if(system == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n"); - char *preload = NULL; - char *removable = NULL; + char *val = NULL; pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle; - preload = (char *)info->manifest_info->preload; - removable = (char *)info->manifest_info->removable; - - if ((strcasecmp(preload, "true") == 0) && (strcasecmp(removable, "false") == 0)) - *system = 1; - else - *system = 0; + val = (char *)info->manifest_info->system; + if (val) { + if (strcasecmp(val, "true") == 0) + *system = 1; + else if (strcasecmp(val, "false") == 0) + *system = 0; + else + *system = 0; + } return PMINFO_R_OK; } @@ -5049,9 +5055,11 @@ API int pkgmgrinfo_appinfo_foreach_permission(pkgmgrinfo_appinfo_h handle, else return PMINFO_R_EINVAL; for (; ptr; ptr = ptr->next) { - ret = permission_func(ptr->value, user_data); - if (ret < 0) - break; + if (ptr->value) { + ret = permission_func(ptr->value, user_data); + if (ret < 0) + break; + } } return PMINFO_R_OK; } @@ -5071,9 +5079,11 @@ API int pkgmgrinfo_appinfo_foreach_category(pkgmgrinfo_appinfo_h handle, else return PMINFO_R_EINVAL; for (; ptr; ptr = ptr->next) { - ret = category_func(ptr->name, user_data); - if (ret < 0) - break; + if (ptr->name) { + ret = category_func(ptr->name, user_data); + if (ret < 0) + break; + } } return PMINFO_R_OK; } -- 2.7.4