From: Sangyoon Jang Date: Wed, 3 Jun 2015 02:53:21 +0000 (+0900) Subject: Clean up dependency X-Git-Tag: submit/tizen_tv/20150611.000001 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Ftags%2Fsubmit%2Ftizen_tv%2F20150611.000001;p=platform%2Fcore%2Fappfw%2Fslp-pkgmgr.git Clean up dependency add buildrequires: glib, gio, gio-unix, xdgmime remove unused buildrequires: ecore, appcore-efl remove unused test code remove unused tool Change-Id: Ica276e4c0e88e1273fdeefe1a0ebf14c02f4153d Signed-off-by: Sangyoon Jang --- diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 46123c7..95b961b 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -9,6 +9,7 @@ pkg_check_modules(CLIENT_DEPS REQUIRED pkgmgr-parser pkgmgr-info iniparser + xdgmime libtzplatform-config) FOREACH(CLIENT_FLAGS ${CLIENT_DEPS_CFLAGS}) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CLIENT_FLAGS}") diff --git a/comm/CMakeLists.txt b/comm/CMakeLists.txt index 23015a4..1a7bd0c 100644 --- a/comm/CMakeLists.txt +++ b/comm/CMakeLists.txt @@ -141,11 +141,3 @@ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-installer-status-broadcast-server.pc ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-installer.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) - - - - -## test -add_subdirectory(test) - - diff --git a/comm/test/CMakeLists.txt b/comm/test/CMakeLists.txt deleted file mode 100644 index 3ff4a22..0000000 --- a/comm/test/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -include(FindPkgConfig) -pkg_check_modules(test_pkgs REQUIRED dbus-glib-1 glib-2.0 dlog) - -add_definitions(${test_pkgs_CFLAGS}) - - -add_executable(test_comm_pkg_mgr_server - test_comm_pkg_mgr_server.c) -target_link_libraries(test_comm_pkg_mgr_server pkgmgr_installer_pkg_mgr_server) -target_link_libraries(test_comm_pkg_mgr_server ${test_pkgs_LDFLAGS}) - -add_executable(test_comm_status_broadcast_server - test_comm_status_broadcast_server.c) -target_link_libraries(test_comm_status_broadcast_server pkgmgr_installer_status_broadcast_server) -target_link_libraries(test_comm_status_broadcast_server ${test_pkgs_LDFLAGS}) - -add_executable(test_comm_client - test_comm_client.c) -target_link_libraries(test_comm_client pkgmgr_installer_client) -target_link_libraries(test_comm_client ${test_pkgs_LDFLAGS}) - -add_executable(test_pkgmgr_installer - test_pkgmgr_installer.c) -target_link_libraries(test_pkgmgr_installer pkgmgr_installer pkgmgr_installer_client ${test_pkgs_LDFLAGS}) -set_target_properties(test_pkgmgr_installer PROPERTIES SKIP_BUILD_RPATH true) - diff --git a/comm/test/test_comm_client.c b/comm/test/test_comm_client.c deleted file mode 100644 index 0f86670..0000000 --- a/comm/test/test_comm_client.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * slp-pkgmgr - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Jayoun Lee , Sewook Park , - * Jaeho Lee , Shobhit Srivastava - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "comm_client.h" -#include -#include - -static GMainLoop *mainloop; - -void -stat_cb(void *data, const char *req_id, const char *pkg_type, - const char *pkgid, const char *key, const char *val) -{ - printf(">>user callback>> Got: %s %s %s %s %s\n", req_id, pkg_type, - pkgid, key, val); - - g_main_loop_quit(mainloop); -} - -int main(int argc, char **argv) -{ - - g_type_init(); - mainloop = g_main_loop_new(NULL, FALSE); - - comm_client *cc = comm_client_new(); - - gint ret; - ret = comm_client_request(cc, "__test__req_key", COMM_REQ_TO_INSTALLER, - "dpkg", "test_pkg", "arg1 arg2 arg3", - getuid(), 0); - - printf("client: waiting signal...\n"); - comm_client_set_status_callback(COMM_STATUS_BROADCAST_ALL, - cc, stat_cb, NULL); - - g_main_loop_run(mainloop); - - comm_client_free(cc); - - return 0; -} - diff --git a/comm/test/test_comm_pkg_mgr_server.c b/comm/test/test_comm_pkg_mgr_server.c deleted file mode 100644 index 00eb462..0000000 --- a/comm/test/test_comm_pkg_mgr_server.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * slp-pkgmgr - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Jayoun Lee , Sewook Park , - * Jaeho Lee , Shobhit Srivastava - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "comm_pkg_mgr_server.h" -#include -#include - -void -req_cb(void *cb_data, uid_t uid, const char *req_id, const int req_type, - const char *pkg_type, const char *pkgid, const char *args, - const char *client, const char *session, const char *user, int *ret) -{ - /* TODO: Do your job here */ - printf(">> in callback >> Got request: %s %d %s %s %s\n", - req_id, req_type, pkg_type, pkgid, args); -} - -gboolean queue_job(void *data) -{ - /* .i.. - - if (no_need_more) { - g_main_loop_quit(mainloop); - return FALSE; - - */ - return TRUE; -} - -int main(int argc, char **argv) -{ - g_type_init(); - - GMainLoop *mainloop = g_main_loop_new(NULL, FALSE); - - PkgMgrObject *pkg_mgr; - pkg_mgr = g_object_new(PKG_MGR_TYPE_OBJECT, NULL); - - pkg_mgr_set_request_callback(pkg_mgr, req_cb, NULL); - - g_timeout_add_seconds(1, queue_job, NULL); - - g_main_loop_run(mainloop); - - /* TODO: add cleanup code */ - - return 0; -} - diff --git a/comm/test/test_comm_status_broadcast_server.c b/comm/test/test_comm_status_broadcast_server.c deleted file mode 100644 index c065e3b..0000000 --- a/comm/test/test_comm_status_broadcast_server.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * slp-pkgmgr - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Jayoun Lee , Sewook Park , - * Jaeho Lee , Shobhit Srivastava - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "comm_status_broadcast_server.h" -#include -#include -#include -#include -static int _main_dbus(int argc, char **argv); -static int _main_dbus(int argc, char **argv) -{ - DBusConnection *conn = comm_status_broadcast_server_connect(COMM_STATUS_BROADCAST_ALL); - int i; - for (i = 0; i < 100; i++) { - comm_status_broadcast_server_send_signal(COMM_STATUS_BROADCAST_ALL, - conn, getuid(), "test_id", - "test", "test_pkgid", - "test_key", - "test_val"); - sleep(1); - printf(">>> sent signal: %d\n", i); - } - - return 0; -} - -int main(int argc, char **argv) -{ - return _main_dbus(argc, argv); - -} - diff --git a/comm/test/test_pkgmgr_installer.c b/comm/test/test_pkgmgr_installer.c deleted file mode 100644 index 98319eb..0000000 --- a/comm/test/test_pkgmgr_installer.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * slp-pkgmgr - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Jayoun Lee , Sewook Park , - * Jaeho Lee , Shobhit Srivastava - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "pkgmgr_installer.h" -#include -#include -#include -#include - -#include - -#include "comm_client.h" -static int _argc; -static char **_argv; -static GMainLoop *mainloop; - -static void __test_pi_new_free(void); -static void __test_pi_receive_request_standard_mode(); -static void __test_pi_send_signal(); -static void __test_pi_receive_request_quiet_mode(); - -static void __test_pi_new_free(void) -{ - pkgmgr_installer *pi = pkgmgr_installer_new(); - assert(NULL != pi); - - pkgmgr_installer_free(pi); -} - -static void __test_pi_receive_request_standard_mode(void) -{ - pkgmgr_installer *pi; - - struct test_data { - char *argv[1024]; - int size_argv; - int desired_ret_type; - char *desired_pkg_info; - char *desired_session_id; - }; - - /* Test data collection: Add more test here, except -q */ - struct test_data td[] = { - { {"a", "-i", "abc" }, 3, PKGMGR_REQ_INSTALL, "abc", NULL}, - { {"a", "-i", "ghi", "-k", "key1" }, 5, PKGMGR_REQ_INSTALL, - "ghi", "key1" }, - { {"a", "-i", "abc", "-k", "key1", "-k", "key2" }, 7, - PKGMGR_REQ_INSTALL, "abc", "key2" }, - { { NULL }, 0, 0, NULL, NULL } /* sentinel */ - }; - - /* Run test! */ - int i = 0; - struct test_data *p_td = td + i; - while (p_td && p_td->size_argv) { - - printf(">>> %s %d %d %s\n", p_td->argv[0], p_td->size_argv, - p_td->desired_ret_type, p_td->desired_pkg_info); - - pi = pkgmgr_installer_new(); - assert(NULL != pi); - - assert(0 == pkgmgr_installer_receive_request( - pi, p_td->size_argv, p_td->argv)); - assert(p_td->desired_ret_type == - pkgmgr_installer_get_request_type(pi)); - assert(pkgmgr_installer_get_request_info(pi)); /* NULL check */ - assert(!strcmp(p_td->desired_pkg_info, - pkgmgr_installer_get_request_info(pi))); - if (p_td->desired_session_id) { - assert(pkgmgr_installer_get_session_id(pi)); - assert(!strcmp(p_td->desired_session_id, - pkgmgr_installer_get_session_id(pi))); - } else { - assert(p_td->desired_session_id == - pkgmgr_installer_get_session_id(pi)); - } - pkgmgr_installer_free(pi); - - /* next */ - i++; - p_td = td + i; - } -} - -struct signal_counter { - int start; - int install_percent; - int end; -}; - -static gboolean timer_stop_mainloop(void *data) -{ - g_main_loop_quit(mainloop); - return FALSE; -} - -static void -get_signal_cb(void *cb_data, const char *req_id, const char *pkg_type, - const char *pkgid, const char *key, const char *val) -{ - struct signal_counter *counter = (struct signal_counter *)cb_data; - - printf("get_signal_cb() called\n"); - if (!strcmp("start", key)) - counter->start += 1; - if (!strcmp("install_percent", key)) - counter->install_percent = atoi(val); - if (!strcmp("end", key)) - counter->end += 1; - - g_main_loop_quit(mainloop); -} - -static gboolean timer_send_signal(void *data) -{ - pkgmgr_installer *pi = (pkgmgr_installer *) data; - printf("try to send signal\n"); - assert(0 == pkgmgr_installer_send_signal(pi, "deb", "testpkg", "start", - "install")); - printf("sent signal\n"); - return FALSE; -} - -static void __test_pi_send_signal(void) -{ - pkgmgr_installer *pi; - pi = pkgmgr_installer_new(); - assert(NULL != pi); - - /* receiver */ - struct signal_counter counter = { 0, }; - comm_client *cc; - cc = comm_client_new(); - comm_client_set_status_callback(COMM_STATUS_BROADCAST_ALL, - cc, get_signal_cb, &counter); - - /* sender */ - g_timeout_add_seconds(1, timer_send_signal, pi); - - /* Set timeout, and run main loop */ - g_timeout_add_seconds(5, timer_stop_mainloop, NULL); - - printf("start loop\n"); - g_main_loop_run(mainloop); - - /* find values */ - printf("exit loop\n"); - assert(1 == counter.start); - - comm_client_free(cc); - - pkgmgr_installer_free(pi); -} - -void __test_pi_receive_request_quiet_mode() -{ - pkgmgr_installer *pi; - - struct test_data { - char *argv[1024]; - int size_argv; - int desired_ret_type; - char *desired_pkg_info; - char *desired_session_id; - }; - - /* Test data collection: Add more test here, except -q */ - struct test_data td[] = { - { {"a", "-q", "-i", "abc" }, 4, PKGMGR_REQ_INSTALL, "abc", NULL}, - { {"a", "-i", "ghi", "-k", "key1", "-q" }, 6, - PKGMGR_REQ_INSTALL, "ghi", "key1"}, - { {NULL}, 0, 0, NULL, NULL } /* sentinel */ - }; - - /* Run test! */ - int i = 0; - int r; - struct test_data *p_td = td + i; - while (p_td && p_td->size_argv) { - - printf(">>> %s %d %d %s\n", p_td->argv[0], p_td->size_argv, - p_td->desired_ret_type, p_td->desired_pkg_info); - - pi = pkgmgr_installer_new(); - assert(NULL != pi); - r = pkgmgr_installer_receive_request(pi, p_td->size_argv, - p_td->argv); - printf("desired=0, r=%d\n", r); - assert(0 == r); - assert(p_td->desired_ret_type == - pkgmgr_installer_get_request_type(pi)); - assert(pkgmgr_installer_get_request_info(pi)); /* NULL check */ - assert(!strcmp - (p_td->desired_pkg_info, - pkgmgr_installer_get_request_info(pi))); - assert(pkgmgr_installer_is_quiet(pi)); - if (p_td->desired_session_id) { - assert(pkgmgr_installer_get_session_id(pi)); - assert(!strcmp - (p_td->desired_session_id, - pkgmgr_installer_get_session_id(pi))); - } else { - assert(p_td->desired_session_id == - pkgmgr_installer_get_session_id(pi)); - } - pkgmgr_installer_free(pi); - - /* next */ - i++; - p_td = td + i; - } -} - -/* Test collection */ -static void __test_pkgmgr_installer(void) -{ - __test_pi_new_free(); - __test_pi_receive_request_standard_mode(); - __test_pi_send_signal(); - __test_pi_receive_request_quiet_mode(); -} - -/* main function */ -int main(int argc, char **argv) -{ - _argc = argc; - _argv = argv; - - /* For event loop */ - g_type_init(); - mainloop = g_main_loop_new(NULL, FALSE); - - __test_pkgmgr_installer(); - - return 0; -} - diff --git a/packaging/pkgmgr.spec b/packaging/pkgmgr.spec index 5770bbe..2779ac0 100644 --- a/packaging/pkgmgr.spec +++ b/packaging/pkgmgr.spec @@ -18,20 +18,22 @@ Source1007: %{name}-types-devel.manifest BuildRequires: cmake BuildRequires: unzip BuildRequires: gettext-tools -BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(cynara-client) BuildRequires: pkgconfig(cynara-creds-dbus) BuildRequires: pkgconfig(cynara-session) +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(gio-2.0) +BuildRequires: pkgconfig(gio-unix-2.0) BuildRequires: pkgconfig(dbus-1) BuildRequires: pkgconfig(dbus-glib-1) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(ail) BuildRequires: pkgconfig(bundle) -BuildRequires: pkgconfig(appcore-efl) BuildRequires: pkgconfig(pkgmgr-info) BuildRequires: pkgconfig(iniparser) BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(security-manager) +BuildRequires: pkgconfig(xdgmime) BuildRequires: pkgconfig(db-util) BuildRequires: pkgmgr-info-parser-devel BuildRequires: pkgmgr-info-parser @@ -168,9 +170,6 @@ chsmack -a '*' %{TZ_SYS_RW_PACKAGES} %{_bindir}/pkg_clearcache %{_bindir}/pkg_privilege %{_bindir}/pkginfo -%{_bindir}/pkgmgr-install -%attr(-,tizenglobalapp,root) %dir %{TZ_SYS_RW_PACKAGES} -%attr(-,tizenglobalapp,root) %{TZ_SYS_RW_PACKAGES}/org.tizen.pkgmgr-install.xml %{_datadir}/mime/packages/mime.wac.xml %{_datadir}/mime/packages/mime.tpk.xml %exclude %{_includedir}/pkgmgr/comm_client.h diff --git a/tool/CMakeLists.txt b/tool/CMakeLists.txt index 2a8a7e1..d52e859 100644 --- a/tool/CMakeLists.txt +++ b/tool/CMakeLists.txt @@ -6,18 +6,18 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/client/include) INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs_initdb REQUIRED libsmack ecore dbus-1 ail libxml-2.0 bundle pkgmgr-parser vconf pkgmgr-info libtzplatform-config) +pkg_check_modules(pkgs_initdb REQUIRED libsmack dbus-1 ail libxml-2.0 bundle pkgmgr-parser vconf pkgmgr-info libtzplatform-config) FOREACH(flag ${pkgs_initdb_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) -pkg_check_modules(pkgs_test REQUIRED ecore 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 vconf pkgmgr-info libtzplatform-config security-manager) FOREACH(flag ${pkgs_test_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) -pkg_check_modules(toolpkgs REQUIRED appcore-efl dlog bundle glib-2.0 pkgmgr-parser vconf pkgmgr-info libtzplatform-config) +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) @@ -77,13 +77,6 @@ add_executable(pkg_initdb_user pkg_initdb_user.c) target_link_libraries(pkg_initdb_user ${pkgs_initdb_LDFLAGS}) INSTALL(TARGETS pkg_initdb_user DESTINATION bin) -add_executable(pkgmgr-install pkgmgr-install.c) -target_link_libraries(pkgmgr-install pkgmgr-client pkgmgr-info ${toolpkgs_LDFLAGS}) -install(TARGETS pkgmgr-install DESTINATION bin) - -configure_file(org.tizen.pkgmgr-install.xml.in ${CMAKE_BINARY_DIR}/org.tizen.pkgmgr-install.xml @ONLY) -install(FILES ${CMAKE_BINARY_DIR}/org.tizen.pkgmgr-install.xml DESTINATION /usr/share/packages/) - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mime.wac.xml DESTINATION /usr/share/mime/packages/) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mime.tpk.xml DESTINATION /usr/share/mime/packages/) diff --git a/tool/org.tizen.pkgmgr-install.xml.in b/tool/org.tizen.pkgmgr-install.xml.in deleted file mode 100644 index 95183d9..0000000 --- a/tool/org.tizen.pkgmgr-install.xml.in +++ /dev/null @@ -1,9 +0,0 @@ - - - - Sewook Park - pkgmgr-install - - - - diff --git a/tool/pkgmgr-install.c b/tool/pkgmgr-install.c deleted file mode 100644 index 5ac2c44..0000000 --- a/tool/pkgmgr-install.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * slp-pkgmgr - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Jayoun Lee , Sewook Park , - * Jaeho Lee , Shobhit Srivastava - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - - - - - -#include "package-manager.h" - -#include -#include -#include -#include -#include - -#include -#include - - -#define KEY_MIME_TYPE "__AUL_MIME_TYPE__" -#define KEY_MIME_CONTENT "__AUL_MIME_CONTENT__" - -#define KEY_MIME_TYPE_NEW "__APP_SVC_MIME_TYPE__" -#define KEY_MIME_CONTENT_NEW "__APP_SVC_URI__" - - -#if !defined(PACKAGE) -#define PACKAGE "org.tizen.pkgmgr-install" -#endif - - -char *supported_mime_type_list[] = { - NULL /* sentinel */ -}; - -struct appdata { - char *file_path; - char *extension; -}; - - -static int __parse_argv(int argc, char **argv, - char **mime_type, char **file_path); -static const char *__get_ext_from_file_path(const char *file_path); - -static int __parse_argv(int argc, char **argv, - char **mime_type, char **file_path) -{ - static bundle *b = NULL; - if (b) - bundle_free(b); - - b = bundle_import_from_argv(argc, argv); - if (b == NULL) { - fprintf(stderr, "bundle for bundle_import_from_argv is NULL"); - } - - errno = 0; - - if(bundle_get_val(b, KEY_MIME_CONTENT_NEW)) { - /* *mime_type = (char *)bundle_get_val(b, KEY_MIME_TYPE_NEW); */ - *file_path = (char *)bundle_get_val(b, KEY_MIME_CONTENT_NEW); - } else { - *mime_type = (char *)bundle_get_val(b, KEY_MIME_TYPE); - *file_path = (char *)bundle_get_val(b, KEY_MIME_CONTENT); - } - - if (errno) - return -1; - - return 0; -} - -static const char *__get_ext_from_file_path(const char *file_path) -{ - return strrchr(file_path, '.') + 1; -} - -gboolean __term(void *data) -{ - ecore_main_loop_quit(); - - return FALSE; -} - -int main(int argc, char **argv) -{ - struct appdata ad; - struct appcore_ops ops = { - .create = NULL, - .terminate = NULL, - .pause = NULL, - .resume = NULL, - .reset = NULL, - }; - - char *mime_type; - char *file_path; - const char *extension; - int request_id = 0; - - if (__parse_argv(argc, argv, &mime_type, &file_path)) { - fprintf(stderr, "Failed to parse argv!\n"); - return -1; - } - - extension = __get_ext_from_file_path(file_path); - - memset(&ad, 0x0, sizeof(struct appdata)); - ops.data = &ad; - ad.file_path = file_path; - ad.extension = extension; - - - int pid = fork(); - if (pid == 0) { - pkgmgr_client *pc = pkgmgr_client_new(PC_REQUEST); - request_id = pkgmgr_client_install(pc, extension, NULL, file_path, NULL, - PM_DEFAULT, NULL, NULL); - if (request_id < 0) - fprintf(stderr, "pkgmgr_client_install fail!\n"); - - request_id = pkgmgr_client_free(pc); - if (request_id < 0) - fprintf(stderr, "pkgmgr_client_free fail\n"); - - exit(0); - } - - g_timeout_add(1000, __term, &ad); - -// sleep(2); - /* Wait until AULD(launchpad) retrives info of this process. - Its timeout is 1.2s. */ - - return appcore_efl_main(PACKAGE, &argc, &argv, &ops); -} -