Remove using removed vconf key 69/42769/1 accepted/tizen/mobile/20150708.015025 accepted/tizen/tv/20150708.015129 accepted/tizen/wearable/20150708.015222 submit/tizen/20150630.051205 submit/tizen/20150702.103311
authorSangyoon Jang <s89.jang@samsung.com>
Thu, 2 Jul 2015 07:26:16 +0000 (16:26 +0900)
committerSangyoon Jang <s89.jang@samsung.com>
Thu, 2 Jul 2015 07:26:16 +0000 (16:26 +0900)
Change-Id: I267cf170bf9419461af3aaae8289cc7ca2b339fa
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
client/src/pkgmgr.c
server/src/pkgmgr-server.c
tool/CMakeLists.txt
tool/pkg_getsize.c

index b0b3087..23727d8 100644 (file)
@@ -32,7 +32,6 @@
 #include <dbus/dbus.h>
 #include <dbus/dbus-glib-lowlevel.h>
 #include <ail.h>
-#include <vconf.h>
 #include <db-util.h>
 #include <pkgmgr-info.h>
 #include <iniparser.h>
@@ -690,31 +689,46 @@ static int __app_list_cb (const pkgmgr_appinfo_h handle,
 
 static int __sync_process(char *req_key)
 {
+       int ret;
        char info_file[PKG_STRING_LEN_MAX] = {'\0', };
-       int result = 0;
+       int result = -1;
        int check_cnt = 0;
+       FILE *fp;
+       char buf[PKG_STRING_LEN_MAX] = {0, };
 
-       snprintf(info_file, PKG_STRING_LEN_MAX, "%s/%s", PKG_TMP_PATH, req_key);
+       snprintf(info_file, PKG_STRING_LEN_MAX, "%s/%s", PKG_SIZE_INFO_PATH, req_key);
        while(1)
        {
-               check_cnt ++;
+               check_cnt++;
+
+               if (access(info_file, F_OK) == 0) {
+                       fp = fopen(info_file, "r");
+                       if (fp == NULL){
+                               DBG("file is not generated yet.... wait\n");
+                               usleep(100 * 1000);     /* 100ms sleep*/
+                               continue;
+                       }
 
-               vconf_get_int(VCONFKEY_PKGMGR_STATUS, &result);
-               if (result < 0) {
-                       DBG("file is not generated yet.... wait\n");
-                       usleep(10 * 1000);      /* 10ms sleep*/
-               } else {
-                       DBG("info_file file is generated, result = %d. \n", result);
+                       fgets(buf, PKG_STRING_LEN_MAX, fp);
+                       fclose(fp);
+
+                       DBG("info_file file is generated, result = %s. \n", buf);
+                       result = atoi(buf);
                        break;
                }
 
-               if (check_cnt > 6000) { /* 60s time over*/
-                       DBG("wait time over!!\n");
+               DBG("file is not generated yet.... wait\n");
+               usleep(100 * 1000);     /* 100ms sleep*/
+
+               if (check_cnt > 6000) { /* 60s * 10 time over*/
+                       ERR("wait time over!!\n");
                        break;
                }
        }
 
-       vconf_set_int(VCONFKEY_PKGMGR_STATUS, -1);
+       ret = remove(info_file);
+       if (ret < 0)
+               ERR("file is can not remove[%s, %d]\n", info_file, ret);
 
        return result;
 }
@@ -882,7 +896,6 @@ static int __move_pkg_process(pkgmgr_client * pc, const char *pkgid, uid_t uid,
        char *temp = NULL;
        int i = 0;
        char buf[128] = {'\0'};
-       char info_file[PKG_STRING_LEN_MAX] = {'\0', };
 
        pkgmgr_client_t *mpc = (pkgmgr_client_t *) pc;
        retvm_if(mpc->ctype != PC_REQUEST, PKGMGR_R_EINVAL, "mpc->ctype is not PC_REQUEST\n");
@@ -942,8 +955,7 @@ static int __move_pkg_process(pkgmgr_client * pc, const char *pkgid, uid_t uid,
        if (ret < 0)
                ERR("comm_client_request failed, ret=%d\n", ret);
 
-       snprintf(info_file, PKG_STRING_LEN_MAX, "app2sd_%s", pkgid);
-       ret = __sync_process(info_file);
+       ret = __sync_process(pkgid);
        if (ret != 0)
                ERR("move pkg failed, ret=%d\n", ret);
 
@@ -991,7 +1003,7 @@ static int __check_app_process(pkgmgr_request_service_type service_type, pkgmgr_
        if (ret < 0)
                ERR("request failed, ret=%d\n", ret);
 
-       pid  = __sync_process(req_key);
+       pid  = __sync_process(pkgid);
        * (int *) data = pid;
 
 catch:
@@ -2464,7 +2476,6 @@ API int pkgmgr_client_usr_request_service(pkgmgr_request_service_type service_ty
        /* Check for NULL value of service type */
        retvm_if(service_type > PM_REQUEST_MAX, PKGMGR_R_EINVAL, "service type is not defined\n");
        retvm_if(service_type < 0, PKGMGR_R_EINVAL, "service type is error\n");
-       vconf_set_int(VCONFKEY_PKGMGR_STATUS, -1);
 
        switch (service_type) {
        case PM_REQUEST_CSC:
index 51144fc..3602e64 100644 (file)
@@ -38,8 +38,6 @@
 
 #include <cynara-client.h>
 
-#include <vconf.h>
-
 /* For multi-user support */
 #include <tzplatform_config.h>
 
@@ -924,20 +922,53 @@ static int __pkgcmd_proc_iter_kill_cmdline(const char *apppath, int option)
        return 0;
 }
 
+static void __make_pid_info_file(char *req_key, int pid)
+{
+       FILE* file;
+       int fd;
+       char buf[MAX_PKG_TYPE_LEN] = {0};
+       char info_file[PATH_MAX] = {'\0'};
+
+       if(req_key == NULL)
+               return;
+
+       snprintf(info_file, PATH_MAX, "/tmp/%s", req_key);
+
+       DBG("info_path(%s)", info_file);
+       file = fopen(info_file, "w");
+       if (file == NULL) {
+               ERR("Couldn't open the file(%s)", info_file);
+               return;
+       }
+
+       snprintf(buf, MAX_PKG_TYPE_LEN, "%d\n", pid);
+       fwrite(buf, 1, strlen(buf), file);
+
+       fflush(file);
+       fd = fileno(file);
+       fsync(fd);
+       fclose(file);
+}
+
 static int __pkgcmd_app_cb(const pkgmgrinfo_appinfo_h handle, void *user_data)
 {
-       char *exec = NULL;
-       int ret = 0;
+       char *pkgid;
+       char *exec;
+       int ret;
        int pid = -1;
+
        if (handle == NULL) {
                perror("appinfo handle is NULL\n");
-               vconf_set_int(VCONFKEY_PKGMGR_STATUS, 0);
                exit(1);
        }
        ret = pkgmgrinfo_appinfo_get_exec(handle, &exec);
        if (ret) {
                perror("Failed to get app exec path\n");
-               vconf_set_int(VCONFKEY_PKGMGR_STATUS, 0);
+               exit(1);
+       }
+       ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid);
+       if (ret) {
+               perror("Failed to get pkgid\n");
                exit(1);
        }
 
@@ -946,7 +977,7 @@ static int __pkgcmd_app_cb(const pkgmgrinfo_appinfo_h handle, void *user_data)
        else if(strcmp(user_data, "check") == 0)
                pid = __pkgcmd_proc_iter_kill_cmdline(exec, 0);
 
-       vconf_set_int(VCONFKEY_PKGMGR_STATUS, pid);
+       __make_pid_info_file(pkgid, pid);
 
        return 0;
 }
index d52e859..2f50a75 100644 (file)
@@ -12,16 +12,11 @@ FOREACH(flag ${pkgs_initdb_CFLAGS})
 ENDFOREACH(flag)
 
 
-pkg_check_modules(pkgs_test REQUIRED dbus-1 ail libxml-2.0 bundle pkgmgr-parser vconf pkgmgr-info libtzplatform-config security-manager)
+pkg_check_modules(pkgs_test REQUIRED dbus-1 ail libxml-2.0 bundle pkgmgr-parser pkgmgr-info libtzplatform-config security-manager)
 FOREACH(flag ${pkgs_test_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
-pkg_check_modules(toolpkgs REQUIRED dlog bundle glib-2.0 pkgmgr-parser vconf pkgmgr-info libtzplatform-config)
-FOREACH(flag ${toolpkgs_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wl,-zdefs" )
 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
index 377fa8d..6dce1ee 100644 (file)
@@ -27,7 +27,6 @@
 #include <string.h>
 
 #include <pkgmgr-info.h>
-#include <vconf.h>
 #include <dirent.h>
 #include <sys/stat.h>
 #include <unistd.h>