- /*If package dont have main_package tag, this package is main package.*/
- if (mfx->main_package == NULL) {
- ret = __exec_query(query);
- if (ret == -1) {
- _LOGD("Package Info DB Insert Failed\n");
- if (type) {
- free(type);
- type = NULL;
- }
- if (path) {
- free(path);
- path = NULL;
- }
- return -1;
- }
- } else {
- /*If package has main_package tag, this package is sub package(ug, efl).
- skip __exec_query for package_info and change pkgid with main_package*/
- memset(root, '\0', MAX_QUERY_LEN);
- snprintf(root, MAX_QUERY_LEN - 1, "/usr/apps/%s", mfx->main_package);
- if (access(root, F_OK) == 0) {
- free((void *)mfx->package);
- mfx->package = strdup(mfx->main_package);
- } else {
- _LOGE("main package[%s] is not installed\n", root);
- return -1;
- }
- }
- if (type) {
- free(type);
- type = NULL;
- }
- if (path) {
- free(path);
- path = NULL;