#define ASCII(s) (char *)s
#define XMLCHAR(s) (const xmlChar *)s
-//#define METADATA_PARSER_LIST SYSCONFDIR "/package-manager/parserlib/metadata/metadata_parser_list.txt"
#define METADATA_PARSER_LIST SYSCONFDIR "/package-manager/parserlib/metadata/mdparser_list.txt"
#define METADATA_PARSER_NAME "metadataparser:"
static int __process_manifest(xmlTextReaderPtr reader, manifest_x * mfx, uid_t uid);
static void __str_trim(char *input);
static char *__get_parser_plugin(const char *type);
-static int __ps_run_parser(xmlDocPtr docPtr, const char *tag, ACTION_TYPE action, const char *pkgid);
API int __is_admin();
static void __save_xml_attribute(xmlTextReaderPtr reader, char *attribute, char **xml_attribute, char *default_value)
*xml_attribute = strdup((const char *)attrib_val);
xmlFree(attrib_val);
} else {
- if (default_value != NULL) {
+ if (default_value != NULL)
*xml_attribute = strdup(default_value);
- }
}
}
mfx->readonly = strdup("False");
mfx->update = strdup("False");
mfx->system = strdup("False");
- mfx->installed_storage= strdup("installed_internal");
+ mfx->installed_storage = strdup("installed_internal");
package = mfx->package;
}
API int __is_admin()
{
uid_t uid = getuid();
- if ((uid_t) 0 == uid )
+ if ((uid_t)0 == uid)
return 1;
else
return 0;
fclose(fp);
if (path == NULL) {
- _LOGE("no matching [%s] [%s]\n", METADATA_PARSER_NAME,type);
+ _LOGE("no matching [%s] [%s]\n", METADATA_PARSER_NAME, type);
return NULL;
}
fclose(fp);
if (path == NULL) {
- _LOGE("no matching [%s] [%s]\n", CATEGORY_PARSER_NAME,type);
+ _LOGE("no matching [%s] [%s]\n", CATEGORY_PARSER_NAME, type);
return NULL;
}
if ((metadata_parser_plugin =
dlsym(lib_handle, ac)) == NULL || dlerror() != NULL) {
- _LOGE("can not find symbol[%s] \n",ac);
+ _LOGE("can not find symbol[%s] \n", ac);
goto END;
}
if ((category_parser_plugin =
dlsym(lib_handle, ac)) == NULL || dlerror() != NULL) {
- _LOGE("can not find symbol[%s] \n",ac);
+ _LOGE("can not find symbol[%s] \n", ac);
goto END;
}
return ret;
}
-static int __ps_run_parser(xmlDocPtr docPtr, const char *tag,
- ACTION_TYPE action, const char *pkgid)
-{
- char *lib_path = NULL;
- void *lib_handle = NULL;
- int (*plugin_install) (xmlDocPtr, const char *);
- int ret = -1;
- char *ac = NULL;
-
- switch (action) {
- case ACTION_INSTALL:
- ac = "PKGMGR_PARSER_PLUGIN_INSTALL";
- break;
- case ACTION_UPGRADE:
- ac = "PKGMGR_PARSER_PLUGIN_UPGRADE";
- break;
- case ACTION_UNINSTALL:
- ac = "PKGMGR_PARSER_PLUGIN_UNINSTALL";
- break;
- default:
- goto END;
- }
-
- lib_path = __get_parser_plugin(tag);
- if (!lib_path) {
- goto END;
- }
-
- if ((lib_handle = dlopen(lib_path, RTLD_LAZY)) == NULL) {
- _LOGE("dlopen is failed lib_path[%s]\n", lib_path);
- goto END;
- }
- if ((plugin_install =
- dlsym(lib_handle, ac)) == NULL || dlerror() != NULL) {
- _LOGE("can not find symbol[%s] \n", ac);
- goto END;
- }
-
- ret = plugin_install(docPtr, pkgid);
- if (ret < 0)
- _LOGD("[pkgid = %s, libpath = %s plugin fail\n", pkgid, lib_path);
- else
- _LOGD("[pkgid = %s, libpath = %s plugin success\n", pkgid, lib_path);
-
-END:
- if (lib_path)
- free(lib_path);
- if (lib_handle)
- dlclose(lib_handle);
- return ret;
-}
-
static void __metadata_parser_clear_dir_list(GList* dir_list)
{
GList *list = NULL;
value = xmlTextReaderConstValue(reader);
if (value != NULL) {
- if (xmlStrlen(value) > 40) {
+ if (xmlStrlen(value) > 40)
_LOGD(" %.40s...", value);
- } else {
+ else
_LOGD(" %s", value);
- }
}
name = xmlTextReaderConstName(reader);
if (temp == NULL)
return -1;
xmlNode *next_node = NULL;
- while(cur_node != NULL) {
- if ( (strcmp(ASCII(temp->name), ASCII(cur_node->name)) == 0) &&
- (temp->line == cur_node->line) ) {
+ while (cur_node != NULL) {
+ if ((strcmp(ASCII(temp->name), ASCII(cur_node->name)) == 0) &&
+ (temp->line == cur_node->line)) {
break;
- }
- else {
+ } else {
next_node = xmlNextElementSibling(cur_node);
xmlUnlinkNode(cur_node);
xmlFreeNode(cur_node);
return ret;
}
-static int __run_metadata_parser_prestep (manifest_x *mfx, char *md_key, ACTION_TYPE action)
+static int __run_metadata_parser_prestep(manifest_x *mfx, char *md_key, ACTION_TYPE action)
{
int ret = -1;
int tag_exist = 0;
md = (metadata_x *)md_tmp->data;
if (md == NULL)
continue;
- //get glist of metadata key and value combination
+ /* get glist of metadata key and value combination */
memset(buffer, 0x00, 1024);
snprintf(buffer, 1024, "%s/", md_key);
if ((md->key && md->value) && (strncmp(md->key, md_key, strlen(md_key)) == 0) && (strncmp(buffer, md->key, strlen(buffer)) == 0)) {
}
}
- //send glist to parser when tags for metadata plugin parser exist.
+ /* send glist to parser when tags for metadata plugin parser exist. */
if (tag_exist) {
ret = __ps_run_metadata_parser(md_list, md_tag, action, mfx->package, app->appid);
- if (ret < 0){
+ if (ret < 0)
_LOGD("metadata_parser failed[%d] for tag[%s]\n", ret, md_tag);
- }
- else{
+ else
_LOGD("metadata_parser success for tag[%s]\n", md_tag);
- }
}
__metadata_parser_clear_dir_list(md_list);
md_list = NULL;
return ret;
}
-static int __run_category_parser_prestep (manifest_x *mfx, char *category_key, ACTION_TYPE action)
+static int __run_category_parser_prestep(manifest_x *mfx, char *category_key, ACTION_TYPE action)
{
int ret = -1;
int tag_exist = 0;
continue;
for (category_tmp = app->category; category_tmp; category_tmp = category_tmp->next) {
category = (const char *)category_tmp->data;
- //get glist of category key and value combination
+ /* get glist of category key and value combination */
memset(buffer, 0x00, 1024);
snprintf(buffer, 1024, "%s/", category_key);
if ((category) && (strncmp(category, category_key, strlen(category_key)) == 0)) {
}
}
- //send glist to parser when tags for metadata plugin parser exist.
+ /* 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, app->appid);
if (ret < 0)
}
case XML_READER_TYPE_ELEMENT:
{
- // Elements without closing tag don't receive
+ /* Elements without closing tag don't receive */
const xmlChar *elementName =
xmlTextReaderLocalName(reader);
- if (elementName == NULL) {
+ if (elementName == NULL)
break;
- }
if (strcmp(tag, ASCII(elementName)) == 0) {
_LOGD("find : tag[%s] ACTION_TYPE[%d] pkg[%s]\n", tag, action, pkgid);
}
xmlFreeTextReader(reader);
- if (ret != 0) {
+ if (ret != 0)
_LOGD("%s : failed to parse", filename);
- }
} else {
_LOGD("Unable to open %s", filename);
}
int __ps_process_metadata_parser(manifest_x *mfx, ACTION_TYPE action)
{
- fprintf(stdout,"__ps_process_metadata_parser\n");
+ fprintf(stdout, "__ps_process_metadata_parser\n");
int ret = 0;
FILE *fp = NULL;
char md_key[PKG_STRING_LEN_MAX] = { 0 };
return strdup(icon);
do {
- snprintf(icon_with_path, sizeof(icon_with_path), "%s%s",
- getIconPath(uid, true), icon);
- if (access(icon_with_path, F_OK) == 0)
- break;
+ if (uid == GLOBAL_USER || uid == OWNER_ROOT) {
+ snprintf(icon_with_path, sizeof(icon_with_path),
+ "%s%s", getIconPath(uid, true), icon);
+ if (access(icon_with_path, F_OK) == 0)
+ break;
- snprintf(icon_with_path, sizeof(icon_with_path), "%s%s",
- getIconPath(uid, false), icon);
- if (access(icon_with_path, F_OK) == 0)
- break;
+ snprintf(icon_with_path, sizeof(icon_with_path),
+ "%s%s", getIconPath(uid, false), icon);
+ if (access(icon_with_path, F_OK) == 0)
+ break;
- /* for backward compatibility (.../default/small/...)
- * this should be removed
- */
- snprintf(icon_with_path, sizeof(icon_with_path),
+ /* for backward compatibility (.../default/small/...)
+ * this should be removed
+ */
+ snprintf(icon_with_path, sizeof(icon_with_path),
"%sdefault/small/%s",
getIconPath(uid, true), icon);
- if (access(icon_with_path, F_OK) == 0)
- break;
+ if (access(icon_with_path, F_OK) == 0)
+ break;
- snprintf(icon_with_path, sizeof(icon_with_path),
+ snprintf(icon_with_path, sizeof(icon_with_path),
"%sdefault/small/%s",
getIconPath(uid, false), icon);
- if (access(icon_with_path, F_OK) == 0)
- break;
+ if (access(icon_with_path, F_OK) == 0)
+ break;
- /* If doesn't exist in case of Global app,
- * try to get icon directly into app's directory
- */
- if (uid == GLOBAL_USER || uid == OWNER_ROOT) {
+ /* If doesn't exist in case of Global app,
+ * try to get icon directly into app's directory
+ */
app_path = tzplatform_getenv(TZ_SYS_RO_APP);
snprintf(icon_with_path, sizeof(icon_with_path),
char delims[] = "=";
char *ret_result = NULL;
char *tag = NULL;
+ char *ptr = NULL;
if (tagv == NULL)
return;
for (tag = strdup(tagv[0]); tag != NULL; ) {
- ret_result = strtok(tag, delims);
+ ret_result = strtok_r(tag, delims, &ptr);
/*check tag : preload */
if (strcmp(ret_result, "preload") == 0) {
- ret_result = strtok(NULL, delims);
+ ret_result = strtok_r(NULL, delims, &ptr);
if (strcmp(ret_result, "true") == 0) {
free((void *)mfx->preload);
mfx->preload = strdup("true");
}
/*check tag : removable*/
} else if (strcmp(ret_result, "removable") == 0) {
- ret_result = strtok(NULL, delims);
- if (strcmp(ret_result, "true") == 0){
+ ret_result = strtok_r(NULL, delims, &ptr);
+ if (strcmp(ret_result, "true") == 0) {
free((void *)mfx->removable);
mfx->removable = strdup("true");
} else if (strcmp(ret_result, "false") == 0) {
__save_xml_attribute(reader, "orientation", &splashscreen->orientation, NULL);
__save_xml_attribute(reader, "indicator-display", &splashscreen->indicatordisplay, NULL);
__save_xml_attribute(reader, "app-control-operation", &splashscreen->operation, NULL);
+ __save_xml_attribute(reader, "color-depth", &splashscreen->color_depth, NULL);
return 0;
}
__save_xml_attribute(reader, "ui-gadget", &application->ui_gadget, "false");
__save_xml_attribute(reader, "auto-restart", &application->autorestart, "false");
__save_xml_attribute(reader, "on-boot", &application->onboot, "false");
+ __save_xml_attribute(reader, "splash-screen-display", &application->splash_screen_display, "true");
- application->package= strdup(package);
+ application->package = strdup(package);
/* overwrite some attributes if the app is widgetapp */
if (type == PMINFO_WIDGET_APP || type == PMINFO_WATCH_APP) {
free((void *)application->nodisplay);
application->indicatordisplay = strdup("false");
}
+ /* hw-acceleration values are changed from use-GL/not-use-GL/use-system-setting to on/off/default */
+ if (strcmp(application->hwacceleration, "use-GL") == 0) {
+ free((void *)application->hwacceleration);
+ application->hwacceleration = strdup("on");
+ } else if (strcmp(application->hwacceleration, "not-use-GL") == 0) {
+ free((void *)application->hwacceleration);
+ application->hwacceleration = strdup("off");
+ } else if (strcmp(application->hwacceleration, "use-system-setting") == 0) {
+ free((void *)application->hwacceleration);
+ application->hwacceleration = strdup("default");
+ }
+
depth = xmlTextReaderDepth(reader);
while ((ret = __next_child_element(reader, depth))) {
node = xmlTextReaderConstName(reader);
if (application == NULL)
continue;
ret = appsvc_operation(application->appid, uid);
- if (ret <0)
+ if (ret < 0)
_LOGE("can not operation symbol \n");
}
return 0;
}
-API int pkgmgr_parser_create_desktop_file(manifest_x *mfx)
-{
- /* desktop file is no longer used */
- return 0;
-}
-
-API int pkgmgr_parser_create_usr_desktop_file(manifest_x *mfx, uid_t uid)
-{
- /* desktop file is no longer used */
- return 0;
-}
-
-
API void pkgmgr_parser_free_manifest_xml(manifest_x *mfx)
{
pkgmgrinfo_basic_free_package((package_x *)mfx);
}
-API manifest_x *pkgmgr_parser_process_manifest_xml(const char *manifest)
+DEPRECATED API manifest_x *pkgmgr_parser_process_manifest_xml(const char *manifest)
{
_LOGD("parsing start pkgmgr_parser_process_manifest_xml\n");
xmlTextReaderPtr reader;
}
-API manifest_x *pkgmgr_parser_usr_process_manifest_xml(const char *manifest, uid_t uid)
+DEPRECATED API manifest_x *pkgmgr_parser_usr_process_manifest_xml(const char *manifest, uid_t uid)
{
_LOGD("parsing start pkgmgr_parser_usr_process_manifest_xml\n");
xmlTextReaderPtr reader;
return pkgmgr_parser_update_tep_info_in_db(pkgid, tep_path);
}
-API int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char *const tagv[])
+DEPRECATED API int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char *const tagv[])
{
retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
_LOGD("parsing manifest for installation: %s\n", manifest);
return PMINFO_R_OK;
}
-API int pkgmgr_parser_parse_usr_manifest_for_installation(const char *manifest, uid_t uid, char *const tagv[])
+
+DEPRECATED API int pkgmgr_parser_parse_usr_manifest_for_installation(const char *manifest, uid_t uid, char *const tagv[])
{
retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
_LOGD("parsing manifest for installation: %s\n", manifest);
return PMINFO_R_OK;
}
-API int pkgmgr_parser_process_manifest_x_for_installation(manifest_x* mfx, const char *manifest) {
+API int pkgmgr_parser_process_manifest_x_for_installation(manifest_x* mfx, const char *manifest)
+{
retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
_LOGD("processing manifest_x for installation: %s\n", manifest);
int ret = -1;
- xmlInitParser();
-
- _LOGD("Added preload infomation\n");
-
ret = pkgmgr_parser_insert_manifest_info_in_db(mfx);
retvm_if(ret == PMINFO_R_ERROR, PMINFO_R_ERROR, "DB Insert failed");
_LOGD("DB Insert Success\n");
- xmlCleanupParser();
return PMINFO_R_OK;
}
-API int pkgmgr_parser_process_usr_manifest_x_for_installation(manifest_x* mfx, const char *manifest, uid_t uid) {
+API int pkgmgr_parser_process_usr_manifest_x_for_installation(manifest_x* mfx, const char *manifest, uid_t uid)
+{
retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
_LOGD("processing manifest_x for installation: %s\n", manifest);
int ret = -1;
- xmlInitParser();
ret = pkgmgr_parser_insert_manifest_info_in_usr_db(mfx, uid);
retvm_if(ret == PMINFO_R_ERROR, PMINFO_R_ERROR, "DB Insert failed");
_LOGD("DB Insert Success\n");
- xmlCleanupParser();
+
return PMINFO_R_OK;
}
-API int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *const tagv[])
+DEPRECATED API int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *const tagv[])
{
retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
_LOGD("pkgmgr_parser_parse_manifest_for_upgrade parsing manifest for upgradation: %s\n", manifest);
mfx->csc_path = strdup(csc_path);
}
+ /*Delete from cert table*/
+ ret = pkgmgrinfo_delete_certinfo(mfx->package);
+ if (ret) {
+ _LOGD("Cert Info DB Delete Failed\n");
+ return -1;
+ }
+
ret = pkgmgr_parser_update_manifest_info_in_db(mfx);
retvm_if(ret == PMINFO_R_ERROR, PMINFO_R_ERROR, "DB Insert failed");
__ps_process_tag_parser(mfx, manifest, ACTION_UPGRADE);
ret = __ps_process_metadata_parser(mfx, ACTION_UPGRADE);
- if (ret == -1){
+ if (ret == -1)
_LOGD("Upgrade metadata parser failed\n");
- }
ret = __ps_process_category_parser(mfx, ACTION_UPGRADE);
if (ret == -1)
_LOGD("Creating category parser failed\n");
return PMINFO_R_OK;
}
-API int pkgmgr_parser_parse_usr_manifest_for_upgrade(const char *manifest, uid_t uid, char *const tagv[])
+DEPRECATED API int pkgmgr_parser_parse_usr_manifest_for_upgrade(const char *manifest, uid_t uid, char *const tagv[])
{
retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
_LOGD(" pkgmgr_parser_parse_usr_manifest_for_upgrade parsing manifest for upgradation: %s\n", manifest);
mfx->csc_path = strdup(csc_path);
}
+ /*Delete from cert table*/
+ ret = pkgmgrinfo_delete_certinfo(mfx->package);
+ if (ret) {
+ _LOGD("Cert Info DB Delete Failed\n");
+ return -1;
+ }
+
ret = pkgmgr_parser_update_manifest_info_in_usr_db(mfx, uid);
retvm_if(ret == PMINFO_R_ERROR, PMINFO_R_ERROR, "DB Insert failed");
_LOGD("DB Update Success\n");
return PMINFO_R_OK;
}
-API int pkgmgr_parser_process_manifest_x_for_upgrade(manifest_x* mfx, const char *manifest) {
+API int pkgmgr_parser_process_manifest_x_for_upgrade(manifest_x* mfx, const char *manifest)
+{
retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
_LOGD("pkgmgr_parser_process_manifest_x_for_upgrade parsing manifest for upgradation: %s\n", manifest);
int ret = -1;
- bool system = false;
- char *csc_path = NULL;
- pkgmgrinfo_pkginfo_h handle = NULL;
-
- xmlInitParser();
-
- ret = pkgmgrinfo_pkginfo_get_pkginfo(mfx->package, &handle);
- if (ret != PMINFO_R_OK)
- _LOGD("pkgmgrinfo_pkginfo_get_pkginfo failed\n");
-
- ret = pkgmgrinfo_pkginfo_is_system(handle, &system);
- if (ret != PMINFO_R_OK)
- _LOGD("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)
- _LOGD("pkgmgrinfo_pkginfo_get_csc_path failed\n");
-
- if (csc_path != NULL) {
- if (mfx->csc_path)
- free((void *)mfx->csc_path);
- mfx->csc_path = strdup(csc_path);
- }
ret = pkgmgr_parser_update_manifest_info_in_db(mfx);
retvm_if(ret == PMINFO_R_ERROR, PMINFO_R_ERROR, "DB Insert failed");
_LOGD("DB Update Success\n");
- pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
- xmlCleanupParser();
return PMINFO_R_OK;
}
-API int pkgmgr_parser_process_usr_manifest_x_for_upgrade(manifest_x* mfx, const char *manifest, uid_t uid) {
+API int pkgmgr_parser_process_usr_manifest_x_for_upgrade(manifest_x* mfx, const char *manifest, uid_t uid)
+{
retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
_LOGD(" pkgmgr_parser_process_usr_manifest_x_for_upgrade parsing manifest for upgradation: %s\n", manifest);
int ret = -1;
- pkgmgrinfo_pkginfo_h handle = NULL;
-
- xmlInitParser();
-
- ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(mfx->package, uid, &handle);
- if (ret != PMINFO_R_OK)
- _LOGD("pkgmgrinfo_pkginfo_get_pkginfo failed\n");
ret = pkgmgr_parser_update_manifest_info_in_usr_db(mfx, uid);
retvm_if(ret == PMINFO_R_ERROR, PMINFO_R_ERROR, "DB Insert failed");
_LOGD("DB Update Success\n");
- pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
- xmlCleanupParser();
return PMINFO_R_OK;
}
if (ret == -1)
_LOGD("Creating category parser failed\n");
+ /*Delete from cert table*/
+ ret = pkgmgrinfo_delete_certinfo(mfx->package);
+ if (ret) {
+ _LOGD("Cert Info DB Delete Failed\n");
+ return -1;
+ }
+
ret = pkgmgr_parser_delete_manifest_info_from_db(mfx);
if (ret == -1)
_LOGD("DB Delete failed\n");
if (ret == -1)
_LOGD("Creating category parser failed\n");
+ /*Delete from cert table*/
+ ret = pkgmgrinfo_delete_certinfo(mfx->package);
+ if (ret) {
+ _LOGD("Cert Info DB Delete Failed\n");
+ return -1;
+ }
+
ret = pkgmgr_parser_delete_manifest_info_from_usr_db(mfx, uid);
if (ret == -1)
_LOGD("DB Delete failed\n");
return PMINFO_R_OK;
}
-API int pkgmgr_parser_process_manifest_x_for_uninstallation(manifest_x* mfx, const char *manifest) {
+API int pkgmgr_parser_process_manifest_x_for_uninstallation(manifest_x* mfx, const char *manifest)
+{
retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
_LOGD("processing manifest_x for uninstallation: %s\n", manifest);
int ret = -1;
- xmlInitParser();
ret = pkgmgr_parser_delete_manifest_info_from_db(mfx);
if (ret == -1)
_LOGD("DB Delete failed\n");
else
_LOGD("DB Delete Success\n");
- xmlCleanupParser();
return PMINFO_R_OK;
}
-API int pkgmgr_parser_process_usr_manifest_x_for_uninstallation(manifest_x* mfx, const char *manifest, uid_t uid) {
+API int pkgmgr_parser_process_usr_manifest_x_for_uninstallation(manifest_x* mfx, const char *manifest, uid_t uid)
+{
retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
_LOGD("processing manifest_x for uninstallation: %s\n", manifest);
int ret = -1;
- xmlInitParser();
ret = pkgmgr_parser_delete_manifest_info_from_usr_db(mfx, uid);
if (ret == -1)
_LOGD("Removing appsvc_db failed\n");
else
_LOGD("Removing appsvc_db Success\n");
- xmlCleanupParser();
return PMINFO_R_OK;
}
-API int pkgmgr_parser_parse_manifest_for_preload()
-{
- return pkgmgr_parser_update_preload_info_in_db();
-}
-
-API int pkgmgr_parser_parse_usr_manifest_for_preload(uid_t uid)
-{
- return pkgmgr_parser_update_preload_info_in_usr_db(uid);
-}
-
-API int pkgmgr_parser_run_parser_for_installation(xmlDocPtr docPtr, const char *tag, const char *pkgid)
-{
- return __ps_run_parser(docPtr, tag, ACTION_INSTALL, pkgid);
-}
-
-API int pkgmgr_parser_run_parser_for_upgrade(xmlDocPtr docPtr, const char *tag, const char *pkgid)
-{
- return __ps_run_parser(docPtr, tag, ACTION_UPGRADE, pkgid);
-}
-
-API int pkgmgr_parser_run_parser_for_uninstallation(xmlDocPtr docPtr, const char *tag, const char *pkgid)
-{
- return __ps_run_parser(docPtr, tag, ACTION_UNINSTALL, pkgid);
-}
-
#define SCHEMA_FILE SYSCONFDIR "/package-manager/preload/manifest.xsd"
-#if 1
API int pkgmgr_parser_check_manifest_validation(const char *manifest)
{
if (manifest == NULL) {
return PMINFO_R_OK;
}
-#else
-API int pkgmgr_parser_check_manifest_validation(const char *manifest)
-{
- int err = 0;
- int status = 0;
- pid_t pid;
-
- pid = fork();
-
- switch (pid) {
- case -1:
- _LOGE("fork failed\n");
- return -1;
- case 0:
- /* child */
- {
- int dev_null_fd = open ("/dev/null", O_RDWR);
- if (dev_null_fd >= 0)
- {
- dup2 (dev_null_fd, 0);/*stdin*/
- dup2 (dev_null_fd, 1);/*stdout*/
- dup2 (dev_null_fd, 2);/*stderr*/
- }
-
- if (execl("/usr/bin/xmllint", "xmllint", manifest, "--schema",
- SCHEMA_FILE, NULL) < 0) {
- _LOGE("execl error\n");
- }
-
- _exit(100);
- }
- default:
- /* parent */
- break;
- }
-
- while ((err = waitpid(pid, &status, WNOHANG)) != pid) {
- if (err < 0) {
- if (errno == EINTR)
- continue;
- _LOGE("waitpid failed\n");
- return -1;
- }
- }
-
-
- if(WIFEXITED(status) && !WEXITSTATUS(status))
- return 0;
- else
- return -1;
-}
-#endif