################## ## build comm libraries
ADD_SUBDIRECTORY(parser)
ADD_SUBDIRECTORY(tool)
+ADD_SUBDIRECTORY(plugin_list)
## build pkgmgr-info library
AUX_SOURCE_DIRECTORY(src SRCS)
TARGET_LINK_LIBRARIES(pkgmgr-info pkgmgr_parser ${libpkgs_LDFLAGS})
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/pkgmgr-info.pc.in ${CMAKE_BINARY_DIR}/pkgmgr-info.pc @ONLY)
-CONFIGURE_FILE(parser_path.conf.in parser_path.conf @ONLY)
-CONFIGURE_FILE(mdparser_list.txt.in mdparser_list.txt @ONLY)
-CONFIGURE_FILE(category_parser_list.txt.in category_parser_list.txt @ONLY)
-CONFIGURE_FILE(tag_parser_list.txt.in tag_parser_list.txt @ONLY)
CONFIGURE_FILE(pkg_db_version.txt.in pkg_db_version.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(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include)
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/parser_path.conf DESTINATION ${SYSCONFDIR}/package-manager/)
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mdparser_list.txt DESTINATION ${SYSCONFDIR}/package-manager/parserlib/metadata)
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/category_parser_list.txt DESTINATION ${SYSCONFDIR}/package-manager/parserlib/category)
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tag_parser_list.txt DESTINATION ${SYSCONFDIR}/package-manager/parserlib)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkg_db_version.txt DESTINATION ${SYSCONFDIR}/package-manager/)
#define XMLCHAR(s) (const xmlChar *)s
#define METADATA_PARSER_LIST SYSCONFDIR "/package-manager/parserlib/metadata/mdparser_list.txt"
-#define METADATA_PARSER_NAME "metadataparser:"
-
#define CATEGORY_PARSER_LIST SYSCONFDIR "/package-manager/parserlib/category/category_parser_list.txt"
-#define CATEGORY_PARSER_NAME "categoryparser:"
-
#define TAG_PARSER_LIST SYSCONFDIR "/package-manager/parserlib/tag_parser_list.txt"
-#define TAG_PARSER_NAME "parserlib:"
+
+#define PLUGIN_PATH_PREFIX SYSCONFDIR "/package-manager/parserlib/"
#define OWNER_ROOT 0
#define BUFSIZE 4096
static char *__get_parser_plugin(const char *type)
{
- FILE *fp = NULL;
- char buffer[1024] = { 0 };
char temp_path[1024] = { 0 };
- char *path = NULL;
int ret = -1;
if (type == NULL) {
return NULL;
}
- fp = fopen(PKG_PARSER_CONF_PATH, "r");
- if (fp == NULL) {
- _LOGE("no matching backendlib\n");
- return NULL;
- }
-
- while (fgets(buffer, sizeof(buffer), fp) != NULL) {
- if (buffer[0] == '#')
- continue;
-
- __str_trim(buffer);
-
- if ((path = strstr(buffer, PKG_PARSERLIB)) != NULL) {
- path = path + strlen(PKG_PARSERLIB);
- break;
- }
-
- memset(buffer, 0x00, 1024);
- }
-
- if (fp != NULL)
- fclose(fp);
-
- if (path == NULL) {
- _LOGE("no matching backendlib\n");
- return NULL;
- }
-
- ret = snprintf(temp_path, sizeof(temp_path) - 1, "%slib%s.so", path, type);
+ ret = snprintf(temp_path, sizeof(temp_path) - 1, "%slib%s.so",
+ PLUGIN_PATH_PREFIX, type);
if (ret < 0 || ret > sizeof(temp_path) -1) {
_LOGE("snprintf fail");
return NULL;
static char *__get_metadata_parser_plugin(const char *type)
{
- FILE *fp = NULL;
- char buffer[1024] = { 0 };
char temp_path[1024] = { 0 };
- char *path = NULL;
if (type == NULL) {
_LOGE("invalid argument\n");
return NULL;
}
- fp = fopen(PKG_PARSER_CONF_PATH, "r");
- if (fp == NULL) {
- _LOGE("no matching metadata parser\n");
- return NULL;
- }
-
- while (fgets(buffer, sizeof(buffer), fp) != NULL) {
- if (buffer[0] == '#')
- continue;
-
- __str_trim(buffer);
-
- if ((path = strstr(buffer, METADATA_PARSER_NAME)) != NULL) {
- path = path + strlen(METADATA_PARSER_NAME);
-
- break;
- }
-
- memset(buffer, 0x00, 1024);
- }
-
- if (fp != NULL)
- fclose(fp);
-
- if (path == NULL) {
- _LOGE("no matching [%s] [%s]\n", METADATA_PARSER_NAME, type);
- return NULL;
- }
-
- snprintf(temp_path, sizeof(temp_path) - 1, "%slib%s.so", path, type);
+ snprintf(temp_path, sizeof(temp_path) - 1, "%smetadata/lib%s.so",
+ PLUGIN_PATH_PREFIX, 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) {
_LOGE("invalid argument\n");
return NULL;
}
- fp = fopen(PKG_PARSER_CONF_PATH, "r");
- if (fp == NULL) {
- _LOGE("no matching metadata parser\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) {
- _LOGE("no matching [%s] [%s]\n", CATEGORY_PARSER_NAME, type);
- return NULL;
- }
-
- snprintf(temp_path, sizeof(temp_path) - 1, "%slib%s.so", path, type);
+ snprintf(temp_path, sizeof(temp_path) - 1, "%s/category/lib%s.so",
+ PLUGIN_PATH_PREFIX, type);
return strdup(temp_path);
}