From 15e2f2e37451cbf480c104ad1865cff17f1366c9 Mon Sep 17 00:00:00 2001 From: "junsuk77.oh" Date: Thu, 11 Apr 2013 17:51:33 +0900 Subject: [PATCH] add pkgmgr patch for fota, --arg-flt pkginfo to get the app filter Change-Id: I31765a1ae948ec0d6c20b8d4bc17d433ad78456f Signed-off-by: junsuk77.oh --- CMakeLists.txt | 2 + packaging/pkgmgr.spec | 4 +- pkgmgr.patch.sh.in | 5 ++ tool/pkg_info.c | 207 ++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 217 insertions(+), 1 deletion(-) create mode 100644 pkgmgr.patch.sh.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ca5b08..fc707f6 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,6 +86,7 @@ SET_TARGET_PROPERTIES(pkgmgr-server PROPERTIES COMPILE_FLAGS "${pkgmgr-server_CF CONFIGURE_FILE(pkgmgr.pc.in pkgmgr.pc @ONLY) configure_file(org.tizen.slp.pkgmgr.service.in org.tizen.slp.pkgmgr.service @ONLY) configure_file(pkg_path.conf.in pkg_path.conf @ONLY) +configure_file(pkgmgr.patch.sh.in pkgmgr.patch.sh @ONLY) #INSTALL(FILES ${CMAKE_BINARY_DIR}/libpkgmgr-client.so DESTINATION lib) INSTALL(TARGETS ${PKGMGR_CLIENT} DESTINATION lib COMPONENT RuntimeLibraries) @@ -96,6 +97,7 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/client/include/pkgmgr-dbinfo.h DESTINA INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.tizen.slp.pkgmgr.service DESTINATION ${PREFIX}/share/dbus-1/services/) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkg_path.conf DESTINATION ${PREFIX}/etc/package-manager/) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/queue_status DESTINATION etc/package-manager/server/) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgmgr.patch.sh DESTINATION /etc/opt/upgrade/) #################################################################################################### add_subdirectory(installers) diff --git a/packaging/pkgmgr.spec b/packaging/pkgmgr.spec index fc87a6c..ad6a9da 100755 --- a/packaging/pkgmgr.spec +++ b/packaging/pkgmgr.spec @@ -1,7 +1,7 @@ #sbs-git:slp/pkgs/s/slp-pkgmgr pkgmgr 0.1.103 29b53909a5d6e8728429f0a188177eac691cb6ce Name: pkgmgr Summary: Packager Manager client library package -Version: 0.2.73 +Version: 0.2.74 Release: 1 Group: System/Libraries License: Apache License, Version 2.0 @@ -101,6 +101,7 @@ rm -rf %{buildroot} mkdir -p /usr/etc/package-manager/backend mkdir -p /usr/etc/package-manager/backendlib +mkdir -p /etc/opt/upgrade # For pkgmgr-install: # Update mime database to support package mime types @@ -140,6 +141,7 @@ mkdir -p /usr/etc/package-manager/server %exclude %{_includedir}/pkgmgr/comm_status_broadcast_server.h %exclude %{_libdir}/libpkgmgr_backend_lib_sample.so %exclude /usr/etc/package-manager/server/queue_status +/etc/opt/upgrade/pkgmgr.patch.sh %files client %manifest pkgmgr-client.manifest diff --git a/pkgmgr.patch.sh.in b/pkgmgr.patch.sh.in new file mode 100644 index 0000000..af5a970 --- /dev/null +++ b/pkgmgr.patch.sh.in @@ -0,0 +1,5 @@ +echo "--------------------------------------" +echo "Update package database..............." +echo "--------------------------------------" +/bin/rm /opt/dbspace/.pkgmgr_parser.db +/usr/bin/pkg_initdb diff --git a/tool/pkg_info.c b/tool/pkg_info.c index 5359cb4..dba3643 100755 --- a/tool/pkg_info.c +++ b/tool/pkg_info.c @@ -63,6 +63,24 @@ static int __app_control_list_cb(pkgmgrinfo_appcontrol_h handle, void *user_data static int __app_metadata_list_cb(const char *metadata_name, const char *metadata_value, void *user_data); int app_func(const pkgmgr_appinfo_h handle, void *user_data); +int __get_app_id(const pkgmgrinfo_appinfo_h handle, void *user_data) +{ + char *appid = NULL; + char *apptype = NULL; + int ret = -1; + + ret = pkgmgrinfo_appinfo_get_appid(handle, &appid); + if (ret < 0) { + printf("Failed to get appid\n"); + } + + ret = pkgmgrinfo_appinfo_get_apptype(handle, &apptype); + if (ret < 0) { + printf("Failed to get package\n"); + } + printf("apptype [%s]\t appid [%s]\n", apptype, appid); +} + static int __get_integer_input_data(void) { char input_str[32] = { 0, }; @@ -141,6 +159,30 @@ static void __print_usage() printf("\tpkginfo --setvisibility \n\n"); } +static void __print_arg_filter_usage() +{ + printf("=========================================\n"); + printf("pkginfo --arg-flt key value\n"); + printf("ex : pkginfo --arg-flt 6 webapp\n"); + printf("key list is bellowed\n"); + printf("2 --> filter by app ID\n"); + printf("3 --> filter by app component\n"); + printf("4 --> filter by app exec\n"); + printf("5 --> filter by app icon\n"); + printf("6 --> filter by app type\n"); + printf("7 --> filter by app operation\n"); + printf("8 --> filter by app uri\n"); + printf("9 --> filter by app mime\n"); + printf("10 --> filter by app category\n"); + printf("11 --> filter by app nodisplay [0|1]\n"); + printf("12 --> filter by app multiple [0|1]\n"); + printf("13 --> filter by app onboot [0|1]\n"); + printf("14 --> filter by app autorestart [0|1]\n"); + printf("15 --> filter by app taskmanage [0|1]\n"); + printf("16 --> filter by app hwacceleration\n"); + printf("=========================================\n"); +} + static int __app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data) { char *appid = NULL; @@ -659,6 +701,164 @@ err: return ret; } +static int __add_arg_filter(char *key, char *value) +{ + int ret = 0; + int choice = -1; + int val = -1; + int count = 0; + pkgmgrinfo_appinfo_filter_h handle; + ret = pkgmgrinfo_appinfo_filter_create(&handle); + if (ret > 0) { + printf("appinfo filter handle create failed\n"); + return -1; + } + choice = atoi(key); + + switch (choice) { + case 2: + ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_ID, value); + if (ret < 0) { + printf("pkgmgrinfo_appinfo_filter_add_string() failed\n"); + ret = -1; + goto err; + } + break; + case 3: + ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_COMPONENT, value); + if (ret < 0) { + printf("pkgmgrinfo_appinfo_filter_add_string() failed\n"); + ret = -1; + goto err; + } + break; + case 4: + ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_EXEC, value); + if (ret < 0) { + printf("pkgmgrinfo_appinfo_filter_add_string() failed\n"); + ret = -1; + goto err; + } + break; + case 5: + ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_ICON, value); + if (ret < 0) { + printf("pkgmgrinfo_appinfo_filter_add_string() failed\n"); + ret = -1; + goto err; + } + break; + case 6: + ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_TYPE, value); + if (ret < 0) { + printf("pkgmgrinfo_appinfo_filter_add_string() failed\n"); + ret = -1; + goto err; + } + break; + case 7: + ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_OPERATION, value); + if (ret < 0) { + printf("pkgmgrinfo_appinfo_filter_add_string() failed\n"); + ret = -1; + goto err; + } + break; + case 8: + ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_URI, value); + if (ret < 0) { + printf("pkgmgrinfo_appinfo_filter_add_string() failed\n"); + ret = -1; + goto err; + } + break; + case 9: + ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_MIME, value); + if (ret < 0) { + printf("pkgmgrinfo_appinfo_filter_add_string() failed\n"); + ret = -1; + goto err; + } + free(value); + value = NULL; + break; + case 10: + ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_CATEGORY, value); + if (ret < 0) { + printf("pkgmgrinfo_appinfo_filter_add_string() failed\n"); + ret = -1; + goto err; + } + break; + case 11: + val = atoi(value); + ret = pkgmgrinfo_appinfo_filter_add_bool(handle, PMINFO_APPINFO_PROP_APP_NODISPLAY, val); + if (ret < 0) { + printf("pkgmgrinfo_appinfo_filter_add_bool() failed\n"); + ret = -1; + goto err; + } + break; + case 12: + val = atoi(value); + ret = pkgmgrinfo_appinfo_filter_add_bool(handle, PMINFO_APPINFO_PROP_APP_MULTIPLE, val); + if (ret < 0) { + printf("pkgmgrinfo_appinfo_filter_add_bool() failed\n"); + ret = -1; + goto err; + } + break; + case 13: + val = atoi(value); + ret = pkgmgrinfo_appinfo_filter_add_bool(handle, PMINFO_APPINFO_PROP_APP_ONBOOT, val); + if (ret < 0) { + printf("pkgmgrinfo_appinfo_filter_add_bool() failed\n"); + ret = -1; + goto err; + } + break; + case 14: + val = atoi(value); + ret = pkgmgrinfo_appinfo_filter_add_bool(handle, PMINFO_APPINFO_PROP_APP_AUTORESTART, val); + if (ret < 0) { + printf("pkgmgrinfo_appinfo_filter_add_bool() failed\n"); + ret = -1; + goto err; + } + break; + case 15: + val = atoi(value); + ret = pkgmgrinfo_appinfo_filter_add_bool(handle, PMINFO_APPINFO_PROP_APP_TASKMANAGE, val); + if (ret < 0) { + printf("pkgmgrinfo_appinfo_filter_add_bool() failed\n"); + ret = -1; + goto err; + } + break; + case 16: + ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_HWACCELERATION, value); + if (ret < 0) { + printf("pkgmgrinfo_appinfo_filter_add_bool() failed\n"); + ret = -1; + goto err; + } + break; + default: + __print_arg_filter_usage(); + goto err; + } + + ret = pkgmgrinfo_appinfo_filter_foreach_appinfo(handle, __get_app_id, NULL); + if (ret < 0) { + printf("pkgmgrinfo_appinfo_filter_foreach_appinfo() failed\n"); + ret = -1; + goto err; + } + +err: + pkgmgrinfo_appinfo_filter_destroy(handle); + return ret; +} static int __del_certinfo_from_db(char *pkgid) { int ret = 0; @@ -1965,6 +2165,13 @@ int main(int argc, char *argv[]) goto end; } goto end; + } else if (strcmp(argv[1], "--arg-flt") == 0) { + ret = __add_arg_filter(argv[2], argv[3]); + if (ret == -1) { + printf("compare certinfo from db failed\n"); + goto end; + } + goto end; } else { __print_usage(); ret = -1; -- 2.7.4