From c558e1b01ad7584689d930892f8adae84110c883 Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Wed, 16 Mar 2016 17:40:07 +0900 Subject: [PATCH 01/16] do not support parsing and db-control via pkginfo. Change-Id: I5acd2205ca77a4cd8b3ce7653e6fa0510410e2f0 Signed-off-by: jongmyeongko --- src/pkg_info.c | 78 +++++----------------------------------------------------- 1 file changed, 6 insertions(+), 72 deletions(-) diff --git a/src/pkg_info.c b/src/pkg_info.c index d7f42f5..9b84209 100644 --- a/src/pkg_info.c +++ b/src/pkg_info.c @@ -47,8 +47,6 @@ static int __get_pkg_list(uid_t uid); static int __get_installed_app_list(uid_t uid); static int __add_app_filter(uid_t uid); static int __add_pkg_filter(uid_t uid); -static int __insert_manifest_in_db(char *manifest, uid_t uid); -static int __remove_manifest_from_db(char *manifest, uid_t uid); static int __set_certinfo_in_db(char *pkgid, uid_t uid); static int __get_certinfo_from_db(char *pkgid, uid_t uid); static int __del_certinfo_from_db(char *pkgid); @@ -1350,61 +1348,6 @@ err: return ret; } -static int __insert_manifest_in_db(char *manifest, uid_t uid) -{ - int ret = 0; - if (manifest == NULL) { - printf("Manifest file is NULL\n"); - return -1; - } - if (uid == GLOBAL_USER || uid == OWNER_ROOT) - ret = pkgmgr_parser_parse_manifest_for_installation(manifest, NULL); - else - ret = pkgmgr_parser_parse_usr_manifest_for_installation(manifest, uid, NULL); - if (ret < 0) { - printf("insert in db failed\n"); - return -1; - } - return 0; -} - -static int __fota_insert_manifest_in_db(char *manifest, uid_t uid) -{ - int ret = 0; - - if (manifest == NULL) { - printf("Manifest file is NULL\n"); - return -1; - } - if (uid != GLOBAL_USER) - ret = pkgmgr_parser_parse_usr_manifest_for_installation(manifest, uid, NULL); - else - ret = pkgmgr_parser_parse_manifest_for_installation(manifest, NULL); - if (ret < 0) { - printf("insert in db failed\n"); - return -1; - } - return 0; -} - -static int __remove_manifest_from_db(char *manifest, uid_t uid) -{ - int ret = 0; - if (manifest == NULL) { - printf("Manifest file is NULL\n"); - return -1; - } - if (uid != GLOBAL_USER) - ret = pkgmgr_parser_parse_usr_manifest_for_uninstallation(manifest, uid, NULL); - else - ret = pkgmgr_parser_parse_manifest_for_uninstallation(manifest, NULL); - if (ret < 0) { - printf("remove from db failed\n"); - return -1; - } - return 0; -} - int app_func(const pkgmgrinfo_appinfo_h handle, void *user_data) { int ret = -1; @@ -2079,23 +2022,14 @@ int main(int argc, char *argv[]) goto end; } } else if (strcmp(argv[1], "--imd") == 0) { - ret = __insert_manifest_in_db(argv[2], getuid()); - if (ret == -1) { - printf("insert in db failed\n"); - goto end; - } + printf("Not supported!\n"); + goto end; } else if (strcmp(argv[1], "--fota") == 0) { - ret = __fota_insert_manifest_in_db(argv[2], getuid()); - if (ret == -1) { - printf("insert in db failed\n"); - goto end; - } + printf("Not supported!\n"); + goto end; } else if (strcmp(argv[1], "--rmd") == 0) { - ret = __remove_manifest_from_db(argv[2], getuid()); - if (ret == -1) { - printf("remove from db failed\n"); - goto end; - } + printf("Not supported!\n"); + goto end; } else if (strcmp(argv[1], "--setcert") == 0) { ret = __set_certinfo_in_db(argv[2], getuid()); if (ret == -1) { -- 2.7.4 From 5673ae324aa793581240430b52ff7e816ce320ba Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Thu, 17 Mar 2016 17:08:16 +0900 Subject: [PATCH 02/16] fix wrong path for processing RW packages Change-Id: I79c15d790cb4cbffef94366fb6c7f0f41323c0a3 Signed-off-by: jongmyeongko --- src/pkg_initdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pkg_initdb.c b/src/pkg_initdb.c index 9bc70c9..6e00960 100644 --- a/src/pkg_initdb.c +++ b/src/pkg_initdb.c @@ -192,7 +192,7 @@ int main(int argc, char *argv[]) dir_rw = tzplatform_getenv(TZ_SYS_RW_PACKAGES); if (dir && dir_rw) if (strcmp(dir, dir_rw)) - ret = _initdb_load_directory(uid, dir); + ret = _initdb_load_directory(uid, dir_rw); } else { /* specified user location */ tzplatform_set_user(uid); -- 2.7.4 From 13d6091d11c50294f259c79588692309cc3cd765 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Tue, 22 Mar 2016 17:37:46 +0900 Subject: [PATCH 03/16] Fix coding style Change-Id: Ibb9d241adafabd1023a52880d304f6e4827d8416 Signed-off-by: Sangyoon Jang --- src/pkg_initdb.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/pkg_initdb.c b/src/pkg_initdb.c index 6e00960..b61abbb 100644 --- a/src/pkg_initdb.c +++ b/src/pkg_initdb.c @@ -64,9 +64,11 @@ static int _is_global(uid_t uid) static int _initdb_load_directory(uid_t uid, const char *directory) { DIR *dir; - struct dirent file_info, *result; - int ret; + struct dirent file_info; + struct dirent *result; char buf[BUFSZE]; + pid_t pid; + int status; dir = opendir(directory); if (!dir) { @@ -77,16 +79,17 @@ static int _initdb_load_directory(uid_t uid, const char *directory) _D("Loading manifest files from %s", directory); - for (ret = readdir_r(dir, &file_info, &result); - ret == 0 && result != NULL; - ret = readdir_r(dir, &file_info, &result)) { - if (file_info.d_name[0] == '.') + while (readdir_r(dir, &file_info, &result) == 0) { + if (result == NULL) + break; + if (file_info.d_type != DT_REG) continue; - snprintf(buf, sizeof(buf), "%s/%s", directory, file_info.d_name); + snprintf(buf, sizeof(buf), "%s/%s", directory, + file_info.d_name); _D("manifest file %s", buf); - pid_t pid = fork(); + pid = fork(); if (pid == 0) { if (setuid(uid) != 0) { _E("failed to set uid"); @@ -94,17 +97,17 @@ static int _initdb_load_directory(uid_t uid, const char *directory) return -1; } - execl(PKGINSTALLMANIFEST_CMD, PKGINSTALLMANIFEST_CMD, "-x", buf, - (char *)NULL); - _E("failed to execute: %s", strerror_r(errno, buf, sizeof(buf))); + execl(PKGINSTALLMANIFEST_CMD, PKGINSTALLMANIFEST_CMD, + "-x", buf, (char *)NULL); + _E("failed to execute: %s", + strerror_r(errno, buf, sizeof(buf))); exit(EXIT_FAILURE); } else if (pid < 0) { - _E("failed to fork and execute %s!", PKGINSTALLMANIFEST_CMD); + _E("failed to fork and execute %s!", + PKGINSTALLMANIFEST_CMD); closedir(dir); return -1; - } - if (pid > 0) { - int status = 0; + } else { waitpid(pid, &status, 0); } } -- 2.7.4 From b1291f59ffb6cbde45795a2a73332fceed54bf60 Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Wed, 23 Mar 2016 16:35:19 +0900 Subject: [PATCH 04/16] add watchapp for pkginfo Change-Id: Ic93ea2d96f8477d205bf1b83669b202ff79c0cbb Signed-off-by: jongmyeongko --- src/pkg_info.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/pkg_info.c b/src/pkg_info.c index 9b84209..b8ec796 100644 --- a/src/pkg_info.c +++ b/src/pkg_info.c @@ -1410,9 +1410,11 @@ int app_func(const pkgmgrinfo_appinfo_h handle, void *user_data) if (apptype) printf("Apptype: %s\n", apptype); - if (component == PMINFO_UI_APP || component == PMINFO_WIDGET_APP) { - printf("component: %s\n", component == PMINFO_UI_APP ? "uiapp" : - "widgetapp"); + if (component == PMINFO_UI_APP || component == PMINFO_WIDGET_APP || + component == PMINFO_WATCH_APP) { + printf("component: %s\n", component == PMINFO_UI_APP ? + "uiapp" : component == PMINFO_WIDGET_APP ? + "widgetapp" : "watchapp"); ret = pkgmgrinfo_appinfo_is_multiple(handle, &multiple); if (ret < 0) printf("Failed to get multiple\n"); @@ -1839,15 +1841,15 @@ static int __get_app_info(char *appid) if (apptype) printf("Apptype: %s\n", apptype); - if (component == PMINFO_UI_APP || component == PMINFO_WIDGET_APP) { - printf("component: %s\n", component == PMINFO_UI_APP ? "uiapp" : - "widgetapp"); - + if (component == PMINFO_UI_APP || component == PMINFO_WIDGET_APP || + component == PMINFO_WATCH_APP) { + printf("component: %s\n", component == PMINFO_UI_APP ? + "uiapp" : component == PMINFO_WIDGET_APP ? + "widgetapp": "watchapp"); if (icon) printf("Icon: %s\n", icon); if (label) printf("Label: %s\n", label); - printf("Nodisplay: %d\n", nodisplay); printf("Multiple: %d\n", multiple); printf("Taskmanage: %d\n", taskmanage); -- 2.7.4 From 7605ab2b88b5402ead3111c7b31e69bebf0cbef0 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Fri, 25 Mar 2016 18:19:43 +0900 Subject: [PATCH 05/16] change functions for thread-safe Change-Id: I3838b267dda0cbbc82a444a389255412ddaf89b3 Signed-off-by: Junghyun Yeon --- src/pkg_clearcache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pkg_clearcache.c b/src/pkg_clearcache.c index 07250d2..c6ff634 100644 --- a/src/pkg_clearcache.c +++ b/src/pkg_clearcache.c @@ -84,7 +84,7 @@ static int __clear_dir(const char *dirname) if (ret != 0) LOGE("Couldn't remove the directory. " "errno : %d (%s)\n", - errno, strerror(errno)); + errno, strerror_r(errno, buf, sizeof(buf))); ret = remove(abs_filename); if (ret != 0) { @@ -99,7 +99,7 @@ static int __clear_dir(const char *dirname) if (ret != 0) { LOGE("Couldn't remove the directory. errno : " "%d (%s)\n", errno, - strerror(errno)); + strerror_r(errno, buf, sizeof(buf))); goto err; } } -- 2.7.4 From 47e9e2737133a1abd62efbf0275672411318cc3a Mon Sep 17 00:00:00 2001 From: Myungki Lee Date: Mon, 28 Mar 2016 14:04:34 +0900 Subject: [PATCH 06/16] Use thread-safe function Change-Id: If3d7bbff9d3e5e6466851a473300a6205d51ff65 Signed-off-by: Myungki Lee --- src/pkg_clearcache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pkg_clearcache.c b/src/pkg_clearcache.c index c6ff634..ba7f110 100644 --- a/src/pkg_clearcache.c +++ b/src/pkg_clearcache.c @@ -90,7 +90,7 @@ static int __clear_dir(const char *dirname) if (ret != 0) { LOGE("Couldn't remove the directory. " "errno : %d (%s)\n", - errno, strerror(errno)); + errno, strerror_r(errno, buf, sizeof(buf))); goto err; } } -- 2.7.4 From 1b5fa04f5f1f6fcbae684d277dc878ed97b151f8 Mon Sep 17 00:00:00 2001 From: Tomasz Iwanek Date: Thu, 24 Mar 2016 11:52:10 +0100 Subject: [PATCH 07/16] Modify scripts to create proper delta package for wgt-backend Always add "config.xml" and "tizen-manifest.xml" file to delta package. Change-Id: Iae8f1fa193334de8993fdf6fce3da1b7422994b6 --- CMakeLists.txt | 4 +- data/pkgmgr-create-delta.sh.in | 159 ++++++++++++++++++++++++----------------- data/pkgmgr-unzip-pkg.sh.in | 78 ++++++++++++++++++++ data/pkgmgr-unzip-tpk.sh.in | 78 -------------------- packaging/pkgmgr-tool.spec | 2 +- src/delta.c | 6 ++ src/pkg_cmd.c | 26 +++---- 7 files changed, 192 insertions(+), 161 deletions(-) create mode 100644 data/pkgmgr-unzip-pkg.sh.in delete mode 100644 data/pkgmgr-unzip-tpk.sh.in diff --git a/CMakeLists.txt b/CMakeLists.txt index bb688e6..4661309 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,7 +73,7 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/mime.tpk.xml DESTINATION /usr/sha CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/data/pkgmgr.patch.sh.in pkgmgr.patch.sh @ONLY) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgmgr.patch.sh DESTINATION ${SYSCONF_INSTALL_DIR}/opt/upgrade/) -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/data/pkgmgr-unzip-tpk.sh.in pkgmgr-unzip-tpk.sh @ONLY) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgmgr-unzip-tpk.sh DESTINATION ${SYSCONF_INSTALL_DIR}/package-manager/) +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/data/pkgmgr-unzip-pkg.sh.in pkgmgr-unzip-pkg.sh @ONLY) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgmgr-unzip-pkg.sh DESTINATION ${SYSCONF_INSTALL_DIR}/package-manager/) CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/data/pkgmgr-create-delta.sh.in pkgmgr-create-delta.sh @ONLY) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgmgr-create-delta.sh DESTINATION ${SYSCONF_INSTALL_DIR}/package-manager/) diff --git a/data/pkgmgr-create-delta.sh.in b/data/pkgmgr-create-delta.sh.in index 747ddc0..b22963e 100644 --- a/data/pkgmgr-create-delta.sh.in +++ b/data/pkgmgr-create-delta.sh.in @@ -4,22 +4,22 @@ usage() cat < - -b|--new_tpk= - -p|--delta_tpk= + -a|--old_pkg= + -b|--new_pkg= + -p|--delta_pkg= [-o|--option=