set(CMAKE_SKIP_BUILD_RPATH true)
#Verbose
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/comm)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/comm )
INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED security-server dlog elementary evas ecore appcore-efl ecore-x ail ecore-file)
+pkg_check_modules(pkgs REQUIRED security-server dlog elementary evas ecore appcore-efl ecore-x ail ecore-file pkgmgr-info)
FOREACH(flag ${pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
-pkg_check_modules(libpkgs REQUIRED dbus-glib-1 dlog aul ail)
+pkg_check_modules(libpkgs REQUIRED dbus-glib-1 dlog ail pkgmgr-info)
FOREACH(flag ${libpkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
###################################################################################################
## for libpkgmgr-client.so (library)
SET(PKGMGR_CLIENT "pkgmgr-client")
-SET(libpkgmgr-client_SOURCES ${pm_c_src_dir}/pkgmgr-info.c ${pm_c_src_dir}/pkgmgr-internal.c ${pm_c_src_dir}/pkgmgr.c)
+SET(libpkgmgr-client_SOURCES ${pm_c_src_dir}/pkgmgr-internal.c ${pm_c_src_dir}/pkgmgr.c ${pm_c_src_dir}/pkgmgr-dbinfo.c)
SET(libpkgmgr-client_LDFLAGS " -module -avoid-version ")
SET(libpkgmgr-client_CFLAGS " ${CFLAGS} -fPIC -I${pm_c_inc_dir} -I${pm_inc_dir} -I${pm_t_inc_dir} ${debug_type}")
SET_TARGET_PROPERTIES(${PKGMGR_CLIENT} PROPERTIES SOVERSION ${VERSION_MAJOR})
SET_TARGET_PROPERTIES(${PKGMGR_CLIENT} PROPERTIES VERSION ${VERSION})
SET_TARGET_PROPERTIES(${PKGMGR_CLIENT} PROPERTIES COMPILE_FLAGS "${libpkgmgr-client_CFLAGS}")
-TARGET_LINK_LIBRARIES(${PKGMGR_CLIENT} pkgmgr_installer_client pkgmgr_installer_status_broadcast_server ${libpkgs_LDFLAGS})
+TARGET_LINK_LIBRARIES(${PKGMGR_CLIENT} pkgmgr_installer_client pkgmgr_installer_status_broadcast_server pkgmgr-info ${libpkgs_LDFLAGS})
###################################################################################################
###################################################################################################
INSTALL(FILES ${CMAKE_BINARY_DIR}/pkgmgr-server DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr.pc DESTINATION lib/pkgconfig)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/client/include/package-manager.h DESTINATION include)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/client/include/pkgmgr-dbinfo.h DESTINATION include)
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/)
#define __PKG_MANAGER_H__
#include <errno.h>
+#include <stdbool.h>
#ifdef __cplusplus
* @addtogroup pkg_operate
* @{
*/
-typedef int (*pkgmgr_iter_fn)(const char* pkg_type, const char* pkg_name,
+
+typedef void* pkgmgr_pkginfo_h;
+typedef void* pkgmgr_appinfo_h;
+typedef void* pkgmgr_certinfo_h;
+
+typedef int (*pkgmgr_iter_fn)(const char* pkg_type, const char* pkgid,
const char* version, void *data);
typedef int (*pkgmgr_handler)(int req_id, const char *pkg_type,
- const char *pkg_name, const char *key,
+ const char *pkgid, const char *key,
const char *val, const void *pmsg, void *data);
+typedef int (*pkgmgr_info_pkg_list_cb ) (const pkgmgr_pkginfo_h handle,
+ void *user_data);
+
+typedef int (*pkgmgr_info_app_list_cb ) (const pkgmgr_appinfo_h handle,
+ void *user_data);
+
+typedef int (*pkgmgr_info_app_category_list_cb ) (const char *category_name,
+ void *user_data);
+
typedef void pkgmgr_client;
PM_QUIET
}pkgmgr_mode;
+typedef enum {
+ PM_INSTALL_LOCATION_AUTO = 0,
+ PM_INSTALL_LOCATION_INTERNAL_ONLY,
+ PM_INSTALL_LOCATION_PREFER_EXTERNAL,
+}pkgmgr_install_location;
+
+typedef enum {
+ PM_HWACCELERATION_NOT_USE_GL = 0,
+ PM_HWACCELERATION_USE_GL = 1,
+ PM_HWACCELERATION_USE_SYSTEM_SETTING = 2,
+}pkgmgr_hwacceleration_type;
+
+typedef enum {
+ PM_ALL_APP = 0,
+ PM_UI_APP,
+ PM_SVC_APP
+}pkgmgr_app_component;
+
+typedef enum {
+ PM_MOVE_TO_INTERNAL = 0,
+ PM_MOVE_TO_SDCARD = 1,
+}pkgmgr_move_type;
+
+typedef enum {
+ PM_INTERNAL_STORAGE = 0,
+ PM_EXTERNAL_STORAGE = 1,
+}pkgmgr_installed_storage;
+
+typedef enum {
+ PM_AUTHOR_ROOT_CERT = 0,
+ PM_AUTHOR_INTERMEDIATE_CERT = 1,
+ PM_AUTHOR_SIGNER_CERT = 2,
+ PM_DISTRIBUTOR_ROOT_CERT = 3,
+ PM_DISTRIBUTOR_INTERMEDIATE_CERT = 4,
+ PM_DISTRIBUTOR_SIGNER_CERT = 5,
+ PM_DISTRIBUTOR2_ROOT_CERT = 6,
+ PM_DISTRIBUTOR2_INTERMEDIATE_CERT = 7,
+ PM_DISTRIBUTOR2_SIGNER_CERT = 8,
+}pkgmgr_cert_type;
+
/**
* @brief This API creates pkgmgr client.
*
*
* @param[in] pc pkgmgr_client
* @param[in] pkg_type package type
- * @param[in] pkg_name package name
+ * @param[in] pkgid package id
* @param[in] mode installation mode - PM_DEFAULT, PM_QUIET
* @param[in] event_cb user callback
* @param[in] data user data
* @retval PKGMGR_R_ECOMM communication error
*/
int pkgmgr_client_uninstall(pkgmgr_client *pc, const char *pkg_type,
- const char *pkg_name, pkgmgr_mode mode,
+ const char *pkgid, pkgmgr_mode mode,
pkgmgr_handler event_cb, void *data);
/**
+ * @brief This API moves installed package to SD card or vice versa.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] pc pkgmgr_client
+ * @param[in] pkg_type package type
+ * @param[in] pkgid application package id
+ * @param[in] move_type PM_MOVE_TO_INTERNAL or PM_MOVE_TO_SDCARD
+ * @param[in] mode installation mode - PM_DEFAULT, PM_QUIET
+ * @retval PKGMGR_R_OK success
+ * @retval PKGMGR_R_EINVAL invalid argument
+ * @retval PKGMGR_R_ERROR general error
+*/
+int pkgmgr_client_move(pkgmgr_client *pc, const char *pkg_type,
+ const char *pkgid, pkgmgr_move_type move_type, pkgmgr_mode mode);
+
+/**
* @brief This API activates package.
*
* This API is for package-manager client application.\n
*
* @param[in] pc pkgmgr_client
* @param[in] pkg_type package type
- * @param[in] pkg_name package name
+ * @param[in] pkgid package id
* @return request_id (>0) if success, error code(<0) if fail\n
* @retval PKGMGR_R_OK success
* @retval PKGMGR_R_EINVAL invalid argument
* @retval PKGMGR_R_ECOMM communication error
*/
int pkgmgr_client_activate(pkgmgr_client *pc, const char *pkg_type,
- const char *pkg_name);
+ const char *appid);
/**
* @brief This API deactivates package.
*
* @param[in] pc pkgmgr_client
* @param[in] pkg_type package type
- * @param[in] pkg_name package name
+ * @param[in] pkgid package id
* @return request_id (>0) if success, error code(<0) if fail\n
* @retval PKGMGR_R_OK success
* @retval PKGMGR_R_EINVAL invalid argument
* @retval PKGMGR_R_ECOMM communication error
*/
int pkgmgr_client_deactivate(pkgmgr_client *pc, const char *pkg_type,
- const char *pkg_name);
+ const char *appid);
/**
* @brief This API deletes application's private data.
*
* @param[in] pc pkgmgr_client
* @param[in] pkg_type package type
- * @param[in] pkg_name package name
+ * @param[in] pkgid package id
* @param[in] mode installation mode - PM_DEFAULT, PM_QUIET
* @return request_id (>0) if success, error code(<0) if fail\n
* @retval PKGMGR_R_OK success
* @retval PKGMGR_R_ECOMM communication error
*/
int pkgmgr_client_clear_user_data(pkgmgr_client *pc, const char *pkg_type,
- const char *pkg_name, pkgmgr_mode mode);
+ const char *appid, pkgmgr_mode mode);
/**
* @brief This API request to listen the pkgmgr's broadcasting
*
* @param[in] pc pkgmgr_client
* @param[in] pkg_type package type
- * @param[in] pkg_name package name
+ * @param[in] pkgid package id
* @param[in] key key to broadcast
* @param[in] val value to broadcast
* @return 0 if success, error code(<0) if fail\n
* @retval PKGMGR_R_EINVAL invalid argument
*/
int pkgmgr_client_broadcast_status(pkgmgr_client *pc, const char *pkg_type,
- const char *pkg_name, const char *key,
+ const char *pkgid, const char *key,
const char *val);
/**
* This API is for package-manager client application.\n
*
* @param[in] pkg_type package type for the package to get infomation
- * @param[in] pkg_name package name for the package to get infomation
+ * @param[in] pkgid package id for the package to get infomation
* @return package entry pointer if success, NULL if fail\n
*/
-pkgmgr_info * pkgmgr_info_new(const char *pkg_type, const char *pkg_name);
+pkgmgr_info * pkgmgr_info_new(const char *pkg_type, const char *pkgid);
/**
* @brief This API gets the package's information.
* @return 0 if success, error code(<0) if fail\n
*/
int pkgmgr_info_free(pkgmgr_info * pkg_info);
-/** @} */
+/**
+ * @brief This API gets list of installed applications.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] pkg_list_cb iteration function for list
+ * @param[in] user_data user data to be passed to callback function
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_get_list(pkgmgr_info_pkg_list_cb pkg_list_cb, void *user_data);
+
+/**
+ * @brief This API get package info entry from db
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] pkgid pointer to package id
+ * @param[out] handle pointer to the package info handle.
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_get_pkginfo(const char *pkgid, pkgmgr_pkginfo_h *handle);
+
+/**
+ * @brief This API gets type of the given package.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] type to hold package type.
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_get_pkgname(pkgmgr_pkginfo_h handle, char **pkg_name);
+
+/**
+ * @brief This API gets id of the given package.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out]pkgid to hold package id.
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_get_pkgid(pkgmgr_pkginfo_h handle, char **pkgid);
+
+/**
+ * @brief This API gets type of the given package.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] type to hold package type.
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_get_type(pkgmgr_pkginfo_h handle, char **type);
+
+/**
+ * @brief This API gets version of the given package.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] version to hold package version.
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_get_version(pkgmgr_pkginfo_h handle, char **version);
+
+/**
+ * @brief This API gets install location of the given package.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] location to hold install location.
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_get_install_location(pkgmgr_pkginfo_h handle, pkgmgr_install_location *location);
+
+/**
+ * @brief This API gets package size of the given package in case of external installation.
+ * size will be 0 if package install location is internal-only.
+ * size will be 0 if package install location is prefer-external but size is not specified in manifest file.
+ * Application should check the return value and use it distinguish the above cases.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] size to hold package size.
+ * @return 0 if success, error code(<0) if fail\n
+ * @return
+*/
+int pkgmgr_pkginfo_get_package_size(pkgmgr_pkginfo_h handle, int *size);
+
+/**
+ * @brief This API gets icon of the given package.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] icon to hold package icon.
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_get_icon(pkgmgr_pkginfo_h handle, char **icon);
+
+/**
+ * @brief This API gets label of the given package.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] label to hold package label.
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_get_label(pkgmgr_pkginfo_h handle, char **label);
+
+/**
+ * @brief This API gets desription of the given package.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] description to hold package description.
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_get_description(pkgmgr_pkginfo_h handle, char **description);
+
+/**
+ * @brief This API gets author's name of the given package.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] author_name to hold author's name.
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_get_author_name(pkgmgr_pkginfo_h handle, char **author_name);
+
+/**
+ * @brief This API gets author's email of the given package.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] author_email to hold author's email id.
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_get_author_email(pkgmgr_pkginfo_h handle, char **author_email);
+
+/**
+ * @brief This API gets author's href of the given package.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] author_href to hold author's href.
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_get_author_href(pkgmgr_pkginfo_h handle, char **author_href);
+
+/**
+ * @brief This API gets removable of the given package.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] removable to hold removable value.
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_is_removable(pkgmgr_pkginfo_h handle, bool *removable);
+
+/**
+ * @brief This API gets preload of the given package.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] preload to hold preload value
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_is_preload(pkgmgr_pkginfo_h handle, bool *preload);
+
+/**
+ * @brief This API gets readonly value of the given package.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] readonly to hold readonly value
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_is_readonly(pkgmgr_pkginfo_h handle, bool *readonly);
+
+/**
+ * @brief This API gets accessible of the given package.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] pkgid id of package
+ * @param[out]accessible accessible of package
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_is_accessible(pkgmgr_pkginfo_h handle, bool *accessible);
+
+/**
+ * @brief This API destroy the pacakge info handle
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to package info handle
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_destroy_pkginfo(pkgmgr_pkginfo_h handle);
+
+/**
+ * @brief This API gets installed storage of the given package.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] pkgid id of package
+ * @param[out] storage storage of package
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_get_installed_storage(pkgmgr_pkginfo_h handle, pkgmgr_installed_storage *storage);
+
+/**
+ * @brief This API gets installed time of the given package.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] installed_time installed time of package
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_get_installed_time(pkgmgr_pkginfo_h handle, int *installed_time);
+
+/**
+ * @brief This API gets list of ui-application/service application of the given package.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[in] component application component type.
+ * @param[in] app_func application's callback function.
+ * @param[in] user_data user data to be passed to callback function
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_appinfo_get_list(pkgmgr_pkginfo_h handle, pkgmgr_app_component component,
+ pkgmgr_info_app_list_cb app_func, void *user_data);
+
+/**
+ * @brief This API gets list of category for ui-application/service application.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[in] category_func callback function.
+ * @param[in] user_data user data to be passed to callback function
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_appinfo_foreach_category(pkgmgr_appinfo_h handle, pkgmgr_info_app_category_list_cb category_func,
+ void *user_data);
+
+/**
+ * @brief This API gets application info entry from db.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] appid application id
+ * @param[out] handle pointer to app info handle
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_appinfo_get_appinfo(const char *appid, pkgmgr_appinfo_h *handle);
+
+/**
+ * @brief This API gets appid of the given appid.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to app info handle
+ * @param[out] appid to hold appid value
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_appinfo_get_appid(pkgmgr_appinfo_h handle, char **appid);
+
+/**
+ * @brief This API gets pkgid of the given appid.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to app info handle
+ * @param[out]pkg_name to hold pkgid value
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_appinfo_get_pkgname(pkgmgr_appinfo_h handle, char **pkg_name);
+
+/**
+ * @brief This API gets pkgid of the given appid.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to app info handle
+ * @param[out] pkgid to hold pkgid value
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_appinfo_get_pkgid(pkgmgr_appinfo_h handle, char **pkgid);
+
+/**
+ * @brief This API gets exec of the given appid.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to app info handle
+ * @param[out] exec to hold exec value
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_appinfo_get_exec(pkgmgr_appinfo_h handle, char **exec);
+
+/**
+ * @brief This API gets icon name of the given appid.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to app info handle
+ * @param[out] icon to hold icon value
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_appinfo_get_icon(pkgmgr_appinfo_h handle, char **icon);
+
+/**
+ * @brief This API gets label of the given appid.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to app info handle
+ * @param[out] label to hold label value
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_appinfo_get_label(pkgmgr_appinfo_h handle, char **label);
+
+/**
+ * @brief This API gets package name of the given appid.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to app info handle
+ * @param[out] package to hold package value
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_appinfo_get_package(pkgmgr_appinfo_h handle, char **package);
+
+/**
+ * @brief This API gets component type of the given appid.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to app info handle
+ * @param[out] component to hold component value
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_appinfo_get_component(pkgmgr_appinfo_h handle, pkgmgr_app_component *component);
+
+/**
+ * @brief This API gets app type of the given appid.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to app info handle
+ * @param[out] app_type to hold the apptype.
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_appinfo_get_apptype(pkgmgr_appinfo_h handle, char **app_type);
+
+/**
+ * @brief This API gets nodisplay value of the given appid.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to app info handle
+ * @param[out] nodisplay to hold the nodisplay value
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_appinfo_is_nodisplay(pkgmgr_appinfo_h handle, bool *nodisplay);
+
+/**
+ * @brief This API gets multiple value of the given appid.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to app info handle
+ * @param[out] multiple to hold the multiple value
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_appinfo_is_multiple(pkgmgr_appinfo_h handle, bool *multiple);
+
+/**
+ * @brief This API gets taskmanage value of the given appid.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to app info handle
+ * @param[out] taskmanage to hold the taskmanage value
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_appinfo_is_taskmanage(pkgmgr_appinfo_h handle, bool *taskmanage);
+
+/**
+ * @brief This API gets hwacceleration value of the given appid.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to app info handle
+ * @param[out] hwacceleration to hold the hwacceleration value
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_appinfo_get_hwacceleration(pkgmgr_appinfo_h handle, pkgmgr_hwacceleration_type *hwacceleration);
+
+/**
+ * @brief This API gets onboot value of the given appid.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to app info handle
+ * @param[out] onboot to hold the onboot value
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_appinfo_is_onboot(pkgmgr_appinfo_h handle, bool *onboot);
+
+/**
+ * @brief This API gets autorestart value of the given appid.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to app info handle
+ * @param[out] autorestart to hold the autorestart value
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_appinfo_is_autorestart(pkgmgr_appinfo_h handle, bool *autorestart);
+
+/**
+ * @brief This API destroy the appinfo handle.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to app info handle
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_appinfo_destroy_appinfo(pkgmgr_appinfo_h handle);
+
+/**
+ * @brief This API creates the certinfo handle.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[out] handle pointer to cert info handle
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_create_certinfo(pkgmgr_certinfo_h *handle);
+
+/**
+ * @brief This API loads cert info in the handle.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to cert info handle
+ * @param[in] pkgid package ID
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_load_certinfo(const char *pkgid, pkgmgr_certinfo_h handle);
+
+/**
+ * @brief This API gets cert value for corresponding cert type.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to cert info handle
+ * @param[in] cert_type enum value for certificate type
+ * @param[out] cert_value pointer to store cert value
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_get_cert_value(pkgmgr_certinfo_h handle, pkgmgr_cert_type cert_type, const char **cert_value);
+
+/**
+ * @brief This API destroys cert info handle freeing all resources.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to cert info handle
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_pkginfo_destroy_certinfo(pkgmgr_certinfo_h handle);
+
+/**
+ * @brief This API gets datacontrol info entry from db.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] providerid pointer to providerid
+ * @param[in] type pointer to type
+ * @param[out] appid pointer to appid value
+ * @param[out] access pointer to access value
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_datacontrol_get_info(const char *providerid, const char * type, char **appid, char **access);
+/** @} */
#ifdef __cplusplus
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+
+/**
+ * @file pkgmgr-dbinfo.h
+ * @author Shobhit Srivastava <shobhit.s@samsung.com>
+ * @version 0.1
+ * @brief This file declares db set API for backend installers
+ *
+ * @addtogroup APPLICATION_FRAMEWORK
+ * @{
+ *
+ * @defgroup PackageManager
+ * @section Header to use them:
+ * @code
+ * #include "pkgmgr-dbinfo.h"
+ * @endcode
+ *
+ * @addtogroup PackageManager
+ * @{
+ */
+
+#ifndef __PKGMGR_DBINFO_H__
+#define __PKGMGR_DBINFO_H__
+
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef DEPRECATED
+#define DEPRECATED __attribute__ ((__deprecated__))
+#endif
+
+typedef enum {
+ PM_INSTALL_INTERNAL = 0,
+ PM_INSTALL_EXTERNAL,
+} PM_INSTALL_LOCATION;
+
+typedef void* pkgmgr_pkgdbinfo_h;
+
+/**
+ * @brief This API creates package info handle to set info in the db.
+ *
+ * This API is for backend installers.\n
+ *
+ * @param[in] pkgid package id.
+ * @param[out] handle package info handle.
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_create_pkgdbinfo(const char *pkgid, pkgmgr_pkgdbinfo_h *handle);
+
+/**
+ * @brief This API sets the package type in DB.
+ *
+ * This API is for backend installers.\n
+ *
+ * @param[in] handle package info handle.
+ * @param[in] type package type.
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_set_type_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, const char *type);
+
+/**
+ * @brief This API sets the package version in DB.
+ *
+ * This API is for backend installers.\n
+ *
+ * @param[in] handle package info handle.
+ * @param[in] version package version.
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_set_version_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, const char *version);
+
+/**
+ * @brief This API sets install location in DB
+ *
+ * This API is for backend installers.\n
+ *
+ * @param[in] handle package info handle.
+ * @param[in] location install location.
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_set_install_location_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, PM_INSTALL_LOCATION location);
+
+/**
+ * @brief This API sets package size in DB
+ *
+ * This API is for backend installers.\n
+ *
+ * @param[in] handle package info handle.
+ * @param[in] size package size.
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_set_size_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, const char *size);
+
+/**
+ * @brief This API sets label in DB.
+ *
+ * This API is for backend installers.\n
+ *
+ * @param[in] handle package info handle.
+ * @param[in] label label text.
+ * @param[in] locale locale (NULL for default).
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_set_label_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, const char *label, const char *locale);
+
+/**
+ * @brief This API sets icon in DB.
+ *
+ * This API is for backend installers.\n
+ *
+ * @param[in] handle package info handle.
+ * @param[in] icon icon name.
+ * @param[in] locale locale (NULL for default).
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_set_icon_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, const char *icon, const char *locale);
+
+/**
+ * @brief This API sets description in DB.
+ *
+ * This API is for backend installers.\n
+ *
+ * @param[in] handle package info handle.
+ * @param[in] description description of the package.
+ * @param[in] locale locale (NULL for default).
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_set_description_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, const char *description, const char *locale);
+
+/**
+ * @brief This API sets author's name, email, href in DB.
+ *
+ * This API is for backend installers.\n
+ *
+ * @param[in] handle package info handle.
+ * @param[in] author_name author' name.
+ * @param[in] author_email author's email.
+ * @param[in] author_href author's href.
+ * @param[in] locale locale (NULL for default).
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_set_author_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, const char *author_name,
+ const char *author_email, const char *author_href, const char *locale);
+
+/**
+ * @brief This API sets removable in DB.
+ *
+ * This API is for backend installers.\n
+ *
+ * @param[in] handle package info handle.
+ * @param[in] removable removable (0 | 1)
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_set_removable_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, int removable);
+
+/**
+ * @brief This API sets preload in DB.
+ *
+ * This API is for backend installers.\n
+ *
+ * @param[in] handle package info handle.
+ * @param[in] preload preload (0 | 1)
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_set_preload_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, int preload);
+
+/**
+ * @brief This API save pakage info entry into the db.
+ *
+ * This API is for backend installers.\n
+ *
+ * @param[in] handle package info handle.
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_save_pkgdbinfo(pkgmgr_pkgdbinfo_h handle);
+
+/**
+ * @brief This API destroy pakage info handle and free the resources.
+ *
+ * This API is for backend installers.\n
+ *
+ * @param[in] handle package info handle.
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_destroy_pkgdbinfo(pkgmgr_pkgdbinfo_h handle);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __PKGMGR_DBINFO_H__ */
+/**
+ * @}
+ * @}
+ */
+
#define LOG_TAG "PKGMGR"
#endif /* LOG_TAG */
+#include "package-manager-plugin.h"
+
+typedef package_manager_pkg_info_t package_manager_app_info_t;
+
+
+char *_get_pkg_type_from_desktop_file(const char *pkgid);
+
+package_manager_pkg_info_t *_pkg_malloc_appinfo(int num);
+
+pkg_plugin_set *_pkg_plugin_load_library(const char *pkg_type,
+ const char *library_path);
+
+int _pkg_plugin_get_library_path(const char *pkg_type, char *library_path);
+
+pkg_plugin_set *_package_manager_load_library(const char *pkg_type);
+
+char *_get_info_string(const char *key,
+ const package_manager_pkg_detail_info_t *
+ pkg_detail_info);
+
+int _get_info_int(const char *key,
+ const package_manager_pkg_detail_info_t *pkg_detail_info);
+
+time_t _get_info_time(const char *key,
+ const package_manager_pkg_detail_info_t *
+ pkg_detail_info);
+
+
#define PKG_FRONTEND "frontend:"
#define PKG_BACKEND "backend:"
#define PKG_BACKENDLIB "backendlib:"
+#define PKG_PARSERLIB "parserlib:"
#define PKG_CONF_PATH "/usr/etc/package-manager/pkg_path.conf"
#define PKG_STATUS "STATUS"
#define PKG_EXT_LEN_MAX 20
#define PKG_ARGC_MAX 16
-#define _LOGE(fmt, arg...) LOGE("[%s,%d] "fmt, __FUNCTION__, __LINE__, ##arg)
-#define _LOGD(fmt, arg...) LOGD("[%s,%d] "fmt, __FUNCTION__, __LINE__, ##arg)
+#define _LOGE(fmt, arg...) LOGE(fmt,##arg)
+#define _LOGD(fmt, arg...) LOGD(fmt,##arg)
#define retvm_if(expr, val, fmt, arg...) do { \
if (expr) { \
char *_get_backend_path(const char *input_path);
char *_get_backend_path_with_type(const char *type);
+int _get_mime_from_file(const char *filename, char *mimetype, int len);
+int _get_mime_extension(const char *mimetype, char *ext, int len);
+
#endif /* __PKG_MANAGER_INTERNAL_H__ */
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <dlfcn.h>
+#include <malloc.h>
+#include <sys/time.h>
+
+#include "package-manager.h"
+#include "package-manager-types.h"
+#include "pkgmgr-internal.h"
+#include "pkgmgr-api.h"
+#include "pkgmgr-dbinfo.h"
+#include <pkgmgr-info.h>
+
+API int pkgmgr_create_pkgdbinfo(const char *pkgid, pkgmgr_pkgdbinfo_h *handle)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_create_pkgdbinfo(pkgid, handle);
+ return ret;
+}
+
+API int pkgmgr_set_type_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, const char *type)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_set_type_to_pkgdbinfo(handle, type);
+ return ret;
+}
+
+API int pkgmgr_set_version_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, const char *version)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_set_version_to_pkgdbinfo(handle, version);
+ return ret;
+}
+
+API int pkgmgr_set_install_location_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, PM_INSTALL_LOCATION location)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_set_install_location_to_pkgdbinfo(handle, location);
+ return ret;
+}
+
+API int pkgmgr_set_size_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, const char *size)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_set_size_to_pkgdbinfo(handle, size);
+ return ret;
+}
+
+API int pkgmgr_set_label_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, const char *label, const char *locale)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_set_label_to_pkgdbinfo(handle, label, locale);
+ return ret;
+}
+
+API int pkgmgr_set_icon_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, const char *icon, const char *locale)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_set_icon_to_pkgdbinfo(handle, icon, locale);
+ return ret;
+}
+
+API int pkgmgr_set_description_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, const char *description, const char *locale)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_set_description_to_pkgdbinfo(handle, description, locale);
+ return ret;
+}
+
+API int pkgmgr_set_author_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, const char *author_name,
+ const char *author_email, const char *author_href, const char *locale)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_set_author_to_pkgdbinfo(handle, author_name, author_email, author_href, locale);
+ return ret;
+}
+
+API int pkgmgr_set_removable_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, int removable)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_set_removable_to_pkgdbinfo(handle, removable);
+ return ret;
+}
+
+API int pkgmgr_set_preload_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, int preload)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_set_preload_to_pkgdbinfo(handle, preload);
+ return ret;
+}
+
+API int pkgmgr_save_pkgdbinfo(pkgmgr_pkgdbinfo_h handle)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_save_pkgdbinfo(handle);
+ return ret;
+}
+
+API int pkgmgr_destroy_pkgdbinfo(pkgmgr_pkgdbinfo_h handle)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_destroy_pkgdbinfo(handle);
+ return ret;
+}
+
#include <string.h>
#include <stdbool.h>
#include <aul.h>
+#include <xdgmime.h>
#include "pkgmgr-internal.h"
+#include <unistd.h>
+#include <dlfcn.h>
+#include <sys/time.h>
+#include <ail.h>
+#include <aul.h>
+
+#include "package-manager.h"
+#include <pkgmgr-info.h>
+
#define IS_WHITESPACE(CHAR) \
((CHAR == ' ' || CHAR == '\t' || CHAR == '\r' || CHAR == '\n') ? \
true : false)
if (access(installer_path, F_OK) != 0) {
char extlist[256] = { '\0', };
- aul_get_mime_extension(type, extlist, sizeof(extlist));
+ _get_mime_extension(type, extlist, sizeof(extlist));
_LOGD("extlist[%s]\n", extlist);
if (strlen(extlist) == 0)
return strdup(installer_path);
}
+int _get_mime_from_file(const char *filename, char *mimetype, int len)
+{
+ const char *mime;
+ if (filename == NULL)
+ return -1;
+
+ if (access(filename, F_OK) != 0)
+ return -1;
+
+ mime = xdg_mime_get_mime_type_for_file(filename, 0);
+ if (strcmp(mime, "application/octet-stream") == 0) {
+ mime = xdg_mime_get_mime_type_from_file_name(filename);
+ }
+
+ snprintf(mimetype, len, "%s", mime);
+ return 0;
+}
+
+int _get_mime_extension(const char *mimetype, char *ext, int len)
+{
+ const char **extlist;
+ int totlen = 0;
+ const char *unaliased_mimetype;
+
+ if (mimetype == NULL || ext == NULL || len <= 0)
+ return -1;
+
+ unaliased_mimetype = xdg_mime_unalias_mime_type(mimetype);
+ if (unaliased_mimetype == NULL)
+ return -1;
+
+ extlist = xdg_mime_get_file_names_from_mime_type(unaliased_mimetype);
+ if (extlist == NULL)
+ return -1;
+
+ if (extlist[0] == NULL)
+ return -1;
+
+ ext[0] = 0;
+ while (*extlist != NULL) {
+ if (*(extlist + 1) == NULL) {
+ snprintf(&ext[totlen], len - totlen, "%s", *extlist);
+ break;
+ } else {
+ snprintf(&ext[totlen], len - totlen, "%s,", *extlist);
+ if (strlen(*extlist) > len - totlen - 1)
+ break;
+ totlen += strlen(*extlist) + 1;
+ extlist++;
+ }
+ }
+
+ return 0;
+}
+
+char *_get_pkg_type_from_desktop_file(const char *pkgid)
+{
+ static char pkg_type[PKG_EXT_LEN_MAX];
+
+ ail_appinfo_h handle;
+ ail_error_e ret;
+ char *str;
+
+ ret = ail_package_get_appinfo(pkgid, &handle);
+ if (ret != AIL_ERROR_OK) {
+ return NULL;
+ }
+
+ ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_PACKAGETYPE_STR, &str);
+ if (ret != AIL_ERROR_OK) {
+ ail_package_destroy_appinfo(handle);
+ return NULL;
+ }
+ snprintf(pkg_type, sizeof(pkg_type) - 1, str);
+
+ ret = ail_package_destroy_appinfo(handle);
+ if (ret != AIL_ERROR_OK) {
+ return NULL;
+ }
+
+ return pkg_type;
+}
+
+package_manager_pkg_info_t *_pkg_malloc_appinfo(int num)
+{
+ package_manager_app_info_t *app_info = NULL;
+ package_manager_app_info_t *first = NULL;
+ package_manager_app_info_t *last = NULL;
+ int i = 0;
+
+ for (i = 0; i < num; i++) {
+ app_info = (package_manager_app_info_t *)
+ malloc(sizeof(package_manager_app_info_t));
+ if (app_info == NULL) {
+ package_manager_app_info_t *temp_info;
+ package_manager_app_info_t *next;
+
+ for (temp_info = first; temp_info != NULL;
+ temp_info = next) {
+ next = temp_info->next;
+ free(temp_info);
+ temp_info = NULL;
+ }
+
+ return NULL;
+ }
+
+ memset(app_info, 0x00, sizeof(package_manager_app_info_t));
+
+ if (first == NULL)
+ first = app_info;
+
+ if (last == NULL)
+ last = app_info;
+ else {
+ last->next = app_info;
+ last = app_info;
+ }
+ }
+
+ return first;
+
+}
+
+static pkg_plugin_set *plugin_set_list[24] = { 0, };
+
+pkg_plugin_set *_pkg_plugin_load_library(const char *pkg_type,
+ const char *library_path)
+{
+ void *library_handle = NULL;
+ int i = 0;
+
+ /* _pkg_plugin_on_load onload = NULL; */
+ bool(*on_load) (pkg_plugin_set *plugin);
+
+ if (library_path == NULL) {
+ _LOGE("pkg library path = [%s] \n", library_path);
+ return NULL;
+ }
+
+ if ((library_handle = dlopen(library_path, RTLD_LAZY)) == NULL) {
+ _LOGE("dlopen is failed library_path[%s]\n", library_path);
+ return NULL;
+ }
+
+ if ((on_load = dlsym(library_handle, "pkg_plugin_on_load")) == NULL ||
+ dlerror() != NULL) {
+ _LOGE("can not find symbol \n");
+ dlclose(library_handle);
+ return NULL;
+ }
+
+ for (i = 0; plugin_set_list[i]; i++) {
+ if (strcmp(plugin_set_list[i]->pkg_type, pkg_type) == 0) {
+ _LOGD("already loaded [%s] is done well \n",
+ library_path);
+ goto END;
+ }
+ }
+
+ plugin_set_list[i] = (pkg_plugin_set *) malloc(sizeof(pkg_plugin_set));
+ if (plugin_set_list[i] == NULL) {
+ _LOGE("malloc of the plugin_set_list element is failed \n");
+ dlclose(library_handle);
+ return NULL;
+ }
+
+ memset(plugin_set_list[i], 0x0, sizeof(pkg_plugin_set));
+
+ if (on_load(plugin_set_list[i]) != 0) {
+ _LOGE("on_load is failed \n");
+
+ dlclose(library_handle);
+
+ free(plugin_set_list[i]);
+ plugin_set_list[i] = NULL;
+
+ return NULL;
+ }
+
+ plugin_set_list[i]->plugin_handle = library_handle;
+ strncpy(plugin_set_list[i]->pkg_type, pkg_type,
+ PKG_TYPE_STRING_LEN_MAX - 1);
+
+ _LOGD("load library [%s] is done well \n", library_path);
+
+ END:
+ return plugin_set_list[i];
+
+}
+
+int _pkg_plugin_get_library_path(const char *pkg_type, char *library_path)
+{
+ FILE *fp = NULL;
+ char buffer[1024] = { 0 };
+
+ if (pkg_type == NULL || library_path == NULL) {
+ _LOGE("invalid argument\n");
+ return -1;
+ }
+
+ fp = fopen(PKG_CONF_PATH, "r");
+ if (fp == NULL) {
+ _LOGE("no matching backendlib\n");
+ return PKGMGR_R_ERROR;
+ }
+
+ char *path = NULL;
+ while (fgets(buffer, 1024, fp) != NULL) {
+ if (buffer[0] == '#')
+ continue;
+
+ _app_str_trim(buffer);
+
+ if ((path = strstr(buffer, PKG_BACKENDLIB)) != NULL) {
+ _LOGD("[%s]\n", buffer);
+ _LOGD("[%s]\n", path);
+ path = path + strlen(PKG_BACKENDLIB);
+ _LOGD("[%s]\n", path);
+
+ break;
+ }
+
+ memset(buffer, 0x00, 1024);
+ }
+
+ if (fp != NULL)
+ fclose(fp);
+
+ if (path == NULL) {
+ _LOGE("no matching backendlib\n");
+ return PKGMGR_R_ERROR;
+ }
+
+ snprintf(library_path, 1024, "%slib%s.so", path, pkg_type);
+
+ return PKGMGR_R_OK;
+
+}
+
+pkg_plugin_set *_package_manager_load_library(const char *pkg_type)
+{
+ char package_path[1024] = { 0 };
+ pkg_plugin_set *plugin_set = NULL;
+
+ if (pkg_type == NULL) {
+ _LOGE("can not load library - pkg_type is null\n");
+ return NULL;
+ }
+
+ if (_pkg_plugin_get_library_path(pkg_type, package_path) ==
+ PKGMGR_R_OK) {
+ plugin_set = _pkg_plugin_load_library(pkg_type, package_path);
+ if (plugin_set == NULL) {
+ _LOGE("can not load library \n");
+ return NULL;
+ }
+ } else {
+ _LOGE("can not find path \n");
+ return NULL;
+ }
+
+ return plugin_set;
+}
+
+typedef struct _detail_info_map_t {
+ char *name;
+ void *field;
+ char *type;
+} detail_info_map_t;
+
+/*
+ typedef struct _package_manager_pkg_detail_info_t {
+ char pkg_type[PKG_TYPE_STRING_LEN_MAX];
+ char pkgid[PKG_NAME_STRING_LEN_MAX];
+ char version[PKG_VERSION_STRING_LEN_MAX];
+ char pkg_description[PKG_VALUE_STRING_LEN_MAX];
+ char min_platform_version[PKG_VERSION_STRING_LEN_MAX];
+ time_t installed_time;
+ int installed_size;
+ int app_size;
+ int data_size;
+ char optional_id[PKG_NAME_STRING_LEN_MAX];
+ void *pkg_optional_info;
+ } package_manager_pkg_detail_info_t;
+*/
+
+static package_manager_pkg_detail_info_t tmp_pkg_detail_info;
+
+static detail_info_map_t info_map[] = {
+ {"pkg_type", tmp_pkg_detail_info.pkg_type, "string"},
+ {"pkgid", tmp_pkg_detail_info.pkgid, "string"},
+ {"version", tmp_pkg_detail_info.version, "string"},
+ {"pkg_description", tmp_pkg_detail_info.pkg_description, "string"},
+ {"min_platform_version", tmp_pkg_detail_info.min_platform_version,
+ "string"},
+ {"installed_time", &tmp_pkg_detail_info.installed_time, "time_t"},
+ {"installed_size", &tmp_pkg_detail_info.installed_size, "int"},
+ {"app_size", &tmp_pkg_detail_info.app_size, "int"},
+ {"data_size", &tmp_pkg_detail_info.data_size, "int"},
+ {"optional_id", tmp_pkg_detail_info.optional_id, "string"}
+};
+
+char *_get_info_string(const char *key,
+ const package_manager_pkg_detail_info_t *
+ pkg_detail_info)
+{
+ detail_info_map_t *tmp;
+ int i = 0;
+
+ if (pkg_detail_info == NULL)
+ return NULL;
+
+ memcpy(&tmp_pkg_detail_info, pkg_detail_info,
+ sizeof(package_manager_pkg_detail_info_t));
+
+ for (i = 0; i < sizeof(info_map) / sizeof(detail_info_map_t); i++) {
+ tmp = &info_map[i];
+ if (strcmp(key, tmp->name) == 0) {
+ if (strcmp(tmp->type, "string") == 0) {
+ return strdup((char *)(tmp->field));
+ } else if (strcmp(tmp->type, "bool") == 0) {
+ char temp[PKG_VALUE_STRING_LEN_MAX];
+ snprintf(temp, PKG_VALUE_STRING_LEN_MAX - 1,
+ "%d", (int)*(bool *) (tmp->field));
+ return strdup(temp);
+ } else if (strcmp(tmp->type, "int") == 0) {
+ char temp[PKG_VALUE_STRING_LEN_MAX];
+ snprintf(temp, PKG_VALUE_STRING_LEN_MAX - 1,
+ "%d", (int)*(int *)(tmp->field));
+ return strdup(temp);
+ } else if (strcmp(tmp->type, "time_t") == 0) {
+ char temp[PKG_VALUE_STRING_LEN_MAX];
+ snprintf(temp, PKG_VALUE_STRING_LEN_MAX - 1,
+ "%d", (int)*(time_t *) (tmp->field));
+ return strdup(temp);
+ } else
+ return NULL;
+ }
+ }
+ return NULL;
+}
+
+int _get_info_int(const char *key,
+ const package_manager_pkg_detail_info_t *pkg_detail_info)
+{
+ detail_info_map_t *tmp;
+ int i = 0;
+
+ if (pkg_detail_info == NULL)
+ return -1;
+
+ memcpy(&tmp_pkg_detail_info, pkg_detail_info,
+ sizeof(package_manager_pkg_detail_info_t));
+ for (i = 0; i < sizeof(info_map) / sizeof(detail_info_map_t); i++) {
+ tmp = &info_map[i];
+ if (strcmp(key, tmp->name) == 0) {
+ if (strcmp(tmp->type, "int") == 0) {
+ return (int)*(int *)(tmp->field);
+ } else
+ return -1;
+ }
+ }
+ return -1;
+}
+
+time_t _get_info_time(const char *key,
+ const package_manager_pkg_detail_info_t *pkg_detail_info)
+{
+ detail_info_map_t *tmp;
+ int i = 0;
+
+ if (pkg_detail_info == NULL)
+ return -1;
+
+ memcpy(&tmp_pkg_detail_info, pkg_detail_info,
+ sizeof(package_manager_pkg_detail_info_t));
+ for (i = 0; i < sizeof(info_map) / sizeof(detail_info_map_t); i++) {
+ tmp = &info_map[i];
+ if (strcmp(key, tmp->name) == 0) {
+ if (strcmp(tmp->type, "time_t") == 0) {
+ return (time_t) *(time_t *) (tmp->field);
+ } else
+ return (time_t) -1;
+ }
+ }
+ return (time_t) -1;
+}
+
+
#include <string.h>
#include <unistd.h>
#include <dlfcn.h>
+#include <dirent.h>
+#include <fcntl.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib-lowlevel.h>
#include <ail.h>
#include <aul.h>
+#include <vconf.h>
+#include <db-util.h>
+#include <pkgmgr-info.h>
#include "package-manager.h"
#include "pkgmgr-internal.h"
-#include "pkgmgr-info.h"
#include "pkgmgr-api.h"
#include "comm_client.h"
#include "comm_status_broadcast_server.h"
+
static int _get_request_id()
{
static int internal_req_id = 1;
void *data;
} iter_data;
+
static void __add_op_cbinfo(pkgmgr_client_t * pc, int request_id,
const char *req_key, pkgmgr_handler event_cb,
void *data)
}
}
-static listen_cb_info *__find_stat_cbinfo(pkgmgr_client_t *pc, int request_id)
-{
- listen_cb_info *tmp;
-
- tmp = pc->info.listening.lhead;
-
- _LOGD("tmp->request_id %d, request_id %d", tmp->request_id, request_id);
-
- while (tmp) {
- if (tmp->request_id == request_id)
- return tmp;
- tmp = tmp->next;
- }
- return NULL;
-}
-
-static void __remove_stat_cbinfo(pkgmgr_client_t *pc, listen_cb_info *info)
-{
- listen_cb_info *tmp;
-
- if (pc == NULL || pc->info.listening.lhead == NULL || info == NULL)
- return;
-
- tmp = pc->info.listening.lhead;
- while (tmp) {
- if (tmp->next == info) {
- tmp->next = info->next;
- free(info);
- return;
- }
- tmp = tmp->next;
- }
-}
-
static void __operation_callback(void *cb_data, const char *req_id,
- const char *pkg_type, const char *pkg_name,
+ const char *pkg_type, const char *pkgid,
const char *key, const char *val)
{
pkgmgr_client_t *pc;
req_cb_info *cb_info;
- _LOGD("__operation_callback() req_id[%s] pkg_type[%s] pkg_name[%s]"
- "key[%s] val[%s]\n", req_id, pkg_type, pkg_name, key, val);
+ _LOGD("__operation_callback() req_id[%s] pkg_type[%s] pkgid[%s]"
+ "key[%s] val[%s]\n", req_id, pkg_type, pkgid, key, val);
pc = (pkgmgr_client_t *) cb_data;
/* call callback */
if (cb_info->event_cb) {
- cb_info->event_cb(cb_info->request_id, pkg_type, pkg_name, key,
+ cb_info->event_cb(cb_info->request_id, pkg_type, pkgid, key,
val, NULL, cb_info->data);
_LOGD("event_cb is called");
}
}
static void __status_callback(void *cb_data, const char *req_id,
- const char *pkg_type, const char *pkg_name,
+ const char *pkg_type, const char *pkgid,
const char *key, const char *val)
{
pkgmgr_client_t *pc;
listen_cb_info *tmp;
- _LOGD("__status_callback() req_id[%s] pkg_type[%s] pkg_name[%s]"
- "key[%s] val[%s]\n", req_id, pkg_type, pkg_name, key, val);
+ _LOGD("__status_callback() req_id[%s] pkg_type[%s] pkgid[%s]"
+ "key[%s] val[%s]\n", req_id, pkg_type, pkgid, key, val);
pc = (pkgmgr_client_t *) cb_data;
tmp = pc->info.listening.lhead;
while (tmp) {
- if (tmp->event_cb(tmp->request_id, pkg_type, pkg_name, key, val,
+ if (tmp->event_cb(tmp->request_id, pkg_type, pkgid, key, val,
NULL, tmp->data) != 0)
break;
tmp = tmp->next;
char extlist[256] = { '\0', };
char *pkg_type;
- ret = aul_get_mime_from_file(pkg_path, mimetype, sizeof(mimetype));
+ ret = _get_mime_from_file(pkg_path, mimetype, sizeof(mimetype));
if (ret) {
- _LOGE("aul_get_mime_from_file() failed - error code[%d]\n",
+ _LOGE("_get_mime_from_file() failed - error code[%d]\n",
ret);
return NULL;
}
- ret = aul_get_mime_extension(mimetype, extlist, sizeof(extlist));
+ ret = _get_mime_extension(mimetype, extlist, sizeof(extlist));
if (ret) {
- _LOGE("aul_get_mime_extension() failed - error code[%d]\n",
+ _LOGE("_get_mime_extension() failed - error code[%d]\n",
ret);
return NULL;
}
/* 6. request install */
ret = comm_client_request(mpc->info.request.cc, req_key,
COMM_REQ_TO_INSTALLER, pkgtype, pkg_path,
- args, cookie, 0);
+ args, cookie, 1);
if (ret < 0) {
_LOGE("request failed, ret=%d\n", ret);
return req_id;
}
-int __iterfunc(const aul_app_info *info, void *data)
+
+static inline int __pkgmgr_read_proc(const char *path, char *buf, int size)
+{
+ int fd;
+ int ret;
+
+ if (buf == NULL || path == NULL)
+ return -1;
+
+ fd = open(path, O_RDONLY);
+ if (fd < 0)
+ return -1;
+
+ ret = read(fd, buf, size - 1);
+ if (ret <= 0) {
+ close(fd);
+ return -1;
+ } else
+ buf[ret] = 0;
+
+ close(fd);
+
+ return ret;
+}
+
+static inline int __pkgmgr_find_pid_by_cmdline(const char *dname,
+ const char *cmdline, const char *apppath)
+{
+ int pid = 0;
+
+ if (strncmp(cmdline, apppath, PKG_STRING_LEN_MAX-1) == 0) {
+ pid = atoi(dname);
+ if (pid != getpgid(pid))
+ pid = 0;
+ }
+
+ return pid;
+}
+
+
+static int __pkgmgr_proc_iter_kill_cmdline(const char *apppath)
{
- char pkgname[PKG_STRING_LEN_MAX];
- const char *pkg_name;
+ DIR *dp;
+ struct dirent *dentry;
+ int pid;
+ int ret;
+ char buf[PKG_STRING_LEN_MAX];
+
+ dp = opendir("/proc");
+ if (dp == NULL) {
+ return -1;
+ }
+
+ while ((dentry = readdir(dp)) != NULL) {
+ if (!isdigit(dentry->d_name[0]))
+ continue;
+
+ snprintf(buf, sizeof(buf), "/proc/%s/cmdline", dentry->d_name);
+ ret = __pkgmgr_read_proc(buf, buf, sizeof(buf));
+ if (ret <= 0)
+ continue;
- pkg_name = (const char *)data;
+ pid = __pkgmgr_find_pid_by_cmdline(dentry->d_name, buf, apppath);
- aul_app_get_pkgname_bypid(info->pid, pkgname, sizeof(pkgname));
+ if (pid > 0) {
+ int pgid;
- if (strncmp(pkg_name, pkgname, strlen(pkg_name)) == 0) {
- if (aul_terminate_pid(info->pid) < 0)
- kill(info->pid, SIGKILL);
+ pgid = getpgid(pid);
+ if (pgid <= 1) {
+ closedir(dp);
+ return -1;
+ }
+
+ if (killpg(pgid, SIGKILL) < 0) {
+ closedir(dp);
+ return -1;
+ }
+ }
}
+ closedir(dp);
+ return 0;
+}
+
+
+static int __app_list_cb (const pkgmgr_appinfo_h handle,
+ void *user_data)
+{
+ char *exec = NULL;
+ pkgmgr_appinfo_get_exec(handle, &exec);
+
+ __pkgmgr_proc_iter_kill_cmdline(exec);
+
return 0;
}
+
API int pkgmgr_client_uninstall(pkgmgr_client *pc, const char *pkg_type,
- const char *pkg_name, pkgmgr_mode mode,
+ const char *pkgid, pkgmgr_mode mode,
pkgmgr_handler event_cb, void *data)
{
const char *pkgtype;
return PKGMGR_R_EINVAL;
/* 1. check argument */
- if (pkg_name == NULL)
+ if (pkgid == NULL)
return PKGMGR_R_EINVAL;
- if (aul_app_is_running(pkg_name)) {
- ret =
- aul_app_get_running_app_info(__iterfunc, (void *)pkg_name);
- if (ret < 0)
+ pkgmgr_pkginfo_h handle;
+ ret = pkgmgr_pkginfo_get_pkginfo(pkgid, &handle);
+
+ if(handle != NULL){
+ /*check package id */
+ if (ret < 0){
+ pkgmgr_pkginfo_destroy_pkginfo(handle);
+ return PKGMGR_R_ERROR;
+ }
+
+ ret = pkgmgr_appinfo_get_list(handle, PM_UI_APP, __app_list_cb, NULL);
+ if (ret < 0){
+ pkgmgr_pkginfo_destroy_pkginfo(handle);
+ return PKGMGR_R_ERROR;
+ }
+
+ ret = pkgmgr_appinfo_get_list(handle, PM_SVC_APP, __app_list_cb, NULL);
+ if (ret < 0){
+ pkgmgr_pkginfo_destroy_pkginfo(handle);
+ return PKGMGR_R_ERROR;
+ }
+
+ pkgmgr_pkginfo_destroy_pkginfo(handle);
+ } else {
+ /*check app id */
+ pkgmgr_appinfo_h handle;
+ ret = pkgmgr_appinfo_get_appinfo(pkgid, &handle);
+
+ if(handle == NULL)
+ return PKGMGR_R_ERROR;
+
+ if (ret < 0){
+ pkgmgr_appinfo_destroy_appinfo(handle);
return PKGMGR_R_ERROR;
+ }
+
+ char *exec = NULL;
+ pkgmgr_appinfo_get_exec(handle, &exec);
+ __pkgmgr_proc_iter_kill_cmdline(exec);
+ pkgmgr_appinfo_destroy_appinfo(handle);
}
if (pkg_type == NULL) {
- pkgtype = _get_pkg_type_from_desktop_file(pkg_name);
+ pkgtype = _get_pkg_type_from_desktop_file(pkgid);
if (pkgtype == NULL)
return PKGMGR_R_EINVAL;
} else
pkgtype = pkg_type;
- if (strlen(pkg_name) >= PKG_STRING_LEN_MAX)
+ if (strlen(pkgid) >= PKG_STRING_LEN_MAX)
return PKGMGR_R_EINVAL;
/* 2. get installer path using pkg_path */
return PKGMGR_R_EINVAL;
/* 3. generate req_key */
- req_key = __get_req_key(pkg_name);
+ req_key = __get_req_key(pkgid);
/* 4. add callback info - add callback info to pkgmgr_client */
req_id = _get_request_id();
/* argv[3] */
argv[argcnt++] = strdup("-d");
/* argv[4] */
- argv[argcnt++] = strdup(pkg_name);
+ argv[argcnt++] = strdup(pkgid);
/* argv[5] -q option should be located at the end of command !! */
if (mode == PM_QUIET)
argv[argcnt++] = strdup("-q");
/* 6. request install */
ret = comm_client_request(mpc->info.request.cc, req_key,
- COMM_REQ_TO_INSTALLER, pkgtype, pkg_name,
- args, cookie, 0);
+ COMM_REQ_TO_INSTALLER, pkgtype, pkgid,
+ args, cookie, 1);
+ if (ret < 0) {
+ _LOGE("request failed, ret=%d\n", ret);
+
+ for (i = 0; i < argcnt; i++)
+ free(argv[i]);
+
+ free(args);
+ return PKGMGR_R_ECOMM;
+ }
+
+ for (i = 0; i < argcnt; i++)
+ free(argv[i]);
+
+ free(args);
+
+ return req_id;
+}
+
+API int pkgmgr_client_move(pkgmgr_client *pc, const char *pkg_type,
+ const char *pkgid, pkgmgr_move_type move_type, pkgmgr_mode mode)
+{
+ const char *pkgtype = NULL;
+ char *installer_path = NULL;
+ char *req_key = NULL;
+ int i = 0;
+ char *argv[PKG_ARGC_MAX] = { NULL, };
+ char *args = NULL;
+ int argcnt = 0;
+ int len = 0;
+ char *temp = NULL;
+ int ret = 0;
+ int req_id = 0;
+ char *cookie = NULL;
+ char buf[128] = {'\0'};
+
+ /* Check for NULL value of pc */
+ if (pc == NULL) {
+ _LOGD("package manager client handle is NULL\n");
+ return PKGMGR_R_EINVAL;
+ }
+ pkgmgr_client_t *mpc = (pkgmgr_client_t *) pc;
+ /*check the pc type */
+ if (mpc->ctype != PC_REQUEST)
+ return PKGMGR_R_EINVAL;
+
+ /*check argument */
+ if (pkgid == NULL)
+ return PKGMGR_R_EINVAL;
+
+ if (pkg_type == NULL) {
+ pkgtype = _get_pkg_type_from_desktop_file(pkgid);
+ if (pkgtype == NULL)
+ return PKGMGR_R_EINVAL;
+ } else
+ pkgtype = pkg_type;
+
+ if (strlen(pkgid) >= PKG_STRING_LEN_MAX)
+ return PKGMGR_R_EINVAL;
+
+ if ((move_type < PM_MOVE_TO_INTERNAL) || (move_type > PM_MOVE_TO_SDCARD))
+ return PKGMGR_R_EINVAL;
+
+ /* get installer path using pkg_path */
+ installer_path = _get_backend_path_with_type(pkgtype);
+ if (installer_path == NULL)
+ return PKGMGR_R_EINVAL;
+
+ /* generate req_key */
+ req_key = __get_req_key(pkgid);
+ req_id = _get_request_id();
+
+ /* generate argv */
+ snprintf(buf, 128, "%d", move_type);
+ /* argv[0] installer path */
+ argv[argcnt++] = installer_path;
+ /* argv[1] */
+ argv[argcnt++] = strdup("-k");
+ /* argv[2] */
+ argv[argcnt++] = req_key;
+ /* argv[3] */
+ argv[argcnt++] = strdup("-m");
+ /* argv[4] */
+ argv[argcnt++] = strdup(pkgid);
+ /* argv[5] */
+ argv[argcnt++] = strdup("-t");
+ /* argv[6] */
+ argv[argcnt++] = strdup(buf);
+ /* argv[7] -q option should be located at the end of command !! */
+ if (mode == PM_QUIET)
+ argv[argcnt++] = strdup("-q");
+
+ /*** add quote in all string for special charactor like '\n'*** FIX */
+ for (i = 0; i < argcnt; i++) {
+ temp = g_shell_quote(argv[i]);
+ len += (strlen(temp) + 1);
+ g_free(temp);
+ }
+
+ args = (char *)calloc(len, sizeof(char));
+ if (args == NULL) {
+ _LOGD("calloc failed");
+
+ for (i = 0; i < argcnt; i++)
+ free(argv[i]);
+
+ return PKGMGR_R_ERROR;
+ }
+ strncpy(args, argv[0], len - 1);
+
+ for (i = 1; i < argcnt; i++) {
+ strncat(args, " ", strlen(" "));
+ temp = g_shell_quote(argv[i]);
+ strncat(args, temp, strlen(temp));
+ g_free(temp);
+ }
+ _LOGD("[args] %s [len] %d\n", args, len);
+ /******************* end of quote ************************/
+
+ /* 6. request install */
+ ret = comm_client_request(mpc->info.request.cc, req_key,
+ COMM_REQ_TO_MOVER, pkgtype, pkgid,
+ args, cookie, 1);
if (ret < 0) {
_LOGE("request failed, ret=%d\n", ret);
}
API int pkgmgr_client_activate(pkgmgr_client * pc, const char *pkg_type,
- const char *pkg_name)
+ const char *appid)
{
const char *pkgtype;
char *req_key;
return PKGMGR_R_EINVAL;
/* 1. check argument */
- if (pkg_name == NULL)
+ if (appid == NULL)
return PKGMGR_R_EINVAL;
if (pkg_type == NULL) {
- pkgtype = _get_pkg_type_from_desktop_file(pkg_name);
+ pkgtype = _get_pkg_type_from_desktop_file(appid);
if (pkgtype == NULL)
return PKGMGR_R_EINVAL;
} else
pkgtype = pkg_type;
- if (strlen(pkg_name) >= PKG_STRING_LEN_MAX)
+ if (strlen(appid) >= PKG_STRING_LEN_MAX)
return PKGMGR_R_EINVAL;
/* 2. generate req_key */
- req_key = __get_req_key(pkg_name);
+ req_key = __get_req_key(appid);
/* 3. request activate */
ret = comm_client_request(mpc->info.request.cc, req_key,
COMM_REQ_TO_ACTIVATOR, pkgtype,
- pkg_name, "1", cookie, 1);
+ appid, "1", cookie, 1);
if (ret < 0) {
_LOGE("request failed, ret=%d\n", ret);
free(req_key);
}
API int pkgmgr_client_deactivate(pkgmgr_client *pc, const char *pkg_type,
- const char *pkg_name)
+ const char *appid)
{
const char *pkgtype;
char *req_key;
return PKGMGR_R_EINVAL;
/* 1. check argument */
- if (pkg_name == NULL)
+ if (appid == NULL)
return PKGMGR_R_EINVAL;
if (pkg_type == NULL) {
- pkgtype = _get_pkg_type_from_desktop_file(pkg_name);
+ pkgtype = _get_pkg_type_from_desktop_file(appid);
if (pkgtype == NULL)
return PKGMGR_R_EINVAL;
} else
pkgtype = pkg_type;
- if (strlen(pkg_name) >= PKG_STRING_LEN_MAX)
+ if (strlen(appid) >= PKG_STRING_LEN_MAX)
return PKGMGR_R_EINVAL;
/* 2. generate req_key */
- req_key = __get_req_key(pkg_name);
+ req_key = __get_req_key(appid);
/* 3. request activate */
ret = comm_client_request(mpc->info.request.cc, req_key,
COMM_REQ_TO_ACTIVATOR, pkgtype,
- pkg_name, "0", cookie, 1);
+ appid, "0", cookie, 1);
if (ret < 0) {
_LOGE("request failed, ret=%d\n", ret);
free(req_key);
}
API int pkgmgr_client_clear_user_data(pkgmgr_client *pc, const char *pkg_type,
- const char *pkg_name, pkgmgr_mode mode)
+ const char *appid, pkgmgr_mode mode)
{
const char *pkgtype;
char *installer_path;
char *req_key;
- int req_id;
int i = 0;
char *argv[PKG_ARGC_MAX] = { NULL, };
char *args = NULL;
return PKGMGR_R_EINVAL;
/* 1. check argument */
- if (pkg_name == NULL)
+ if (appid == NULL)
return PKGMGR_R_EINVAL;
-/*
- if( aul_app_is_running(pkg_name) ) {
- ret = aul_app_get_running_app_info(__iterfunc, (void *) pkg_name);
- if(ret < 0)
- return PKGMGR_R_ERROR;
- }
-*/
if (pkg_type == NULL) {
- pkgtype = _get_pkg_type_from_desktop_file(pkg_name);
+ pkgtype = _get_pkg_type_from_desktop_file(appid);
if (pkgtype == NULL)
return PKGMGR_R_EINVAL;
} else
pkgtype = pkg_type;
- if (strlen(pkg_name) >= PKG_STRING_LEN_MAX)
+ if (strlen(appid) >= PKG_STRING_LEN_MAX)
return PKGMGR_R_EINVAL;
/* 2. get installer path using pkg_path */
return PKGMGR_R_EINVAL;
/* 3. generate req_key */
- req_key = __get_req_key(pkg_name);
+ req_key = __get_req_key(appid);
/* 4. generate argv */
/* argv[3] */
argv[argcnt++] = strdup("-c");
/* argv[4] */
- argv[argcnt++] = strdup(pkg_name);
+ argv[argcnt++] = strdup(appid);
/* argv[5] -q option should be located at the end of command !! */
if (mode == PM_QUIET)
argv[argcnt++] = strdup("-q");
/* 6. request clear */
ret = comm_client_request(mpc->info.request.cc, req_key,
- COMM_REQ_TO_CLEARER, pkgtype, pkg_name,
+ COMM_REQ_TO_CLEARER, pkgtype, appid,
args, cookie, 1);
if (ret < 0) {
_LOGE("request failed, ret=%d\n", ret);
}
API int pkgmgr_client_broadcast_status(pkgmgr_client *pc, const char *pkg_type,
- const char *pkg_name, const char *key,
+ const char *pkgid, const char *key,
const char *val)
{
/* Check for NULL value of pc */
return PKGMGR_R_EINVAL;
}
/* Check for valid arguments. NULL parameter causes DBUS to abort */
- if (pkg_name == NULL || pkg_type == NULL || key == NULL || val == NULL) {
+ if (pkgid == NULL || pkg_type == NULL || key == NULL || val == NULL) {
_LOGD("Argument supplied is NULL\n");
return PKGMGR_R_EINVAL;
}
comm_status_broadcast_server_send_signal(mpc->info.broadcast.bc,
PKG_STATUS, pkg_type,
- pkg_name, key, val);
+ pkgid, key, val);
return PKGMGR_R_OK;
}
return AIL_CB_RET_CONTINUE;
}
+
+
+#define __START_OF_OLD_API
+
API int pkgmgr_get_pkg_list(pkgmgr_iter_fn iter_fn, void *data)
{
int cnt = -1;
return PKGMGR_R_OK;
}
-API pkgmgr_info *pkgmgr_info_new(const char *pkg_type, const char *pkg_name)
+API pkgmgr_info *pkgmgr_info_new(const char *pkg_type, const char *pkgid)
{
const char *pkgtype;
pkg_plugin_set *plugin_set = NULL;
package_manager_pkg_detail_info_t *pkg_detail_info = NULL;
/* 1. check argument */
- if (pkg_name == NULL)
+ if (pkgid == NULL)
return NULL;
if (pkg_type == NULL) {
- pkgtype = _get_pkg_type_from_desktop_file(pkg_name);
+ pkgtype = _get_pkg_type_from_desktop_file(pkgid);
if (pkgtype == NULL)
return NULL;
} else
pkgtype = pkg_type;
- if (strlen(pkg_name) >= PKG_STRING_LEN_MAX)
+ if (strlen(pkgid) >= PKG_STRING_LEN_MAX)
return NULL;
pkg_detail_info = calloc(1, sizeof(package_manager_pkg_detail_info_t));
plugin_set = _package_manager_load_library(pkgtype);
if (plugin_set == NULL) {
+ _LOGE("*** Failed to load library");
free(pkg_detail_info);
return NULL;
}
if (plugin_set->pkg_is_installed) {
- if (plugin_set->pkg_is_installed(pkg_name) != 0) {
+ if (plugin_set->pkg_is_installed(pkgid) != 0) {
+ _LOGE("*** Failed to call pkg_is_installed()");
free(pkg_detail_info);
return NULL;
}
if (plugin_set->get_pkg_detail_info) {
- if (plugin_set->get_pkg_detail_info(pkg_name,
+ if (plugin_set->get_pkg_detail_info(pkgid,
pkg_detail_info) != 0) {
+ _LOGE("*** Failed to call get_pkg_detail_info()");
free(pkg_detail_info);
return NULL;
}
return 0;
}
+
+#define __END_OF_OLD_API
+
+API int pkgmgr_pkginfo_get_list(pkgmgr_info_pkg_list_cb pkg_list_cb, void *user_data)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_get_list(pkg_list_cb, user_data);
+ return ret;
+}
+
+API int pkgmgr_pkginfo_get_pkginfo(const char *pkgid, pkgmgr_pkginfo_h *handle)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, handle);
+ return ret;
+}
+
+API int pkgmgr_pkginfo_get_pkgname(pkgmgr_pkginfo_h handle, char **pkg_name)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_get_pkgname(handle, pkg_name);
+ return ret;
+}
+
+
+API int pkgmgr_pkginfo_get_pkgid(pkgmgr_pkginfo_h handle, char **pkgid)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_get_pkgid(handle, pkgid);
+ return ret;
+}
+
+API int pkgmgr_pkginfo_get_type(pkgmgr_pkginfo_h handle, char **type)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_get_type(handle, type);
+ return ret;
+}
+
+API int pkgmgr_pkginfo_get_version(pkgmgr_pkginfo_h handle, char **version)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_get_version(handle, version);
+ return ret;
+}
+
+API int pkgmgr_pkginfo_get_install_location(pkgmgr_pkginfo_h handle, pkgmgr_install_location *location)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_get_install_location(handle, location);
+ return ret;
+}
+
+API int pkgmgr_pkginfo_get_package_size(pkgmgr_pkginfo_h handle, int *size)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_get_package_size(handle, size);
+ return ret;
+}
+
+API int pkgmgr_pkginfo_get_icon(pkgmgr_pkginfo_h handle, char **icon)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_get_icon(handle, icon);
+ return ret;
+}
+
+API int pkgmgr_pkginfo_get_label(pkgmgr_pkginfo_h handle, char **label)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_get_label(handle, label);
+ return ret;
+}
+
+API int pkgmgr_pkginfo_get_description(pkgmgr_pkginfo_h handle, char **description)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_get_description(handle, description);
+ return ret;
+}
+
+API int pkgmgr_pkginfo_get_author_name(pkgmgr_pkginfo_h handle, char **author_name)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_get_author_name(handle, author_name);
+ return ret;
+}
+
+API int pkgmgr_pkginfo_get_author_email(pkgmgr_pkginfo_h handle, char **author_email)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_get_author_email(handle, author_email);
+ return ret;
+}
+
+API int pkgmgr_pkginfo_get_author_href(pkgmgr_pkginfo_h handle, char **author_href)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_get_author_href(handle, author_href);
+ return ret;
+}
+
+API int pkgmgr_pkginfo_is_removable(pkgmgr_pkginfo_h handle, bool *removable)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_is_removable(handle, removable);
+ return ret;
+}
+
+API int pkgmgr_pkginfo_is_preload(pkgmgr_pkginfo_h handle, bool *preload)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_is_preload(handle, preload);
+ return ret;
+}
+
+API int pkgmgr_pkginfo_is_readonly(pkgmgr_pkginfo_h handle, bool *readonly)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_is_readonly(handle, readonly);
+ return ret;
+}
+
+API int pkgmgr_pkginfo_is_accessible(pkgmgr_pkginfo_h handle, bool *accessible)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_is_accessible(handle, accessible);
+ return ret;
+}
+
+API int pkgmgr_pkginfo_destroy_pkginfo(pkgmgr_pkginfo_h handle)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return ret;
+}
+
+API int pkgmgr_pkginfo_get_installed_storage(pkgmgr_pkginfo_h handle, pkgmgr_installed_storage *storage)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_get_installed_storage(handle, storage);
+ return ret;
+}
+
+API int pkgmgr_pkginfo_get_installed_time(pkgmgr_pkginfo_h handle, int *installed_time)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_get_installed_time(handle, installed_time);
+ return ret;
+}
+
+API int pkgmgr_appinfo_get_list(pkgmgr_pkginfo_h handle, pkgmgr_app_component component,
+ pkgmgr_info_app_list_cb app_func, void *user_data)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_appinfo_get_list(handle, component, app_func, user_data);
+ return ret;
+}
+
+API int pkgmgr_appinfo_foreach_category(pkgmgr_appinfo_h handle, pkgmgr_info_app_category_list_cb category_func,
+ void *user_data)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_appinfo_foreach_category(handle, category_func, user_data);
+ return ret;
+}
+
+API int pkgmgr_appinfo_get_appinfo(const char *appid, pkgmgr_appinfo_h *handle)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, handle);
+ return ret;
+}
+
+API int pkgmgr_appinfo_get_appid(pkgmgr_appinfo_h handle, char **appid)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_appinfo_get_appid(handle, appid);
+ return ret;
+}
+
+API int pkgmgr_appinfo_get_pkgname(pkgmgr_appinfo_h handle, char **pkg_name)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_appinfo_get_pkgname(handle, pkg_name);
+ return ret;
+}
+
+API int pkgmgr_appinfo_get_pkgid(pkgmgr_appinfo_h handle, char **pkgid)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_appinfo_get_pkgid(handle, pkgid);
+ return ret;
+}
+
+API int pkgmgr_appinfo_get_icon(pkgmgr_appinfo_h handle, char **icon)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_appinfo_get_icon(handle, icon);
+ return ret;
+}
+
+API int pkgmgr_appinfo_get_label(pkgmgr_appinfo_h handle, char **label)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_appinfo_get_label(handle, label);
+ return ret;
+}
+
+API int pkgmgr_appinfo_get_exec(pkgmgr_appinfo_h handle, char **exec)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_appinfo_get_exec(handle, exec);
+ return ret;
+}
+
+API int pkgmgr_appinfo_get_component(pkgmgr_appinfo_h handle, pkgmgr_app_component *component)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_appinfo_get_component(handle, component);
+ return ret;
+}
+
+API int pkgmgr_appinfo_get_apptype(pkgmgr_appinfo_h handle, char **app_type)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_appinfo_get_apptype(handle, app_type);
+ return ret;
+}
+
+API int pkgmgr_appinfo_is_nodisplay(pkgmgr_appinfo_h handle, bool *nodisplay)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_appinfo_is_nodisplay(handle, nodisplay);
+ return ret;
+}
+
+API int pkgmgr_appinfo_is_multiple(pkgmgr_appinfo_h handle, bool *multiple)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_appinfo_is_multiple(handle, multiple);
+ return ret;
+}
+
+API int pkgmgr_appinfo_is_taskmanage(pkgmgr_appinfo_h handle, bool *taskmanage)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_appinfo_is_taskmanage(handle, taskmanage);
+ return ret;
+}
+
+API int pkgmgr_appinfo_get_hwacceleration(pkgmgr_appinfo_h handle, pkgmgr_hwacceleration_type *hwacceleration)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_appinfo_get_hwacceleration(handle, hwacceleration);
+ return ret;
+}
+
+API int pkgmgr_appinfo_is_onboot(pkgmgr_appinfo_h handle, bool *onboot)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_appinfo_is_onboot(handle, onboot);
+ return ret;
+}
+
+API int pkgmgr_appinfo_is_autorestart(pkgmgr_appinfo_h handle, bool *autorestart)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_appinfo_is_autorestart(handle, autorestart);
+ return ret;
+}
+
+API int pkgmgr_appinfo_destroy_appinfo(pkgmgr_appinfo_h handle)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return ret;
+}
+
+API int pkgmgr_pkginfo_create_certinfo(pkgmgr_certinfo_h *handle)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_create_certinfo(handle);
+ return ret;
+}
+
+API int pkgmgr_pkginfo_load_certinfo(const char *pkgid, pkgmgr_certinfo_h handle)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, handle);
+ return ret;
+}
+
+API int pkgmgr_pkginfo_get_cert_value(pkgmgr_certinfo_h handle, pkgmgr_cert_type cert_type, const char **cert_value)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_get_cert_value(handle, cert_type, cert_value);
+ return ret;
+}
+
+API int pkgmgr_pkginfo_destroy_certinfo(pkgmgr_certinfo_h handle)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_pkginfo_destroy_certinfo(handle);
+ return ret;
+}
+
+API int pkgmgr_datacontrol_get_info(const char *providerid, const char * type, char **appid, char **access)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_datacontrol_get_info(providerid, type, appid, access);
+ return ret;
+}
### Get required CFLAGS, LDFLAGS from pkg-config
include(FindPkgConfig)
-pkg_check_modules(comm_pkgs REQUIRED dbus-1 dbus-glib-1 dlog)
+pkg_check_modules(comm_pkgs REQUIRED dbus-1 dbus-glib-1 dlog pkgmgr-info)
foreach(flag ${comm_pkgs_CFLAGS})
set(comm_pkgs_CFLAGS_str "${comm_pkgs_CFLAGS_str} ${flag}")
<h3 class="pg">Parse command args</h3>
Every installer backend's command arguments are like this; <br>
@code
-$ <backend> <req_id> <pkg_name> [<arg1> <arg2> <arg3> ...]
+$ <backend> <req_id> <pkgid> [<arg1> <arg2> <arg3> ...]
@endcode
<ul>
<li>backend : An installer backend executable file. </li>
<li>req_id : A request id, which is passed from frontend (with -k option). This is broadcasted with all signals from this backend. </li>
- <li>pkg_name : package name</li>
+ <li>pkgid : package name</li>
<li>arg1, arg2, ... : Separated arguments from frontend. You can use anything. This is a rule just between frontend and backend. </li>
</ul>
DBusConnection *conn;
conn = comm_status_broadcast_server_connect();
-comm_status_broadcast_server_send_signal(conn, req_id, pkg_type, pkg_name, "start", "0");
+comm_status_broadcast_server_send_signal(conn, req_id, pkg_type, pkgid, "start", "0");
/* ... */
-comm_status_broadcast_server_send_signal(conn, req_id, pkg_type, pkg_name, "install_percent", "60");
+comm_status_broadcast_server_send_signal(conn, req_id, pkg_type, pkgid, "install_percent", "60");
/* ... */
-comm_status_broadcast_server_send_signal(conn, req_id, pkg_type, pkg_name, "end", "0");
+comm_status_broadcast_server_send_signal(conn, req_id, pkg_type, pkgid, "end", "0");
/* ... */
@endcode
//ToDo
}
-static int pkg_plugin_app_is_installed(const char *pkg_name)
+static int pkg_plugin_app_is_installed(const char *pkgid)
{
//ToDo
return 0;
}
-static int pkg_plugin_get_app_detail_info(const char *pkg_name, package_manager_pkg_detail_info_t* pkg_detail_info)
+static int pkg_plugin_get_app_detail_info(const char *pkgid, package_manager_pkg_detail_info_t* pkg_detail_info)
{
//ToDo
GError *err;
DBusGProxy *request_proxy;
DBusGProxy *signal_proxy;
- char *pkg_name;
+ char *pkgid;
status_cb signal_cb;
void *signal_cb_data;
g_object_unref(cc->request_proxy);
if (cc->signal_proxy)
g_object_unref(cc->signal_proxy);
- if (cc->pkg_name)
- free(cc->pkg_name);
+ if (cc->pkgid)
+ free(cc->pkgid);
free(cc);
status_signal_handler(DBusGProxy *proxy,
const char *req_id,
const char *pkg_type,
- const char *pkg_name,
+ const char *pkgid,
const char *key, const char *val, gpointer data)
{
comm_client *cc = (comm_client *) data;
dbg("Got signal: %s/%s/%s/%s/%s", req_id, pkg_type,
- pkg_name, key, val);
+ pkgid, key, val);
if (cc->signal_cb) {
- if (cc->pkg_name && pkg_name &&
- 0 == strncmp(cc->pkg_name, pkg_name,
- strlen(cc->pkg_name))) {
+ if (cc->pkgid && pkgid &&
+ 0 == strncmp(cc->pkgid, pkgid,
+ strlen(cc->pkgid))) {
dbg("Run signal handler");
cc->signal_cb(cc->signal_cb_data, req_id, pkg_type,
- pkg_name, key, val);
+ pkgid, key, val);
} else {
- dbg("pkg_name is different. (My pkg_name:%s)"
- " Though pass signal to user callback.", cc->pkg_name);
+ dbg("pkgid is different. (My pkgid:%s)"
+ " Though pass signal to user callback.", cc->pkgid);
cc->signal_cb(cc->signal_cb_data, req_id, pkg_type,
- pkg_name, key, val);
+ pkgid, key, val);
}
} else {
dbg("No signal handler is set. Do nothing.");
int
comm_client_request(comm_client *cc, const char *req_id, const int req_type,
- const char *pkg_type, const char *pkg_name,
+ const char *pkg_type, const char *pkgid,
const char *args, const char *cookie)
{
gboolean r;
gint ret = COMM_RET_ERROR;
dbg("got request:%s/%d/%s/%s/%s/%s\n", req_id, req_type, pkg_type,
- pkg_name, args, cookie);
+ pkgid, args, cookie);
- if (!pkg_name)
- pkg_name = ""; /* NULL check */
+ if (!pkgid)
+ pkgid = ""; /* NULL check */
r = org_tizen_slp_pkgmgr_request(cc->request_proxy, req_id, req_type,
- pkg_type, pkg_name, args, cookie,
+ pkg_type, pkgid, args, cookie,
&ret, &(cc->err));
if (TRUE == r) {
ret = COMM_RET_OK;
}
dbg("request sent");
- if (cc->pkg_name) {
- dbg("freeing pkg_name");
- free(cc->pkg_name);
- dbg("freed pkg_name");
+ if (cc->pkgid) {
+ dbg("freeing pkgid");
+ free(cc->pkgid);
+ dbg("freed pkgid");
}
- cc->pkg_name = strdup(pkg_name);
+ cc->pkgid = strdup(pkgid);
dbg("ret:%d", ret);
#define __COMM_CLIENT_H__
#include "comm_config.h"
-#include <glib/gerror.h>
-#include <glib/gtypes.h>
+#include <glib.h>
#include <dbus/dbus-glib.h>
enum {
typedef struct comm_client comm_client;
typedef void (*status_cb) (void *cb_data, const char *req_id,
- const char *pkg_type, const char *pkg_name,
+ const char *pkg_type, const char *pkgid,
const char *key, const char *val);
API comm_client *comm_client_new(void);
API int comm_client_request(comm_client *cc, const char *req_id,
const int req_type, const char *pkg_type,
- const char *pkg_name, const char *args,
+ const char *pkgid, const char *args,
const char *cookie, int is_block);
API int comm_client_set_status_callback(comm_client *cc, status_cb cb,
/* Values to be received by signal */
char *req_id = NULL;
char *pkg_type = NULL;
- char *pkg_name = NULL;
+ char *pkgid = NULL;
char *key = NULL;
char *val = NULL;
if (dbus_message_get_args(msg, &err,
DBUS_TYPE_STRING, &req_id,
DBUS_TYPE_STRING, &pkg_type,
- DBUS_TYPE_STRING, &pkg_name,
+ DBUS_TYPE_STRING, &pkgid,
DBUS_TYPE_STRING, &key,
DBUS_TYPE_STRING, &val,
DBUS_TYPE_INVALID)) {
/* Got signal! */
dbg("Got signal: %s / %s / %s / %s / %s", req_id,
- pkg_type, pkg_name, key, val);
+ pkg_type, pkgid, key, val);
/* Run signal callback if exist */
if (sig_cb_data && sig_cb_data->cb) {
sig_cb_data->cb(sig_cb_data->cb_data, req_id,
- pkg_type, pkg_name, key, val);
+ pkg_type, pkgid, key, val);
dbg("callback function is end");
}
/* Connect to dbus */
dbus_error_init(&err);
- cc->conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
+ cc->conn = dbus_bus_get_private(DBUS_BUS_SYSTEM, &err);
if (dbus_error_is_set(&err)) {
ERR("dbus connection error (%s)", err.message);
dbus_error_free(&err);
/* Cleanup ADT */
/* flush remaining buffer: blocking mode */
- dbus_connection_flush(cc->conn);
+ dbus_connection_flush(cc->conn);
/* Free signal filter if signal callback is exist */
if (cc->sig_cb_data) {
/* _free_sig_cb_data(cc->sig_cb_data); */
}
+ dbus_connection_close(cc->conn);
dbus_connection_unref(cc->conn);
free(cc);
const char *req_id,
const int req_type,
const char *pkg_type,
- const char *pkg_name,
+ const char *pkgid,
const char *args,
const char *cookie,
int is_block)
req_id = "tmp_reqid";
if (NULL == pkg_type)
pkg_type = "none";
- if (NULL == pkg_name)
- pkg_name = "";
+ if (NULL == pkgid)
+ pkgid = "";
if (NULL == args)
args = "";
if (NULL == cookie)
DBUS_TYPE_STRING, &req_id,
DBUS_TYPE_INT32, &req_type,
DBUS_TYPE_STRING, &pkg_type,
- DBUS_TYPE_STRING, &pkg_name,
+ DBUS_TYPE_STRING, &pkgid,
DBUS_TYPE_STRING, &args,
DBUS_TYPE_STRING, &cookie,
DBUS_TYPE_INVALID)) {
- r = COMM_RET_NOMEM;
+ r = COMM_RET_ERROR;
goto ERROR_CLEANUP;
}
/* Send message */
if (is_block == 1){
if(!dbus_connection_send_with_reply_and_block(cc->conn, msg,
- 1200, NULL)) {
- r = COMM_RET_NOMEM;
+ 5000, NULL)) {
+ r = COMM_RET_ERROR;
goto ERROR_CLEANUP;
}
} else {
if (!dbus_connection_send(cc->conn, msg, NULL)) {
- r = COMM_RET_NOMEM;
+ r = COMM_RET_ERROR;
goto ERROR_CLEANUP;
}
}
/* to clearer */
COMM_REQ_TO_CLEARER,
+ /* to mover*/
+ COMM_REQ_TO_MOVER,
+
/* cancel job */
COMM_REQ_CANCEL,
<arg type="s" name="req_id" direction="in" />
<arg type="i" name="req_type" direction="in" />
<arg type="s" name="pkg_type" direction="in" />
- <arg type="s" name="pkg_name" direction="in" />
+ <arg type="s" name="pkgid" direction="in" />
<arg type="s" name="args" direction="in" />
<arg type="s" name="cookie" direction="in" />
<arg type="i" name="ret" direction="out" />
*/
GCallback pkgmgr_request(PkgMgrObject *obj, const gchar *req_id,
const gint req_type, const gchar *pkg_type,
- const gchar *pkg_name, const gchar *args,
+ const gchar *pkgid, const gchar *args,
const gchar *cookie, gint *ret, GError *err);
/* Include stub header */
const gchar *req_id,
const gint req_type,
const gchar *pkg_type,
- const gchar *pkg_name,
+ const gchar *pkgid,
const gchar *args,
const gchar *cookie, gint *ret, GError *err)
{
if (obj->req_cb) {
dbg("Call request callback(obj, %s, %d, %s, %s, %s, *ret)",
- req_id, req_type, pkg_type, pkg_name, args);
+ req_id, req_type, pkg_type, pkgid, args);
obj->req_cb(obj->req_cb_data, req_id, req_type, pkg_type,
- pkg_name, args, cookie, ret);
+ pkgid, args, cookie, ret);
} else {
dbg("Attempt to call request callback,"
" but request callback is not set. Do nothing.\n"
typedef void (*request_callback) (void *cb_data, const char *req_id,
const int req_type, const char *pkg_type,
- const char *pkg_name, const char *args,
+ const char *pkgid, const char *args,
const char *cookie, int *ret);
API void pkg_mgr_set_request_callback(PkgMgrObject *obj,
/* bind */
if (bind(fd, (struct sockaddr *)&saddr, sizeof(saddr))) {
+ close(fd);
return -errno;
}
/* chmod */
if (chmod(saddr.sun_path, (S_IRWXU | S_IRWXG | S_IRWXO)) < 0) {
+ close(fd);
return -errno;
}
/* listen */
if (-1 == listen(fd, 10)) {
+ close(fd);
return -errno;
}
<signal name="status">
<arg type="s" name="req_id" direction="out" />
<arg type="s" name="pkgtype" direction="out" />
- <arg type="s" name="pkgname" direction="out" />
+ <arg type="s" name="pkgid" direction="out" />
<arg type="s" name="key" direction="out" />
<arg type="s" name="val" direction="out" />
</signal>
API void comm_status_broadcast_server_send_signal(DBusConnection *conn,
const char *req_id,
const char *pkg_type,
- const char *pkg_name,
+ const char *pkgid,
const char *key,
const char *val);
API void comm_status_broadcast_server_disconnect(DBusConnection *conn);
comm_status_broadcast_server_send_signal(DBusConnection *conn,
const char *req_id,
const char *pkg_type,
- const char *pkg_name, const char *key,
+ const char *pkgid, const char *key,
const char *val)
{
dbus_uint32_t serial = 0;
const char *values[] = {
req_id,
pkg_type,
- pkg_name,
+ pkgid,
key,
val
};
#include <unistd.h>
#include <string.h>
#include <getopt.h>
+#include <db-util.h>
+#include <pkgmgr-info.h>
+
#define MAX_STRLEN 512
+#define MAX_QUERY_LEN 4096
+
#define CHK_PI_RET(r) \
do { if (NULL == pi) return (r); } while (0)
struct pkgmgr_installer {
int request_type;
int quiet;
+ int move_type;
char *pkgmgr_info;
char *session_id;
char *license_path;
DBusConnection *conn;
};
-static int __pkgmgr_installer_receive_request_by_socket(pkgmgr_installer *pi);
-/* Internal func */
+static int __validate_cb(void *data, int ncols, char **coltxt, char **colname);
-static int __pkgmgr_installer_receive_request_by_socket(pkgmgr_installer *pi)
+static int __validate_cb(void *data, int ncols, char **coltxt, char **colname)
{
- CHK_PI_RET(-EINVAL);
- int r = 0;
-
-#ifdef USE_SOCKET
- /* TODO: implement this */
-
- /* Try to connect to socket */
- comm_socket_client *csc =
- comm_socket_client_new(pi->quiet_socket_path);
- if (!csc)
- return -EINVAL;
-
- /* Receive request */
- char *req = NULL, *pkg_info = NULL;
- if (0 != comm_socket_client_receive_request(csc, &req, &pkg_info)) {
- r = -EINVAL;
- goto CLEANUP_RET;
- }
-
- /* Verify requester */
-
- /* Set request value */
-
- /* Cleanup */
- CLEANUP_RET:
- if (csc)
- comm_socket_client_free(csc);
-#endif
-
- return r;
+ int *p = (int*)data;
+ *p = atoi(coltxt[0]);
+ _LOGE("exist value is %d\n", *p);
+ return 0;
}
-
/* API */
API pkgmgr_installer *pkgmgr_installer_new(void)
return ERR_PTR(-ENOMEM);
pi->request_type = PKGMGR_REQ_INVALID;
+ pi->quiet = 0;
return pi;
}
pi->pkgmgr_info = strndup(optarg, MAX_STRLEN);
break;
+ case 'm': /* move */
+ if (mode) {
+ r = -EINVAL;
+ goto RET;
+ }
+ mode = 'm';
+ pi->request_type = PKGMGR_REQ_MOVE;
+ if (pi->pkgmgr_info)
+ free(pi->pkgmgr_info);
+ pi->pkgmgr_info = strndup(optarg, MAX_STRLEN);
+ break;
+
case 'r': /* recover */
if (mode) {
r = -EINVAL;
mode = 'r';
break;
+ case 't': /* move type*/
+ pi->move_type = atoi(optarg);
+ break;
+
case 'q': /* quiet mode */
/* if(mode) { r = -EINVAL; goto RET; }
mode = 'q'; */
pi->quiet = 1;
/* pi->quiet_socket_path = strndup(optarg, MAX_STRLEN);
- maximum 255 bytes
- return
- __pkgmgr_installer_receive_request_by_socket(pi); */
+ maximum 255 bytes
+ return
+ */
break;
return pi->quiet;
}
+API int pkgmgr_installer_get_move_type(pkgmgr_installer *pi)
+{
+ CHK_PI_RET(PKGMGR_REQ_INVALID);
+ return pi->move_type;
+}
+
API int
pkgmgr_installer_send_signal(pkgmgr_installer *pi,
const char *pkg_type,
- const char *pkg_name,
+ const char *pkgid,
const char *key, const char *val)
{
int r = 0;
if (!sid)
sid = "";
comm_status_broadcast_server_send_signal(pi->conn, sid, pkg_type,
- pkg_name, key, val);
+ pkgid, key, val);
return r;
}
+
+API int pkgmgr_installer_create_certinfo_set_handle(pkgmgr_instcertinfo_h *handle)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_create_certinfo_set_handle(handle);
+ return ret;
+}
+
+API int pkgmgr_installer_set_cert_value(pkgmgr_instcertinfo_h handle, pkgmgr_instcert_type cert_type, char *cert_value)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_set_cert_value(handle, cert_type, cert_value);
+ return ret;
+}
+
+API int pkgmgr_installer_save_certinfo(const char *pkgid, pkgmgr_instcertinfo_h handle)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_save_certinfo(pkgid, handle);
+ return ret;
+}
+
+API int pkgmgr_installer_destroy_certinfo_set_handle(pkgmgr_instcertinfo_h handle)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_destroy_certinfo_set_handle(handle);
+ return ret;
+}
+
+API int pkgmgr_installer_delete_certinfo(const char *pkgid)
+{
+ int ret = 0;
+ ret = pkgmgrinfo_delete_certinfo(pkgid);
+ return ret;
+}
#include <stdlib.h>
#include <getopt.h>
+#include <dlog.h>
+
+#undef LOG_TAG
+#ifndef LOG_TAG
+#define LOG_TAG "PKGMGR_INSTALLER"
+#endif /* LOG_TAG */
+
+#define _LOGE(fmt, arg...) LOGE(fmt,##arg)
/**
* pkgmgr_installer is an opaque type for an object
*/
typedef struct pkgmgr_installer pkgmgr_installer;
+typedef void* pkgmgr_instcertinfo_h;
/**
* Request type.
PKGMGR_REQ_INSTALL = 1,
PKGMGR_REQ_UNINSTALL = 2,
PKGMGR_REQ_CLEAR = 3,
- PKGMGR_REQ_RECOVER = 4
+ PKGMGR_REQ_MOVE = 4,
+ PKGMGR_REQ_RECOVER = 5
};
+enum {
+ PKGMGR_INSTALLER_EINVAL = -2, /**< Invalid argument */
+ PKGMGR_INSTALLER_ERROR = -1, /**< General error */
+ PKGMGR_INSTALLER_EOK = 0 /**< General success */
+};
+
+
+typedef enum {
+ PM_SET_AUTHOR_ROOT_CERT = 0,
+ PM_SET_AUTHOR_INTERMEDIATE_CERT = 1,
+ PM_SET_AUTHOR_SIGNER_CERT = 2,
+ PM_SET_DISTRIBUTOR_ROOT_CERT = 3,
+ PM_SET_DISTRIBUTOR_INTERMEDIATE_CERT = 4,
+ PM_SET_DISTRIBUTOR_SIGNER_CERT = 5,
+ PM_SET_DISTRIBUTOR2_ROOT_CERT = 6,
+ PM_SET_DISTRIBUTOR2_INTERMEDIATE_CERT = 7,
+ PM_SET_DISTRIBUTOR2_SIGNER_CERT = 8,
+}pkgmgr_instcert_type;
+
+
/**
* @brief Create a pkgmgr_installer object.
* @pre None
int pkgmgr_installer_is_quiet(pkgmgr_installer *pi);
/**
+ @brief Get move type
+ @pre pkgmgr_installer_receive_request() must be called.
+ @post None
+ @see pkgmgr_installer_receive_request
+ @param[in] pi pkgmgr_installer object
+ @return Operation result
+ @retval enum value of move type
+ @remark None
+ @code
+#include <pkgmgr_installer.h>
+int main(int argc, char **argv)
+{
+ pkgmgr_installer *pi;
+ int r = 0;
+
+ pi = pkgmgr_installer_new();
+ if(!pi) return -1;
+ if(pkgmgr_installer_receive_request(pi, argc, argv)) {
+ r = -1;
+ goto CLEANUP_RET;
+ }
+ move_type = pkgmgr_installer_get_move_type(pi);
+
+ //Do Something
+
+ pkgmgr_installer_free(pi);
+ return r;
+}
+ @endcode
+ */
+int pkgmgr_installer_get_move_type(pkgmgr_installer *pi);
+
+/**
@brief Send a process status signal
@pre None
@post None
@see None
@param[in] pi pkgmgr_installer object
@param[in] pkg_type package type: "deb", "jar", "wgt", ...
- @param[in] pkg_name package name
+ @param[in] pkgid package id
@param[in] key Signal key
@param[in] val Signal value
@return Operation result
// Do something...
pkgmgr_installer_send_signal(pi,
- "deb", "deb.org.tizen.foo", "install_percent", "100");
+ "deb", "org.tizen.foo", "install_percent", "100");
// A sample signal
pkgmgr_installer_free(pi);
*/
int pkgmgr_installer_send_signal(pkgmgr_installer *pi,
const char *pkg_type,
- const char *pkg_name, const char *key,
+ const char *pkgid, const char *key,
const char *val);
+/**
+ * @brief This API creates the certinfo handle.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[out] handle pointer to cert info handle
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_installer_create_certinfo_set_handle(pkgmgr_instcertinfo_h *handle);
+
+/**
+ * @brief This API sets cert value for corresponding cert type.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to cert info handle
+ * @param[in] cert_type enum value for certificate type
+ * @param[in] cert_value certificate value
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_installer_set_cert_value(pkgmgr_instcertinfo_h handle, pkgmgr_instcert_type cert_type, char *cert_value);
+
+/**
+ * @brief This API saves cert info in DB.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] pkgid package ID
+ * @param[in] handle pointer to cert info handle
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_installer_save_certinfo(const char *pkgid, pkgmgr_instcertinfo_h handle);
+
+/**
+ * @brief This API destroys cert info handle freeing all resources.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] handle pointer to cert info handle
+ * @return 0 if success, error code(<0) if fail\n
+*/
+int pkgmgr_installer_destroy_certinfo_set_handle(pkgmgr_instcertinfo_h handle);
+
+/**
+ * @brief This API deletes cert info from DB. To be used to cleanup info upon pkg uninstallation
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] pkgid package ID
+ * @return 0 if success, error code(<0) if fail\n
+*/
+ int pkgmgr_installer_delete_certinfo(const char *pkgid);
+
#ifdef __cplusplus
}
#endif
#endif
/* Supported options */
-const char *short_opts = "k:l:i:d:c:rq";
+const char *short_opts = "k:l:i:d:c:m:t:rq";
const struct option long_opts[] = {
{ "session-id", 1, NULL, 'k' },
{ "license-path", 1, NULL, 'l' },
{ "install", 1, NULL, 'i' },
{ "uninstall", 1, NULL, 'd' },
{ "clear", 1, NULL, 'c' },
+ { "move", 1, NULL, 'm' },
+ { "move-type", 1, NULL, 't' },
{ "recover", 0, NULL, 'r' },
{ "quiet", 1, NULL, 'q' },
{ 0, 0, 0, 0 } /* sentinel */
void
stat_cb(void *data, const char *req_id, const char *pkg_type,
- const char *pkg_name, const char *key, const char *val)
+ const char *pkgid, const char *key, const char *val)
{
printf(">>user callback>> Got: %s %s %s %s %s\n", req_id, pkg_type,
- pkg_name, key, val);
+ pkgid, key, val);
g_main_loop_quit(mainloop);
}
void
req_cb(void *cb_data, const char *req_id, const int req_type,
- const char *pkg_type, const char *pkg_name, const char *args,
+ const char *pkg_type, const char *pkgid, const char *args,
const char *cookie, int *ret)
{
/* TODO: Do your job here */
printf(">> in callback >> Got request: %s %d %s %s %s (cookie:%s)\n",
- req_id, req_type, pkg_type, pkg_name, args, cookie);
+ req_id, req_type, pkg_type, pkgid, args, cookie);
}
gboolean queue_job(void *data)
int i;
for (i = 0; i < 100; i++) {
comm_status_broadcast_server_send_signal(conn, "test_id",
- "test", "test_pkgname",
+ "test", "test_pkgid",
"test_key",
"test_val");
sleep(1);
static void
get_signal_cb(void *cb_data, const char *req_id, const char *pkg_type,
- const char *pkg_name, const char *key, const char *val)
+ const char *pkgid, const char *key, const char *val)
{
struct signal_counter *counter = (struct signal_counter *)cb_data;
-slp-pkgmgr (0.1.100-2) unstable; urgency=low
+slp-pkgmgr (0.1.122) unstable; urgency=low
+
+ * Applied manifest
+ * Git: slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.122
+
+ -- Sewook Park <sewook7.park@samsung.com> Wed, 25 Jul 2012 19:11:44 +0900
+
+slp-pkgmgr (0.1.115) unstable; urgency=low
+
+ * Fixed bug when backend installer exits with failure
+ * Git: slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.115
+
+ -- Sewook Park <sewook7.park@samsung.com> Mon, 21 May 2012 21:12:04 +0900
+
+slp-pkgmgr (0.1.114) unstable; urgency=low
+
+ * Fixed server hang issue on pressing NO in popup
+ * Git: slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.114
+
+ -- Sewook Park <sewook7.park@samsung.com> Mon, 07 May 2012 15:34:45 +0900
+
+slp-pkgmgr (0.1.113) unstable; urgency=low
+
+ * Implemented multiple queue support
+ * Git: slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.113
+
+ -- Sewook Park <sewook7.park@samsung.com> Fri, 20 Apr 2012 10:51:58 +0900
+
+slp-pkgmgr (0.1.112) unstable; urgency=low
+
+ * Fixed activate/deactivate feature
+ * Git: slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.112
+
+ -- Sewook Park <sewook7.park@samsung.com> Tue, 03 Apr 2012 20:39:45 +0900
+
+slp-pkgmgr (0.1.111) unstable; urgency=low
+
+ * Fixed pkgmgr-install desktop to support rpm
+ * Git: slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.111
+
+ -- Sewook Park <sewook7.park@samsung.com> Fri, 30 Mar 2012 11:50:01 +0900
+
+slp-pkgmgr (0.1.110) unstable; urgency=low
+
+ * Fixed popup UI bug
+ * Git: slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.110
+
+ -- Sewook Park <sewook7.park@samsung.com> Fri, 23 Mar 2012 19:06:13 +0900
+
+slp-pkgmgr (0.1.109) unstable; urgency=low
+
+ * Fixed compile warnings
+ * Git: slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.109
+
+ -- Sewook Park <sewook7.park@samsung.com> Tue, 20 Mar 2012 15:36:02 +0900
+
+slp-pkgmgr (0.1.108) unstable; urgency=low
+
+ * Fixed desktop file
+ * Git: slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.108
+
+ -- Sewook Park <sewook7.park@samsung.com> Fri, 16 Mar 2012 21:35:27 +0900
+
+slp-pkgmgr (0.1.107) unstable; urgency=low
+
+ * Fixed bug for elementary modification
+ * Git: slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.107
+
+ -- Sewook Park <sewook7.park@samsung.com> Thu, 15 Mar 2012 15:04:39 +0900
+
+slp-pkgmgr (0.1.106) unstable; urgency=low
+
+ * Fixed code for elementary 1.0 release
+ * Git: slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.106
+
+ -- Sewook Park <sewook7.park@samsung.com> Tue, 13 Mar 2012 17:52:30 +0900
+
+slp-pkgmgr (0.1.105) unstable; urgency=low
+
+ * Support Appsvc for pkgmgr-install
+ * Git: slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.105
+
+ -- Sewook Park <sewook7.park@samsung.com> Mon, 27 Feb 2012 21:34:10 +0900
+
+slp-pkgmgr (0.1.104) unstable; urgency=low
+
+ * Added clear_user_data API
+ * Git: slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.104
+
+ -- Sewook Park <sewook7.park@samsung.com> Wed, 25 Jan 2012 17:47:26 +0900
+
+slp-pkgmgr (0.1.103) unstable; urgency=low
+
+ * Added Pkgmgr TC and fixed issues
+ * Git: slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.103
+
+ -- Sewook Park <sewook7.park@samsung.com> Mon, 26 Dec 2011 19:06:00 +0900
+
+slp-pkgmgr (0.1.102) unstable; urgency=low
+
+ * Removed README file
+ * Git: slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.102
+
+ -- Sewook Park <sewook7.park@samsung.com> Thu, 22 Dec 2011 20:19:24 +0900
+
+slp-pkgmgr (0.1.101) unstable; urgency=low
+
+ * Fixed pkgmgr_info_new bug
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.101
+
+ -- Sewook Park <sewook7.park@samsung.com> Thu, 22 Dec 2011 17:27:37 +0900
+
+slp-pkgmgr (0.1.100) unstable; urgency=low
+
+ * Fixed package activate/deactivate
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.100
+
+ -- Sewook Park <sewook7.park@samsung.com> Tue, 13 Dec 2011 19:51:00 +0900
+
+slp-pkgmgr (0.1.99) unstable; urgency=low
+
+ * Added ecore_init() due to ecore internal logic change
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.99
+
+ -- Sewook Park <sewook7.park@samsung.com> Fri, 09 Dec 2011 10:17:31 +0900
+
+slp-pkgmgr (0.1.98) unstable; urgency=low
+
+ * Cleanup code
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.98
+
+ -- Sewook Park <sewook7.park@samsung.com> Tue, 06 Dec 2011 16:31:23 +0900
+
+slp-pkgmgr (0.1.97) unstable; urgency=low
+
+ * Updated changelog
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.97
+
+ -- Sewook Park <sewook7.park@samsung.com> Mon, 05 Dec 2011 16:05:30 +0900
+
+slp-pkgmgr (0.1.96) unstable; urgency=low
+
+ * Fix pkgcmd exit code according to the installation result for SDK support
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.96
+
+ -- Sewook Park <sewook7.park@samsung.com> Thu, 24 Nov 2011 15:12:31 +0900
+
+slp-pkgmgr (0.1.95) unstable; urgency=low
+
+ * Fixed gcc warnings, Klockwork issues and regression test issues
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.95
+
+ -- Sewook Park <sewook7.park@samsung.com> Wed, 09 Nov 2011 15:45:40 +0900
+
+slp-pkgmgr (0.1.94) unstable; urgency=low
+
+ * Changed Boilerplate as per the guideline
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.94
+
+ -- Sewook Park <sewook7.park@samsung.com> Mon, 07 Nov 2011 18:30:37 +0900
+
+slp-pkgmgr (0.1.93) unstable; urgency=low
+
+ * Apply AIL update in pkgmgr
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.93
+
+ -- Sewook Park <sewook7.park@samsung.com> Mon, 31 Oct 2011 15:37:21 +0900
+
+slp-pkgmgr (0.1.92) unstable; urgency=low
+
+ * Fix prevent bug
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.92
+
+ -- Sewook Park <sewook7.park@samsung.com> Wed, 26 Oct 2011 20:54:24 +0900
+
+slp-pkgmgr (0.1.91) unstable; urgency=low
+
+ * Fix package_manager_pkg_detail_info_t
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.91
+
+ -- Sewook Park <sewook7.park@samsung.com> Thu, 20 Oct 2011 21:26:13 +0900
+
+slp-pkgmgr (0.1.90) unstable; urgency=low
+
+ * Apply localization string
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.90
+
+ -- Sewook Park <sewook7.park@samsung.com> Tue, 18 Oct 2011 17:40:10 +0900
+
+slp-pkgmgr (0.1.89) unstable; urgency=low
+
+ * Add app_size in package_manager_pkg_detail_info_t
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.89
+
+ -- Sewook Park <sewook7.park@samsung.com> Tue, 18 Oct 2011 11:54:56 +0900
+
+slp-pkgmgr (0.1.88) unstable; urgency=low
+
+ * Fix string
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.88
+
+ -- Sewook Park <sewook7.park@samsung.com> Fri, 14 Oct 2011 10:49:17 +0900
+
+slp-pkgmgr (0.1.87) unstable; urgency=low
+
+ * set elm_scale
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.87
+
+ -- Sewook Park <sewook7.park@samsung.com> Wed, 12 Oct 2011 13:06:20 +0900
+
+slp-pkgmgr (0.1.86) unstable; urgency=low
+
+ * Fix pkgmgr-install inteface to use bundle_import_from_argv()
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.86
+
+ -- Sewook Park <sewook7.park@samsung.com> Fri, 07 Oct 2011 16:31:00 +0900
+
+slp-pkgmgr (0.1.85) unstable; urgency=low
+
+ * Remove unnecessary define
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.85
+
+ -- Sewook Park <sewook7.park@samsung.com> Wed, 05 Oct 2011 15:47:42 +0900
+
+slp-pkgmgr (0.1.84) unstable; urgency=low
+
+ * Terminate application before uninstalling
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.84
+
+ -- Sewook Park <sewook7.park@samsung.com> Wed, 28 Sep 2011 11:06:58 +0900
+
+slp-pkgmgr (0.1.83) unstable; urgency=low
+
+ * Fixed server bug while creating popup
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.83
+
+ -- Sewook Park <sewook7.park@samsung.com> Fri, 23 Sep 2011 14:36:43 +0900
+
+slp-pkgmgr (0.1.82) unstable; urgency=low
+
+ * Remove old API
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.82
+
+ -- Sewook Park <sewook7.park@samsung.com> Thu, 22 Sep 2011 12:25:55 +0900
+
+slp-pkgmgr (0.1.81) unstable; urgency=low
+
+ * Remove old AIL structure
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.81
+
+ -- Sewook Park <sewook7.park@samsung.com> Wed, 21 Sep 2011 18:00:00 +0900
+
+slp-pkgmgr (0.1.80) unstable; urgency=low
+
+ * Fix callback unresistering
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.80
+
+ -- Sewook Park <sewook7.park@samsung.com> Tue, 20 Sep 2011 20:09:45 +0900
+
+slp-pkgmgr (0.1.79) unstable; urgency=low
+
+ * Fix bug - pkgmgr-client/server
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.79
+
+ -- Sewook Park <sewook7.park@samsung.com> Mon, 19 Sep 2011 19:05:37 +0900
+
+slp-pkgmgr (0.1.78) unstable; urgency=low
+
+ * Fix prevent defects
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.78
+
+ -- Sewook Park <sewook7.park@samsung.com> Tue, 06 Sep 2011 11:12:54 +0900
+
+slp-pkgmgr (0.1.77) unstable; urgency=low
+
+ * Use name instead of pkg_name on uninstallation
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.77
+
+ -- Sewook Park <sewook7.park@samsung.com> Mon, 05 Sep 2011 16:15:54 +0900
+
+slp-pkgmgr (0.1.76) unstable; urgency=low
+
+ * Fix bug
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.76
+
+ -- Sewook Park <sewook7.park@samsung.com> Mon, 29 Aug 2011 15:17:47 +0900
+
+slp-pkgmgr (0.1.75) unstable; urgency=low
+
+ * Apply new API
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.75
+
+ -- Sewook Park <sewook7.park@samsung.com> Thu, 25 Aug 2011 21:08:35 +0900
+
+slp-pkgmgr (0.1.74) unstable; urgency=low
+
+ * Fixed Prevent Issues
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.74
+
+ -- Sewook Park <sewook7.park@samsung.com> Wed, 24 Aug 2011 20:12:30 +0900
+
+slp-pkgmgr (0.1.73) unstable; urgency=low
+
+ * Fix for AIL exception
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.73
+
+ -- Sewook Park <sewook7.park@samsung.com> Tue, 23 Aug 2011 17:12:30 +0900
+
+slp-pkgmgr (0.1.72) unstable; urgency=low
+
+ * Cleanup code
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.72
+
+ -- Sewook Park <sewook7.park@samsung.com> Fri, 19 Aug 2011 11:46:33 +0900
+
+slp-pkgmgr (0.1.71) unstable; urgency=low
+
+ * Add info type
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.71
+
+ -- Sewook Park <sewook7.park@samsung.com> Thu, 18 Aug 2011 18:40:30 +0900
+
+slp-pkgmgr (0.1.70) unstable; urgency=low
+
+ * Add optional_id in package_manager_pkg_detail_info_t
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.70
+
+ -- Sewook Park <sewook7.park@samsung.com> Wed, 10 Aug 2011 19:18:52 +0900
+
+slp-pkgmgr (0.1.69) unstable; urgency=low
+
+ * Apply new AIL API
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.69
+
+ -- Sewook Park <sewook7.park@samsung.com> Tue, 09 Aug 2011 14:25:09 +0900
+
+slp-pkgmgr (0.1.68) unstable; urgency=low
+
+ * Apply code cleanup
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.68
+
+ -- Sewook Park <sewook7.park@samsung.com> Mon, 01 Aug 2011 19:32:38 +0900
+
+slp-pkgmgr (0.1.67) unstable; urgency=low
+
+ * Apply Boilerplate
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.67
+
+ -- Sewook Park <sewook7.park@samsung.com> Wed, 13 Jul 2011 17:33:40 +0900
+
+slp-pkgmgr (0.1.66) unstable; urgency=low
+
+ * Cleanup code
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.66
+
+ -- Sewook Park <sewook7.park@samsung.com> Tue, 05 Jul 2011 17:59:59 +0900
+
+slp-pkgmgr (0.1.65) unstable; urgency=low
+
+ * Cleanup control file
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.65
+
+ -- Sewook Park <sewook7.park@samsung.com> Mon, 04 Jul 2011 20:25:20 +0900
+
+slp-pkgmgr (0.1.64) unstable; urgency=low
+
+ * Cleanup code
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.64
+
+ -- Sewook Park <sewook7.park@samsung.com> Tue, 28 Jun 2011 19:40:17 +0900
+
+slp-pkgmgr (0.1.63) unstable; urgency=low
+
+ * Cleanup code
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.63
+
+ -- Sewook Park <sewook7.park@samsung.com> Fri, 24 Jun 2011 19:09:13 +0900
+
+slp-pkgmgr (0.1.62) unstable; urgency=low
+
+ * Fix prevent defect
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.62
+
+ -- Sewook Park <sewook7.park@samsung.com> Mon, 20 Jun 2011 14:37:43 +0900
+
+slp-pkgmgr (0.1.61) unstable; urgency=low
+
+ * Change popup type to modal
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.61
+
+ -- Sewook Park <sewook7.park@samsung.com> Mon, 06 Jun 2011 12:59:16 +0900
+
+slp-pkgmgr (0.1.60) unstable; urgency=low
+
+ * Apply ail
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.60
+
+ -- Sewook Park <sewook7.park@samsung.com> Wed, 18 May 2011 20:25:58 +0900
+
+slp-pkgmgr (0.1.59) unstable; urgency=low
+
+ * Fix build error - CMakeLists.txt
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.59
+
+ -- Sewook Park <sewook7.park@samsung.com> Wed, 18 May 2011 14:31:49 +0900
+
+slp-pkgmgr (0.1.58) unstable; urgency=low
+
+ * Move pkgmgr-tool pkgmgr-install to libpkgmgr-client-0
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.58
+
+ -- Sewook Park <sewook7.park@samsung.com> Tue, 17 May 2011 20:41:15 +0900
+
+slp-pkgmgr (0.1.57) unstable; urgency=low
+
+ * Fix argument handling - to include # character
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.57
+
+ -- Sewook Park <sewook7.park@samsung.com> Mon, 16 May 2011 20:56:26 +0900
+
+slp-pkgmgr (0.1.56) unstable; urgency=low
+
+ * Fix popup problem
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.56
+
+ -- Sewook Park <sewook7.park@samsung.com> Wed, 11 May 2011 16:18:05 +0900
+
+slp-pkgmgr (0.1.55) unstable; urgency=low
+
+ * Fix popup problem
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.55
+
+ -- Sewook Park <sewook7.park@samsung.com> Wed, 11 May 2011 16:11:00 +0900
+
+slp-pkgmgr (0.1.54) unstable; urgency=low
+
+ * Fix getting type in pkgmgr-client
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.54
+
+ -- Sewook Park <sewook7.park@samsung.com> Mon, 25 Apr 2011 21:26:31 +0900
+
+slp-pkgmgr (0.1.53) unstable; urgency=low
+
+ * Fix bug in pkgmgr-client
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.53
+
+ -- Sewook Park <sewook7.park@samsung.com> Mon, 18 Apr 2011 18:38:26 +0900
+
+slp-pkgmgr (0.1.52) unstable; urgency=low
+
+ * Fix item name in desktop file: X-SLP-PackageType
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.52
+
+ -- Youmin Ha <youmin.ha@samsung.com> Fri, 15 Apr 2011 10:50:01 +0900
+
+slp-pkgmgr (0.1.51) unstable; urgency=low
+
+ * Read pkg_type from desktop file when uninstall
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.51
+
+ -- Youmin Ha <youmin.ha@samsung.com> Thu, 14 Apr 2011 14:40:41 +0900
+
+slp-pkgmgr (0.1.50) unstable; urgency=low
+
+ * Fix pkgmgr-tool
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.50
+
+ -- Sewook Park <sewook7.park@samsung.com> Mon, 04 Apr 2011 21:35:36 +0900
+
+slp-pkgmgr (0.1.49) unstable; urgency=low
+
+ * Fix build error and popup string
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.49
+
+ -- Sewook Park <sewook7.park@samsung.com> Sat, 02 Apr 2011 17:22:23 +0900
+
+slp-pkgmgr (0.1.48) unstable; urgency=low
+
+ * Change popup handling in pkgmgr
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.48
+
+ -- Sewook Park <sewook7.park@samsung.com> Fri, 01 Apr 2011 17:05:28 +0900
+
+slp-pkgmgr (0.1.47) unstable; urgency=low
+
+ * Add function body for get_license_path()
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.47
+
+ -- Youmin Ha <youmin.ha@samsung.com> Wed, 16 Mar 2011 18:40:02 +0900
+
+slp-pkgmgr (0.1.46) unstable; urgency=low
+
+ * Add api: pkgmgr_installer_get_license_path()
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.46
+
+ -- Youmin Ha <youmin.ha@samsung.com> Mon, 14 Mar 2011 17:15:43 +0900
+
+slp-pkgmgr (0.1.45) unstable; urgency=low
+
+ * Add license parameter on package_manager_install_application_with_type()
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.45
+
+ -- Sewook Park <sewook7.park@samsung.com> Thu, 10 Mar 2011 13:54:27 +0900
+
+slp-pkgmgr (0.1.44) unstable; urgency=low
+
+ * Apply 2sec wait in pkgmgr-install
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.44
+
+ -- Youmin Ha <youmin.ha@samsung.com> Tue, 08 Mar 2011 15:14:10 +0900
+slp-pkgmgr (0.1.43) unstable; urgency=low
+
+ * Fix mime bugs
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.43
+
+ -- Youmin Ha <youmin.ha@samsung.com> Fri, 04 Mar 2011 09:20:23 +0900
+
+slp-pkgmgr (0.1.42) unstable; urgency=low
+
+ * Fix for argument which has white space
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.42
+
+ -- Sewook Park <sewook7.park@samsung.com> Fri, 04 Mar 2011 01:42:07 +0900
+
+slp-pkgmgr (0.1.41) unstable; urgency=low
+
+ * Fix pkgmgr-server.postinst -exclude updaet-mime-database
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.41
+
+ -- Sewook Park <sewook7.park@samsung.com> Thu, 03 Mar 2011 23:07:08 +0900
+
+slp-pkgmgr (0.1.40) unstable; urgency=low
+
+ * Fix MAX_PKG_TYPE_LEN to 128
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.40
+
+ -- Sewook Park <sewook7.park@samsung.com> Thu, 03 Mar 2011 21:54:45 +0900
+
+slp-pkgmgr (0.1.39-1) unstable; urgency=low
+
+ * Fix header to pass api review (no code change)
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.39-1
+
+ -- Youmin Ha <youmin.ha@samsung.com> Thu, 03 Mar 2011 20:27:45 +0900
+
+slp-pkgmgr (0.1.39) unstable; urgency=low
+
+ * Support wgt mime type, Fix build error
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.39
+
+ -- Youmin Ha <youmin.ha@samsung.com> Thu, 03 Mar 2011 18:53:17 +0900
+
+slp-pkgmgr (0.1.38) unstable; urgency=low
+
+ * Fix trivial bug
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.38
+
+ -- Sewook Park <sewook7.park@samsung.com> Thu, 03 Mar 2011 16:45:07 +0900
+
+slp-pkgmgr (0.1.37) unstable; urgency=low
+
+ * Change pkgmgr architecture
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.37
+
+ -- Sewook7.park <sewook7.park@samsung.com> Thu, 03 Mar 2011 15:36:33 +0900
+
+slp-pkgmgr (0.1.36-2) unstable; urgency=low
+
+ * Rollback
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.36-2
+
+ -- Sewook Park <sewook7.park@samsung.com> Sat, 26 Feb 2011 16:06:20 +0900
+
+slp-pkgmgr (0.1.36) unstable; urgency=low
+
+ * Add install_with_license API
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.36
+
+ -- Sewook Park <sewook7.park@samsung.com> Sat, 26 Feb 2011 14:48:31 +0900
+
+slp-pkgmgr (0.1.35) unstable; urgency=low
+
+ * Install pkgmgr-tool into the binary package, to be used with SDK
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.35
+
+ -- Youmin Ha <youmin.ha@samsung.com> Tue, 22 Feb 2011 16:45:32 +0900
+
+slp-pkgmgr (0.1.34) unstable; urgency=low
+
+ * fix pkgmgr_tool
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.34
+
+ -- Sewook Park <sewook7.park@samsung.com> Fri, 18 Feb 2011 13:40:52 +0900
+
+slp-pkgmgr (0.1.33) unstable; urgency=low
+
+ * check argument length (Found by prevent)
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.33
+
+ -- Sewook Park <sewook7.park@samsung.com> Wed, 16 Feb 2011 20:17:13 +0900
+
+slp-pkgmgr (0.1.32) unstable; urgency=low
+
+ * Add null check to pkgmgr_server (Found by prevent)
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.32
+
+ -- Youmin Ha <youmin.ha@samsung.com> Wed, 16 Feb 2011 14:36:34 +0900
+
+slp-pkgmgr (0.1.31) unstable; urgency=low
+
+ * pkgmgr_tool fix
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.31
+
+ -- Sewook Park <sewook7.park@samsung.com> Wed, 02 Feb 2011 15:29:27 +0900
+
+slp-pkgmgr (0.1.30) unstable; urgency=low
+
+ * Prevent bug fix
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.30
+
+ -- Sewook Park <sewook7.park@samsung.com> Wed, 26 Jan 2011 10:24:51 +0900
+
+slp-pkgmgr (0.1.29) unstable; urgency=low
+
+ * fix the return value of comm_client_free()
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.29
+
+ -- Sewook Park <sewook7.park@samsung.com> Tue, 18 Jan 2011 15:09:56 +0900
+
+slp-pkgmgr (0.1.28) unstable; urgency=low
+
+ * Change pkgmgr structure
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.28
+
+ -- Sewook Park <sewook7.park@samsung.com> Fri, 14 Jan 2011 14:05:22 +0900
+
+slp-pkgmgr (0.1.27-1) unstable; urgency=low
+
+ * upload
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.27-1
+
+ -- Youmin Ha <youmin.ha@samsung.com> Wed, 29 Dec 2010 15:21:11 +0900
+
+slp-pkgmgr (0.1.27) unstable; urgency=low
+
+ * Initialize gerror variable to NULL, to avoid error from
+ g_shell_parse_argv()
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.27
+
+ -- Youmin Ha <youmin.ha@samsung.com> Wed, 29 Dec 2010 14:45:33 +0900
+
+slp-pkgmgr (0.1.26) unstable; urgency=low
+
+ * fix pkgmgr_tool
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.26
+
+ -- root <sewook7.park@samsung.com> Tue, 21 Dec 2010 19:50:57 +0900
+
+slp-pkgmgr (0.1.25) unstable; urgency=low
+
+ * fix pkgmgr_client bug - resource free of result_callback
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.25
+
+ -- Sewook Park <sewook7.park@samsung.com> Mon, 20 Dec 2010 21:17:19 +0900
+
+slp-pkgmgr (0.1.24) unstable; urgency=low
+
+ * Apply new dbus-based comm_client library. (Known bugs are fixed)
+ Avoid BS fron opengl, by unsetting ELM_ENGINE environnent variable.
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.24
+
+ -- Youmin Ha <youmin.ha@samsung.com> Sat, 18 Dec 2010 16:44:23 +0900
+
+slp-pkgmgr (0.1.23-2) unstable; urgency=low
+
+ * fix control
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.23-2
+
+ -- root <sewook7.park@samsung.com> Mon, 13 Dec 2010 15:07:17 +0900
+
+slp-pkgmgr (0.1.23-1) unstable; urgency=low
+
+ * add aul on control
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.23-1
+
+ -- root <sewook7.park@samsung.com> Mon, 13 Dec 2010 13:42:50 +0900
+
+slp-pkgmgr (0.1.23) unstable; urgency=low
+
+ * add pkgmgr_client API - package_manager_install_application_with_type()
+ * Git: 165.213.180.234:slp/pkgs/s/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.23
+
+ -- Sewook Park <sewook7.park@samsung.com> Fri, 10 Dec 2010 17:14:31 +0900
+
+slp-pkgmgr (0.1.22) unstable; urgency=low
+
+ * fix pkgmgr_client for system package
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.22
+
+ -- root <sewook7.park@samsung.com> Mon, 06 Dec 2010 12:13:00 +0900
+
+slp-pkgmgr (0.1.21) unstable; urgency=low
+
+ * fix bugs in pkgmgr_client
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.21
+
+ -- Sewook Park <sewook7.park@samsung.com> Fri, 03 Dec 2010 17:48:14 +0900
+
+slp-pkgmgr (0.1.20) unstable; urgency=low
+
+ * fix bugs in comm_client
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.20
+
+ -- Youmin Ha <youmin.ha@samsung.com> Fri, 03 Dec 2010 15:13:52 +0900
+
+slp-pkgmgr (0.1.19) unstable; urgency=low
+
+ * fix pkgmgr_client - bug fix, pkg_info
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.19
+
+ -- root <sewook7.park@samsung.com> Wed, 01 Dec 2010 20:04:10 +0900
+
+slp-pkgmgr (0.1.18) unstable; urgency=low
+
+ * NULL check on pkg_name in comm_client_request()
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.18
+
+ -- Youmin Ha <youmin.ha@samsung.com> Wed, 24 Nov 2010 21:28:17 +0900
+
+slp-pkgmgr (0.1.17) unstable; urgency=low
+
+ * fix pkgmgr_tool bug, add LOG_TAG
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.17
+
+ -- root <sewook7.park@samsung.com> Wed, 24 Nov 2010 19:46:41 +0900
+
+slp-pkgmgr (0.1.16) unstable; urgency=low
+
+ * fix pkgmgr-client bug
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.16
+
+ -- root <sewook7.park@samsung.com> Thu, 18 Nov 2010 14:52:42 +0900
+
+slp-pkgmgr (0.1.15) unstable; urgency=low
+
+ * remove pkgmgr_frontend_test, pkgmgr_backend_test
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.15
+
+ -- root <sewook7.park@samsung.com> Fri, 12 Nov 2010 14:15:47 +0900
+
+slp-pkgmgr (0.1.14-2) unstable; urgency=low
+
+ * fix pkgmgr-client log
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.14-2
+
+ -- root <sewook7.park@samsung.com> Thu, 11 Nov 2010 14:02:25 +0900
+
+slp-pkgmgr (0.1.14-1) unstable; urgency=low
+
+ * fix pkgmgr-client
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.14-1
+
+ -- root <sewook7.park@samsung.com> Thu, 11 Nov 2010 11:51:15 +0900
+
+slp-pkgmgr (0.1.14) unstable; urgency=low
+
+ * fix pkgmgr-client
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.14
+
+ -- root <sewook7.park@samsung.com> Wed, 10 Nov 2010 14:29:37 +0900
+
+slp-pkgmgr (0.1.13) unstable; urgency=low
+
+ * add activator facility
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.13
+
+ -- Kidong Kim <kd0228.kim@samsung.com> Wed, 10 Nov 2010 10:39:59 +0900
+
+slp-pkgmgr (0.1.12) unstable; urgency=low
+
+ * fix package dependency
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.12
+
+ -- Youmin Ha <youmin.ha@samsung.com> Wed, 10 Nov 2010 09:13:23 +0900
+
+slp-pkgmgr (0.1.11) unstable; urgency=low
+
+ * re-versioning
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.11
+
+ -- Youmin Ha <youmin.ha@samsung.com> Tue, 09 Nov 2010 18:08:06 +0900
+
+slp-pkgmgr (0.1.10-4) unstable; urgency=low
+
+ * fix shared libs' dependencies
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.10-4
+
+ -- Youmin Ha <youmin.ha@samsung.com> Tue, 09 Nov 2010 18:03:25 +0900
+
+slp-pkgmgr (0.1.10-3) unstable; urgency=low
+
+ * Fix build error
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.10-3
+
+ -- root <sewook7.park@samsung.com> Tue, 09 Nov 2010 16:17:42 +0900
+
+slp-pkgmgr (0.1.10-2) unstable; urgency=low
+
+ * Fix pkgmgr-client & pkgmgr-server
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.10-2
+
+ -- root <sewook7.park@samsung.com> Tue, 09 Nov 2010 14:15:58 +0900
+
+slp-pkgmgr (0.1.10-1) unstable; urgency=low
+
+ * Fix pc files
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.10-1
+
+ -- Youmin Ha <youmin.ha@samsung.com> Tue, 09 Nov 2010 11:29:28 +0900
+
+slp-pkgmgr (0.1.10) unstable; urgency=low
+
+ * Free comm_client in libpkgmgr_client.so
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.10
+
+ -- root <sewook7.park@samsung.com> Mon, 08 Nov 2010 20:30:37 +0900
+
+slp-pkgmgr (0.1.9) unstable; urgency=low
+
+ * Make comm* libs to shared libs
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.9
+
+ -- Youmin Ha <youmin.ha@samsung.com> Mon, 08 Nov 2010 15:20:42 +0900
+
+slp-pkgmgr (0.1.8-1) unstable; urgency=low
+
+ * fix PG
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.8-1
+
+ -- Youmin Ha <youmin.ha@samsung.com> Mon, 08 Nov 2010 10:46:06 +0900
+
+slp-pkgmgr (0.1.8) unstable; urgency=low
+
+ * fix client - get_list
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.8
+
+ -- root <youmin.ha@samsung.com> Wed, 03 Nov 2010 12:03:16 +0900
+
+slp-pkgmgr (0.1.7) unstable; urgency=low
+
+ * add listen/broadcast API
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.7
+
+ -- Youmin Ha <youmin.ha@samsung.com> Thu, 28 Oct 2010 17:15:11 +0900
+
+slp-pkgmgr (0.1.6) unstable; urgency=low
+
+ * fix PMS code, which generates argv for backend
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.6
+
+ -- Youmin Ha <youmin.ha@samsung.com> Wed, 27 Oct 2010 19:46:57 +0900
+
+slp-pkgmgr (0.1.5) unstable; urgency=low
+
+ * if PMS_STANDALONE env_var is set, PMS doens't stop.
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.5
+
+ -- Youmin Ha <youmin.ha@samsung.com> Wed, 27 Oct 2010 17:51:03 +0900
+
+slp-pkgmgr (0.1.4) unstable; urgency=low
+
+ * fix auto-activation
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.4
+
+ -- Youmin Ha <youmin.ha@samsung.com> Wed, 27 Oct 2010 17:41:54 +0900
+
+slp-pkgmgr (0.1.3) unstable; urgency=low
+
+ * apply new dbus service/path/interface, fix bug
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.3
+
+ -- Youmin Ha <youmin.ha@samsung.com> Tue, 26 Oct 2010 12:23:54 +0900
+
+slp-pkgmgr (0.1.2-1) unstable; urgency=low
+
+ * fix pc file
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.2-1
+
+ -- Youmin Ha <youmin.ha@samsung.com> Sat, 23 Oct 2010 13:37:57 +0900
+
+slp-pkgmgr (0.1.2) unstable; urgency=low
+
+ * fix bug in pkgmgr-server
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.2
+
+ -- Youmin Ha <youmin.ha@samsung.com> Wed, 20 Oct 2010 16:38:58 +0900
+
+slp-pkgmgr (0.1.1-5) unstable; urgency=low
+
+ * install comm_config.h
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.1-5
+
+ -- Youmin Ha <youmin.ha@samsung.com> Mon, 18 Oct 2010 20:45:10 +0900
+
+slp-pkgmgr (0.1.1-4) unstable; urgency=low
+
+ * Fix build flags
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.1-4
+
+ -- Youmin Ha <youmin.ha@samsung.com> Mon, 18 Oct 2010 20:19:57 +0900
+
+slp-pkgmgr (0.1.1-3) unstable; urgency=low
+
+ * change max pkg name length
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.1-3
+
+ -- Kidong Kim <kd0228.kim@samsung.com> Mon, 18 Oct 2010 19:42:01 +0900
+
+slp-pkgmgr (0.1.1-2) unstable; urgency=low
+
+ * fix wrong version of dependent package
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.1-2
+
+ -- Youmin Ha <youmin.ha@samsung.com> Mon, 18 Oct 2010 19:22:14 +0900
+
+slp-pkgmgr (0.1.1-1) unstable; urgency=low
+
+ * fix build-dependency
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.1-1
+
+ -- Youmin Ha <youmin.ha@samsung.com> Mon, 18 Oct 2010 18:07:37 +0900
+
+slp-pkgmgr (0.1.1) unstable; urgency=low
+
+ * Release first version
+ * Git: 165.213.180.234:/git/slp/pkgs/slp-pkgmgr
+ * Tag: slp-pkgmgr_0.1.1
+
+ -- Youmin Ha <youmin.ha@samsung.com> Mon, 18 Oct 2010 18:07:37 +0900
+
+slp-pkgmgr (0.1.0) unstable; urgency=low
* Initial Release.
- * Git: pkgs/s/slp-pkgmgr
- * Tag: slp-pkgmgr_0.1.100-2
- -- Sewook Park <sewook7.park@samsung.com> Wed, 07 Dec 2011 12:55:49 +0900
+ -- Kidong Kim <kd0228.kim@samsung.com> Thu, 16 Sep 2010 09:31:11 +0900
Source: slp-pkgmgr
Priority: extra
Maintainer: Sewook Park <sewook7.park@samsung.com>, Youmin Ha <youmin.ha@samsung.com>
-Build-Depends: debhelper (>= 5), autotools-dev, libsecurity-server-client-dev, libdbus-1-dev, libdbus-glib-1-dev, libecore-dev, dlog-dev, libaul-1-dev, libail-0-dev, libappcore-efl-dev
+Build-Depends: debhelper (>= 5), autotools-dev, libsecurity-server-client-dev, libdbus-1-dev, libdbus-glib-1-dev, libecore-dev, dlog-dev, libaul-1-dev, libail-0-dev, libappcore-efl-dev, libxml2-dev
Standards-Version: 3.7.2
Section: base
Package: libpkgmgr-client-dev
Section: libdevel
Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, libpkgmgr-client-0 (= ${Source-Version}), libecore-dev, libsecurity-server-client-dev, libaul-1-dev, libail-0-dev, libpkgmgr-types-dev(>= ${Source-Version}), libpkgmgr-installer-dev (>= ${Source-Version})
+Depends: ${shlibs:Depends}, ${misc:Depends}, libpkgmgr-client-0 (= ${Source-Version}), libecore-dev, libsecurity-server-client-dev, libaul-1-dev, libail-0-dev, libpkgmgr-types-dev(>= ${Source-Version}), libpkgmgr-installer-dev (>= ${Source-Version}), libpkgmgr-parser-dev (>= ${Source-Version})
Description: Package Manager client library develpoment package
Package: libpkgmgr-client-0
Section: libs
Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, libpkgmgr-installer (>= ${Source-Version}), pkgmgr-server (>= ${Source-Version})
+Depends: ${shlibs:Depends}, ${misc:Depends}, libpkgmgr-installer (>= ${Source-Version}), libpkgmgr-parser (>= ${Source-Version}), pkgmgr-server (>= ${Source-Version})
Description: Packager Manager client library package
Package: pkgmgr-server
Section: libs
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: Library for installer frontend/backend.
+Description: Library for installer backend.
Package: libpkgmgr-installer-dev
Section: libdevel
Depends: libpkgmgr-installer (= ${Source-Version}),
Description: Dev package for libpkgmgr-installer
+Package: libpkgmgr-parser
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Parser Library for installer backend.
+
+Package: libpkgmgr-parser-dev
+Section: libdevel
+Architecture: any
+Depends: libpkgmgr-parser (= ${Source-Version}),
+Description: Dev package for libpkgmgr-parser
+
Package: libpkgmgr-types-dev
Section: libdevel
Architecture: any
@PREFIX@/etc/package-manager/pkg_path.conf
@PREFIX@/bin/pkgcmd
@PREFIX@/bin/pkgmgr-install
-/opt/share/applications/*.desktop
+@PREFIX@/share/applications/*.desktop
@PREFIX@/share/mime/packages/*.xml
- Install request with return callback function
@code
-// the package path is "/opt/apps/org.tizen.hello.deb"
+// the package path is "/opt/usr/apps/org.tizen.hello.deb"
#include <package-manager.h>
int static return_cb(pkg_request_id req_id, const char *pkg_type, const char *pkg_name, const char *key, const char *val, const void *pmsg, void *data)
return -1;
}
- result = pkgmgr_client_install(pc, NULL, des, "/opt/apps/org.tizen.hello.deb", NULL, PM_DEFAULT, return_cb, pc);
+ result = pkgmgr_client_install(pc, NULL, des, "/opt/usr/apps/org.tizen.hello.deb", NULL, PM_DEFAULT, return_cb, pc);
if(result < 0) {
fprintf(stderr, "Install failed! %d\n", result);
return -1;
--- /dev/null
+../client/include/pkgmgr-dbinfo.h
\ No newline at end of file
include(FindPkgConfig)
-pkg_check_modules(security_pkgs security-server)
+pkg_check_modules(parser_pkgs REQUIRED dlog libxml-2.0)
+
+foreach(flag ${parser_pkgs_CFLAGS})
+ set(parser_pkgs_CFLAGS_str "${parser_pkgs_CFLAGS_str} ${flag}")
+endforeach()
add_executable(pkgmgr_backend_sample
sample_backend.c)
add_library(pkgmgr_backend_lib_sample SHARED
sample_backendlib.c)
+add_library(pkgmgr_parser_lib_sample SHARED
+ sample_parserlib.c)
+set_target_properties(pkgmgr_parser_lib_sample PROPERTIES COMPILE_FLAGS "${parser_pkgs_CFLAGS_str}")
+target_link_libraries(pkgmgr_parser_lib_sample ${parser_pkgs_LDFLAGS})
+
install(TARGETS pkgmgr_backend_sample
DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
DESTINATION lib
COMPONENT RuntimeLibraries
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
+
+install(TARGETS pkgmgr_parser_lib_sample
+ DESTINATION lib
+ COMPONENT RuntimeLibraries
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
static int __confirm_ui(void *data, char *msg);
static int __install_package(const char *pkg_file_path);
-static int __uninstall_package(const char *pkg_name);
+static int __uninstall_package(const char *pkgid);
static int __recover_package_system(void);
static pkgmgr_installer *_pi;
return 0;
}
-static int __uninstall_package(const char *pkg_name)
+static int __uninstall_package(const char *pkgid)
{
return 0;
}
-static int __clear_package(const char *pkg_name)
+static int __clear_package(const char *pkgid)
{
return 0;
}
#include "package-manager-plugin.h"
static void pkg_native_plugin_on_unload(void);
-static int pkg_plugin_app_is_installed(const char *pkg_name);
+static int pkg_plugin_app_is_installed(const char *pkgid);
static int pkg_plugin_get_installed_apps_list(const char *category,
const char *option,
package_manager_pkg_info_t **
list, int *count);
-static int pkg_plugin_get_app_detail_info(const char *pkg_name,
+static int pkg_plugin_get_app_detail_info(const char *pkgid,
package_manager_pkg_detail_info_t *
pkg_detail_info);
static int pkg_plugin_get_app_detail_info_from_package(const char *pkg_path,
printf("pkg_native_plugin_unload() is called\n");
}
-static int pkg_plugin_app_is_installed(const char *pkg_name)
+static int pkg_plugin_app_is_installed(const char *pkgid)
{
printf("pkg_plugin_app_is_installed() is called\n");
return 0;
}
-static int pkg_plugin_get_app_detail_info(const char *pkg_name,
+static int pkg_plugin_get_app_detail_info(const char *pkgid,
package_manager_pkg_detail_info_t *
pkg_detail_info)
{
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+
+
+
+
+/* sample_parserlib.c
+ * test package
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <libxml/xmlreader.h>
+
+/* debug output */
+#include <dlog.h>
+#undef LOG_TAG
+#define LOG_TAG "PKGMGR_PARSER"
+
+#define DBGE(fmt, arg...) LOGE("[%s,%d] "fmt, __FUNCTION__, __LINE__, ##arg)
+#define DBGI(fmt, arg...) LOGD("[%s,%d] "fmt, __FUNCTION__, __LINE__, ##arg)
+
+
+static void
+print_element_names(xmlNode * a_node)
+{
+ xmlNode *cur_node = NULL;
+
+ for (cur_node = a_node; cur_node; cur_node = cur_node->next) {
+ if (cur_node->type == XML_ELEMENT_NODE) {
+ DBGI("node type: Element, name: %s\n", cur_node->name);
+ }
+
+ print_element_names(cur_node->children);
+ }
+}
+
+
+__attribute__ ((visibility("default")))
+int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr)
+{
+ xmlNode *root_element = NULL;
+
+ xmlTextReaderPtr reader = xmlReaderWalker(docPtr);
+ if(reader != NULL) {
+ int ret = xmlTextReaderRead(reader);
+ while(ret == 1) {
+ const xmlChar *name;
+ name = xmlTextReaderConstName(reader);
+ DBGI("name %s", name?name:"NULL");
+ ret = xmlTextReaderRead(reader);
+ }
+ xmlFreeTextReader(reader);
+
+ if(ret != 0) {
+ DBGE("failed to parse");
+ }
+ }
+
+ /*Get the root element node */
+ root_element = xmlFirstElementChild(xmlDocGetRootElement(docPtr));
+
+ print_element_names(root_element);
+
+ return 0;
+}
+
[D-BUS Service]
+User=root
Name=org.tizen.slp.pkgmgr
-Exec=@PREFIX@/bin/pkgmgr-server
+Exec=@PREFIX@/bin/env DISPLAY=:0 @PREFIX@/bin/pkgmgr-server
#sbs-git:slp/pkgs/s/slp-pkgmgr pkgmgr 0.1.103 29b53909a5d6e8728429f0a188177eac691cb6ce
Name: pkgmgr
Summary: Packager Manager client library package
-Version: 0.1.104
+Version: 0.2.28
Release: 1
-Group: TO_BE/FILLED_IN
-License: LGPL
+Group: System/Libraries
+License: Apache License, Version 2.0
Source0: %{name}-%{version}.tar.gz
BuildRequires: cmake
BuildRequires: gettext-tools
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(dbus-glib-1)
BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(aul)
BuildRequires: pkgconfig(ail)
+BuildRequires: pkgconfig(bundle)
BuildRequires: pkgconfig(appcore-efl)
+BuildRequires: pkgconfig(pkgmgr-info)
+BuildRequires: pkgmgr-info-parser-devel
+BuildRequires: pkgmgr-info-parser
%description
Requires: %{name} = %{version}-%{release}
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
+Requires: shared-mime-info
%description client
Package Manager client library develpoment package for packaging
%description installer-devel
Dev package for libpkgmgr-installer for packaging.
+
%package types-devel
-Summary: Package Manager client types develpoment package
+Summary: Package Manager manifest parser develpoment package
Group: TO_BE/FILLED_IN
Requires: %{name} = %{version}-%{release}
%post
/sbin/ldconfig
-mkdir -p /usr/etc/package-manager/frontend
mkdir -p /usr/etc/package-manager/backend
+mkdir -p /usr/etc/package-manager/backendlib
# For pkgmgr-install:
# Update mime database to support package mime types
%postun installer -p /sbin/ldconfig
%files
+%manifest pkgmgr.manifest
%defattr(-,root,root,-)
%{_bindir}/pkgcmd
+%{_bindir}/pkg_initdb
+%{_bindir}/pkginfo
+%{_bindir}/pkgmgr-install
+%{_datadir}/packages/org.tizen.pkgmgr-install.xml
+%{_datadir}/mime/packages/mime.wac.xml
+%{_datadir}/mime/packages/mime.tpk.xml
+%{_libdir}/libpkgmgr_parser_lib_sample.so
%exclude %{_bindir}/pkgmgr_backend_sample
-%exclude %{_bindir}/pkgmgr_backend_test
-%exclude %{_bindir}/pkgmgr_frontend_sample
-%exclude %{_bindir}/pkgmgr_frontend_test
%exclude %{_includedir}/pkgmgr/comm_client.h
%exclude %{_includedir}/pkgmgr/comm_config.h
%exclude %{_includedir}/pkgmgr/comm_status_broadcast_server.h
%exclude /usr/etc/package-manager/server/queue_status
%files client
+%manifest pkgmgr-client.manifest
%defattr(-,root,root,-)
%{_prefix}/etc/package-manager/pkg_path.conf
-%{_datadir}/mime/packages/mime.wac.xml
-%{_bindir}/pkgmgr-install
%{_libdir}/libpkgmgr-client.so.*
-/opt/share/applications/org.tizen.pkgmgr-install.desktop
%files client-devel
%defattr(-,root,root,-)
%{_includedir}/package-manager.h
+%{_includedir}/pkgmgr-dbinfo.h
%{_libdir}/pkgconfig/pkgmgr.pc
%{_libdir}/libpkgmgr-client.so
%files server
+%manifest pkgmgr-server.manifest
%defattr(-,root,root,-)
%{_datadir}/dbus-1/services/org.tizen.slp.pkgmgr.service
%{_bindir}/pkgmgr-server
%{_datadir}/locale/*/LC_MESSAGES/*.mo
%files installer
+%manifest pkgmgr-installer.manifest
%defattr(-,root,root,-)
%{_libdir}/libpkgmgr_installer.so.*
%{_libdir}/libpkgmgr_installer_status_broadcast_server.so.*
%{_libdir}/libpkgmgr_installer_client.so
%{_libdir}/libpkgmgr_installer_status_broadcast_server.so
+
%files types-devel
%defattr(-,root,root,-)
%{_includedir}/package-manager-types.h
# usage
-# frontend:directory_path
# backend:directory_path
-frontend:/usr/etc/package-manager/frontend/
+# backendlib:directory_path
+
backend:/usr/etc/package-manager/backend/
-backendlib:/usr/etc/package-manager/backendlib/
\ No newline at end of file
+backendlib:/usr/etc/package-manager/backendlib/
--- /dev/null
+<manifest>
+ <define>
+ <domain name="pkgmgr-client"/>
+ <provide>
+ <label name="pkgmgr-client::db"/>
+ </provide>
+ </define>
+ <request>
+ <domain name="pkgmgr-client"/>
+ </request>
+ <assign>
+ <filesystem path="/usr/lib/libpkgmgr-client.so.0" label="_"/>
+ <filesystem path="/usr/lib/libpkgmgr-client.so.0.1.68" label="_"/>
+ </assign>
+</manifest>
--- /dev/null
+<manifest>
+ <define>
+ <domain name="pkgmgr-installer"/>
+ </define>
+ <request>
+ <domain name="pkgmgr-installer"/>
+ </request>
+ <assign>
+ <filesystem path="/usr/lib/libpkgmgr_installer.so.0" label="_"/>
+ <filesystem path="/usr/lib/libpkgmgr_installer.so.0.1.0" label="_"/>
+ <filesystem path="/usr/lib/libpkgmgr_installer_client.so.0" label="_"/>
+ <filesystem path="/usr/lib/libpkgmgr_installer_client.so.0.1.0" label="_"/>
+ <filesystem path="/usr/lib/libpkgmgr_installer_status_broadcast_server.so.0" label="_"/>
+ <filesystem path="/usr/lib/libpkgmgr_installer_status_broadcast_server.so.0.1.0" label="_"/>
+ </assign>
+</manifest>
--- /dev/null
+<manifest>
+ <define>
+ <domain name="pkgmgr-parser"/>
+ </define>
+ <request>
+ <domain name="pkgmgr-parser"/>
+ </request>
+ <assign>
+ <filesystem path="/usr/lib/libpkgmgr_parser.so.0" label="_"/>
+ <filesystem path="/usr/lib/libpkgmgr_parser.so.0.1.0" label="_"/>
+ <filesystem path="/usr/lib/libpkgmgr_parser_lib_sample.so" label="_"/>
+ </assign>
+</manifest>
--- /dev/null
+<manifest>
+ <define>
+ <domain name="pkgmgr-server"/>
+ </define>
+ <request>
+ <domain name="pkgmgr-server"/>
+ </request>
+ <assign>
+ <filesystem path="/usr/bin/pkgmgr-server" exec_label="pkgmgr-server"/>
+ </assign>
+</manifest>
--- /dev/null
+<manifest>
+ <define>
+ <domain name="pkgmgr"/>
+ </define>
+ <request>
+ <domain name="pkgmgr"/>
+ </request>
+ <assign>
+ <filesystem path="/usr/bin/pkg_initdb" exec_label="pkgmgr"/>
+ <filesystem path="/usr/bin/pkgcmd" exec_label="pkgmgr"/>
+ <filesystem path="/usr/bin/pkginfo" exec_label="pkgmgr"/>
+ <filesystem path="/usr/lib/libpkgmgr_parser_lib_sample.so" label="_"/>
+ </assign>
+</manifest>
Name: package manager
Description: SLP Package Manager Package
Version: @VERSION@
-Requires: security-server dlog pkgmgr-types pkgmgr-installer-client pkgmgr-installer-status-broadcast-server aul
+Requires: security-server dlog pkgmgr-types pkgmgr-installer-client pkgmgr-installer-status-broadcast-server
Libs: -L${libdir} -L${libdir}/pkgmgr -lpkgmgr-client
Cflags: -I${includedir}
char req_id[MAX_REQ_ID_LEN];
int req_type;
char pkg_type[MAX_PKG_TYPE_LEN];
- char pkg_name[MAX_PKG_NAME_LEN];
+ char pkgid[MAX_PKG_NAME_LEN];
char args[MAX_PKG_ARGS_LEN];
char cookie[MAX_COOKIE_LEN];
} pm_dbus_msg;
+typedef struct backend_info_t {
+ int pid;
+ char pkgtype[MAX_PKG_TYPE_LEN];
+ char pkgid[MAX_PKG_NAME_LEN];
+ char args[MAX_PKG_ARGS_LEN];
+}backend_info;
struct pm_inotify_paths_t {
int wd;
struct _pm_queue_data *next;
} pm_queue_data;
-void _pm_queue_init();
-void _pm_queue_push(pm_dbus_msg item);
-pm_dbus_msg _pm_queue_pop();
-pm_dbus_msg _pm_queue_get_head();
+typedef struct queue_info_map_t {
+ char pkgtype[MAX_PKG_TYPE_LEN];
+ char backend[MAX_PKG_NAME_LEN];
+ int queue_slot;
+ pm_queue_data *head;
+} queue_info_map;
+
+#define MAX_QUEUE_NUM 128
+
+int _pm_queue_init();
+int _pm_queue_push(pm_dbus_msg *item);
+/*position specifies the queue from which to pop request*/
+pm_dbus_msg *_pm_queue_pop(int position);
void _pm_queue_final();
-void _pm_queue_delete(pm_dbus_msg item);
+void _pm_queue_delete(pm_dbus_msg *item);
pm_queue_data *_add_node();
-void _save_queue_status(pm_dbus_msg item, char *status);
-void _print_queue();
+void _save_queue_status(pm_dbus_msg *item, char *status);
+void _print_queue(int position);
#endif /* _PM_QUEUE_H_ */
#include <Ecore_File.h>
#include <ail.h>
+#include <X11/Xatom.h>
+#include <X11/Xutil.h>
+
#include "pkgmgr_installer.h"
#include "comm_pkg_mgr_server.h"
#include "pkgmgr-server.h"
#undef LOG_TAG
#define LOG_TAG "PKGMGR_SERVER"
-#define DBGE(fmt, arg...) LOGE("[%s,%d] "fmt, __FUNCTION__, __LINE__, ##arg)
-#define DBG(fmt, arg...) LOGD("[%s,%d] "fmt, __FUNCTION__, __LINE__, ##arg)
+#define DBGE(fmt, arg...) LOGE(fmt,##arg)
+#define DBG(fmt, arg...) LOGD(fmt,##arg)
#endif
#if !defined(PACKAGE)
* before the db is updated. */
int ail_db_update = 1;
+/*
+8 bit value to represent maximum 8 backends.
+Each bit position corresponds to a queue slot which
+is dynamically determined.
+*/
+char backend_busy = 0;
+/*
+8 bit value to represent quiet mode operation for maximum 8 backends
+1->quiet 0->non-quiet
+Each bit position corresponds to a queue slot which
+is dynamically determined.
+*/
+char backend_mode = 63; /*00111111*/
+extern int num_of_backends;
+
+backend_info *begin;
+extern queue_info_map *start;
+extern int entries;
+int pos = 0;
+/*To store info in case of backend crash*/
+char pname[MAX_PKG_NAME_LEN] = {'\0'};
+char ptype[MAX_PKG_TYPE_LEN] = {'\0'};
+char args[MAX_PKG_ARGS_LEN] = {'\0'};
+
GMainLoop *mainloop = NULL;
-static const char *activate_cmd = "/usr/bin/activator";
/* operation_type */
typedef enum {
pm_desktop_notifier desktop_notifier;
pm_inotify_paths paths[DESKTOP_FILE_DIRS_NUM];
-
-static
-void response_cb(void *data, Evas_Object *notify, void *event_info);
-static
-int create_popup(struct appdata *ad);
+static int __check_backend_status_for_exit();
+static int __check_queue_status_for_exit();
+static int __check_backend_mode();
+static int __is_backend_busy(int position);
+static void __set_backend_busy(int position);
+static void __set_backend_free(int position);
+static int __is_backend_mode_quiet(int position);
+static void __set_backend_mode(int position);
+static void __unset_backend_mode(int position);
+static void response_cb1(void *data, Evas_Object *notify, void *event_info);
+static void response_cb2(void *data, Evas_Object *notify, void *event_info);
+static int create_popup(struct appdata *ad);
static void sighandler(int signo);
+static int __get_position_from_pkg_type(char *pkgtype);
gboolean queue_job(void *data);
+gboolean send_fail_signal(void *data);
+gboolean exit_server(void *data);
static Eina_Bool __directory_notify(void *data, Ecore_Fd_Handler *fd_handler);
+/* To check whether a particular backend is free/busy*/
+static int __is_backend_busy(int position)
+{
+ return backend_busy & 1<<position;
+}
+/*To set a particular backend as busy*/
+static void __set_backend_busy(int position)
+{
+ backend_busy = backend_busy | 1<<position;
+}
+/*To set a particular backend as free */
+static void __set_backend_free(int position)
+{
+ backend_busy = backend_busy & ~(1<<position);
+}
+/* To check whether a particular backend is running in quiet mode*/
+static int __is_backend_mode_quiet(int position)
+{
+ return backend_mode & 1<<position;
+}
+/*To set a particular backend mode as quiet*/
+static void __set_backend_mode(int position)
+{
+ backend_mode = backend_mode | 1<<position;
+}
+/*To unset a particular backend mode */
+static void __unset_backend_mode(int position)
+{
+ backend_mode = backend_mode & ~(1<<position);
+}
+
+static int __get_position_from_pkg_type(char *pkgtype)
+{
+ int i = 0;
+ queue_info_map *ptr;
+ ptr = start;
+ for(i = 0; i < entries; i++)
+ {
+ if (!strncmp(ptr->pkgtype, pkgtype, MAX_PKG_TYPE_LEN))
+ return ptr->queue_slot;
+ else
+ ptr++;
+
+ }
+ return -1;
+}
+
static Eina_Bool __directory_notify(void *data, Ecore_Fd_Handler *fd_handler)
{
ail_db_update = 0;
return ECORE_CALLBACK_RENEW;
}
- buf = malloc(read_size);
+ buf = calloc(1, read_size+1);
if (!buf) {
DBG("Failed to allocate memory for event handling\n");
ail_db_update = 1;
return ECORE_CALLBACK_CANCEL;
}
+ buf[len] = 0;
+
while (i < len) {
struct inotify_event *event = (struct inotify_event*) &buf[i];
char *str_potksed = "potksed.";
continue;
cut = strstr(package, ".desktop");
- *cut = '\0';
+ if (cut)
+ *cut = '\0';
DBG("Package : %s\n", package);
/* add & update */
- if (event->mask & IN_CREATE || event->mask & IN_CLOSE_WRITE ||
- event->mask & IN_MOVED_TO) {
+ if (event->mask & IN_CLOSE_WRITE || event->mask & IN_MOVED_TO) {
ail_appinfo_h ai = NULL;
ail_error_e ret;
}
static
-void response_cb(void *data, Evas_Object *notify, void *event_info)
+void response_cb1(void *data, Evas_Object *notify, void *event_info)
{
struct appdata *ad = (struct appdata *)data;
-
+ int p = 0;
+ int ret = 0;
DBG("start of response_cb()\n");
- if ((int)event_info == ELM_POPUP_RESPONSE_OK) { /* YES */
- DBG("Uninstalling... [%s]\n", ad->item->pkg_name);
+ /* YES */
+ DBG("Uninstalling... [%s]\n", ad->item->pkgid);
- if (strlen(ad->item->pkg_name) == 0) {
- DBG("package_name is empty\n");
- }
+ if (strlen(ad->item->pkgid) == 0) {
+ DBG("package_name is empty\n");
+ }
- if (strlen(ad->item->pkg_type) == 0) {
- DBG("Fail : Uninstalling... [%s]\n",
- ad->item->pkg_name);
- free(ad->item);
- evas_object_del(ad->notify);
- evas_object_del(ad->win);
- drawing_popup = 0;
+ if (strlen(ad->item->pkg_type) == 0) {
+ DBG("Fail : Uninstalling... [%s]\n",
+ ad->item->pkgid);
+ free(ad->item);
+ evas_object_del(ad->notify);
+ evas_object_del(ad->win);
+ drawing_popup = 0;
- return;
- }
+ return;
+ }
- DBG("pkg_type = [%s]\n", ad->item->pkg_type);
+ DBG("pkg_type = [%s]\n", ad->item->pkg_type);
- _pm_queue_push(*(ad->item));
+ ret = _pm_queue_push(ad->item);
+ p = __get_position_from_pkg_type(ad->item->pkg_type);
+ __unset_backend_mode(p);
- } else { /* NO */
- pkgmgr_installer *pi;
- gboolean ret_parse;
- gint argcp;
- gchar **argvp;
- GError *gerr = NULL;
+ /* Free resource */
+ free(ad->item);
+ evas_object_del(ad->notify);
+ evas_object_del(ad->win);
+ /***************/
+ if (ret == 0)
+ g_idle_add(queue_job, NULL);
- pi = pkgmgr_installer_new();
- if (!pi) {
- DBG("Failure in creating the pkgmgr_installer object");
- return;
- }
+ DBG("end of response_cb()\n");
- ret_parse = g_shell_parse_argv(ad->item->args,
- &argcp, &argvp, &gerr);
- if (FALSE == ret_parse) {
- DBG("Failed to split args: %s", ad->item->args);
- DBG("messsage: %s", gerr->message);
- pkgmgr_installer_free(pi);
- return;
- }
+ drawing_popup = 0;
- pkgmgr_installer_receive_request(pi, argcp, argvp);
+ return;
+}
- pkgmgr_installer_send_signal(pi, ad->item->pkg_type,
- ad->item->pkg_name, "end",
- "cancel");
+static
+void response_cb2(void *data, Evas_Object *notify, void *event_info)
+{
+ int p = 0;
+ struct appdata *ad = (struct appdata *)data;
+ DBG("start of response_cb()\n");
+
+ /* NO */
+ pkgmgr_installer *pi;
+ gboolean ret_parse;
+ gint argcp;
+ gchar **argvp;
+ GError *gerr = NULL;
+
+ pi = pkgmgr_installer_new();
+ if (!pi) {
+ DBG("Failure in creating the pkgmgr_installer object");
+ return;
+ }
+
+ ret_parse = g_shell_parse_argv(ad->item->args,
+ &argcp, &argvp, &gerr);
+ if (FALSE == ret_parse) {
+ DBG("Failed to split args: %s", ad->item->args);
+ DBG("messsage: %s", gerr->message);
pkgmgr_installer_free(pi);
+ return;
}
+ pkgmgr_installer_receive_request(pi, argcp, argvp);
+
+ pkgmgr_installer_send_signal(pi, ad->item->pkg_type,
+ ad->item->pkgid, "end",
+ "cancel");
+
+ pkgmgr_installer_free(pi);
+ p = __get_position_from_pkg_type(ad->item->pkg_type);
+ __set_backend_mode(p);
+
/* Free resource */
free(ad->item);
evas_object_del(ad->notify);
evas_object_del(ad->win);
/***************/
-
- g_idle_add(queue_job, NULL);
+ /* queue_job should be called for every request that is pushed
+ into queue. In "NO" case, request is not pushed so no need of
+ calling queue_job*/
DBG("end of response_cb()\n");
return;
}
-static char *__get_exe_path(const char *pkg_name)
+
+static char *__get_exe_path(const char *pkgid)
{
ail_appinfo_h handle;
ail_error_e ret;
char *str;
char *exe_path;
- ret = ail_package_get_appinfo(pkg_name, &handle);
+ ret = ail_package_get_appinfo(pkgid, &handle);
if (ret != AIL_ERROR_OK) {
DBGE("ail_package_get_appinfo() failed");
return NULL;
ret = ail_package_destroy_appinfo(handle);
if (ret != AIL_ERROR_OK) {
DBGE("ail_package_destroy_appinfo() failed");
+ free(exe_path);
return NULL;
}
return exe_path;
}
+
+static int __X_rotate_disable_focus(Display *dpy, Window win)
+{
+ XWMHints *hints;
+
+ hints = XAllocWMHints();
+ if (!hints) return -1;
+
+ hints->flags = InputHint | StateHint;
+ hints->input = 0;
+ hints->initial_state = NormalState;
+
+ XSetWMHints(dpy, win, hints);
+ XFree(hints);
+
+ return 0;
+}
+
+static int __X_rotate_get_window_property(Display *dpy, Window win, Atom atom,
+ Atom type, unsigned int *val,
+ unsigned int len)
+{
+ unsigned char *prop_ret;
+ Atom type_ret;
+ unsigned long bytes_after;
+ unsigned long num_ret;
+ int format_ret;
+ unsigned int i;
+ int num;
+
+ prop_ret = NULL;
+ if (XGetWindowProperty(dpy, win, atom, 0, 0x7fffffff, False,
+ type, &type_ret, &format_ret, &num_ret,
+ &bytes_after, &prop_ret) != Success)
+ return -1;
+
+ if (type_ret != type || format_ret != 32)
+ num = -1;
+ else if (num_ret == 0 || !prop_ret)
+ num = 0;
+ else {
+ if (num_ret < len)
+ len = num_ret;
+ for (i = 0; i < len; i++) {
+ val[i] = ((unsigned long *)prop_ret)[i];
+ }
+ num = len;
+ }
+
+ if (prop_ret)
+ XFree(prop_ret);
+
+ return num;
+}
+
+static int __X_rotate_get_rotation(Display *dpy)
+{
+ Window active_win;
+ Window root_win;
+ int rotation = -1;
+ int ret;
+
+ int angles[2];
+
+ Atom atom_active_win;
+ Atom atom_win_rotate_angle;
+
+ root_win = XDefaultRootWindow(dpy);
+
+ atom_active_win = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
+ ret = __X_rotate_get_window_property(dpy, root_win, atom_active_win,
+ XA_WINDOW,
+ (unsigned int *)&active_win, 1);
+ if (ret < 0)
+ return ret;
+
+ atom_win_rotate_angle =
+ XInternAtom(dpy, "_E_ILLUME_ROTATE_ROOT_ANGLE", False);
+ ret = __X_rotate_get_window_property(dpy, root_win,
+ atom_win_rotate_angle, XA_CARDINAL,
+ (unsigned int *)&rotation, 1);
+
+ if (ret != -1)
+ return rotation;
+
+ return -1;
+}
+
+static int __X_rotate_do_rotation(Window win)
+{
+ Display *d;
+ int rotation;
+
+ d = XOpenDisplay(NULL);
+
+ rotation = __X_rotate_get_rotation(d);
+
+ if (rotation == -1) {
+ rotation = 0;
+ }
+
+ if (rotation >= 0)
+ elm_win_rotation_with_resize_set(win, rotation);
+
+ XCloseDisplay(d);
+
+ return 0;
+}
+
+static Eina_Bool __X_rotate_cb(void *data, int type, void *event)
+{
+ Window win = (Window)data;
+ Ecore_X_Event_Client_Message *ev = event;
+
+ if (!event)
+ return ECORE_CALLBACK_RENEW;
+
+ if (ev->message_type == ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE)
+ __X_rotate_do_rotation(win);
+
+ return ECORE_CALLBACK_RENEW;
+}
+
static
int create_popup(struct appdata *ad)
{
drawing_popup = 1;
char sentence[MAX_PKG_ARGS_LEN] = { '\0' };
- char *pkg_name = NULL;
+ char *pkgid = NULL;
char app_name[MAX_PKG_NAME_LEN] = { '\0' };
ad->win = elm_win_add(NULL, PACKAGE, ELM_WIN_DIALOG_BASIC);
if (rotation != -1)
elm_win_rotation_with_resize_set(ad->win, rotation);
+ __X_rotate_disable_focus(ecore_x_display_get(), ad->win);
+
+ ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE,
+ __X_rotate_cb, ad->win);
+
double s;
s = w / DESKTOP_W;
- elm_scale_set(s);
+ elm_config_scale_set(s);
evas_object_show(ad->win);
}
/* Sentence of popup */
- pkg_name = strrchr(ad->item->pkg_name, '/') == NULL ?
- ad->item->pkg_name : strrchr(ad->item->pkg_name, '/') + 1;
+ pkgid = strrchr(ad->item->pkgid, '/') == NULL ?
+ ad->item->pkgid : strrchr(ad->item->pkgid, '/') + 1;
if (ad->op_type == OPERATION_INSTALL) {
snprintf(sentence, sizeof(sentence) - 1, _("Install?"));
ail_appinfo_h handle;
ail_error_e ret;
char *str;
- ret = ail_package_get_appinfo(pkg_name, &handle);
+ ret = ail_package_get_appinfo(pkgid, &handle);
if (ret != AIL_ERROR_OK) {
drawing_popup = 0;
evas_object_del(ad->notify);
return -1;
}
- pkg_name = app_name;
+ pkgid = app_name;
snprintf(sentence, sizeof(sentence) - 1, _("Uninstall?"));
} else
snprintf(sentence, sizeof(sentence) - 1, _("Invalid request"));
- elm_popup_title_label_set(ad->notify, pkg_name);
+ elm_object_part_text_set(ad->notify, "title,text", pkgid);
evas_object_size_hint_weight_set(ad->notify, EVAS_HINT_EXPAND,
EVAS_HINT_EXPAND);
-/* elm_popup_mode_set(ad->notify, ELM_POPUP_TYPE_ALERT); */
evas_object_show(ad->notify);
/***********************************/
- elm_popup_desc_set(ad->notify, sentence);
+ elm_object_text_set(ad->notify, sentence);
+
+ Evas_Object *button1 = NULL;
+ Evas_Object *button2 = NULL;
- elm_popup_buttons_add(ad->notify, 2,
- dgettext("sys_string", "IDS_COM_SK_YES"),
- ELM_POPUP_RESPONSE_OK, dgettext("sys_string",
- "IDS_COM_SK_NO"),
- ELM_POPUP_RESPONSE_CANCEL, NULL);
- evas_object_smart_callback_add(ad->notify,
- "response", response_cb, ad);
+ button1 = elm_button_add(ad->notify);
+ elm_object_text_set(button1, dgettext("sys_string", "IDS_COM_SK_YES"));
+ elm_object_part_content_set(ad->notify, "button1", button1);
+ evas_object_smart_callback_add(button1, "clicked", response_cb1, ad);
+
+ button2 = elm_button_add(ad->notify);
+ elm_object_text_set(button2, dgettext("sys_string", "IDS_COM_SK_NO"));
+ elm_object_part_content_set(ad->notify, "button2", button2);
+ evas_object_smart_callback_add(button2, "clicked", response_cb2, ad);
evas_object_show(ad->notify);
return 0;
}
+gboolean send_fail_signal(void *data)
+{
+ DBG("send_fail_signal start\n");
+ gboolean ret_parse;
+ gint argcp;
+ gchar **argvp;
+ GError *gerr = NULL;
+ pkgmgr_installer *pi;
+ pi = pkgmgr_installer_new();
+ if (!pi) {
+ DBG("Failure in creating the pkgmgr_installer object");
+ return FALSE;
+ }
+ ret_parse = g_shell_parse_argv(args,
+ &argcp, &argvp, &gerr);
+ if (FALSE == ret_parse) {
+ DBG("Failed to split args: %s", args);
+ DBG("messsage: %s", gerr->message);
+ pkgmgr_installer_free(pi);
+ return FALSE;
+ }
+
+ pkgmgr_installer_receive_request(pi, argcp, argvp);
+ pkgmgr_installer_send_signal(pi, ptype, pname, "end", "fail");
+ pkgmgr_installer_free(pi);
+ return FALSE;
+}
+
static void sighandler(int signo)
{
int status;
- pid_t pid;
-
- while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
- DBG("child exit [%d]\n", pid);
+ pid_t cpid;
+ int i = 0;
+ backend_info *ptr = NULL;
+ ptr = begin;
+
+ while ((cpid = waitpid(-1, &status, WNOHANG)) > 0) {
+ DBG("child exit [%d]\n", cpid);
+ if (WIFEXITED(status)) {
+ DBG("child NORMAL exit [%d]\n", cpid);
+ for(i = 0; i < num_of_backends; i++)
+ {
+ if (cpid == (ptr + i)->pid) {
+ __set_backend_free(i);
+ __set_backend_mode(i);
+ break;
+ }
+ }
+ }
+ else if (WIFSIGNALED(status)) {
+ DBG("child SIGNALED exit [%d]\n", cpid);
+ /*get the pkgid and pkgtype to send fail signal*/
+ for(i = 0; i < num_of_backends; i++)
+ {
+ if (cpid == (ptr + i)->pid) {
+ __set_backend_free(i);
+ __set_backend_mode(i);
+ strncpy(pname, (ptr + i)->pkgid, MAX_PKG_NAME_LEN-1);
+ strncpy(ptype, (ptr + i)->pkgtype, MAX_PKG_TYPE_LEN-1);
+ strncpy(args, (ptr + i)->args, MAX_PKG_ARGS_LEN-1);
+ g_idle_add(send_fail_signal, NULL);
+ break;
+ }
+ }
+ }
}
- g_idle_add(queue_job, NULL);
-
- backend_flag = 0;
}
void req_cb(void *cb_data, const char *req_id, const int req_type,
- const char *pkg_type, const char *pkg_name, const char *args,
+ const char *pkg_type, const char *pkgid, const char *args,
const char *cookie, int *ret)
{
static int sig_reg = 0;
int err = -1;
+ int p = 0;
DBG(">> in callback >> Got request: [%s] [%d] [%s] [%s] [%s] [%s]",
- req_id, req_type, pkg_type, pkg_name, args, cookie);
+ req_id, req_type, pkg_type, pkgid, args, cookie);
struct appdata *ad = (struct appdata *)cb_data;
strncpy(item->req_id, req_id, sizeof(item->req_id) - 1);
item->req_type = req_type;
strncpy(item->pkg_type, pkg_type, sizeof(item->pkg_type) - 1);
- strncpy(item->pkg_name, pkg_name, sizeof(item->pkg_name) - 1);
+ strncpy(item->pkgid, pkgid, sizeof(item->pkgid) - 1);
strncpy(item->args, args, sizeof(item->args) - 1);
strncpy(item->cookie, cookie, sizeof(item->cookie) - 1);
DBG("signal: SIGCHLD failed\n");
} else
DBG("signal: SIGCHLD succeed\n");
+ if (g_timeout_add_seconds(2, exit_server, NULL))
+ DBG("g_timeout_add_seconds() Added to Main Loop");
sig_reg = 1;
}
((quiet = strstr(args, " '-q'")) &&
(quiet[strlen(quiet)] == '\0'))) {
/* quiet mode */
- _pm_queue_push(*item);
+ err = _pm_queue_push(item);
+ p = __get_position_from_pkg_type(item->pkg_type);
+ __set_backend_mode(p);
/* Free resource */
free(item);
-
- g_idle_add(queue_job, NULL);
+ if (err == 0)
+ g_idle_add(queue_job, NULL);
*ret = COMM_RET_OK;
} else {
/* non quiet mode */
- if (drawing_popup == 0 && backend_flag == 0) {
+ p = __get_position_from_pkg_type(item->pkg_type);
+ if (drawing_popup == 0 &&
+ !__is_backend_busy(p) &&
+ __check_backend_mode()) {
/* if there is no popup */
ad->item = item;
if (err != 0) {
*ret = COMM_RET_ERROR;
DBG("create popup failed\n");
- queue_job(NULL);
- return;
+ /*queue_job(NULL);*/
+ goto err;
} else {
*ret = COMM_RET_OK;
}
} else {
+ DBG("info drawing_popup:%d, __is_backend_busy(p):%d, __check_backend_mode():%d\n",
+ drawing_popup, __is_backend_busy(p), __check_backend_mode());
/* if popup is already being drawn */
- free(item);
*ret = COMM_RET_ERROR;
+ goto err;
}
}
break;
case COMM_REQ_TO_ACTIVATOR:
/* In case of activate, there is no popup */
- _pm_queue_push(*item);
+ err = _pm_queue_push(item);
+ p = __get_position_from_pkg_type(item->pkg_type);
+ __set_backend_mode(p);
/* Free resource */
free(item);
/* g_idle_add(queue_job, NULL); */
- queue_job(NULL);
+ if (err == 0)
+ queue_job(NULL);
*ret = COMM_RET_OK;
break;
case COMM_REQ_TO_CLEARER:
- /* In case of activate, there is no popup */
- _pm_queue_push(*item);
+ /* In case of clearer, there is no popup */
+ err = _pm_queue_push(item);
+ p = __get_position_from_pkg_type(item->pkg_type);
+ /*the backend shows the success/failure popup
+ so this request is non quiet*/
+ __unset_backend_mode(p);
/* Free resource */
free(item);
/* g_idle_add(queue_job, NULL); */
- queue_job(NULL);
+ if (err == 0)
+ queue_job(NULL);
+ *ret = COMM_RET_OK;
+ break;
+ case COMM_REQ_TO_MOVER:
+ /* In case of mover, there is no popup */
+ err = _pm_queue_push(item);
+ p = __get_position_from_pkg_type(item->pkg_type);
+ /*the backend shows the success/failure popup
+ so this request is non quiet*/
+ __unset_backend_mode(p);
+ /* Free resource */
+ free(item);
+ if (err == 0)
+ queue_job(NULL);
*ret = COMM_RET_OK;
break;
case COMM_REQ_CANCEL:
ad->item = item;
- _pm_queue_delete(*(ad->item));
+ _pm_queue_delete(ad->item);
+ p = __get_position_from_pkg_type(item->pkg_type);
+ __unset_backend_mode(p);
free(item);
*ret = COMM_RET_OK;
break;
default:
DBG("Check your request..\n");
- free(item);
*ret = COMM_RET_ERROR;
break;
}
+err:
+ if (*ret == COMM_RET_ERROR) {
+ DBG("Failed to handle request %s %s\n",item->pkg_type, item->pkgid);
+ pkgmgr_installer *pi;
+ gboolean ret_parse;
+ gint argcp;
+ gchar **argvp;
+ GError *gerr = NULL;
+
+ pi = pkgmgr_installer_new();
+ if (!pi) {
+ DBG("Failure in creating the pkgmgr_installer object");
+ free(item);
+ return;
+ }
+
+ ret_parse = g_shell_parse_argv(args, &argcp, &argvp, &gerr);
+ if (FALSE == ret_parse) {
+ DBG("Failed to split args: %s", args);
+ DBG("messsage: %s", gerr->message);
+ pkgmgr_installer_free(pi);
+ free(item);
+ return;
+ }
+
+ pkgmgr_installer_receive_request(pi, argcp, argvp);
+
+ pkgmgr_installer_send_signal(pi, item->pkg_type,
+ item->pkgid, "end",
+ "fail");
+
+ pkgmgr_installer_free(pi);
+
+ free(item);
+ }
+ return;
+}
+
+static int __check_backend_mode()
+{
+ int i = 0;
+ for(i = 0; i < num_of_backends; i++)
+ {
+ if (__is_backend_mode_quiet(i))
+ continue;
+ else
+ return 0;
+ }
+ return 1;
+}
+static int __check_backend_status_for_exit()
+{
+ int i = 0;
+ for(i = 0; i < num_of_backends; i++)
+ {
+ if (!__is_backend_busy(i))
+ continue;
+ else
+ return 0;
+ }
+ return 1;
+}
+
+static int __check_queue_status_for_exit()
+{
+ pm_queue_data *head[MAX_QUEUE_NUM] = {NULL,};
+ queue_info_map *ptr = NULL;
+ ptr = start;
+ int i = 0;
+ int c = 0;
+ int slot = -1;
+ for(i = 0; i < entries; i++)
+ {
+ if (ptr->queue_slot <= slot) {
+ ptr++;
+ continue;
+ }
+ else {
+ head[c] = ptr->head;
+ slot = ptr->queue_slot;
+ c++;
+ ptr++;
+ }
+ }
+ for(i = 0; i < num_of_backends; i++)
+ {
+ if (!head[i])
+ continue;
+ else
+ return 0;
+ }
+ return 1;
+}
+gboolean exit_server(void *data)
+{
+ DBG("exit_server Start\n");
+ if (__check_backend_status_for_exit() &&
+ __check_queue_status_for_exit() &&
+ drawing_popup == 0) {
+ if (!getenv("PMS_STANDALONE") && ail_db_update) {
+ ecore_main_loop_quit();
+ return FALSE;
+ }
+ }
+ return TRUE;
}
gboolean queue_job(void *data)
{
/* DBG("queue_job start"); */
-
+ pm_dbus_msg *item;
+ backend_info *ptr = NULL;
+ ptr = begin;
+ int x = 0;
/* Pop a job from queue */
- pm_dbus_msg item = _pm_queue_get_head();
- pid_t pid;
+pop:
+ if (!__is_backend_busy(pos % num_of_backends)) {
+ item = _pm_queue_pop(pos % num_of_backends);
+ pos = (pos + 1) % num_of_backends;
+ }
+ else {
+ pos = (pos + 1) % num_of_backends;
+ goto pop;
+ }
+
int ret = 0;
char *backend_cmd = NULL;
- char *exe_path = NULL;
-
- DBG("item.req_type=(%d) backend_flag=(%d)\n", item.req_type,
- backend_flag);
-
- /* queue is empty and backend process is not running, quit */
- if ((item.req_type == -1) && (backend_flag == 0) &&
- drawing_popup == 0 && ail_db_update == 1) {
- if (!getenv("PMS_STANDALONE"))
- ecore_main_loop_quit(); /* Quit main loop:
- go to cleanup */
- return FALSE; /* Anyway, run queue_job() again. */
- } else if (backend_flag == 1) /* backend process is running */
- return FALSE;
- _pm_queue_pop();
+ /* queue is empty and backend process is not running */
+ if ( (item == NULL) || (item->req_type == -1) ) {
+ if(item)
+ free(item);
+ goto pop;
+ }
+ __set_backend_busy((pos + num_of_backends - 1) % num_of_backends);
- switch (item.req_type) {
+ switch (item->req_type) {
case COMM_REQ_TO_INSTALLER:
DBG("installer start");
_save_queue_status(item, "processing");
DBG("saved queue status. Now try fork()");
- pid = fork();
-
- switch (pid) {
+ /*save pkg type and pkg name for future*/
+ x = (pos + num_of_backends - 1) % num_of_backends;
+ strncpy((ptr + x)->pkgtype, item->pkg_type, MAX_PKG_TYPE_LEN-1);
+ strncpy((ptr + x)->pkgid, item->pkgid, MAX_PKG_NAME_LEN-1);
+ strncpy((ptr + x)->args, item->args, MAX_PKG_ARGS_LEN-1);
+ (ptr + x)->pid = fork();
+ DBG("child forked [%d]\n", (ptr + x)->pid);
+
+ switch ((ptr + x)->pid) {
case 0: /* child */
DBG("before run _get_backend_cmd()");
- backend_cmd = _get_backend_cmd(item.pkg_type);
+ backend_cmd = _get_backend_cmd(item->pkg_type);
if (NULL == backend_cmd)
break;
- DBG("Try to exec [%s][%s]", item.pkg_type,
+ DBG("Try to exec [%s][%s]", item->pkg_type,
backend_cmd);
fprintf(stdout, "Try to exec [%s][%s]\n",
- item.pkg_type, backend_cmd);
+ item->pkg_type, backend_cmd);
/* Create args vector
- * req_id + pkg_name + args
+ * req_id + pkgid + args
*
* vector size = # of args +
- *(req_id + pkg_name + NULL termination = 3)
+ *(req_id + pkgid + NULL termination = 3)
* Last value must be NULL for execv.
*/
gboolean ret_parse;
gint argcp;
gchar **argvp;
GError *gerr = NULL;
- ret_parse = g_shell_parse_argv(item.args,
+ ret_parse = g_shell_parse_argv(item->args,
&argcp, &argvp, &gerr);
if (FALSE == ret_parse) {
- DBG("Failed to split args: %s", item.args);
+ DBG("Failed to split args: %s", item->args);
DBG("messsage: %s", gerr->message);
exit(1);
}
calloc(argcp + 4, sizeof(char *)); */
char **args_vector = calloc(argcp + 1, sizeof(char *));
/*args_vector[0] = strdup(backend_cmd);
- args_vector[1] = strdup(item.req_id);
- args_vector[2] = strdup(item.pkg_name); */
+ args_vector[1] = strdup(item->req_id);
+ args_vector[2] = strdup(item->pkgid); */
int arg_idx;
for (arg_idx = 0; arg_idx < argcp; arg_idx++) {
/* args_vector[arg_idx+3] = argvp[arg_idx]; */
if (ret == -1) {
perror("fail to exec");
- exit(SIGCHLD);
+ exit(1);
}
_save_queue_status(item, "done");
if (NULL != backend_cmd)
free(backend_cmd);
- exit(SIGCHLD); /* exit with SIGCHLD */
+ exit(0); /* exit */
break;
case -1: /* error */
break;
default: /* parent */
- backend_flag = 1;
DBG("parent \n");
_save_queue_status(item, "done");
break;
break;
case COMM_REQ_TO_ACTIVATOR:
DBG("activator start");
+ int val = 0;
_save_queue_status(item, "processing");
DBG("saved queue status. Now try fork()");
- pid = fork();
-
- switch (pid) {
+ /*save pkg type and pkg name for future*/
+ x = (pos + num_of_backends - 1) % num_of_backends;
+ strncpy((ptr + x)->pkgtype, item->pkg_type, MAX_PKG_TYPE_LEN-1);
+ strncpy((ptr + x)->pkgid, item->pkgid, MAX_PKG_NAME_LEN-1);
+ strncpy((ptr + x)->args, item->args, MAX_PKG_ARGS_LEN-1);
+ (ptr + x)->pid = fork();
+ DBG("child forked [%d]\n", (ptr + x)->pid);
+
+ switch ((ptr + x)->pid) {
case 0: /* child */
- /* Execute Activator !!! */
- exe_path = __get_exe_path(item.pkg_name);
- if (exe_path == NULL)
- break;
-
- if (item.args[0] == '1') /* activate */
- ret = chmod(exe_path, 0755);
- else if (item.args[0] == '0') /* deactivate */
- ret = chmod(exe_path, 0000);
+ if (item->args[0] == '1') /* activate */
+ val = 0;
+ else if (item->args[0] == '0') /* deactivate */
+ val = 1;
else {
DBG("error in args parameter:[%c]\n",
- item.args[0]);
- exit(SIGCHLD);
+ item->args[0]);
+ exit(1);
}
- free(exe_path);
+ DBG("inactivated val %d", val);
- if (ret == -1) {
- perror("fail to exec");
- exit(SIGCHLD);
+ ret = ail_desktop_appinfo_modify_bool(item->pkgid,
+ AIL_PROP_X_SLP_INACTIVATED_BOOL,
+ val);
+ if (ret != AIL_ERROR_OK) {
+ perror("fail to activate/deactivte package");
+ exit(1);
}
_save_queue_status(item, "done");
- exit(SIGCHLD); /* exit with SIGCHLD */
+ exit(0); /* exit with */
break;
case -1: /* error */
break;
default: /* parent */
- backend_flag = 1;
DBG("parent exit\n");
_save_queue_status(item, "done");
break;
}
break;
+ case COMM_REQ_TO_MOVER:
case COMM_REQ_TO_CLEARER:
DBG("cleaner start");
_save_queue_status(item, "processing");
DBG("saved queue status. Now try fork()");
- pid = fork();
-
- switch (pid) {
+ /*save pkg type and pkg name for future*/
+ x = (pos + num_of_backends - 1) % num_of_backends;
+ strncpy((ptr + x)->pkgtype, item->pkg_type, MAX_PKG_TYPE_LEN-1);
+ strncpy((ptr + x)->pkgid, item->pkgid, MAX_PKG_NAME_LEN-1);
+ strncpy((ptr + x)->args, item->args, MAX_PKG_ARGS_LEN-1);
+ (ptr + x)->pid = fork();
+ DBG("child forked [%d]\n", (ptr + x)->pid);
+
+ switch ((ptr + x)->pid) {
case 0: /* child */
DBG("before run _get_backend_cmd()");
- backend_cmd = _get_backend_cmd(item.pkg_type);
+ backend_cmd = _get_backend_cmd(item->pkg_type);
if (NULL == backend_cmd)
break;
- DBG("Try to exec [%s][%s]", item.pkg_type,
+ DBG("Try to exec [%s][%s]", item->pkg_type,
backend_cmd);
fprintf(stdout, "Try to exec [%s][%s]\n",
- item.pkg_type, backend_cmd);
+ item->pkg_type, backend_cmd);
/* Create args vector
- * req_id + pkg_name + args
+ * req_id + pkgid + args
*
* vector size = # of args +
- *(req_id + pkg_name + NULL termination = 3)
+ *(req_id + pkgid + NULL termination = 3)
* Last value must be NULL for execv.
*/
gboolean ret_parse;
gint argcp;
gchar **argvp;
GError *gerr = NULL;
- ret_parse = g_shell_parse_argv(item.args,
+ ret_parse = g_shell_parse_argv(item->args,
&argcp, &argvp, &gerr);
if (FALSE == ret_parse) {
- DBG("Failed to split args: %s", item.args);
+ DBG("Failed to split args: %s", item->args);
DBG("messsage: %s", gerr->message);
exit(1);
}
calloc(argcp + 4, sizeof(char *)); */
char **args_vector = calloc(argcp + 1, sizeof(char *));
/*args_vector[0] = strdup(backend_cmd);
- args_vector[1] = strdup(item.req_id);
- args_vector[2] = strdup(item.pkg_name); */
+ args_vector[1] = strdup(item->req_id);
+ args_vector[2] = strdup(item->pkgid); */
int arg_idx;
for (arg_idx = 0; arg_idx < argcp; arg_idx++) {
/* args_vector[arg_idx+3] = argvp[arg_idx]; */
if (ret == -1) {
perror("fail to exec");
- exit(SIGCHLD);
+ exit(1);
}
_save_queue_status(item, "done");
if (NULL != backend_cmd)
free(backend_cmd);
- exit(SIGCHLD); /* exit with SIGCHLD */
+ exit(0); /* exit */
break;
case -1: /* error */
break;
default: /* parent */
- backend_flag = 1;
DBG("parent \n");
_save_queue_status(item, "done");
break;
break;
}
+ free(item);
+
return FALSE;
}
}
wd = inotify_add_watch(desktop_notifier.ifd, paths[i].path,
- IN_CREATE | IN_CLOSE_WRITE | IN_MOVED_TO
- | IN_DELETE);
+ IN_CLOSE_WRITE | IN_MOVED_TO | IN_DELETE);
if (wd == -1) {
DBG("inotify_add_watch error: %s\n", strerror(errno));
close(desktop_notifier.ifd);
if (ioctl(fd, FIONREAD, &read_size) < 0) {
DBG("Failed to get a size of %s file.\n", DESKTOP_FILE_DIRS);
+ close(fd);
return -EFAULT;
}
if (read_size <= 0) {
DBG("Buffer is not ready.\n");
+ close(fd);
return -EFAULT;
}
- buf = malloc(read_size);
+ buf = calloc(1, read_size+1);
if (!buf) {
DBG("Failed to allocate heap.\n");
+ close(fd);
return -EFAULT;
}
len = read(fd, buf, read_size);
if (len < 0) {
DBG("Failed to read.\n");
+ close(fd);
free(buf);
return -EFAULT;
}
+ buf[len] = 0;
+
noti_dir = strtok_r(buf, "\n", &saveptr);
if (!noti_dir) {
DBG("Failed to strtok for %s.\n", buf);
+ close(fd);
free(buf);
return -EFAULT;
}
pid_t pid;
char *backend_cmd = NULL;
char *backend_name = NULL;
+ backend_info *ptr = NULL;
int r;
ecore_init();
}
}
- _pm_queue_init();
+ r = _pm_queue_init();
+ if (r) {
+ DBG("Queue Initialization Failed\n");
+ return -1;
+ }
+
/*Initialize inotify to monitor desktop file updates */
_pm_desktop_file_monitor_init();
+ /*Allocate memory for holding pid, pkgtype and pkgid*/
+ ptr = (backend_info*)calloc(num_of_backends, sizeof(backend_info));
+ if (ptr == NULL) {
+ DBG("Malloc Failed\n");
+ return -1;
+ }
+ memset(ptr, '\0', num_of_backends * sizeof(backend_info));
+ begin = ptr;
+
/* init internationalization */
r = appcore_set_i18n(PACKAGE, LOCALEDIR);
if (r)
pkg_mgr_set_request_callback(pkg_mgr, req_cb, &ad);
DBG("pkg_mgr object is created, and request callback is registered.");
-/* g_timeout_add_seconds(1, queue_job, NULL); */
- DBG("queue function is added to idler. Now run main loop.");
-
/* g_main_loop_run(mainloop); */
appcore_efl_main(PACKAGE, &argc, &argv, &ops);
DBG("Quit main loop.");
_pm_desktop_file_monitor_fini();
_pm_queue_final();
+ /*Free backend info */
+ if (begin) {
+ free(begin);
+ begin = NULL;
+ }
DBG("package manager server terminated.");
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <dirent.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include "pkgmgr-server.h"
#include "pm-queue.h"
-pm_queue_data *head = NULL;
+#define BACKEND_INFO_DIR "/usr/etc/package-manager/backend"
-void _pm_queue_init()
+static pm_queue_data *__get_head_from_pkgtype(pm_dbus_msg *item);
+static void __update_head_from_pkgtype(pm_queue_data *data);
+static int __entry_exist(char *backend);
+static int __is_pkg_supported(char *pkgtype);
+
+queue_info_map *start = NULL;
+int entries = 0;
+int slot = 0;
+int num_of_backends = 0;
+
+/*Function to check whether a particular package type
+is supported or not. It parses the queue info map
+to get the information.
+It will prevent the accidental hanging of server.
+Returns 1 if found.*/
+static int __is_pkg_supported(char *pkgtype)
+{
+ queue_info_map *ptr = NULL;
+ ptr = start;
+ int i = 0;
+ for(i = 0; i < entries; i++)
+ {
+ if (!strncmp(ptr->pkgtype, pkgtype, MAX_PKG_TYPE_LEN))
+ return 1;
+ else {
+ ptr++;
+ continue;
+ }
+ }
+ return 0;
+}
+
+/*tells whether a particular backend exists in the
+* info map or not.
+* on Success it return the queue slot of the already present entry
+* on Failure -1 is returned*/
+static int __entry_exist(char *backend)
+{
+ queue_info_map *ptr = NULL;
+ ptr = start;
+ int i = 0;
+ for(i = 0; i < entries; i++)
+ {
+ if (!strncmp(ptr->backend, backend, MAX_PKG_NAME_LEN))
+ return ptr->queue_slot;
+ else {
+ ptr++;
+ continue;
+ }
+ }
+ return -1;
+}
+
+/*In case of first push, it updates the queue head
+and copies it to all duplicate entries in queue info map*/
+static void __update_head_from_pkgtype(pm_queue_data *data)
+{
+ queue_info_map *ptr = NULL;
+ ptr = start;
+ int slot = -1;
+ int i = 0;
+ for(i = 0; i < entries; i++)
+ {
+ if (!strncmp(ptr->pkgtype, data->msg->pkg_type, MAX_PKG_TYPE_LEN)) {
+ ptr->head = data;
+ slot = ptr->queue_slot;
+ }
+ else {
+ ptr++;
+ continue;
+ }
+ }
+ /*update head for each duplicate entry*/
+ ptr = start;
+ for(i = 0; i < entries; i++)
+ {
+ if(ptr->queue_slot == slot && !ptr->head) {
+ ptr->head = data;
+ }
+ ptr++;
+ }
+ return;
+}
+
+/*Gets the queue head based on pkg type*/
+static pm_queue_data *__get_head_from_pkgtype(pm_dbus_msg *item)
+{
+ queue_info_map *ptr = NULL;
+ ptr = start;
+ int i = 0;
+ for(i = 0; i < entries; i++)
+ {
+ if (!strncmp(ptr->pkgtype, item->pkg_type, MAX_PKG_TYPE_LEN))
+ return ptr->head;
+ else {
+ ptr++;
+ continue;
+ }
+ }
+ return NULL;
+
+}
+
+int _pm_queue_init()
{
- head = NULL;
+ /*Find the num of backends currently supported and initialize
+ that many queues. It is dynamically determined.*/
+ struct dirent **namelist;
+ struct stat fileinfo;
+ queue_info_map *ptr = NULL;
+ int n = 0;
+ int c = 0;
+ int i = 0;
+ int ret = 0;
+ char abs_filename[MAX_PKG_NAME_LEN] = {'\0'};
+ char buf[MAX_PKG_NAME_LEN] = {'\0'};
+ n = scandir(BACKEND_INFO_DIR, &namelist, NULL, alphasort);
+ if (n < 0) {
+ perror("scandir");
+ return -1;
+ }
+ i = n;
+ /*Find number of backends (symlinks + executables)
+ The /usr/etc/package-manager/backend dir should not conatin
+ any other file except the backends.*/
+ while(n--)
+ {
+ if(!strcmp(namelist[n]->d_name, ".") ||
+ !strcmp(namelist[n]->d_name, ".."))
+ continue;
+ snprintf(abs_filename, MAX_PKG_NAME_LEN, "%s/%s",
+ BACKEND_INFO_DIR, namelist[n]->d_name);
+ if (lstat(abs_filename, &fileinfo)) {
+ perror("lstat");
+ continue;
+ }
+ if (S_ISDIR(fileinfo.st_mode))
+ continue;
+ c++;
+ memset(abs_filename, 0x00, MAX_PKG_NAME_LEN);
+ }
+ /*Add entries to info map.*/
+ ptr = (queue_info_map*)calloc(c , sizeof(queue_info_map));
+ memset(ptr, '\0', c * sizeof(queue_info_map));
+ start = ptr;
+ for(n = 0; n < c ; n++)
+ {
+ ptr->backend[0] = '\0';
+ ptr->head = NULL;
+ ptr->queue_slot = -2;/*-1 can be error return*/
+ ptr->pkgtype[0] = '\0';
+ ptr++;
+ }
+ n = i;
+ ptr = start;
+ while(n--)
+ {
+ if(!strcmp(namelist[n]->d_name, ".") ||
+ !strcmp(namelist[n]->d_name, ".."))
+ continue;
+ snprintf(abs_filename, MAX_PKG_NAME_LEN, "%s/%s",
+ BACKEND_INFO_DIR, namelist[n]->d_name);
+ if (lstat(abs_filename, &fileinfo) < 0) {
+ perror(abs_filename);
+ return -1;
+ }
+ if (S_ISDIR(fileinfo.st_mode))
+ continue;
+ /*Found backend*/
+ if (S_ISLNK(fileinfo.st_mode)) {
+ /*found a symlink*/
+ ret = readlink(abs_filename, buf, MAX_PKG_NAME_LEN - 1);
+ if (ret == -1) {
+ perror("readlink");
+ return -1;
+ }
+ buf[ret] = '\0';
+ }
+ /*executable*/
+ else {
+ strncpy(buf, abs_filename, MAX_PKG_NAME_LEN - 1);
+ }
+ ret = __entry_exist(buf);
+ if (ret == -1) {
+ strncpy(ptr->backend, buf, MAX_PKG_NAME_LEN - 1);
+ strncpy(ptr->pkgtype, namelist[n]->d_name, MAX_PKG_TYPE_LEN - 1);
+ ptr->queue_slot = slot;
+ ptr->head = NULL;
+ entries++;
+ slot++;
+ ptr++;
+ }
+ else {
+ strncpy(ptr->backend, buf, MAX_PKG_NAME_LEN - 1);
+ strncpy(ptr->pkgtype, namelist[n]->d_name, MAX_PKG_TYPE_LEN - 1);
+ ptr->queue_slot = ret;
+ ptr->head = NULL;
+ entries++;
+ ptr++;
+ }
+ free(namelist[n]);
+ memset(buf, 0x00, MAX_PKG_NAME_LEN);
+ continue;
+ }
+ free(namelist);
+ num_of_backends = slot;
+#ifdef DEBUG_INFO
+ /*Debug info*/
+ printf("Queue Info Map\n");
+ printf("Number of Backends is %d\n", num_of_backends);
+ printf("Number of Entries is %d\n", entries);
+ printf("Backend\tType\tSlot\tHead\n");
+ ptr = start;
+ for(n = 0; n < entries; n++)
+ {
+ printf("%s\t%s\t%d\t%p\n", ptr->backend, ptr->pkgtype, ptr->queue_slot, ptr->head);
+ ptr++;
+ }
+#endif
+ return 0;
}
-void _pm_queue_push(pm_dbus_msg item)
+int _pm_queue_push(pm_dbus_msg *item)
{
pm_queue_data *data = NULL;
pm_queue_data *cur = NULL;
+ pm_queue_data *tmp = NULL;
+ int ret = 0;
+ ret = __is_pkg_supported(item->pkg_type);
+ if (ret == 0)
+ return -1;
- cur = head;
+ cur = __get_head_from_pkgtype(item);
+ tmp = cur;
data = _add_node();
if (!data) { /* fail to allocate mem */
fprintf(stderr, "Fail to allocate memory\n");
- return;
+ return -1;
}
- strncpy(data->msg->req_id, item.req_id, strlen(item.req_id));
- data->msg->req_type = item.req_type;
- strncpy(data->msg->pkg_type, item.pkg_type, strlen(item.pkg_type));
- strncpy(data->msg->pkg_name, item.pkg_name, strlen(item.pkg_name));
- strncpy(data->msg->args, item.args, strlen(item.args));
- strncpy(data->msg->cookie, item.cookie, strlen(item.cookie));
+ strncpy(data->msg->req_id, item->req_id, strlen(item->req_id));
+ data->msg->req_type = item->req_type;
+ strncpy(data->msg->pkg_type, item->pkg_type, strlen(item->pkg_type));
+ strncpy(data->msg->pkgid, item->pkgid, strlen(item->pkgid));
+ strncpy(data->msg->args, item->args, strlen(item->args));
+ strncpy(data->msg->cookie, item->cookie, strlen(item->cookie));
data->next = NULL;
- if (head == NULL) /* first push */
- head = data;
+ if (cur == NULL) {
+ /* first push */
+ cur = data;
+ __update_head_from_pkgtype(data);
+ }
else {
- while (cur->next)
- cur = cur->next;
+ while (tmp->next)
+ tmp = tmp->next;
- cur->next = data;
+ tmp->next = data;
}
+ return 0;
}
-pm_dbus_msg _pm_queue_pop()
+/*pop request from queue slot "position" */
+pm_dbus_msg *_pm_queue_pop(int position)
{
- pm_dbus_msg ret;
+ pm_dbus_msg *ret;
pm_queue_data *cur = NULL;
+ pm_queue_data *saveptr = NULL;
+ queue_info_map *ptr = start;
+ int i = 0;
- cur = head;
+ ret = (pm_dbus_msg *) malloc(sizeof(pm_dbus_msg));
+ if (!ret) {
+ fprintf(stderr, "Mem alloc error\n");
+ return NULL;
+ }
+ memset(ret, 0x00, sizeof(pm_dbus_msg));
- memset(&ret, 0x00, sizeof(pm_dbus_msg));
+ for(i = 0; i < entries; i++)
+ {
+ if (ptr->queue_slot == position) {
+ cur = ptr->head;
+ break;
+ }
+ ptr++;
+ }
- if (!head) { /* queue is empty */
- ret.req_type = -1;
+ if (!cur) { /* queue is empty */
+ ret->req_type = -1;
return ret;
}
- strncpy(ret.req_id, cur->msg->req_id, strlen(cur->msg->req_id));
- ret.req_type = cur->msg->req_type;
- strncpy(ret.pkg_type, cur->msg->pkg_type, strlen(cur->msg->pkg_type));
- strncpy(ret.pkg_name, cur->msg->pkg_name, strlen(cur->msg->pkg_name));
- strncpy(ret.args, cur->msg->args, strlen(cur->msg->args));
- strncpy(ret.cookie, cur->msg->cookie, strlen(cur->msg->cookie));
+ strncpy(ret->req_id, cur->msg->req_id, strlen(cur->msg->req_id));
+ ret->req_type = cur->msg->req_type;
+ strncpy(ret->pkg_type, cur->msg->pkg_type, strlen(cur->msg->pkg_type));
+ strncpy(ret->pkgid, cur->msg->pkgid, strlen(cur->msg->pkgid));
+ strncpy(ret->args, cur->msg->args, strlen(cur->msg->args));
+ strncpy(ret->cookie, cur->msg->cookie, strlen(cur->msg->cookie));
- head = cur->next;
+ ptr->head = cur->next;
+ saveptr = ptr->head;
cur->next = NULL;
-
free(cur->msg);
free(cur);
-
- return ret;
-}
-
-pm_dbus_msg _pm_queue_get_head()
-{
- pm_dbus_msg ret;
- pm_queue_data *cur = NULL;
-
- cur = head;
-
- memset(&ret, 0x00, sizeof(pm_dbus_msg));
-
- if (!head) { /* queue is empty */
- ret.req_type = -1;
- return ret;
+ /*update head for each duplicate queue entry*/
+ ptr = start;
+ for(i = 0; i < entries; i++)
+ {
+ if(ptr->queue_slot == position) {
+ ptr->head = saveptr;
+ }
+ ptr++;
}
-
- strncpy(ret.req_id, cur->msg->req_id, strlen(cur->msg->req_id));
- ret.req_type = cur->msg->req_type;
- strncpy(ret.pkg_type, cur->msg->pkg_type, strlen(cur->msg->pkg_type));
- strncpy(ret.pkg_name, cur->msg->pkg_name, strlen(cur->msg->pkg_name));
- strncpy(ret.args, cur->msg->args, strlen(cur->msg->args));
- strncpy(ret.cookie, cur->msg->cookie, strlen(cur->msg->cookie));
-
return ret;
}
+/*populate an array of all queue heads and delete them one by one*/
void _pm_queue_final()
{
+ int c = 0;
+ int i = 0;
+ int slot = -1;
pm_queue_data *cur = NULL;
pm_queue_data *tail = NULL;
pm_queue_data *prev = NULL;
+ pm_queue_data *head[MAX_QUEUE_NUM] = {NULL,};
+ queue_info_map *ptr = NULL;
+ ptr = start;
- if (!head) { /* in case of head is NULL */
- fprintf(stderr, "queue is NULL\n");
- return;
+ for(i = 0; i < num_of_backends; i++)
+ {
+ head[i] = NULL;
}
- while (head->next) {
- cur = head;
+ for(i = 0; i < entries; i++)
+ {
+ if (ptr->queue_slot <= slot) {
+ ptr++;
+ continue;
+ }
+ else {
+ head[c] = ptr->head;
+ slot = ptr->queue_slot;
+ c++;
+ ptr++;
+ }
+ }
- while (cur->next) {
- printf(" -- [%p]\n", cur);
- prev = cur;
- cur = cur->next;
+ c = 0;
+ while(c < num_of_backends) {
+ if (!head[c]) { /* in case of head is NULL */
+ fprintf(stderr, "queue is NULL\n");
+ c = c + 1;
+ continue;
}
- tail = cur;
- printf("%p\n", tail);
+ while (head[c]->next) {
+ cur = head[c]->next;
- free(tail->msg);
- free(tail);
- prev->next = NULL;
- }
+ while (cur->next) {
+ printf(" -- [%p]\n", cur);
+ prev = cur;
+ cur = cur->next;
+ }
+
+ tail = cur;
+ printf("%p\n", tail);
+
+ free(tail->msg);
+ free(tail);
+ prev->next = NULL;
+ }
- free(head->msg);
- free(head);
+ free(head[c]->msg);
+ free(head[c]);
- head = NULL;
+ head[c] = NULL;
+ c = c + 1;
+ }
+ /*Free the info map*/
+ if (start) {
+ free(start);
+ start = NULL;
+ }
}
pm_queue_data *_add_node()
return newnode;
}
-void _pm_queue_delete(pm_dbus_msg item)
+void _pm_queue_delete(pm_dbus_msg *item)
{
/* Assume that pacakge name is unique */
pm_queue_data *cur = NULL;
pm_queue_data *prev = NULL;
-
- cur = head;
+ cur = __get_head_from_pkgtype(item);
prev = cur;
-
- while (cur->next) {
- if (!strcmp(item.pkg_name, cur->msg->pkg_name)) {
- prev->next = cur->next;
-
- free(cur->msg);
- free(cur);
-
- break;
+ if (cur) {
+ while (cur->next) {
+ if (!strcmp(item->pkgid, cur->msg->pkgid)) {
+ prev->next = cur->next;
+ free(cur->msg);
+ free(cur);
+ break;
+ }
+ prev = cur;
+ cur = cur->next;
}
-
- prev = cur;
- cur = cur->next;
}
}
-void _save_queue_status(pm_dbus_msg item, char *status)
+void _save_queue_status(pm_dbus_msg *item, char *status)
{
FILE *fp_status = NULL;
fprintf(fp_status, "%s\n", status);
printf("[%s]\n", status);
- fprintf(fp_status, "%s\n", item.pkg_type);
- printf("[%s]\n", item.pkg_type);
+ fprintf(fp_status, "%s\n", item->pkg_type);
+ printf("[%s]\n", item->pkg_type);
fsync(fp_status->_fileno);
fclose(fp_status);
}
-void _print_queue()
+void _print_queue(int position)
{
pm_queue_data *cur = NULL;
+ queue_info_map *ptr = start;
+ int i = 0;
+ for(i =0; i < entries; i++)
+ {
+ if (ptr->queue_slot == position) {
+ cur = ptr->head;
+ break;
+ }
+ ptr++;
+ }
int index = 1;
-
- cur = head;
-
- if (!cur)
+ if (!cur) {
printf(" ** queue is NULL **\n");
+ return;
+ }
while (cur) {
printf(" * queue[%d]: [%s] [%d] [%s] [%s] [%s] [%s]\n",
cur->msg->req_id,
cur->msg->req_type,
cur->msg->pkg_type,
- cur->msg->pkg_name, cur->msg->args, cur->msg->cookie);
+ cur->msg->pkgid, cur->msg->args, cur->msg->cookie);
index++;
cur = cur->next;
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TEST_CFLAGS}")
#Verbose
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/client/include ${CMAKE_SOURCE_DIR}/comm)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/client/include)
INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs_test REQUIRED ecore dbus-1 ail)
+pkg_check_modules(pkgs_test REQUIRED ecore dbus-1 ail libxml-2.0 bundle pkgmgr-info pkgmgr-parser)
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-info pkgmgr-parser)
+FOREACH(flag ${libpkgs_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")
target_link_libraries(pkgcmd pkgmgr-client ${pkgs_test_LDFLAGS})
INSTALL(TARGETS pkgcmd DESTINATION bin)
+add_executable(pkginfo
+ pkg_info.c)
+target_link_libraries(pkginfo pkgmgr-client pkgmgr_installer ${pkgs_test_LDFLAGS})
+INSTALL(TARGETS pkginfo DESTINATION bin)
+
+add_executable(pkg_initdb
+ pkg_initdb.c)
+target_link_libraries(pkg_initdb ${pkgs_test_LDFLAGS})
+INSTALL(TARGETS pkg_initdb DESTINATION bin)
+
+
add_executable(pkgmgr-install pkgmgr-install.c)
-target_link_libraries(pkgmgr-install pkgmgr-client)
+target_link_libraries(pkgmgr-install pkgmgr-client pkgmgr-info ${toolpkgs_LDFLAGS})
install(TARGETS pkgmgr-install DESTINATION bin)
-configure_file(org.tizen.pkgmgr-install.desktop.in ${CMAKE_BINARY_DIR}/org.tizen.pkgmgr-install.desktop @ONLY)
-install(FILES ${CMAKE_BINARY_DIR}/org.tizen.pkgmgr-install.desktop DESTINATION /opt/share/applications/)
+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/)
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
+ <mime-type type="application/vnd.tizen.package">
+ <!--Created automatically by update-mime-database. DO NOT EDIT!-->
+ <comment>Tizen Package</comment>
+ <acronym>TPK</acronym>
+ <expanded-acronym>Tizen PacKage</expanded-acronym>
+ <glob pattern="*.tpk"/>
+ </mime-type>
+</mime-info>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.pkgmgr-install" version="0.1" install-location="internal-only">
+ <label>pkgmgr-install</label>
+ <author email="sewook7.park@samsung.com" href="www.samsung.com">Sewook Park</author>
+ <description>pkgmgr-install</description>
+ <ui-application appid="org.tizen.pkgmgr-install" exec="/usr/bin/pkgmgr-install" nodisplay="true" multiple="false" type="capp" taskmanage="false">
+ <label>pkgmgr-install</label>
+ <application-service>
+ <operation name="http://tizen.org/appcontrol/operation/view"/>
+ <mime name="application/widget"/>
+ <mime name="application/vnd.wac.widget-sharing"/>
+ <mime name="application/x-rpm"/>
+ <mime name="application/x-redhat-package-manager"/>
+ </application-service>
+ </ui-application>
+</manifest>
#include <stdlib.h>
#include <unistd.h>
#include <getopt.h>
+#include <dirent.h>
+#include <fcntl.h>
+#include <dlfcn.h>
#include <sys/types.h>
#include <glib.h>
#include <ail.h>
#include <glib-object.h>
+#include <pkgmgr-info.h>
#include "package-manager.h"
#include "package-manager-types.h"
#define PKG_TOOL_VERSION "0.1"
+#define APP_INSTALLATION_PATH_RW "/opt/usr/apps"
static int __process_request();
static void __print_usage();
static int __is_authorized();
-static int __is_app_installed(char *pkgname);
+static int __is_app_installed(char *pkgid);
static void __print_pkg_info(pkgmgr_info * pkg_info);
-static int __iter_fn(const char *pkg_type, const char *pkg_name,
- const char *version, void *data);
-static int __return_cb(int req_id, const char *pkg_type, const char *pkg_name,
+static int __return_cb(int req_id, const char *pkg_type, const char *pkgid,
const char *key, const char *val, const void *pmsg,
void *data);
+static int __convert_to_absolute_path(char *path);
+static int __pkgcmd_read_proc(const char *path, char *buf, int size);
+static int __pkgcmd_find_pid_by_cmdline(const char *dname,
+ const char *cmdline, const char *apppath);
+static int __pkgcmd_proc_iter_kill_cmdline(const char *apppath, int option);
+static int __app_list_cb(const pkgmgr_appinfo_h handle, void *user_data);
/* Supported options */
-const char *short_options = "iuclsd:p:t:n:qh";
+const char *short_options = "iumcCkaADlsd:p:t:n:T:qh";
const struct option long_options[] = {
{"install", 0, NULL, 'i'},
{"uninstall", 0, NULL, 'u'},
+ {"move", 0, NULL, 'm'},
{"clear", 0, NULL, 'c'},
+ {"activate", 0, NULL, 'A'},
+ {"deactivate", 0, NULL, 'D'},
+ {"check", 0, NULL, 'C'},
+ {"kill", 0, NULL, 'k'},
+ {"app-path", 0, NULL, 'a'},
{"list", 0, NULL, 'l'},
{"show", 0, NULL, 's'},
{"descriptor", 1, NULL, 'd'},
{"package-path", 1, NULL, 'p'},
{"package-type", 1, NULL, 't'},
{"package-name", 1, NULL, 'n'},
+ {"move-type", 1, NULL, 'T'},
{"quiet", 0, NULL, 'q'},
{"help", 0, NULL, 'h'},
{0, 0, 0, 0} /* sentinel */
INSTALL_REQ = 1,
UNINSTALL_REQ,
CLEAR_REQ,
+ MOVE_REQ,
+ ACTIVATE_REQ,
+ DEACTIVATE_REQ,
+ APPPATH_REQ,
+ CHECKAPP_REQ,
+ KILLAPP_REQ,
LIST_REQ,
SHOW_REQ,
HELP_REQ
req_type request;
char pkg_path[PKG_NAME_STRING_LEN_MAX];
char pkg_type[PKG_TYPE_STRING_LEN_MAX];
- char pkg_name[PKG_NAME_STRING_LEN_MAX];
+ char pkgid[PKG_NAME_STRING_LEN_MAX];
char des_path[PKG_NAME_STRING_LEN_MAX];
int quiet;
+ int move_type;
int result;
};
typedef struct pm_tool_args_t pm_tool_args;
static GMainLoop *main_loop = NULL;
-static int __iter_fn(const char *pkg_type, const char *pkg_name,
- const char *version, void *data)
-{
- printf("pkg_type [%s]\tpkg_name [%s]\tversion [%s]\n", pkg_type,
- pkg_name, version);
- return 0;
-}
-
static int __return_cb(int req_id, const char *pkg_type,
- const char *pkg_name, const char *key, const char *val,
+ const char *pkgid, const char *key, const char *val,
const void *pmsg, void *priv_data)
{
printf("__return_cb req_id[%d] pkg_type[%s] "
- "pkg_name[%s] key[%s] val[%s]\n",
- req_id, pkg_type, pkg_name, key, val);
+ "pkgid[%s] key[%s] val[%s]\n",
+ req_id, pkg_type, pkgid, key, val);
if (strncmp(key, "end", strlen("end")) == 0) {
if (strncasecmp(val, "ok", strlen("ok")) != 0)
return 0;
}
-static int __is_app_installed(char *pkgname)
+static int __pkgcmd_read_proc(const char *path, char *buf, int size)
+{
+ int fd;
+ int ret;
+ if (buf == NULL || path == NULL)
+ return -1;
+ fd = open(path, O_RDONLY);
+ if (fd < 0)
+ return -1;
+ ret = read(fd, buf, size - 1);
+ if (ret <= 0) {
+ close(fd);
+ return -1;
+ } else
+ buf[ret] = 0;
+ close(fd);
+ return ret;
+}
+
+static int __pkgcmd_find_pid_by_cmdline(const char *dname,
+ const char *cmdline, const char *apppath)
+{
+ int pid = 0;
+
+ if (strcmp(cmdline, apppath) == 0) {
+ pid = atoi(dname);
+ if (pid != getpgid(pid))
+ pid = 0;
+ }
+ return pid;
+}
+
+static int __pkgcmd_proc_iter_kill_cmdline(const char *apppath, int option)
+{
+ DIR *dp;
+ struct dirent *dentry;
+ int pid;
+ int ret;
+ char buf[1024] = {'\0'};
+ int pgid;
+
+ dp = opendir("/proc");
+ if (dp == NULL) {
+ return -1;
+ }
+
+ while ((dentry = readdir(dp)) != NULL) {
+ if (!isdigit(dentry->d_name[0]))
+ continue;
+
+ snprintf(buf, sizeof(buf), "/proc/%s/cmdline", dentry->d_name);
+ ret = __pkgcmd_read_proc(buf, buf, sizeof(buf));
+ if (ret <= 0)
+ continue;
+
+ pid = __pkgcmd_find_pid_by_cmdline(dentry->d_name, buf, apppath);
+ if (pid > 0) {
+ if (option == 0) {
+ closedir(dp);
+ return pid;
+ }
+ pgid = getpgid(pid);
+ if (pgid <= 1) {
+ closedir(dp);
+ return -1;
+ }
+ if (killpg(pgid, SIGKILL) < 0) {
+ closedir(dp);
+ return -1;
+ }
+ closedir(dp);
+ return pid;
+ }
+ }
+ closedir(dp);
+ return 0;
+}
+
+static int __app_list_cb(const pkgmgr_appinfo_h handle, void *user_data)
+{
+ char *exec = NULL;
+ char *appid = NULL;
+ int ret = 0;
+ int pid = -1;
+ if (handle == NULL) {
+ printf("appinfo handle is NULL\n");
+ return -1;
+ }
+ ret = pkgmgr_appinfo_get_exec(handle, &exec);
+ if (ret) {
+ printf("Failed to get app exec path\n");
+ return -1;
+ }
+ ret = pkgmgr_appinfo_get_appid(handle, &appid);
+ if (ret) {
+ printf("Failed to get appid\n");
+ return -1;
+ }
+ /*option 0 to check and option 1 to kill*/
+ switch(data.request) {
+ case CHECKAPP_REQ:
+ pid = __pkgcmd_proc_iter_kill_cmdline(exec, 0);
+ if (pid) {
+ printf("Appid: %s is Running\n", appid);
+ } else {
+ printf("Appid: %s is Not Running\n", appid);
+ }
+ break;
+ case KILLAPP_REQ:
+ pid = __pkgcmd_proc_iter_kill_cmdline(exec, 1);
+ if (pid > 0)
+ printf("Appid: %s is Terminated\n", appid);
+ break;
+ default:
+ break;
+ }
+ return 0;
+}
+
+static int __convert_to_absolute_path(char *path)
+{
+ char abs[PKG_NAME_STRING_LEN_MAX] = {'\0'};
+ char temp[PKG_NAME_STRING_LEN_MAX] = {'\0'};
+ char *ptr = NULL;
+ if (path == NULL) {
+ printf("path is NULL\n");
+ return -1;
+ }
+ strncpy(temp, path, PKG_NAME_STRING_LEN_MAX - 1);
+ if (strchr(path, '/') == NULL) {
+ getcwd(abs, PKG_NAME_STRING_LEN_MAX - 1);
+ if (abs[0] == '\0') {
+ printf("getcwd() failed\n");
+ return -1;
+ }
+ memset(data.pkg_path, '\0', PKG_NAME_STRING_LEN_MAX);
+ snprintf(data.pkg_path, PKG_NAME_STRING_LEN_MAX - 1, "%s/%s", abs, temp);
+ return 0;
+ }
+ if (strncmp(path, "./", 2) == 0) {
+ ptr = temp;
+ getcwd(abs, PKG_NAME_STRING_LEN_MAX - 1);
+ if (abs[0] == '\0') {
+ printf("getcwd() failed\n");
+ return -1;
+ }
+ ptr = ptr + 2;
+ memset(data.pkg_path, '\0', PKG_NAME_STRING_LEN_MAX);
+ snprintf(data.pkg_path, PKG_NAME_STRING_LEN_MAX - 1, "%s/%s", abs, ptr);
+ return 0;
+ }
+ return 0;
+}
+
+static int __is_app_installed(char *pkgid)
{
+#if 0
ail_appinfo_h handle;
ail_error_e ret;
char *str = NULL;
- ret = ail_package_get_appinfo(pkgname, &handle);
+ ret = ail_package_get_appinfo(pkgid, &handle);
if (ret != AIL_ERROR_OK) {
return -1;
}
if (ret != AIL_ERROR_OK) {
return -1;
}
+//#else
+ pkgmgr_pkginfo_h handle;
+ int ret = pkgmgr_pkginfo_get_pkginfo(pkgid, &handle);
+ if(ret < 0) {
+ printf("package is not in pkgmgr_info DB\n");
+ return -1;
+ } else
+ pkgmgr_pkginfo_destroy_pkginfo(handle);
+#endif
return 0;
}
printf("-i, --install install the package\n");
printf("-u, --uninstall uninstall the package\n");
printf("-c, --clear clear user data\n");
+ printf("-m, --move move package\n");
printf("-l, --list display list of installed packages\n");
printf("-s, --show show detail package info\n");
+ printf("-a, --app-path show app installation path\n");
+ printf("-C, --check check if applications belonging to a package are running or not\n");
+ printf("-k, --kill terminate applications belonging to a package\n");
printf("-d, --descriptor provide descriptor path\n");
printf("-p, --package-path provide package path\n");
printf("-n, --package-name provide package name\n");
printf("-t, --package-type provide package type\n");
+ printf("-T, --move-type provide move type [0 : move to internal /1: move to external]\n");
printf("-q, --quiet quiet mode operation\n");
printf("-h, --help print this help\n\n");
printf("Usage: pkgcmd [options] (--quiet)\n");
printf("pkgcmd -l \n");
printf("pkgcmd -s -t <pkg type> -p <pkg path> (-q)\n");
printf("pkgcmd -s -t <pkg type> -n <pkg name> (-q)\n\n");
+ printf("pkgcmd -m -t <pkg type> -T <move type> -n <pkg name> (-q)\n\n");
printf("Example:\n");
- printf("pkgcmd -u -t deb -n org.tizen.calculator\n");
- printf("pkgcmd -i -t deb -p /mnt/nfs/org.tizen.calculator_0.1.2-95_armel.deb\n");
- printf("pkgcmd -c -t deb -n org.tizen.hello\n");
+ printf("pkgcmd -u -t rpm -n org.tizen.calculator\n");
+ printf
+ ("pkgcmd -i -t rpm -p /mnt/nfs/org.tizen.calculator_0.1.2-95_armel.rpm\n");
+ printf("pkgcmd -c -t rpm -n org.tizen.hello\n");
+ printf("pkgcmd -m -t rpm -T 1 -n org.tizen.hello\n");
+ printf("pkgcmd -C -t rpm -n org.tizen.hello\n");
+ printf("pkgcmd -k -t rpm -n org.tizen.hello\n");
+ printf("pkgcmd -a\n");
+ printf("pkgcmd -a -t rpm -n org.tizen.hello\n");
exit(0);
}
free(temp);
}
- temp = pkgmgr_info_get_string(pkg_info, "pkg_name");
+ temp = pkgmgr_info_get_string(pkg_info, "pkgid");
if (temp) {
- printf("pkg_name : %s\n", temp);
+ printf("pkgid : %s\n", temp);
free(temp);
}
}
}
+static int __pkgmgr_list_cb (const pkgmgr_pkginfo_h handle, void *user_data)
+{
+ int ret = -1;
+ char *pkgid = NULL;
+ char *pkg_type = NULL;
+ char *pkg_version = NULL;
+ char *pkg_label = NULL;
+
+ ret = pkgmgr_pkginfo_get_pkgid(handle, &pkgid);
+ if (ret == -1) {
+ printf("Failed to get pkgmgr_pkginfo_get_pkgid\n");
+ return ret;
+ }
+ ret = pkgmgr_pkginfo_get_type(handle, &pkg_type);
+ if (ret == -1) {
+ printf("Failed to get pkgmgr_pkginfo_get_type\n");
+ return ret;
+ }
+ ret = pkgmgr_pkginfo_get_version(handle, &pkg_version);
+ if (ret == -1) {
+ printf("Failed to get pkgmgr_pkginfo_get_version\n");
+ return ret;
+ }
+ ret = pkgmgr_pkginfo_get_label(handle, &pkg_label);
+ if (ret == -1) {
+ printf("Failed to get pkgmgr_pkginfo_get_label\n");
+ return ret;
+ }
+
+ printf("pkg_type [%s]\tpkgid [%s]\tname [%s]\tversion [%s]\n", pkg_type, pkgid, pkg_label, pkg_version);
+
+ return ret;
+}
+
static int __process_request()
{
int ret = -1;
int mode = PM_DEFAULT;
pkgmgr_client *pc = NULL;
+ char buf[1024] = {'\0'};
switch (data.request) {
case INSTALL_REQ:
if (data.pkg_type[0] == '\0' || data.pkg_path[0] == '\0') {
break;
case UNINSTALL_REQ:
- if (data.pkg_type[0] == '\0' || data.pkg_name[0] == '\0') {
+ if (data.pkg_type[0] == '\0' || data.pkgid[0] == '\0') {
printf("Please provide the arguments.\n");
printf("use -h option to see usage\n");
ret = -1;
mode = PM_DEFAULT;
else
mode = PM_QUIET;
- ret = __is_app_installed(data.pkg_name);
+
+ ret = __is_app_installed(data.pkgid);
if (ret == -1) {
printf("package is not installed\n");
break;
}
+
ret =
- pkgmgr_client_uninstall(pc, data.pkg_type, data.pkg_name,
+ pkgmgr_client_uninstall(pc, data.pkg_type, data.pkgid,
mode, __return_cb, NULL);
if (ret < 0)
break;
break;
case CLEAR_REQ:
- if (data.pkg_type[0] == '\0' || data.pkg_name[0] == '\0') {
+ if (data.pkg_type[0] == '\0' || data.pkgid[0] == '\0') {
printf("Please provide the arguments.\n");
printf("use -h option to see usage\n");
ret = -1;
mode = PM_DEFAULT;
else
mode = PM_QUIET;
- ret = __is_app_installed(data.pkg_name);
+ ret = __is_app_installed(data.pkgid);
if (ret == -1) {
printf("package is not installed\n");
break;
}
ret = pkgmgr_client_clear_user_data(pc, data.pkg_type,
- data.pkg_name, mode);
+ data.pkgid, mode);
if (ret < 0)
break;
ret = data.result;
break;
+ case ACTIVATE_REQ:
+ if (data.pkg_type[0] == '\0' || data.pkgid[0] == '\0') {
+ printf("Please provide the arguments.\n");
+ printf("use -h option to see usage\n");
+ ret = -1;
+ break;
+ }
+
+ pc = pkgmgr_client_new(PC_REQUEST);
+ if (pc == NULL) {
+ printf("PkgMgr Client Creation Failed\n");
+ ret = -1;
+ break;
+ }
+
+ ret = pkgmgr_client_activate(pc, data.pkg_type, data.pkgid);
+ if (ret < 0)
+ break;
+ ret = data.result;
+
+ break;
+
+
+ case DEACTIVATE_REQ:
+ if (data.pkg_type[0] == '\0' || data.pkgid[0] == '\0') {
+ printf("Please provide the arguments.\n");
+ printf("use -h option to see usage\n");
+ ret = -1;
+ break;
+ }
+
+ pc = pkgmgr_client_new(PC_REQUEST);
+ if (pc == NULL) {
+ printf("PkgMgr Client Creation Failed\n");
+ ret = -1;
+ break;
+ }
+
+ ret = pkgmgr_client_deactivate(pc, data.pkg_type, data.pkgid);
+ if (ret < 0)
+ break;
+ ret = data.result;
+
+ break;
+
+ case MOVE_REQ:
+ if (data.pkg_type[0] == '\0' || data.pkgid[0] == '\0') {
+ printf("Please provide the arguments.\n");
+ printf("use -h option to see usage\n");
+ ret = -1;
+ break;
+ }
+ if (data.move_type < 0 || data.move_type > 1) {
+ printf("Invalid move type...See usage\n");
+ ret = -1;
+ break;
+ }
+ pc = pkgmgr_client_new(PC_REQUEST);
+ if (pc == NULL) {
+ printf("PkgMgr Client Creation Failed\n");
+ ret = -1;
+ break;
+ }
+ if (data.quiet == 0)
+ mode = PM_DEFAULT;
+ else
+ mode = PM_QUIET;
+ ret = __is_app_installed(data.pkgid);
+ if (ret == -1) {
+ printf("package is not installed\n");
+ break;
+ }
+ ret = pkgmgr_client_move(pc, data.pkg_type, data.pkgid, data.move_type, mode);
+ if (ret < 0)
+ break;
+ ret = data.result;
+ break;
+
+ case APPPATH_REQ:
+ if (data.pkg_type[0] == '\0' && data.pkgid[0] == '\0') {
+ printf("Tizen Application Installation Path: %s\n", APP_INSTALLATION_PATH_RW);
+ ret = 0;
+ break;
+ }
+ if ((data.pkg_type[0] == '\0') || (data.pkgid[0] == '\0')) {
+ printf("Use -h option to see usage\n");
+ ret = -1;
+ break;
+ }
+ if (strncmp(data.pkg_type, "rpm", PKG_TYPE_STRING_LEN_MAX - 1) == 0) {
+ snprintf(buf, 1023, "%s/%s", APP_INSTALLATION_PATH_RW, data.pkgid);
+ printf("Tizen Application Installation Path: %s\n", buf);
+ ret = 0;
+ break;
+ } else if (strncmp(data.pkg_type, "wgt", PKG_TYPE_STRING_LEN_MAX - 1) == 0) {
+ snprintf(buf, 1023, "%s/%s/res/wgt", APP_INSTALLATION_PATH_RW, data.pkgid);
+ printf("Tizen Application Installation Path: %s\n", buf);
+ ret = 0;
+ break;
+ } else if (strncmp(data.pkg_type, "tpk", PKG_TYPE_STRING_LEN_MAX - 1) == 0) {
+ snprintf(buf, 1023, "%s/%s", APP_INSTALLATION_PATH_RW, data.pkgid);
+ printf("Tizen Application Installation Path: %s\n", buf);
+ ret = 0;
+ break;
+ } else {
+ printf("Invalid package type.\n");
+ printf("use -h option to see usage\n");
+ ret = -1;
+ break;
+ }
+ break;
+
+ case KILLAPP_REQ:
+ case CHECKAPP_REQ:
+ if (data.pkg_type[0] == '\0' || data.pkgid[0] == '\0') {
+ printf("Please provide the arguments.\n");
+ printf("use -h option to see usage\n");
+ ret = -1;
+ break;
+ }
+ pkgmgr_pkginfo_h handle;
+ ret = pkgmgr_pkginfo_get_pkginfo(data.pkgid, &handle);
+ if (ret < 0) {
+ printf("Failed to get handle\n");
+ return -1;
+ }
+ ret = pkgmgr_appinfo_get_list(handle, PM_UI_APP, __app_list_cb, NULL);
+ if (ret < 0) {
+ printf("pkgmgr_appinfo_get_list() failed\n");
+ pkgmgr_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ ret = pkgmgr_appinfo_get_list(handle, PM_SVC_APP, __app_list_cb, NULL);
+ if (ret < 0) {
+ printf("pkgmgr_appinfo_get_list() failed\n");
+ pkgmgr_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ pkgmgr_pkginfo_destroy_pkginfo(handle);
+ ret = 0;
+ break;
+
case LIST_REQ:
- ret = pkgmgr_get_pkg_list(__iter_fn, NULL);
+ ret = pkgmgr_pkginfo_get_list(__pkgmgr_list_cb, NULL);
+ if (ret == -1) {
+ printf("Failed to get package list\n");
+ break;
+ }
break;
case SHOW_REQ:
- if (data.pkg_name[0] != '\0') {
+ if (data.pkgid[0] != '\0') {
pkgmgr_info *pkg_info =
- pkgmgr_info_new(data.pkg_type, data.pkg_name);
+ pkgmgr_info_new(data.pkg_type, data.pkgid);
if (pkg_info == NULL) {
printf("Failed to get pkginfo handle\n");
ret = -1;
ret = pkgmgr_info_free(pkg_info);
break;
}
- printf("Either pkgname or pkgpath should be supplied\n");
+ printf("Either pkgid or pkgpath should be supplied\n");
ret = -1;
break;
data.request = -1;
memset(data.des_path, '\0', PKG_NAME_STRING_LEN_MAX);
memset(data.pkg_path, '\0', PKG_NAME_STRING_LEN_MAX);
- memset(data.pkg_name, '\0', PKG_NAME_STRING_LEN_MAX);
+ memset(data.pkgid, '\0', PKG_NAME_STRING_LEN_MAX);
memset(data.pkg_type, '\0', PKG_TYPE_STRING_LEN_MAX);
data.quiet = 0;
data.result = 0;
+ data.move_type = -1;
while (1) {
c = getopt_long(argc, argv, short_options, long_options,
&opt_idx);
data.request = CLEAR_REQ;
break;
+ case 'm': /* move */
+ data.request = MOVE_REQ;
+ break;
+
+ case 'A': /* activate */
+ data.request = ACTIVATE_REQ;
+ break;
+
+ case 'D': /* deactivate */
+ data.request = DEACTIVATE_REQ;
+ break;
+
+ case 'a': /* app installation path */
+ data.request = APPPATH_REQ;
+ break;
+
+ case 'k': /* Terminate applications of a package */
+ data.request = KILLAPP_REQ;
+ break;
+
+ case 'C': /* Check running status of applications of a package */
+ data.request = CHECKAPP_REQ;
+ break;
+
case 'l': /* list */
data.request = LIST_REQ;
break;
if (optarg)
strncpy(data.pkg_path, optarg,
PKG_NAME_STRING_LEN_MAX);
+ ret = __convert_to_absolute_path(data.pkg_path);
+ if (ret == -1) {
+ printf("conversion of relative path to absolute path failed\n");
+ return -1;
+ }
+ printf("package path is %s\n", data.pkg_path);
break;
case 'd': /* descriptor path */
case 'n': /* package name */
if (optarg)
- strncpy(data.pkg_name, optarg,
+ strncpy(data.pkgid, optarg,
PKG_NAME_STRING_LEN_MAX);
break;
PKG_TYPE_STRING_LEN_MAX);
break;
+ case 'T': /* move type */
+ data.move_type = atoi(optarg);
+ break;
+
case 'h': /* help */
data.request = HELP_REQ;
break;
ret = __process_request();
if (ret != 0) {
printf("processing request %d failed\n", data.request);
+ } else {
+ if (data.request == INSTALL_REQ)
+ sleep(2);
}
+
return ret;
}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+#define _GNU_SOURCE
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <vconf.h>
+#include <pkgmgr_parser.h>
+#include <pkgmgr-info.h>
+#include "package-manager.h"
+#include "package-manager-types.h"
+#include "pkgmgr-dbinfo.h"
+#include "pkgmgr_installer.h"
+
+
+static void __print_usage();
+static int __get_pkg_info(char *pkgid);
+static int __get_app_info(char *appid);
+static int __get_app_list(char *pkgid);
+static int __get_app_category_list(char *appid);
+static int __get_app_control_list(char *appid);
+static int __get_pkg_list(void);
+static int __get_installed_app_list();
+static int __add_app_filter(void);
+static int __add_pkg_filter(void);
+static int __insert_manifest_in_db(char *manifest);
+static int __remove_manifest_from_db(char *manifest);
+static int __set_pkginfo_in_db(char *pkgid);
+static int __set_certinfo_in_db(char *pkgid);
+static int __get_certinfo_from_db(char *pkgid);
+static int __del_certinfo_from_db(char *pkgid);
+static int __get_integer_input_data(void);
+char *__get_string_input_data(void);
+static int __pkg_list_cb (const pkgmgr_pkginfo_h handle, void *user_data);
+static int __app_category_list_cb(const char *category_name, void *user_data);
+static int __app_control_list_cb(pkgmgrinfo_appcontrol_h handle, void *user_data);
+int app_func(const pkgmgr_appinfo_h handle, void *user_data);
+
+static int __get_integer_input_data(void)
+{
+ char input_str[32] = { 0, };
+ int data = 0;
+ fflush(stdin);
+
+ if (fgets(input_str, sizeof(input_str), stdin) == NULL) {
+ printf("fgets() failed....\n");
+ return -1;
+ }
+
+ if (sscanf(input_str, "%d", &data) != 1) {
+ printf("Input only integer option....\n");
+ return -1;
+ }
+
+ return data;
+}
+
+
+char *__get_string_input_data(void)
+{
+ char *data = (char *)malloc(1024);
+ if (data == NULL) {
+ printf("Malloc Failed\n");
+ return NULL;
+ }
+ if (fgets(data,1024,stdin) == NULL){
+ printf("Buffer overflow!!! try again\n");
+ exit(-1);
+ }
+ data[strlen(data) - 1] = '\0';
+ return data;
+}
+
+static void __print_usage()
+{
+ printf("For Getting package|App Info\n");
+ printf("\tpkginfo --[pkg|app] <pkgid|appid>\n\n");
+ printf("For Getting list of installed packages\n");
+ printf("\tpkginfo --listpkg \n\n");
+ printf("For Getting list of installed applications\n");
+ printf("\tpkginfo --listapp \n\n");
+ printf("For Getting app list for a particular package\n");
+ printf("\tpkginfo --list <pkgid>\n\n");
+ printf("For Getting app category list for a particular application\n");
+ printf("\tpkginfo --category <appid>\n\n");
+ printf("For Getting app control list for a particular application\n");
+ printf("\tpkginfo --appcontrol <appid>\n\n");
+ printf("To insert|remove manifest info in DB\n");
+ printf("\tpkginfo --[imd|rmd] <manifest file name>\n\n");
+ printf("To set pkginfo in DB\n");
+ printf("\tpkginfo --setdb <pkgid>\n\n");
+ printf("To set manifest validation\n");
+ printf("\tpkginfo --check <manifest file name>\n\n");
+ printf("To set cert info in DB\n");
+ printf("\tpkginfo --setcert <pkgid>\n\n");
+ printf("To get cert info from DB\n");
+ printf("\tpkginfo --getcert <pkgid>\n\n");
+ printf("To delete all cert info from DB\n");
+ printf("\tpkginfo --delcert <pkgid>\n\n");
+ printf("To add application filter values [Multiple values can be added]\n");
+ printf("\tpkginfo --app-flt\n\n");
+ printf("To add package filter values [Multiple values can be added]\n");
+ printf("\tpkginfo --pkg-flt\n\n");
+}
+
+static int __add_app_filter()
+{
+ int ret = 0;
+ int choice = -1;
+ char *value = NULL;
+ 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;
+ }
+ while (choice != 0 && choice != 1)
+ {
+ printf("Enter Choice\n");
+ printf("0 --> Finalize filter and get count of apps\n");
+ printf("1 --> Finalize filter and get list of apps\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");
+ choice = __get_integer_input_data();
+ switch (choice) {
+ case 0:
+ ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
+ if (ret < 0) {
+ printf("pkgmgrinfo_appinfo_filter_count() failed\n");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ printf("App count = %d\n", count);
+ return 0;
+ case 1:
+ ret = pkgmgrinfo_appinfo_filter_foreach_appinfo(handle, app_func, NULL);
+ if (ret < 0) {
+ printf("pkgmgrinfo_appinfo_filter_foreach_appinfo() failed\n");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ return 0;
+ case 2:
+ value = __get_string_input_data();
+ ret = pkgmgrinfo_appinfo_filter_add_string(handle,
+ PMINFO_APPINFO_PROP_APP_ID, value);
+ if (ret < 0) {
+ printf("pkgmgrinfo_appinfo_filter_add_string() failed\n");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ ret = -1;
+ goto err;
+ }
+ free(value);
+ break;
+ case 3:
+ value = __get_string_input_data();
+ ret = pkgmgrinfo_appinfo_filter_add_string(handle,
+ PMINFO_APPINFO_PROP_APP_COMPONENT, value);
+ if (ret < 0) {
+ printf("pkgmgrinfo_appinfo_filter_add_string() failed\n");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ ret = -1;
+ goto err;
+ }
+ free(value);
+ break;
+ case 4:
+ value = __get_string_input_data();
+ ret = pkgmgrinfo_appinfo_filter_add_string(handle,
+ PMINFO_APPINFO_PROP_APP_EXEC, value);
+ if (ret < 0) {
+ printf("pkgmgrinfo_appinfo_filter_add_string() failed\n");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ ret = -1;
+ goto err;
+ }
+ free(value);
+ break;
+ case 5:
+ value = __get_string_input_data();
+ ret = pkgmgrinfo_appinfo_filter_add_string(handle,
+ PMINFO_APPINFO_PROP_APP_ICON, value);
+ if (ret < 0) {
+ printf("pkgmgrinfo_appinfo_filter_add_string() failed\n");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ ret = -1;
+ goto err;
+ }
+ free(value);
+ break;
+ case 6:
+ value = __get_string_input_data();
+ ret = pkgmgrinfo_appinfo_filter_add_string(handle,
+ PMINFO_APPINFO_PROP_APP_TYPE, value);
+ if (ret < 0) {
+ printf("pkgmgrinfo_appinfo_filter_add_string() failed\n");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ ret = -1;
+ goto err;
+ }
+ free(value);
+ break;
+ case 7:
+ value = __get_string_input_data();
+ ret = pkgmgrinfo_appinfo_filter_add_string(handle,
+ PMINFO_APPINFO_PROP_APP_OPERATION, value);
+ if (ret < 0) {
+ printf("pkgmgrinfo_appinfo_filter_add_string() failed\n");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ ret = -1;
+ goto err;
+ }
+ free(value);
+ break;
+ case 8:
+ value = __get_string_input_data();
+ ret = pkgmgrinfo_appinfo_filter_add_string(handle,
+ PMINFO_APPINFO_PROP_APP_URI, value);
+ if (ret < 0) {
+ printf("pkgmgrinfo_appinfo_filter_add_string() failed\n");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ ret = -1;
+ goto err;
+ }
+ free(value);
+ break;
+ case 9:
+ value = __get_string_input_data();
+ ret = pkgmgrinfo_appinfo_filter_add_string(handle,
+ PMINFO_APPINFO_PROP_APP_MIME, value);
+ if (ret < 0) {
+ printf("pkgmgrinfo_appinfo_filter_add_string() failed\n");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ ret = -1;
+ goto err;
+ }
+ free(value);
+ break;
+ case 10:
+ value = __get_string_input_data();
+ ret = pkgmgrinfo_appinfo_filter_add_string(handle,
+ PMINFO_APPINFO_PROP_APP_CATEGORY, value);
+ if (ret < 0) {
+ printf("pkgmgrinfo_appinfo_filter_add_string() failed\n");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ ret = -1;
+ goto err;
+ }
+ free(value);
+ break;
+ case 11:
+ val = __get_integer_input_data();
+ ret = pkgmgrinfo_appinfo_filter_add_bool(handle,
+ PMINFO_APPINFO_PROP_APP_NODISPLAY, val);
+ if (ret < 0) {
+ printf("pkgmgrinfo_appinfo_filter_add_bool() failed\n");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ break;
+ case 12:
+ val = __get_integer_input_data();
+ ret = pkgmgrinfo_appinfo_filter_add_bool(handle,
+ PMINFO_APPINFO_PROP_APP_MULTIPLE, val);
+ if (ret < 0) {
+ printf("pkgmgrinfo_appinfo_filter_add_bool() failed\n");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ break;
+ case 13:
+ val = __get_integer_input_data();
+ ret = pkgmgrinfo_appinfo_filter_add_bool(handle,
+ PMINFO_APPINFO_PROP_APP_ONBOOT, val);
+ if (ret < 0) {
+ printf("pkgmgrinfo_appinfo_filter_add_bool() failed\n");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ break;
+ case 14:
+ val = __get_integer_input_data();
+ ret = pkgmgrinfo_appinfo_filter_add_bool(handle,
+ PMINFO_APPINFO_PROP_APP_AUTORESTART, val);
+ if (ret < 0) {
+ printf("pkgmgrinfo_appinfo_filter_add_bool() failed\n");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ break;
+ case 15:
+ val = __get_integer_input_data();
+ ret = pkgmgrinfo_appinfo_filter_add_bool(handle,
+ PMINFO_APPINFO_PROP_APP_TASKMANAGE, val);
+ if (ret < 0) {
+ printf("pkgmgrinfo_appinfo_filter_add_bool() failed\n");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ break;
+ case 16:
+ value = __get_string_input_data();
+ ret = pkgmgrinfo_appinfo_filter_add_string(handle,
+ PMINFO_APPINFO_PROP_APP_HWACCELERATION, value);
+ if (ret < 0) {
+ printf("pkgmgrinfo_appinfo_filter_add_bool() failed\n");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ ret = -1;
+ goto err;
+ }
+ free(value);
+ break;
+ default:
+ printf("Invalid filter property\n");
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ }
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ ret = 0;
+err:
+ if (value) {
+ free(value);
+ value = NULL;
+ }
+ return ret;
+}
+
+static int __add_pkg_filter()
+{
+ int ret = 0;
+ int choice = -1;
+ char *value = NULL;
+ int val = -1;
+ int count = 0;
+ pkgmgrinfo_pkginfo_filter_h handle;
+ ret = pkgmgrinfo_pkginfo_filter_create(&handle);
+ if (ret > 0) {
+ printf("pkginfo filter handle create failed\n");
+ return -1;
+ }
+ while (choice != 0 && choice !=1)
+ {
+ printf("Enter Choice\n");
+ printf("0 --> Finalize filter and get count of packages\n");
+ printf("1 --> Finalize filter and get list of packages\n");
+ printf("2 --> filter by package ID\n");
+ printf("3 --> filter by package version\n");
+ printf("4 --> filter by package type\n");
+ printf("5 --> filter by package install location\n");
+ printf("6 --> filter by author name\n");
+ printf("7 --> filter by author email\n");
+ printf("8 --> filter by author href\n");
+ printf("9 --> filter by package removable [0|1]\n");
+ printf("10 --> filter by package readonly [0|1]\n");
+ printf("11 --> filter by package preload [0|1]\n");
+ printf("12 --> filter by package size\n");
+ choice = __get_integer_input_data();
+ switch (choice) {
+ case 0:
+ ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
+ if (ret < 0) {
+ printf("pkgmgrinfo_pkginfo_filter_count() failed\n");
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return -1;
+ }
+ printf("Package count = %d\n", count);
+ return 0;
+ case 1:
+ ret = pkgmgrinfo_pkginfo_filter_foreach_pkginfo(handle, __pkg_list_cb, NULL);
+ if (ret < 0) {
+ printf("pkgmgrinfo_pkginfo_filter_foreach_pkginfo() failed\n");
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return -1;
+ }
+ return 0;
+ case 2:
+ value = __get_string_input_data();
+ ret = pkgmgrinfo_pkginfo_filter_add_string(handle,
+ PMINFO_PKGINFO_PROP_PACKAGE_ID, value);
+ if (ret < 0) {
+ printf("pkgmgrinfo_pkginfo_filter_add_string() failed\n");
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ ret = -1;
+ goto err;
+ }
+ free(value);
+ value = NULL;
+ break;
+ case 3:
+ value = __get_string_input_data();
+ ret = pkgmgrinfo_pkginfo_filter_add_string(handle,
+ PMINFO_PKGINFO_PROP_PACKAGE_VERSION, value);
+ if (ret < 0) {
+ printf("pkgmgrinfo_pkginfo_filter_add_string() failed\n");
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ ret = -1;
+ goto err;
+ }
+ free(value);
+ value = NULL;
+ break;
+ case 4:
+ value = __get_string_input_data();
+ ret = pkgmgrinfo_pkginfo_filter_add_string(handle,
+ PMINFO_PKGINFO_PROP_PACKAGE_TYPE, value);
+ if (ret < 0) {
+ printf("pkgmgrinfo_pkginfo_filter_add_string() failed\n");
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ ret = -1;
+ goto err;
+ }
+ free(value);
+ value = NULL;
+ break;
+ case 5:
+ value = __get_string_input_data();
+ ret = pkgmgrinfo_pkginfo_filter_add_string(handle,
+ PMINFO_PKGINFO_PROP_PACKAGE_INSTALL_LOCATION, value);
+ if (ret < 0) {
+ printf("pkgmgrinfo_pkginfo_filter_add_string() failed\n");
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ ret = -1;
+ goto err;
+ }
+ free(value);
+ value = NULL;
+ break;
+ case 6:
+ value = __get_string_input_data();
+ ret = pkgmgrinfo_pkginfo_filter_add_string(handle,
+ PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME, value);
+ if (ret < 0) {
+ printf("pkgmgrinfo_pkginfo_filter_add_string() failed\n");
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ ret = -1;
+ goto err;
+ }
+ free(value);
+ value = NULL;
+ break;
+ case 7:
+ value = __get_string_input_data();
+ ret = pkgmgrinfo_pkginfo_filter_add_string(handle,
+ PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_EMAIL, value);
+ if (ret < 0) {
+ printf("pkgmgrinfo_pkginfo_filter_add_string() failed\n");
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ ret = -1;
+ goto err;
+ }
+ free(value);
+ value = NULL;
+ break;
+ case 8:
+ value = __get_string_input_data();
+ ret = pkgmgrinfo_pkginfo_filter_add_string(handle,
+ PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF, value);
+ if (ret < 0) {
+ printf("pkgmgrinfo_pkginfo_filter_add_string() failed\n");
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ ret = -1;
+ goto err;
+ }
+ free(value);
+ value = NULL;
+ break;
+ case 9:
+ val = __get_integer_input_data();
+ ret = pkgmgrinfo_pkginfo_filter_add_bool(handle,
+ PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE, val);
+ if (ret < 0) {
+ printf("pkgmgrinfo_pkginfo_filter_add_bool() failed\n");
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return -1;
+ }
+ break;
+ case 10:
+ val = __get_integer_input_data();
+ ret = pkgmgrinfo_pkginfo_filter_add_bool(handle,
+ PMINFO_PKGINFO_PROP_PACKAGE_READONLY, val);
+ if (ret < 0) {
+ printf("pkgmgrinfo_pkginfo_filter_add_bool() failed\n");
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return -1;
+ }
+ break;
+ case 11:
+ val = __get_integer_input_data();
+ ret = pkgmgrinfo_pkginfo_filter_add_bool(handle,
+ PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD, val);
+ if (ret < 0) {
+ printf("pkgmgrinfo_pkginfo_filter_add_bool() failed\n");
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return -1;
+ }
+ break;
+ case 12:
+ val = __get_integer_input_data();
+ ret = pkgmgrinfo_pkginfo_filter_add_int(handle,
+ PMINFO_PKGINFO_PROP_PACKAGE_SIZE, val);
+ if (ret < 0) {
+ printf("pkgmgrinfo_pkginfo_filter_add_int() failed\n");
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return -1;
+ }
+ break;
+ default:
+ printf("Invalid filter property\n");
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ return -1;
+ }
+ }
+ pkgmgrinfo_pkginfo_filter_destroy(handle);
+ ret = 0;
+err:
+ if (value) {
+ free(value);
+ value = NULL;
+ }
+ return ret;
+}
+
+static int __del_certinfo_from_db(char *pkgid)
+{
+ int ret = 0;
+ if (pkgid == NULL) {
+ printf("pkgid is NULL\n");
+ return -1;
+ }
+ ret = pkgmgr_installer_delete_certinfo(pkgid);
+ if (ret < 0) {
+ printf("pkgmgr_installer_delete_certinfo failed\n");
+ return -1;
+ }
+ return 0;
+}
+
+static int __get_certinfo_from_db(char *pkgid)
+{
+ if (pkgid == NULL) {
+ printf("pkgid is NULL\n");
+ return -1;
+ }
+ int ret = 0;
+ int choice = -1;
+ int i = 0;
+ char *value = NULL;
+ pkgmgr_certinfo_h handle = NULL;
+ ret = pkgmgr_pkginfo_create_certinfo(&handle);
+ if (ret < 0) {
+ printf("pkgmgr_pkginfo_create_certinfo failed\n");
+ return -1;
+ }
+ ret = pkgmgr_pkginfo_load_certinfo(pkgid, handle);
+ if (ret < 0) {
+ printf("pkgmgr_pkginfo_load_certinfo failed\n");
+ return -1;
+ }
+ while (choice != 10)
+ {
+ printf("Enter the choice to get\n");
+ printf("0 --> to get all cert values\n");
+ printf("1 --> author root certificate\n");
+ printf("2 --> author intermediate certificate\n");
+ printf("3 --> author signer certificate\n");
+ printf("4 --> distributor root certificate\n");
+ printf("5 --> distributor intermediate certificate\n");
+ printf("6 --> distributor signer certificate\n");
+ printf("7 --> distributor2 root certificate\n");
+ printf("8 --> distributor2 intermediate certificate\n");
+ printf("9 --> distributor2 signer certificate\n");
+ printf("10 --> exit\n");
+ choice = __get_integer_input_data();
+ switch (choice) {
+ case 0:
+ for (i = 0; i < 9; i++)
+ {
+ pkgmgr_pkginfo_get_cert_value(handle, i, &value);
+ if (value)
+ printf("cert type[%d] value = %s\n", i, value);
+ }
+ ret = pkgmgr_pkginfo_destroy_certinfo(handle);
+ if (ret < 0) {
+ printf("pkgmgr_pkginfo_destroy_certinfo failed\n");
+ return -1;
+ }
+ return 0;
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ ret = pkgmgr_pkginfo_get_cert_value(handle, choice - 1, &value);
+ if (value)
+ printf("cert type[%d] value = %s\n", choice - 1, value);
+ break;
+ case 10:
+ ret = pkgmgr_pkginfo_destroy_certinfo(handle);
+ if (ret < 0) {
+ printf("pkgmgr_pkginfo_destroy_certinfo failed\n");
+ return -1;
+ }
+ return 0;
+ default:
+ printf("Invalid choice entered\n");
+ return -1;
+ }
+ }
+ return 0;
+}
+
+static int __set_certinfo_in_db(char *pkgid)
+{
+ if (pkgid == NULL) {
+ printf("pkgid is NULL\n");
+ return -1;
+ }
+ int ret = 0;
+ int choice = -1;
+ char *value = NULL;
+ pkgmgr_instcertinfo_h handle = NULL;
+ ret = pkgmgr_installer_create_certinfo_set_handle(&handle);
+ if (ret < 0) {
+ printf("pkgmgr_installer_create_certinfo_set_handle failed\n");
+ return -1;
+ }
+ while (choice != 0)
+ {
+ printf("Enter the choice you want to set\n");
+ printf("0 --> to set data in DB\n");
+ printf("1 --> author root certificate\n");
+ printf("2 --> author intermediate certificate\n");
+ printf("3 --> author signer certificate\n");
+ printf("4 --> distributor root certificate\n");
+ printf("5 --> distributor intermediate certificate\n");
+ printf("6 --> distributor signer certificate\n");
+ printf("7 --> distributor2 root certificate\n");
+ printf("8 --> distributor2 intermediate certificate\n");
+ printf("9 --> distributor2 signer certificate\n");
+ choice = __get_integer_input_data();
+ switch (choice) {
+ case 0:
+ ret = pkgmgr_installer_save_certinfo(pkgid, handle);
+ if (ret < 0) {
+ printf("pkgmgr_installer_save_certinfo failed\n");
+ return -1;
+ }
+ ret = pkgmgr_installer_destroy_certinfo_set_handle(handle);
+ if (ret < 0) {
+ printf("pkgmgr_installer_destroy_certinfo_set_handle failed\n");
+ return -1;
+ }
+ return 0;
+ case 1:
+ printf("Enter Author Root Certificate Value: \n");
+ value = __get_string_input_data();
+ ret = pkgmgr_installer_set_cert_value(handle, 0, value);
+ if (ret < 0) {
+ printf("pkgmgr_installer_set_cert_value failed\n");
+ pkgmgr_installer_destroy_certinfo_set_handle(handle);
+ return -1;
+ }
+ break;
+ case 2:
+ printf("Enter Author Intermediate Certificate Value: \n");
+ value = __get_string_input_data();
+ ret = pkgmgr_installer_set_cert_value(handle, 1, value);
+ if (ret < 0) {
+ printf("pkgmgr_installer_set_cert_value failed\n");
+ pkgmgr_installer_destroy_certinfo_set_handle(handle);
+ return -1;
+ }
+ break;
+ case 3:
+ printf("Enter Author Signer Certificate Value: \n");
+ value = __get_string_input_data();
+ ret = pkgmgr_installer_set_cert_value(handle, 2, value);
+ if (ret < 0) {
+ printf("pkgmgr_installer_set_cert_value failed\n");
+ pkgmgr_installer_destroy_certinfo_set_handle(handle);
+ return -1;
+ }
+ break;
+ case 4:
+ printf("Enter Distributor Root Certificate Value: \n");
+ value = __get_string_input_data();
+ ret = pkgmgr_installer_set_cert_value(handle, 3, value);
+ if (ret < 0) {
+ printf("pkgmgr_installer_set_cert_value failed\n");
+ pkgmgr_installer_destroy_certinfo_set_handle(handle);
+ return -1;
+ }
+ break;
+ case 5:
+ printf("Enter Distributor Intermediate Certificate Value: \n");
+ value = __get_string_input_data();
+ ret = pkgmgr_installer_set_cert_value(handle, 4, value);
+ if (ret < 0) {
+ printf("pkgmgr_installer_set_cert_value failed\n");
+ pkgmgr_installer_destroy_certinfo_set_handle(handle);
+ return -1;
+ }
+ break;
+ case 6:
+ printf("Enter Distributor Signer Certificate Value: \n");
+ value = __get_string_input_data();
+ ret = pkgmgr_installer_set_cert_value(handle, 5, value);
+ if (ret < 0) {
+ printf("pkgmgr_installer_set_cert_value failed\n");
+ pkgmgr_installer_destroy_certinfo_set_handle(handle);
+ return -1;
+ }
+ break;
+ case 7:
+ printf("Enter Distributor2 Root Certificate Value: \n");
+ value = __get_string_input_data();
+ ret = pkgmgr_installer_set_cert_value(handle, 6, value);
+ if (ret < 0) {
+ printf("pkgmgr_installer_set_cert_value failed\n");
+ pkgmgr_installer_destroy_certinfo_set_handle(handle);
+ return -1;
+ }
+ break;
+ case 8:
+ printf("Enter Distributor2 Intermediate Certificate Value: \n");
+ value = __get_string_input_data();
+ ret = pkgmgr_installer_set_cert_value(handle, 7, value);
+ if (ret < 0) {
+ printf("pkgmgr_installer_set_cert_value failed\n");
+ pkgmgr_installer_destroy_certinfo_set_handle(handle);
+ return -1;
+ }
+ break;
+ case 9:
+ printf("Enter Distributor2 Signer Certificate Value: \n");
+ value = __get_string_input_data();
+ ret = pkgmgr_installer_set_cert_value(handle, 8, value);
+ if (ret < 0) {
+ printf("pkgmgr_installer_set_cert_value failed\n");
+ pkgmgr_installer_destroy_certinfo_set_handle(handle);
+ return -1;
+ }
+ break;
+ default:
+ printf("Invalid Number Entered\n");
+ choice = 0;
+ ret = pkgmgr_installer_destroy_certinfo_set_handle(handle);
+ if (ret < 0) {
+ printf("pkgmgr_installer_destroy_certinfo_set_handle failed\n");
+ return -1;
+ }
+ break;
+ }
+ }
+ return -1;
+}
+
+static int __set_pkginfo_in_db(char *pkgid)
+{
+ if (pkgid == NULL) {
+ printf("pkgid is NULL\n");
+ return -1;
+ }
+ int ret = 0;
+ int choice = -1;
+ int preload = -1;
+ int removable = -1;
+ int location = -1;
+ char *locale = NULL;
+ pkgmgr_pkgdbinfo_h handle = NULL;
+ ret = pkgmgr_create_pkgdbinfo(pkgid, &handle);
+ if (ret < 0) {
+ printf("pkgmgr_create_pkgdbinfo failed\n");
+ return -1;
+ }
+ while (choice != 0)
+ {
+ printf("Enter the choice you want to set\n");
+ printf("0 --> to set data in DB\n");
+ printf("1 --> pkg type\n");
+ printf("2 --> pkg version\n");
+ printf("3 --> pkg instal location\n");
+ printf("4 --> pkg label\n");
+ printf("5 --> pkg icon\n");
+ printf("6 --> pkg description\n");
+ printf("7 --> pkg author\n");
+ printf("8 --> pkg removable\n");
+ printf("9 --> pkg preload\n");
+ printf("10 --> pkg size\n");
+ choice = __get_integer_input_data();
+ switch (choice) {
+ case 0:
+ ret = pkgmgr_save_pkgdbinfo(handle);
+ if (ret < 0) {
+ printf("pkgmgr_save_pkgdbinfo failed\n");
+ pkgmgr_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ ret = pkgmgr_destroy_pkgdbinfo(handle);
+ if (ret < 0) {
+ printf("pkgmgr_destroy_pkgdbinfo failed\n");
+ return -1;
+ }
+ break;
+ case 1:
+ printf("Enter type: \n");
+ char *type = __get_string_input_data();
+ ret = pkgmgr_set_type_to_pkgdbinfo(handle, type);
+ if (ret < 0) {
+ printf("pkgmgr_set_type_to_pkgdbinfo failed\n");
+ pkgmgr_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ break;
+ case 2:
+ printf("Enter version: \n");
+ char *version = __get_string_input_data();
+ ret = pkgmgr_set_version_to_pkgdbinfo(handle, version);
+ if (ret < 0) {
+ printf("pkgmgr_set_version_to_pkgdbinfo failed\n");
+ pkgmgr_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ break;
+ case 3:
+ printf("Enter install location [0:internal | 1:external]: \n");
+ location = __get_integer_input_data();
+ ret = pkgmgr_set_install_location_to_pkgdbinfo(handle, location);
+ if (ret < 0) {
+ printf("pkgmgr_set_install_location_to_pkgdbinfo failed\n");
+ pkgmgr_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ break;
+ case 4:
+ printf("Enter label :\n");
+ char *label = __get_string_input_data();
+ printf("Enter locale ['def' for default]: \n");
+ locale = __get_string_input_data();
+ if (strcmp(locale, "def") == 0)
+ ret = pkgmgr_set_label_to_pkgdbinfo(handle, label, NULL);
+ else
+ ret = pkgmgr_set_label_to_pkgdbinfo(handle, label, locale);
+ if (ret < 0) {
+ printf("pkgmgr_set_label_to_pkgdbinfo failed\n");
+ pkgmgr_destroy_pkgdbinfo(handle);
+ free(locale);
+ return -1;
+ }
+ free(locale);
+ break;
+ case 5:
+ printf("Enter icon: \n");
+ char *icon = __get_string_input_data();
+ printf("Enter locale ['def' for default]: \n");
+ locale = __get_string_input_data();
+ if (strcmp(locale, "def") == 0)
+ ret = pkgmgr_set_icon_to_pkgdbinfo(handle, icon, NULL);
+ else
+ ret = pkgmgr_set_icon_to_pkgdbinfo(handle, icon, locale);
+ if (ret < 0) {
+ printf("pkgmgr_set_icon_to_pkgdbinfo failed\n");
+ pkgmgr_destroy_pkgdbinfo(handle);
+ free(locale);
+ return -1;
+ }
+ free(locale);
+ break;
+ case 6:
+ printf("Enter description: \n");
+ char *description = __get_string_input_data();
+ printf("Enter locale ['def' for default]: \n");
+ locale = __get_string_input_data();
+ if (strcmp(locale, "def") == 0)
+ ret = pkgmgr_set_description_to_pkgdbinfo(handle, description, NULL);
+ else
+ ret = pkgmgr_set_description_to_pkgdbinfo(handle, description, locale);
+ if (ret < 0) {
+ printf("pkgmgr_set_description_to_pkgdbinfo failed\n");
+ pkgmgr_destroy_pkgdbinfo(handle);
+ free(locale);
+ return -1;
+ }
+ free(locale);
+ break;
+ case 7:
+ printf("Enter author name: \n");
+ char *author_name = __get_string_input_data();
+ printf("Enter locale ['def' for default]: \n");
+ locale = __get_string_input_data();
+ printf("Enter author email: \n");
+ char *author_email = __get_string_input_data();
+ printf("Enter author href: \n");
+ char *author_href = __get_string_input_data();
+ if (strcmp(locale, "def") == 0)
+ ret = pkgmgr_set_author_to_pkgdbinfo(handle, author_name, author_email, author_href, NULL);
+ else
+ ret = pkgmgr_set_author_to_pkgdbinfo(handle, author_name, author_email, author_href, locale);
+ if (ret < 0) {
+ printf("pkgmgr_set_author_to_pkgdbinfo failed\n");
+ pkgmgr_destroy_pkgdbinfo(handle);
+ free(locale);
+ return -1;
+ }
+ free(locale);
+ break;
+ case 8:
+ printf("Enter removable [0:false | 1:true]: \n");
+ removable = __get_integer_input_data();
+ ret = pkgmgr_set_removable_to_pkgdbinfo(handle, removable);
+ if (ret < 0) {
+ printf("pkgmgr_set_removable_to_pkgdbinfo failed\n");
+ pkgmgr_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ break;
+ case 9:
+ printf("Enter preload [0:false | 1:true]: \n");
+ preload = __get_integer_input_data();
+ ret = pkgmgr_set_preload_to_pkgdbinfo(handle, preload);
+ if (ret < 0) {
+ printf("pkgmgr_set_preload_to_pkgdbinfo failed\n");
+ pkgmgr_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ break;
+ case 10:
+ printf("Enter size in MB \n");
+ char *size = __get_string_input_data();
+ ret = pkgmgr_set_size_to_pkgdbinfo(handle, size);
+ if (ret < 0) {
+ printf("pkgmgr_set_size_to_pkgdbinfo failed\n");
+ pkgmgr_destroy_pkgdbinfo(handle);
+ return -1;
+ }
+ break;
+ default:
+ printf("Invalid number entered\n");
+ continue;
+ }
+ }
+ return 0;
+}
+
+static int __insert_manifest_in_db(char *manifest)
+{
+ int ret = 0;
+ if (manifest == NULL) {
+ printf("Manifest file is NULL\n");
+ return -1;
+ }
+ 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)
+{
+ int ret = 0;
+ if (manifest == NULL) {
+ printf("Manifest file is NULL\n");
+ return -1;
+ }
+ 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 pkgmgr_appinfo_h handle, void *user_data)
+{
+ char *appid;
+ char *data = NULL;
+ if (user_data) {
+ data = (char *)user_data;
+ }
+ int ret = -1;
+ char *exec = NULL;
+ char *icon = NULL;
+ char *label = NULL;
+ pkgmgr_app_component component = 0;
+ char *apptype = NULL;
+ bool nodisplay = 0;
+ bool multiple = 0;
+ bool taskmanage = 0;
+ int hwacceleration = 0;
+ bool onboot = 0;
+ bool autorestart = 0;
+ char *package = NULL;
+
+ ret = pkgmgr_appinfo_get_appid(handle, &appid);
+ if (ret < 0) {
+ printf("Failed to get appid\n");
+ }
+ if (appid)
+ printf("Appid: %s\n", appid);
+
+ ret = pkgmgr_appinfo_get_pkgid(handle, &package);
+ if (ret < 0) {
+ printf("Failed to get package\n");
+ }
+ if (package)
+ printf("Package: %s\n", package);
+
+ ret = pkgmgr_appinfo_get_exec(handle, &exec);
+ if (ret < 0) {
+ printf("Failed to get exec\n");
+ }
+ if (exec)
+ printf("Exec: %s\n", exec);
+
+ ret = pkgmgr_appinfo_get_icon(handle, &icon);
+ if (ret < 0) {
+ printf("Failed to get icon\n");
+ }
+ if (icon)
+ printf("Icon: %s\n", icon);
+
+ ret = pkgmgr_appinfo_get_label(handle, &label);
+ if (ret < 0) {
+ printf("Failed to get label\n");
+ }
+ if (label)
+ printf("Label: %s\n", label);
+
+ ret = pkgmgr_appinfo_get_component(handle, &component);
+ if (ret < 0) {
+ printf("Failed to get component\n");
+ }
+
+ ret = pkgmgr_appinfo_get_apptype(handle, &apptype);
+ if (ret < 0) {
+ printf("Failed to get apptype\n");
+ }
+ if (apptype)
+ printf("Apptype: %s\n", apptype);
+
+ if (component == PM_UI_APP) {
+ printf("component: uiapp\n");
+ ret = pkgmgr_appinfo_is_multiple(handle, &multiple);
+ if (ret < 0) {
+ printf("Failed to get multiple\n");
+ } else {
+ printf("Multiple: %d\n", multiple);
+ }
+
+ ret = pkgmgr_appinfo_is_nodisplay(handle, &nodisplay);
+ if (ret < 0) {
+ printf("Failed to get nodisplay\n");
+ } else {
+ printf("Nodisplay: %d \n", nodisplay);
+ }
+
+ ret = pkgmgr_appinfo_is_taskmanage(handle, &taskmanage);
+ if (ret < 0) {
+ printf("Failed to get taskmanage\n");
+ } else {
+ printf("Taskmanage: %d\n", taskmanage);
+ }
+
+ ret = pkgmgr_appinfo_get_hwacceleration(handle, &hwacceleration);
+ if (ret < 0) {
+ printf("Failed to get hwacceleration\n");
+ } else {
+ printf("hw-acceleration: %d\n", hwacceleration);
+ }
+
+ }
+ if (component == PM_SVC_APP) {
+ printf("component: svcapp\n");
+ ret = pkgmgr_appinfo_is_onboot(handle, &onboot);
+ if (ret < 0) {
+ printf("Failed to get onboot\n");
+ } else {
+ printf("Onboot: %d\n", onboot);
+ }
+
+ ret = pkgmgr_appinfo_is_autorestart(handle, &autorestart);
+ if (ret < 0) {
+ printf("Failed to get autorestart\n");
+ } else {
+ printf("Autorestart: %d \n", autorestart);
+ }
+ }
+
+
+ printf("\n", data);
+ return 0;
+}
+
+
+static int __pkg_list_cb (const pkgmgr_pkginfo_h handle, void *user_data)
+{
+ char *test_data = "test data";
+ int ret = -1;
+ char *pkgid;
+ char *pkg_type;
+ char *pkg_version;
+ ret = pkgmgr_pkginfo_get_pkgid(handle, &pkgid);
+ if(ret < 0) {
+ printf("pkgmgr_pkginfo_get_pkgid() failed\n");
+ }
+ ret = pkgmgr_pkginfo_get_type(handle, &pkg_type);
+ if(ret < 0) {
+ printf("pkgmgr_pkginfo_get_type() failed\n");
+ }
+ ret = pkgmgr_pkginfo_get_version(handle, &pkg_version);
+ if(ret < 0) {
+ printf("pkgmgr_pkginfo_get_version() failed\n");
+ }
+ printf("---------------------------------------\n");
+ printf("pkg_type [%s]\tpkgid [%s]\tversion [%s]\n", pkg_type,
+ pkgid, pkg_version);
+
+ printf("**List of Ui-Apps**\n");
+ ret = pkgmgr_appinfo_get_list(handle, PM_UI_APP, app_func, (void *)test_data);
+ if (ret < 0) {
+ printf("pkgmgr_get_info_app() failed\n");
+ }
+ printf("**List of Svc-Apps**\n");
+ ret = pkgmgr_appinfo_get_list(handle, PM_SVC_APP, app_func, (void *)test_data);
+ if (ret < 0) {
+ printf("pkgmgr_get_info_app() failed\n");
+ }
+
+ printf("---------------------------------------\n");
+
+ return 0;
+}
+
+static int __get_pkg_list()
+{
+ int ret = -1;
+ ret = pkgmgr_pkginfo_get_list(__pkg_list_cb, NULL);
+ if (ret < 0) {
+ printf("pkgmgr_pkginfo_get_list() failed\n");
+ return -1;
+ }
+ return 0;
+}
+
+static int __get_installed_app_list()
+{
+ int ret = -1;
+ ret = pkgmgrinfo_appinfo_get_installed_list(app_func, NULL);
+ if (ret < 0) {
+ printf("pkgmgrinfo_appinfo_get_installed_list() failed\n");
+ return -1;
+ }
+ return 0;
+}
+
+
+static int __app_category_list_cb(const char *category_name, void *user_data)
+{
+ if (category_name)
+ printf("Category: %s\n", category_name);
+ return 0;
+}
+
+static int __app_control_list_cb(pkgmgrinfo_appcontrol_h handle, void *user_data)
+{
+ printf("-------------------------------------------------------\n");
+ int i = 0;
+ int ret = 0;
+ int oc = 0;
+ int mc = 0;
+ int uc = 0;
+ char **operation = NULL;
+ char **uri = NULL;
+ char **mime = NULL;
+ ret = pkgmgrinfo_appinfo_get_operation(handle, &oc, &operation);
+ if (ret < 0) {
+ printf("Get Operation Failed\n");
+ return -1;
+ }
+ ret = pkgmgrinfo_appinfo_get_uri(handle, &uc, &uri);
+ if (ret < 0) {
+ printf("Get Uri Failed\n");
+ return -1;
+ }
+ ret = pkgmgrinfo_appinfo_get_mime(handle, &mc, &mime);
+ if (ret < 0) {
+ printf("Get Mime Failed\n");
+ return -1;
+ }
+ for (i = 0; i < oc; i++) {
+ if (operation && operation[i])
+ printf("Operation: %s\n", operation[i]);
+ }
+ for (i = 0; i < uc; i++) {
+ if (uri && uri[i])
+ printf("Uri: %s\n", uri[i]);
+ }
+ for (i = 0; i < mc; i++) {
+ if (mime && mime[i])
+ printf("Mime: %s\n", mime[i]);
+ }
+ printf("-------------------------------------------------------\n\n");
+ return 0;
+}
+
+
+static int __get_app_category_list(char *appid)
+{
+ int ret = -1;
+ pkgmgr_appinfo_h handle;
+ ret = pkgmgr_appinfo_get_appinfo(appid, &handle);
+ if (ret < 0) {
+ printf("Failed to get handle\n");
+ return -1;
+ }
+ ret = pkgmgr_appinfo_foreach_category(handle, __app_category_list_cb, NULL);
+ if (ret < 0) {
+ printf("pkgmgr_appinfo_foreach_category() failed\n");
+ pkgmgr_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ pkgmgr_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+
+static int __get_app_control_list(char *appid)
+{
+ int ret = -1;
+ pkgmgr_appinfo_h handle;
+ ret = pkgmgr_appinfo_get_appinfo(appid, &handle);
+ if (ret < 0) {
+ printf("Failed to get handle\n");
+ return -1;
+ }
+ ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, __app_control_list_cb, NULL);
+ if (ret < 0) {
+ printf("pkgmgrinfo_appinfo_foreach_appcontrol() failed\n");
+ pkgmgr_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ pkgmgr_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+
+static int __get_app_list(char *pkgid)
+{
+ pkgmgr_pkginfo_h handle;
+ int ret = -1;
+ char *test_data = "test data";
+ ret = pkgmgr_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret < 0) {
+ printf("Failed to get handle\n");
+ return -1;
+ }
+ printf("List of Ui-Apps\n\n");
+ ret = pkgmgr_appinfo_get_list(handle, PM_UI_APP, app_func, (void *)test_data);
+ if (ret < 0) {
+ printf("pkgmgr_appinfo_get_list() failed\n");
+ }
+ printf("List of Svc-Apps\n\n");
+ ret = pkgmgr_appinfo_get_list(handle, PM_SVC_APP, app_func, (void *)test_data);
+ if (ret < 0) {
+ printf("pkgmgr_appinfo_get_list() failed\n");
+ }
+ pkgmgr_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+
+static int __get_pkg_info(char *pkgid)
+{
+ pkgmgr_pkginfo_h handle;
+ int ret = -1;
+ char *type = NULL;
+ char *version = NULL;
+ char *author_name = NULL;
+ char *author_email = NULL;
+ char *author_href = NULL;
+ pkgmgr_install_location location = 0;
+ char *icon = NULL;
+ char *label = NULL;
+ char *desc = NULL;
+ bool removable = 0;
+ bool preload = 0;
+ bool readonly = 0;
+ int size = -1;
+ int installed_time = -1;
+
+ printf("Get Pkg Info Called [%s]\n", pkgid);
+ ret = pkgmgr_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret < 0) {
+ printf("Failed to get handle\n");
+ return -1;
+ }
+
+ ret = pkgmgr_pkginfo_get_type(handle, &type);
+ if (ret < 0) {
+ printf("Failed to get pkg type\n");
+ }
+ if (type)
+ printf("Type: %s\n", type);
+
+ ret = pkgmgr_pkginfo_get_version(handle, &version);
+ if (ret < 0) {
+ printf("Failed to get version\n");
+ }
+ if (version)
+ printf("Version: %s\n", version);
+
+ ret = pkgmgr_pkginfo_get_install_location(handle, &location);
+ if (ret < 0) {
+ printf("Failed to get install location\n");
+ }
+ printf("Install Location: %d\n", location);
+
+ ret = pkgmgr_pkginfo_get_package_size(handle, &size);
+ if (ret < 0) {
+ printf("Failed to get package size \n");
+ }
+ printf("Package Size: %d\n", size);
+
+ ret = pkgmgr_pkginfo_get_icon(handle, &icon);
+ if (ret < 0) {
+ printf("Failed to get icon\n");
+ }
+ if (icon)
+ printf("Icon: %s\n", icon);
+
+ ret = pkgmgr_pkginfo_get_label(handle, &label);
+ if (ret < 0) {
+ printf("Failed to get label\n");
+ }
+ if (label)
+ printf("Label: %s\n", label);
+
+ ret = pkgmgr_pkginfo_get_description(handle, &desc);
+ if (ret < 0) {
+ printf("Failed to get description\n");
+ }
+ if (desc)
+ printf("Description: %s\n", desc);
+
+ ret = pkgmgr_pkginfo_get_author_name(handle, &author_name);
+ if (ret < 0) {
+ printf("Failed to get author name\n");
+ }
+ if (author_name)
+ printf("Author Name: %s\n", author_name);
+
+ ret = pkgmgr_pkginfo_get_author_email(handle, &author_email);
+ if (ret < 0) {
+ printf("Failed to get author email\n");
+ }
+ if (author_email)
+ printf("Author Email: %s\n", author_email);
+
+ ret = pkgmgr_pkginfo_get_author_href(handle, &author_href);
+ if (ret < 0) {
+ printf("Failed to get author href\n");
+ }
+ if (author_href)
+ printf("Author Href: %s\n", author_href);
+
+ ret = pkgmgr_pkginfo_is_removable(handle, &removable);
+ if (ret < 0) {
+ printf("Failed to get removable\n");
+ }
+ else
+ printf("Removable: %d\n", removable);
+
+ ret = pkgmgr_pkginfo_is_preload(handle, &preload);
+ if (ret < 0) {
+ printf("Failed to get preload\n");
+ }
+ else
+ printf("Preload: %d\n", preload);
+
+ ret = pkgmgr_pkginfo_is_readonly(handle, &readonly);
+ if (ret < 0) {
+ printf("Failed to get readonly\n");
+ }
+ else
+ printf("Readonly: %d\n", readonly);
+
+ ret = pkgmgr_pkginfo_get_installed_time(handle, &installed_time);
+ if (ret < 0) {
+ printf("Failed to get install time\n");
+ }
+ printf("Install time: %d\n", installed_time);
+
+ pkgmgr_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+
+static int __get_app_info(char *appid)
+{
+ printf("Get App Info Called [%s]\n", appid);
+ char *exec = NULL;
+ char *app_id = NULL;
+ char *apptype = NULL;
+ char *icon = NULL;
+ char *label = NULL;
+ char *package = NULL;
+ pkgmgr_app_component component = 0;
+ bool nodisplay = 0;
+ bool multiple = 0;
+ bool taskmanage = 0;
+ int hwacceleration = 0;
+ bool onboot = 0;
+ bool autorestart = 0;
+ pkgmgr_appinfo_h handle;
+ int ret = -1;
+
+ ret = pkgmgr_appinfo_get_appinfo(appid, &handle);
+ if (ret < 0) {
+ printf("Failed to get handle\n");
+ return -1;
+ }
+
+ ret = pkgmgr_appinfo_get_pkgid(handle, &package);
+ if (ret < 0) {
+ printf("Failed to get package\n");
+ }
+
+ ret = pkgmgr_appinfo_get_appid(handle, &app_id);
+ if (ret < 0) {
+ printf("Failed to get exec\n");
+ }
+
+ ret = pkgmgr_appinfo_get_label(handle, &label);
+ if (ret < 0) {
+ printf("Failed to get label\n");
+ }
+ ret = pkgmgr_appinfo_get_icon(handle, &icon);
+ if (ret < 0) {
+ printf("Failed to get icon\n");
+ }
+
+ ret = pkgmgr_appinfo_get_exec(handle, &exec);
+ if (ret < 0) {
+ printf("Failed to get exec\n");
+ }
+ ret = pkgmgr_appinfo_get_component(handle, &component);
+ if (ret < 0) {
+ printf("Failed to get component\n");
+ }
+ ret = pkgmgr_appinfo_get_apptype(handle, &apptype);
+ if (ret < 0) {
+ printf("Failed to get apptype\n");
+ }
+ ret = pkgmgr_appinfo_is_nodisplay(handle, &nodisplay);
+ if (ret < 0) {
+ printf("Failed to get nodisplay\n");
+ }
+ ret = pkgmgr_appinfo_is_multiple(handle, &multiple);
+ if (ret < 0) {
+ printf("Failed to get multiple\n");
+ }
+ ret = pkgmgr_appinfo_is_taskmanage(handle, &taskmanage);
+ if (ret < 0) {
+ printf("Failed to get taskmanage\n");
+ }
+ ret = pkgmgr_appinfo_get_hwacceleration(handle, &hwacceleration);
+ if (ret < 0) {
+ printf("Failed to get hwacceleration\n");
+ }
+ ret = pkgmgr_appinfo_is_onboot(handle, &onboot);
+ if (ret < 0) {
+ printf("Failed to get onboot\n");
+ }
+ ret = pkgmgr_appinfo_is_autorestart(handle, &autorestart);
+ if (ret < 0) {
+ printf("Failed to get autorestart\n");
+ }
+
+ if (app_id)
+ printf("Appid: %s\n", app_id);
+
+ if (package)
+ printf("Package: %s\n", package);
+
+ if (exec)
+ printf("Exec: %s\n", exec);
+ if (apptype)
+ printf("Apptype: %s\n", apptype);
+
+ if (component == PM_UI_APP) {
+ printf("component: uiapp\n");
+
+ 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);
+ printf("Hw-Acceleration: %d\n", hwacceleration);
+ } else if (component == PM_SVC_APP) {
+ printf("component: svcapp\n");
+
+ if (icon)
+ printf("Icon: %s\n", icon);
+ if (label)
+ printf("Label: %s\n", label);
+
+ printf("Autorestart: %d\n", autorestart);
+ printf("Onboot: %d\n", onboot);
+ } else {
+ printf("Invalid Component Type\n");
+ }
+
+ pkgmgr_appinfo_destroy_appinfo(handle);
+ return 0;
+
+}
+
+static int __check_manifest_validation(char *manifest)
+{
+ int ret = 0;
+ if (manifest == NULL) {
+ printf("Manifest file is NULL\n");
+ return -1;
+ }
+ ret = pkgmgr_parser_check_manifest_validation(manifest);
+ if (ret < 0) {
+ printf("check manifest validation failed\n");
+ return -1;
+ }
+ return 0;
+}
+
+int main(int argc, char *argv[])
+{
+ int ret = -1;
+ char *locale = NULL;
+ locale = vconf_get_str(VCONFKEY_LANGSET);
+ if (locale == NULL) {
+ printf("locale is NULL\n");
+ return -1;
+ }
+ else
+ printf("Locale is %s\n", locale);
+ free(locale);
+ locale = NULL;
+ if (argc == 2) {
+ if (strcmp(argv[1], "--listpkg") == 0) {
+ ret = __get_pkg_list();
+ if (ret == -1) {
+ printf("get pkg list failed\n");
+ return -1;
+ } else {
+ return 0;
+ }
+ } else if (strcmp(argv[1], "--app-flt") == 0) {
+ ret = __add_app_filter();
+ if (ret == -1) {
+ printf("Adding app filter failed\n");
+ return -1;
+ } else {
+ return 0;
+ }
+ } else if (strcmp(argv[1], "--pkg-flt") == 0) {
+ ret = __add_pkg_filter();
+ if (ret == -1) {
+ printf("Adding pkg filter failed\n");
+ return -1;
+ } else {
+ return 0;
+ }
+ } else if (strcmp(argv[1], "--listapp") == 0) {
+ ret = __get_installed_app_list();
+ if (ret == -1) {
+ printf("get installed app list failed\n");
+ return -1;
+ } else {
+ return 0;
+ }
+ } else {
+ __print_usage();
+ return -1;
+ }
+ }
+ if (argc != 3) {
+ __print_usage();
+ return -1;
+ }
+ if (!argv[1] || !argv[2]) {
+ __print_usage();
+ return -1;
+ }
+
+ if (strcmp(argv[1], "--pkg") == 0) {
+ ret = __get_pkg_info(argv[2]);
+ if (ret == -1) {
+ printf("get pkg info failed\n");
+ return -1;
+ }
+ } else if (strcmp(argv[1], "--app") == 0) {
+ ret = __get_app_info(argv[2]);
+ if (ret == -1) {
+ printf("get app info failed\n");
+ return -1;
+ }
+ } else if (strcmp(argv[1], "--list") == 0) {
+ ret = __get_app_list(argv[2]);
+ if (ret == -1) {
+ printf("get app list failed\n");
+ return -1;
+ }
+ } else if (strcmp(argv[1], "--imd") == 0) {
+ ret = __insert_manifest_in_db(argv[2]);
+ if (ret == -1) {
+ printf("insert in db failed\n");
+ return -1;
+ }
+ } else if (strcmp(argv[1], "--rmd") == 0) {
+ ret = __remove_manifest_from_db(argv[2]);
+ if (ret == -1) {
+ printf("remove from db failed\n");
+ return -1;
+ }
+ } else if (strcmp(argv[1], "--setdb") == 0) {
+ ret = __set_pkginfo_in_db(argv[2]);
+ if (ret == -1) {
+ printf("set pkginfo in db failed\n");
+ return -1;
+ }
+ } else if (strcmp(argv[1], "--setcert") == 0) {
+ ret = __set_certinfo_in_db(argv[2]);
+ if (ret == -1) {
+ printf("set certinfo in db failed\n");
+ return -1;
+ }
+ } else if (strcmp(argv[1], "--getcert") == 0) {
+ ret = __get_certinfo_from_db(argv[2]);
+ if (ret == -1) {
+ printf("get certinfo from db failed\n");
+ return -1;
+ }
+ } else if (strcmp(argv[1], "--delcert") == 0) {
+ ret = __del_certinfo_from_db(argv[2]);
+ if (ret == -1) {
+ printf("del certinfo from db failed\n");
+ return -1;
+ }
+ } else if (strcmp(argv[1], "--check") == 0) {
+ ret = __check_manifest_validation(argv[2]);
+ if (ret == -1) {
+ printf("check manifest failed\n");
+ return -1;
+ }
+ } else if (strcmp(argv[1], "--category") == 0) {
+ ret = __get_app_category_list(argv[2]);
+ if (ret == -1) {
+ printf("get app category list failed\n");
+ return -1;
+ }
+ } else if (strcmp(argv[1], "--appcontrol") == 0) {
+ ret = __get_app_control_list(argv[2]);
+ if (ret == -1) {
+ printf("get app control list failed\n");
+ return -1;
+ }
+ } else
+ __print_usage();
+
+ return 0;
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * 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.
+ *
+ */
+
+#define _GNU_SOURCE
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <errno.h>
+
+#include "pkgmgr_parser.h"
+
+#define OWNER_ROOT 0
+#define GROUP_MENU 6010
+#define BUFSZE 1024
+#define OPT_MANIFEST_DIRECTORY "/opt/share/packages"
+#define USR_MANIFEST_DIRECTORY "/usr/share/packages"
+#define PACKAGE_INFO_DB_FILE "/opt/dbspace/.pkgmgr_parser.db"
+
+#ifdef _E
+#undef _E
+#endif
+#define _E(fmt, arg...) fprintf(stderr, "[PKG_INITDB][E][%s,%d] "fmt"\n", __FUNCTION__, __LINE__, ##arg);
+
+#ifdef _D
+#undef _D
+#endif
+#define _D(fmt, arg...) fprintf(stderr, "[PKG_INITDB][D][%s,%d] "fmt"\n", __FUNCTION__, __LINE__, ##arg);
+
+static int initdb_count_package(void)
+{
+ int total = 0;
+
+ return total;
+}
+
+
+
+char* _manifest_to_package(const char* manifest)
+{
+ char *package;
+
+ if(manifest == NULL)
+ return NULL;
+
+ package = strdup(manifest);
+ if(package == NULL)
+ return NULL;
+
+
+ if (!strstr(package, ".xml")) {
+ _E("%s is not a manifest file", manifest);
+ free(package);
+ return NULL;
+ }
+
+ return package;
+}
+
+
+
+int initdb_load_directory(const char *directory)
+{
+ DIR *dir;
+ struct dirent entry, *result;
+ int len, ret;
+ char buf[BUFSZE];
+
+ // desktop file
+ dir = opendir(directory);
+ if (!dir) {
+ if (strerror_r(errno, buf, sizeof(buf)) == 0)
+ _E("Failed to access the [%s] because %s\n", directory, buf);
+ return -1;
+ }
+
+ len = strlen(directory) + 1;
+ _D("Loading manifest files from %s\n", directory);
+
+ for (ret = readdir_r(dir, &entry, &result);
+ ret == 0 && result != NULL;
+ ret = readdir_r(dir, &entry, &result)) {
+ char *manifest;
+
+ if (entry.d_name[0] == '.') continue;
+
+ manifest = _manifest_to_package(entry.d_name);
+ if (!manifest) {
+ _E("Failed to convert file to package[%s]\n", entry.d_name);
+ continue;
+ }
+
+ snprintf(buf, sizeof(buf), "%s/%s", directory, manifest);
+
+ fprintf(stderr, "pkg_initdb : manifest file %s\n", buf);
+
+ ret = pkgmgr_parser_check_manifest_validation(buf);
+ if (ret < 0) {
+ _E("check manifest validation failed code[%d] %s\n", ret, buf);
+ fprintf(stderr, "check manifest validation failed code[%d] %s\n", ret, buf);
+ free(manifest);
+ continue;
+ }
+
+
+ /*temporarily fixed due to glib abort */
+ // pkgmgr_parser_parse_manifest_for_installation(buf, NULL);
+
+ char buf2[BUFSZE];
+ snprintf(buf2, sizeof(buf2), "/usr/bin/pkginfo --imd %s", buf);
+ system(buf2);
+
+ free(manifest);
+ }
+
+ closedir(dir);
+
+ return 0;
+}
+
+
+
+static int initdb_change_perm(const char *db_file)
+{
+ char buf[BUFSZE];
+ char journal_file[BUFSZE];
+ char *files[3];
+ int ret, i;
+
+ files[0] = (char *)db_file;
+ files[1] = journal_file;
+ files[2] = NULL;
+
+ if(db_file == NULL)
+ return -1;
+
+ snprintf(journal_file, sizeof(journal_file), "%s%s", db_file, "-journal");
+
+ for (i = 0; files[i]; i++) {
+ ret = chown(files[i], OWNER_ROOT, GROUP_MENU);
+ if (ret == -1) {
+ strerror_r(errno, buf, sizeof(buf));
+ _E("FAIL : chown %s %d.%d, because %s", db_file, OWNER_ROOT, GROUP_MENU, buf);
+ return -1;
+ }
+
+ ret = chmod(files[i], S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+ if (ret == -1) {
+ strerror_r(errno, buf, sizeof(buf));
+ _E("FAIL : chmod %s 0664, because %s", db_file, buf);
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+
+static int __is_authorized()
+{
+ /* pkg_init db should be called by as root privilege. */
+
+ uid_t uid = getuid();
+ if ((uid_t) 0 == uid)
+ return 1;
+ else
+ return 0;
+}
+
+
+int main(int argc, char *argv[])
+{
+ int ret;
+
+ if (!__is_authorized()) {
+ _E("You are not an authorized user!\n");
+ return -1;
+ }
+
+ ret = initdb_count_package();
+ if (ret > 0) {
+ _D("Some Packages in the Package Info DB.");
+ return 0;
+ }
+
+ ret = initdb_load_directory(OPT_MANIFEST_DIRECTORY);
+ if (ret == -1) {
+ _E("cannot load opt manifest directory.");
+ }
+
+ ret = initdb_load_directory(USR_MANIFEST_DIRECTORY);
+ if (ret == -1) {
+ _E("cannot load usr manifest directory.");
+ }
+
+ ret = initdb_change_perm(PACKAGE_INFO_DB_FILE);
+ if (ret == -1) {
+ _E("cannot chown.");
+ return -1;
+ }
+
+ return 0;
+}
+
+
#include <string.h>
#include <unistd.h>
+#include <appcore-efl.h>
+#include <glib.h>
+
+
#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);
errno = 0;
- *mime_type = (char *)bundle_get_val(b, KEY_MIME_TYPE);
- *file_path = (char *)bundle_get_val(b, KEY_MIME_CONTENT);
+ 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 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;
+ char *extension;
if (__parse_argv(argc, argv, &mime_type, &file_path)) {
fprintf(stderr, "Failed to parse argv!\n");
return -1;
}
- const char *extension = __get_ext_from_file_path(file_path);
+ extension = __get_ext_from_file_path(file_path);
- int req_id;
+ memset(&ad, 0x0, sizeof(struct appdata));
+ ops.data = &ad;
+ ad.file_path = file_path;
+ ad.extension = extension;
- pkgmgr_client *pc = pkgmgr_client_new(PC_REQUEST);
- req_id = pkgmgr_client_install(pc, extension, NULL, file_path, NULL,
- PM_DEFAULT, NULL, NULL);
- pkgmgr_client_free(pc);
- sleep(2);
- /* Wait until AULD(launchpad) retrives info of this process.
- Its timeout is 1.2s. */
+ int pid = fork();
+ if (pid == 0) {
+ int req_id;
+ pkgmgr_client *pc = pkgmgr_client_new(PC_REQUEST);
+ req_id = pkgmgr_client_install(pc, extension, NULL, file_path, NULL,
+ PM_DEFAULT, NULL, NULL);
+ pkgmgr_client_free(pc);
- return 0;
+ 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);
}
#endif
typedef void (*_pkg_plugin_unload) (void);
-typedef int (*_pkg_plugin_pkg_is_installed) (const char *pkg_name);
+typedef int (*_pkg_plugin_pkg_is_installed) (const char *pkgid);
typedef int (*_pkg_plugin_get_installed_pkg_list) (const char *category,
const char *option,
package_manager_pkg_info_t
**list, int *count);
-typedef int (*_pkg_plugin_get_pkg_detail_info) (const char *pkg_name,
+typedef int (*_pkg_plugin_get_pkg_detail_info) (const char *pkgid,
package_manager_pkg_detail_info_t
*pkg_detail_info);
typedef int (*_pkg_plugin_get_pkg_detail_info_from_package) (const char
typedef struct _package_manager_pkg_info_t {
char pkg_type[PKG_TYPE_STRING_LEN_MAX];
char pkg_name[PKG_NAME_STRING_LEN_MAX];
+ char pkgid[PKG_NAME_STRING_LEN_MAX];
char version[PKG_VERSION_STRING_LEN_MAX];
struct _package_manager_pkg_info_t *next;
} package_manager_pkg_info_t;
typedef struct _package_manager_pkg_detail_info_t {
char pkg_type[PKG_TYPE_STRING_LEN_MAX];
char pkg_name[PKG_NAME_STRING_LEN_MAX];
+ char pkgid[PKG_NAME_STRING_LEN_MAX];
char version[PKG_VERSION_STRING_LEN_MAX];
char pkg_description[PKG_VALUE_STRING_LEN_MAX];
char min_platform_version[PKG_VERSION_STRING_LEN_MAX];