From: Sangyoon Jang Date: Mon, 31 Oct 2016 10:06:33 +0000 (+0900) Subject: Remove pkgmgrinfo_client_xxx X-Git-Tag: submit/tizen/20161102.115555~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F35%2F94535%2F2;p=platform%2Fcore%2Fappfw%2Fpkgmgr-info.git Remove pkgmgrinfo_client_xxx These apis can be replaced with pkgmgr_client_xxx. Change-Id: I974c7abf22445dc986a71f2cafb10c14459ae975 Signed-off-by: Sangyoon Jang --- diff --git a/CMakeLists.txt b/CMakeLists.txt index a9098d8..c6f5d72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,14 +14,14 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src ${CMAKE_ ### Required packages INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED glib-2.0 dlog vconf sqlite3 db-util libxml-2.0 dbus-1 dbus-glib-1 libtzplatform-config libsmack bundle) +pkg_check_modules(pkgs REQUIRED glib-2.0 dlog vconf sqlite3 db-util libxml-2.0 libtzplatform-config libsmack bundle) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) -pkg_check_modules(libpkgs REQUIRED glib-2.0 dlog vconf sqlite3 db-util dbus-1 dbus-glib-1 libtzplatform-config libsmack bundle capi-system-info) +pkg_check_modules(libpkgs REQUIRED glib-2.0 dlog vconf sqlite3 db-util libtzplatform-config libsmack bundle capi-system-info) FOREACH(flag ${libpkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") @@ -39,7 +39,6 @@ ADD_SUBDIRECTORY(parser) ## build pkgmgr-info library ADD_LIBRARY(pkgmgr-info SHARED - src/pkgmgrinfo_client.c src/pkgmgrinfo_db.c src/pkgmgrinfo_certinfo.c src/pkgmgrinfo_pkginfo.c diff --git a/include/pkgmgr-info.h b/include/pkgmgr-info.h index f55996a..8ab3f7c 100644 --- a/include/pkgmgr-info.h +++ b/include/pkgmgr-info.h @@ -5471,29 +5471,6 @@ int pkgmgrinfo_pkginfo_set_installed_storage(const char *pkgid, INSTALL_LOCATION int pkgmgrinfo_pkginfo_set_usr_installed_storage(const char * pkgid, INSTALL_LOCATION location, uid_t uid); /** - * @pkgmgrinfo client API -**/ - -/** - * @brief listening status type in pkgmgrinfo. - */ -#define PMINFO_CLIENT_STATUS_ALL 0x00 -#define PMINFO_CLIENT_STATUS_INSTALL 0x01 -#define PMINFO_CLIENT_STATUS_UNINSTALL 0x02 -#define PMINFO_CLIENT_STATUS_UPGRADE 0x04 -#define PMINFO_CLIENT_STATUS_MOVE 0x08 -#define PMINFO_CLIENT_STATUS_CLEAR_DATA 0x10 -#define PMINFO_CLIENT_STATUS_INSTALL_PROGRESS 0x20 - -/** - * @brief This APIs provides pkgmgrinfo client listener - */ -pkgmgrinfo_client *pkgmgrinfo_client_new(pkgmgrinfo_client_type ctype); -int pkgmgrinfo_client_set_status_type(pkgmgrinfo_client *pc, int status_type); -int pkgmgrinfo_client_listen_status(pkgmgrinfo_client *pc, pkgmgrinfo_handler event_cb, void *data); -int pkgmgrinfo_client_free(pkgmgrinfo_client *pc); - -/** * @brief TEMP */ diff --git a/packaging/pkgmgr-info.spec b/packaging/pkgmgr-info.spec index e993f44..2a2c3e3 100644 --- a/packaging/pkgmgr-info.spec +++ b/packaging/pkgmgr-info.spec @@ -12,8 +12,6 @@ BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(sqlite3) BuildRequires: pkgconfig(db-util) BuildRequires: pkgconfig(libxml-2.0) -BuildRequires: pkgconfig(dbus-1) -BuildRequires: pkgconfig(dbus-glib-1) BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(libsmack) BuildRequires: pkgconfig(bundle) diff --git a/src/pkgmgrinfo_client.c b/src/pkgmgrinfo_client.c deleted file mode 100644 index c65b70d..0000000 --- a/src/pkgmgrinfo_client.c +++ /dev/null @@ -1,119 +0,0 @@ -#include -#include -#include - -#include -#include - -#include "pkgmgrinfo_type.h" -#include "pkgmgrinfo_debug.h" -#include "pkgmgrinfo_private.h" - -API pkgmgrinfo_client *pkgmgrinfo_client_new(pkgmgrinfo_client_type ctype) -{ - char *errmsg; - void *pc = NULL; - void *handle; - pkgmgrinfo_client *(*__pkgmgr_client_new)(pkgmgrinfo_client_type ctype) = NULL; - - handle = dlopen("libpkgmgr-client.so.0", RTLD_LAZY | RTLD_GLOBAL); - retvm_if(!handle, NULL, "dlopen() failed. [%s]", dlerror()); - - __pkgmgr_client_new = dlsym(handle, "pkgmgr_client_new"); - errmsg = dlerror(); - trym_if((errmsg != NULL) || (__pkgmgr_client_new == NULL), "dlsym() failed. [%s]", errmsg); - - pc = __pkgmgr_client_new(ctype); - trym_if(pc == NULL, "pkgmgr_client_new failed."); - -catch: - dlclose(handle); - return (pkgmgrinfo_client *) pc; -} - -API int pkgmgrinfo_client_set_status_type(pkgmgrinfo_client *pc, int status_type) -{ - int ret; - char *errmsg; - void *handle; - int (*__pkgmgr_client_set_status_type)(pkgmgrinfo_client *pc, int status_type) = NULL; - - handle = dlopen("libpkgmgr-client.so.0", RTLD_LAZY | RTLD_GLOBAL); - retvm_if(!handle, PMINFO_R_ERROR, "dlopen() failed. [%s]", dlerror()); - - __pkgmgr_client_set_status_type = dlsym(handle, "pkgmgr_client_set_status_type"); - errmsg = dlerror(); - tryvm_if((errmsg != NULL) || (__pkgmgr_client_set_status_type == NULL), ret = PMINFO_R_ERROR, "dlsym() failed. [%s]", errmsg); - - ret = __pkgmgr_client_set_status_type(pc, status_type); - tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "pkgmgr_client_new failed."); - -catch: - /* - * Do not close libpkgmgr-client.so.0 to avoid munmap registered callback - * - * The lib dependency chain like below - * amd --> pkgmgr-info -- dlopen --> libpkgmgr-client --> libpkgmgr-installer-client - * - * And there is a function in libpkgmgr-installer-client named _on_signal_handle_filter() - * which will registered to dbus callback in amd though in fact amd doesn't direct depends - * on libpkgmgr-installer-client. - * - * So when the dlcose happen, then libpkgmgr-installer-client been closed too since no one - * link to it then. - * - * However, when the libdbus call into the callback function, it suddenly fond that the - * function address is gone (unmapped), then we receive a SIGSEGV. - * - * I'm not sure why we're using dlopen/dlclose in this case, I think it's much simple and - * robust if we just link to the well-known lib. - * - * See https://bugs.tizen.org/jira/browse/PTREL-591 - dlclose(handle); - */ - return ret; -} - -API int pkgmgrinfo_client_listen_status(pkgmgrinfo_client *pc, pkgmgrinfo_handler event_cb, void *data) -{ - int ret = 0; - char *errmsg = NULL; - void *handle = NULL; - int (*__pkgmgr_client_listen_status)(pkgmgrinfo_client *pc, pkgmgrinfo_handler event_cb, void *data) = NULL; - - handle = dlopen("libpkgmgr-client.so.0", RTLD_LAZY | RTLD_GLOBAL); - retvm_if(!handle, PMINFO_R_ERROR, "dlopen() failed. [%s]", dlerror()); - - __pkgmgr_client_listen_status = dlsym(handle, "pkgmgr_client_listen_status"); - errmsg = dlerror(); - tryvm_if((errmsg != NULL) || (__pkgmgr_client_listen_status == NULL), ret = PMINFO_R_ERROR, "dlsym() failed. [%s]", errmsg); - - ret = __pkgmgr_client_listen_status(pc, event_cb, data); - tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "pkgmgr_client_new failed."); - -catch: - /* same as pkgmgrinfo_client_new */ - return ret; -} - -API int pkgmgrinfo_client_free(pkgmgrinfo_client *pc) -{ - int ret = 0; - char *errmsg = NULL; - void *handle = NULL; - int (*__pkgmgr_client_free)(pkgmgrinfo_client *pc) = NULL; - - handle = dlopen("libpkgmgr-client.so.0", RTLD_LAZY | RTLD_GLOBAL); - retvm_if(!handle, PMINFO_R_ERROR, "dlopen() failed. [%s]", dlerror()); - - __pkgmgr_client_free = dlsym(handle, "pkgmgr_client_free"); - errmsg = dlerror(); - tryvm_if((errmsg != NULL) || (__pkgmgr_client_free == NULL), ret = PMINFO_R_ERROR, "dlsym() failed. [%s]", errmsg); - - ret = __pkgmgr_client_free(pc); - tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "pkgmgr_client_new failed."); - -catch: - /* same as pkgmgrinfo_client_new */ - return ret; -}