From: junsuk77.oh Date: Tue, 9 Apr 2013 07:58:59 +0000 (+0900) Subject: update installed storage to pkgmgr db when pkg is moved X-Git-Tag: 2.1b_release^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen_2.1;p=framework%2Fappfw%2Fapp2sd.git update installed storage to pkgmgr db when pkg is moved Change-Id: I752ebecdb2769699f310ab1487cbfd7947722845 Signed-off-by: junsuk77.oh --- diff --git a/packaging/app2sd.spec b/packaging/app2sd.spec index 235d059..927b222 100755 --- a/packaging/app2sd.spec +++ b/packaging/app2sd.spec @@ -1,6 +1,6 @@ Name: app2sd Summary: Application installation on external memory -Version: 0.5.12 +Version: 0.5.13 Release: 1 Group: Application Framework/Application Installer License: Apache-2.0 @@ -11,6 +11,7 @@ BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(openssl) BuildRequires: pkgconfig(db-util) +BuildRequires: pkgconfig(pkgmgr-info) BuildRequires: cmake %description diff --git a/plugin/app2sd/CMakeLists.txt b/plugin/app2sd/CMakeLists.txt index 8533b08..4d3ca20 100755 --- a/plugin/app2sd/CMakeLists.txt +++ b/plugin/app2sd/CMakeLists.txt @@ -3,13 +3,13 @@ PROJECT(app2sd C) ### Required packages INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED libssl dlog openssl db-util) +pkg_check_modules(pkgs REQUIRED libssl dlog openssl db-util pkgmgr-info) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) -pkg_check_modules(libpkgs REQUIRED libssl dlog openssl db-util) +pkg_check_modules(libpkgs REQUIRED libssl dlog openssl db-util pkgmgr-info) FOREACH(flag ${libpkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") diff --git a/plugin/app2sd/src/app2sd_interface.c b/plugin/app2sd/src/app2sd_interface.c index 110eb0e..3d94ee0 100755 --- a/plugin/app2sd/src/app2sd_interface.c +++ b/plugin/app2sd/src/app2sd_interface.c @@ -26,6 +26,7 @@ #include #include #include +#include int app2sd_pre_app_install(const char *pkgid, GList* dir_list, int size) @@ -201,6 +202,26 @@ int app2sd_post_app_install(const char *pkgid, buf_dir); } + } else { + /*If the status is success, then update installed storage to pkgmgr_parser db*/ + int rt = 0; + pkgmgrinfo_pkgdbinfo_h handle = NULL; + rt = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle); + if (rt < 0) { + app2ext_print("pkgmgrinfo_create_pkgdbinfo[%s] fail.. \n", pkgid); + } + rt = pkgmgrinfo_set_installed_storage_to_pkgdbinfo(handle, INSTALL_EXTERNAL); + if (rt < 0) { + app2ext_print("fail to update installed location to db[%s, %s]\n", pkgid, INSTALL_EXTERNAL); + } + rt =pkgmgrinfo_save_pkgdbinfo(handle); + if (rt < 0) { + app2ext_print("pkgmgrinfo_save_pkgdbinfo[%s] failed\n", pkgid); + } + rt =pkgmgrinfo_destroy_pkgdbinfo(handle); + if (rt < 0) { + app2ext_print("pkgmgrinfo_destroy_pkgdbinfo[%s] failed\n", pkgid); + } } return ret; } @@ -479,6 +500,35 @@ int app2sd_move_installed_app(const char *pkgid, GList* dir_list, app2ext_print("App2Sd Error : Unable to move application\n"); return ret; } + + /*If move is completed, then update installed storage to pkgmgr_parser db*/ + int rt = 0; + pkgmgrinfo_pkgdbinfo_h handle = NULL; + rt = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle); + if (rt < 0) { + app2ext_print("App2Sd Error : pkgmgrinfo_create_pkgdbinfo[%s] fail.. \n", pkgid); + } + + if (move_type == APP2EXT_MOVE_TO_EXT) { + rt = pkgmgrinfo_set_installed_storage_to_pkgdbinfo(handle, INSTALL_EXTERNAL); + if (rt < 0) { + app2ext_print("App2Sd Error : fail to update installed location to db[%s, %s]\n", pkgid, INSTALL_EXTERNAL); + } + } else { + rt = pkgmgrinfo_set_installed_storage_to_pkgdbinfo(handle, INSTALL_INTERNAL); + if (rt < 0) { + app2ext_print("App2Sd Error : fail to update installed location to db[%s, %s]\n", pkgid, INSTALL_INTERNAL); + } + } + rt =pkgmgrinfo_save_pkgdbinfo(handle); + if (rt < 0) { + app2ext_print("pkgmgrinfo_save_pkgdbinfo[%s] failed\n", pkgid); + } + rt =pkgmgrinfo_destroy_pkgdbinfo(handle); + if (rt < 0) { + app2ext_print("pkgmgrinfo_destroy_pkgdbinfo failed\n"); + } + return ret; }