Move internal headers to src directory 37/98037/5
authorSangyoon Jang <s89.jang@samsung.com>
Wed, 16 Nov 2016 02:40:53 +0000 (11:40 +0900)
committerSangyoon Jang <s89.jang@samsung.com>
Wed, 16 Nov 2016 11:58:33 +0000 (03:58 -0800)
Change-Id: I68181ae1eba05f0c1463c6367c949d9d01d3faa7
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
CMakeLists.txt
parser/CMakeLists.txt
parser/src/pkgmgr_parser.c
parser/src/pkgmgr_parser_db.c
parser/src/pkgmgr_parser_debug.h [new file with mode: 0644]
parser/src/pkgmgr_parser_internal.h [moved from parser/include/pkgmgr_parser_internal.h with 100% similarity]
src/pkgmgrinfo_db.c
src/pkgmgrinfo_debug.h [moved from include/pkgmgrinfo_debug.h with 100% similarity]
src/pkgmgrinfo_pkginfo.c
src/pkgmgrinfo_private.h [moved from include/pkgmgrinfo_private.h with 98% similarity]

index 4c53429..becf4be 100644 (file)
@@ -53,8 +53,7 @@ CONFIGURE_FILE(tag_parser_list.txt.in tag_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(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include
-       PATTERN "*_debug.h" EXCLUDE PATTERN "*_private.h" EXCLUDE)
+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)
index aaeef28..a6518d9 100644 (file)
@@ -66,8 +66,8 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
 ### Build modules
 
 # This library is for installer backend
-AUX_SOURCE_DIRECTORY(src SRCS)
-add_library(pkgmgr_parser SHARED ${SRCS})
+AUX_SOURCE_DIRECTORY(src PARSER_SRCS)
+add_library(pkgmgr_parser SHARED ${PARSER_SRCS})
 set_target_properties(pkgmgr_parser PROPERTIES SOVERSION ${VERSION_MAJOR})
 set_target_properties(pkgmgr_parser PROPERTIES VERSION ${VERSION})
 set_target_properties(pkgmgr_parser PROPERTIES COMPILE_FLAGS "${parser_pkgs_CFLAGS_str}")
@@ -80,8 +80,7 @@ configure_file(xml.xsd.in xml.xsd @ONLY)
 
 ## Install
 INSTALL(TARGETS pkgmgr_parser DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
-INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include/pkgmgr
-       PATTERN "*_internal.h" EXCLUDE)
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include/pkgmgr)
 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-parser.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.xsd DESTINATION ${SYSCONFDIR}/package-manager/preload/)
 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/xml.xsd DESTINATION ${SYSCONFDIR}/package-manager/preload/)
index cb5a204..154d135 100644 (file)
 
 #include "pkgmgr-info.h"
 #include "pkgmgrinfo_basic.h"
-#include "pkgmgrinfo_debug.h"
 
 #include "pkgmgr_parser.h"
 #include "pkgmgr_parser_internal.h"
 #include "pkgmgr_parser_db.h"
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "PKGMGR_PARSER"
+#include "pkgmgr_parser_debug.h"
 
 #define ASCII(s) (char *)s
 #define XMLCHAR(s) (const xmlChar *)s
index 7331af1..612f601 100644 (file)
 
 #include "pkgmgr-info.h"
 #include "pkgmgrinfo_basic.h"
-#include "pkgmgrinfo_debug.h"
 #include "pkgmgr_parser_internal.h"
 #include "pkgmgr_parser_db.h"
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "PKGMGR_PARSER"
+#include "pkgmgr_parser_debug.h"
 
 #define PKGMGR_PARSER_DB_FILE tzplatform_mkpath(TZ_SYS_DB, ".pkgmgr_parser.db")
 #define PKGMGR_CERT_DB_FILE tzplatform_mkpath(TZ_SYS_DB, ".pkgmgr_cert.db")
