const unsigned char **icon, size_t *size);
/**
+ * @fn int pkgmgrinfo_archiveinfo_foreach_dependency(pkgmgrinfo_archiveinfo_h handle, pkgmgrinfo_dependency_cb callback, void *user_data)
+ * @brief This API retrieve the dependency information and invoke given callback for it.
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package archive info handle
+ * @param[in] callback callback to be invoked for each retrieved dependency information
+ * @param[in] user_data user data to be passed to callback
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @pre pkgmgrinfo_archiveinfo_get_archiveinfo()
+ * @post pkgmgrinfo_archiveinfo_destroy_archiveinfo()
+ * @code
+static int get_pkg_archive_dependency(const char *path, pkgmgrinfo_pkg_dependency_list_cb callback)
+{
+ int ret = 0;
+ size_t icon_size = 0;
+ pkgmgrinfo_archiveinfo_h handle;
+ ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_archiveinfo_foreach_dependency(handle, callback, NULL);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_archiveinfo_foreach_dependency(pkgmgrinfo_archiveinfo_h handle,
+ pkgmgrinfo_pkg_dependency_list_cb callback, void *user_data);
+
+/**
* @pkgmgrinfo client API end
**/
/**
* @fn int (*pkgmgrinfo_pkg_dependency_list_cb) (const char *from, const char *to, const char *type, const char *required_version, void *user_data)
*
- * @brief Specifies the dependency info of given package passed to pkgmgrinfo_pkginfo_foreach_dependency() or pkgmgrinfo_pkginfo_foreach_required_by()
+ * @brief Specifies the dependency info of given package passed to pkgmgrinfo_pkginfo_foreach_dependency(), pkgmgrinfo_pkginfo_foreach_required_by(), pkgmgrinfo_archiveinfo_foreach_dependency()
*
* @param[in] from the pkgid which depends other package
* @param[in] to the pkgid which has dependency with given package
const char *indicatordisplay, const char *operation,
const char *color_depth, void *user_data);
+
+
/**
* @brief Install Location Types
*/
}
free(info->icon_buf);
+ g_list_free_full(info->privilege_list, free);
+ g_list_free_full(info->dependency_list, free);
free(info);
return PMINFO_R_OK;
return PMINFO_R_OK;
}
+
+API int pkgmgrinfo_archiveinfo_foreach_dependency(
+ pkgmgrinfo_archiveinfo_h handle,
+ pkgmgrinfo_pkg_dependency_list_cb callback, void *user_data)
+{
+ GList *tmp;
+ pkg_dependency_info_t *dependency_info;
+ package_manager_pkg_detail_info_t *info =
+ (package_manager_pkg_detail_info_t *)handle;
+
+ if (info == NULL || callback == NULL) {
+ _LOGE("invalid parameter");
+ return PMINFO_R_EINVAL;
+ }
+
+ for (tmp = info->dependency_list; tmp != NULL;
+ tmp = g_list_next(tmp)) {
+ dependency_info = (pkg_dependency_info_t *)tmp->data;
+ if (callback(info->pkgid,
+ dependency_info->pkgid,
+ dependency_info->type,
+ dependency_info->required_version,
+ user_data) != 0)
+ return PMINFO_R_ERROR;
+ }
+ return PMINFO_R_OK;
+}
#define PKG_URL_STRING_LEN_MAX 1024
#define PKG_LABEL_STRING_LEN_MAX 128
#define PKG_PATH_STRING_LEN_MAX 512
+#define PKG_DEP_TYPE_STRING_LEN_MAX 128
typedef struct _package_manager_pkg_info_t {
char pkg_type[PKG_TYPE_STRING_LEN_MAX];
struct _package_manager_pkg_info_t *next;
} package_manager_pkg_info_t;
+typedef struct _package_manager_pkg_dependency_info_t {
+ char pkgid[PKG_NAME_STRING_LEN_MAX];
+ char type[PKG_DEP_TYPE_STRING_LEN_MAX];
+ char required_version[PKG_VERSION_STRING_LEN_MAX];
+} pkg_dependency_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 *icon_buf;
int icon_size;
GList *privilege_list;
+ GList *dependency_list;
} package_manager_pkg_detail_info_t;
typedef void (*_pkg_plugin_unload)(void);