return mfx;
}
+API int pkgmgr_parser_usr_update_tep(const char *pkgid, const char *tep_path, uid_t uid)
+{
+ return pkgmgr_parser_update_tep_info_in_usr_db(pkgid, tep_path, uid);
+}
+
+API int pkgmgr_parser_update_tep(const char *pkgid, const char *tep_path)
+{
+ return pkgmgr_parser_update_tep_info_in_db(pkgid, tep_path);
+}
+
DEPRECATED API int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char *const tagv[])
{
retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
int pkgmgr_parser_process_usr_manifest_x_for_installation(manifest_x* mfx, const char *manifest, uid_t uid);
/**
+ * @fn int pkgmgr_parser_update_tep(const char* pkgid, const char * tep_path)
+ * @fn int pkgmgr_parser_usr_update_tep(const char* pkgid, const char* tep_path, uid_t uid)
+ * @brief This API updates tep path information stored in DB.
+ *
+ * @par This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] pkgid pointer to package ID
+ * @param[in]tep_path pointer to path of TEP file
+ * @param[in] uid the addressee user id of the instruction
+ * @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 None
+ * @post None
+ * @code
+static int update_tep_info_for_upgrade(const char *pkgid, const char *tep_path)
+{
+ int ret = 0;
+ ret = pkgmgr_parser_update_tep(pkgid, tep_path);
+ if (ret)
+ return -1;
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgr_parser_update_tep(const char* pkgid, const char* tep_path);
+int pkgmgr_parser_usr_update_tep(const char* pkgid, const char* tep_path, uid_t uid);
+
+/**
* @fn int pkgmgr_parser_parse_usr_manifest_for_upgrade(const char *manifest, uid_t uid, char *const tagv[])
* @fn int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *const tagv[])
* @brief This API parses the manifest file of the package after upgrade and stores the data in DB.
return ret;
}
+API int pkgmgr_parser_update_tep_info_in_db(const char *pkgid, const char *tep_path)
+{
+ return pkgmgr_parser_update_tep_info_in_usr_db(pkgid, tep_path, _getuid());
+}
+
+API int pkgmgr_parser_update_tep_info_in_usr_db(const char *pkgid, const char *tep_path, uid_t uid)
+{
+ if (pkgid == NULL || tep_path == NULL) {
+ _LOGE("invalid parameter");
+ return -1;
+ }
+
+ int ret = -1;
+ char *query = NULL;
+
+ ret = pkgmgr_parser_check_and_create_db(uid);
+ if (ret == -1) {
+ _LOGD("Failed to open DB\n");
+ return ret;
+ }
+ ret = pkgmgr_parser_initialize_db(uid);
+ if (ret == -1)
+ goto err;
+
+ /*Begin transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGD("Failed to begin transaction\n");
+ ret = -1;
+ goto err;
+ }
+ _LOGD("Transaction Begin\n");
+
+
+ /* Updating TEP info in "package_info" table */
+ query = sqlite3_mprintf("UPDATE package_info "\
+ "SET package_tep_name = %Q "\
+ "WHERE package = %Q", tep_path, pkgid);
+
+ ret = __exec_query(query);
+ sqlite3_free(query);
+ if (ret != SQLITE_OK) {
+ ret = PM_PARSER_R_ERROR;
+ _LOGE("sqlite exec failed to insert entries into package_info!!");
+ goto err;
+ }
+
+ /* Updating TEP info in "package_app_info" table */
+ query = sqlite3_mprintf("UPDATE package_app_info "\
+ "SET app_tep_name = %Q "\
+ "WHERE package = %Q", tep_path, pkgid);
+
+ ret = __exec_query(query);
+ sqlite3_free(query);
+ if (ret != SQLITE_OK) {
+ ret = PM_PARSER_R_ERROR;
+ _LOGE("sqlite exec failed to insert entries into package_app_info!!");
+ goto err;
+ }
+
+ /*Commit transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "COMMIT", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("Failed to commit transaction, Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("Failed to Rollback\n");
+
+ ret = PM_PARSER_R_ERROR;
+ goto err;
+ }
+ _LOGD("Transaction Commit and End\n");
+ ret = PM_PARSER_R_OK;
+
+err:
+ pkgmgr_parser_close_db();
+ return ret;
+}
+
+
API int pkgmgr_parser_update_manifest_info_in_usr_db(manifest_x *mfx, uid_t uid)
{
if (mfx == NULL) {