diff --git a/parser/src/pkgmgr_parser_debug.h b/parser/src/pkgmgr_parser_debug.h
new file mode 100644 (file)
index 0000000..78756ba
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * pkgmgrinfo_debug
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+  * Contact: junsuk. oh <junsuk77.oh@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __PKGMGR_PARSER_DEBUG_H__
+#define __PKGMGR_PARSER_DEBUG_H__
+
+#include <dlog.h>
+
+#define _LOGE(fmt, arg...) LOGE(fmt, ##arg)
+#define _LOGI(fmt, arg...) LOGI(fmt, ##arg)
+#define _LOGD(fmt, arg...) LOGD(fmt, ##arg)
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "PKGMGR_PARSER"
+
+#define ret_if(expr) do { \
+       if (expr) { \
+               _LOGE("(%s) ", #expr); \
+               return; \
+       } \
+} while (0)
+
+#define retm_if(expr, fmt, arg...) do { \
+       if (expr) { \
+               _LOGE("(%s) "fmt, #expr, ##arg); \
+               return; \
+       } \
+} while (0)
+
+#define retv_if(expr, val) do { \
+       if (expr) { \
+               _LOGE("(%s) ", #expr); \
+               return (val); \
+       } \
+} while (0)
+
+#define retvm_if(expr, val, fmt, arg...) do { \
+       if (expr) { \
+               _LOGE("(%s) "fmt, #expr, ##arg); \
+               return (val); \
+       } \
+} while (0)
+
+#define trym_if(expr, fmt, arg...) do { \
+       if (expr) { \
+               _LOGE("(%s) "fmt, #expr, ##arg); \
+               goto catch; \
+       } \
+} while (0)
+
+#define tryvm_if(expr, val, fmt, arg...) do { \
+       if (expr) { \
+               _LOGE("(%s) "fmt, #expr, ##arg); \
+               val; \
+               goto catch; \
+       } \
+} while (0)
+
+#endif  /* __PKGMGR_PARSER_DEBUG_H__ */
index ebf2879..b6134d0 100644 (file)
@@ -19,7 +19,6 @@
 #include "pkgmgrinfo_debug.h"
 #include "pkgmgrinfo_private.h"
 #include "pkgmgr_parser.h"
-#include "pkgmgr_parser_internal.h"
 
 #define QUERY_CREATE_TABLE_PACKAGE_CERT_INDEX_INFO \
        "CREATE TABLE IF NOT EXISTS package_cert_index_info( " \
index 2b22e92..d0c2e7c 100644 (file)
 #include <sqlite3.h>
 #include <glib.h>
 
-#include "pkgmgr_parser.h"
 #include "pkgmgrinfo_basic.h"
 #include "pkgmgrinfo_private.h"
 #include "pkgmgrinfo_debug.h"
 #include "pkgmgr-info.h"
-#include "pkgmgr_parser_db.h"
-#include "pkgmgr_parser_internal.h"
 
 static bool _get_bool_value(const char *str)
 {
similarity index 98%
rename from include/pkgmgrinfo_private.h
rename to src/pkgmgrinfo_private.h
index 776cd89..9892dee 100644 (file)
@@ -55,6 +55,7 @@
 #define MAX_QUERY_LEN  4096
 #define MAX_CERT_TYPE  9
 #define CERT_DB                tzplatform_mkpath(TZ_SYS_DB, ".pkgmgr_cert.db")
+#define PKG_STRING_LEN_MAX 1024
 #define PKG_TYPE_STRING_LEN_MAX                128
 #define PKG_VERSION_STRING_LEN_MAX     128
 #define PKG_VALUE_STRING_LEN_MAX               512
@@ -244,6 +245,7 @@ int _add_label_info_into_list(const char *locale, char *value, GList **label);
 int __pkginfo_check_installed_storage(package_x *pkginfo);
 int __appinfo_check_installed_storage(application_x *appinfo);
 
+#define GLOBAL_USER tzplatform_getuid(TZ_SYS_GLOBALAPP_USER)
 #define REGULAR_USER 5000
 static inline uid_t _getuid(void)
 {