+ * @fn int pkgmgrinfo_pkginfo_foreach_dependency(pkgmgrinfo_pkginfo_h handle,
+ pkgmgrinfo_pkg_dependency_list_cb dependency_cb,
+ void *user_data);
+ * @brief This API gets the list of dependency of a particular package
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in] handle pointer to the package info handle.
+ * @param[in] dependency_cb callback function for list
+ * @param[in] user_data user data to be passed to callback function
+ * @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_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @code
+int dependency_cb(const char *from const char *to, const char *type,
+ const char *required_version,void *user_data)
+{
+ printf("this package %s %s", type, to);
+ if (required_version)
+ printf("required version : %s", required_version);
+ return 0;
+}
+
+static int list_dependency(const char *package)
+{
+ int ret = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_foreach_dependency(handle, dependency_cb, NULL);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_foreach_dependency(pkgmgrinfo_pkginfo_h handle,
+ pkgmgrinfo_pkg_dependency_list_cb dependency_cb,
+ void *user_data);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_foreach_depends_on(pkgmgrinfo_pkginfo_h handle,
+ pkgmgrinfo_pkg_dependency_list_cb dependency_cb,
+ void *user_data);
+ * @brief This API gets the list of packages which has dependency directly
+ * and indirectly of a particular package
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in] handle pointer to the package info handle.
+ * @param[in] dependency_cb callback function for list
+ * @param[in] user_data user data to be passed to callback function
+ * @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_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @code
+int dependency_cb(const char *from, const char *to, const char *type,
+ const char *required_version,void *user_data)
+{
+ printf("%s %s %s package", from, to, type);
+ if (required_version)
+ printf("required version : %s", required_version);
+ return 0;
+}
+
+static int list_depends_on(const char *package)
+{
+ int ret = 0;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_foreach_depends_on(handle, dependency_cb, NULL);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode