${INSTALLER_JOBS}/widget_install/task_update_files.cpp
${INSTALLER_JOBS}/widget_install/task_remove_backup.cpp
${INSTALLER_JOBS}/widget_install/task_encrypt_resource.cpp
- ${INSTALLER_JOBS}/widget_install/task_certificates.cpp
${INSTALLER_JOBS}/widget_install/task_prepare_reinstall.cpp
+ ${INSTALLER_JOBS}/widget_install/task_pkg_info_update.cpp
${INSTALLER_JOBS}/widget_install/widget_security.cpp
${INSTALLER_JOBS}/widget_install/widget_update_info.cpp
${INSTALLER_JOBS}/widget_install/directory_api.cpp
#include <widget_install/task_database.h>
#include <widget_install/task_remove_backup.h>
#include <widget_install/task_encrypt_resource.h>
-#include <widget_install/task_certificates.h>
+#include <widget_install/task_pkg_info_update.h>
#include <widget_install/task_commons.h>
#include <widget_install/task_prepare_reinstall.h>
{
AddTask(new TaskInstallOspsvc(m_installerContext));
}
- AddTask(new TaskCertificates(m_installerContext));
AddTask(new TaskDatabase(m_installerContext));
AddTask(new TaskAceCheck(m_installerContext));
AddTask(new TaskSmack(m_installerContext));
+ AddTask(new TaskPkgInfoUpdate(m_installerContext));
} else if (result == ConfigureResult::Updated) {
LogDebug("Configure installation updated");
LogDebug("Widget Update");
{
AddTask(new TaskInstallOspsvc(m_installerContext));
}
- AddTask(new TaskCertificates(m_installerContext));
AddTask(new TaskDatabase(m_installerContext));
AddTask(new TaskAceCheck(m_installerContext));
//TODO: remove widgetHandle from this task and move before database task
// Any error in acecheck while update will break widget
AddTask(new TaskSmack(m_installerContext));
AddTask(new TaskRemoveBackupFiles(m_installerContext));
+ AddTask(new TaskPkgInfoUpdate(m_installerContext));
} else {
// Installation is not allowed to proceed due to widget update policy
LogWarning("Configure installation failed!");
{
AddStep(&TaskInstallOspsvc::StartStep);
AddStep(&TaskInstallOspsvc::StepInstallOspService);
- AddStep(&TaskInstallOspsvc::StepUpdateManifestFile);
AddStep(&TaskInstallOspsvc::EndStep);
}
pclose(fd);
}
-void TaskInstallOspsvc::StepUpdateManifestFile()
-{
- std::string pkgid = DPL::ToUTF8String(m_context.widgetConfig.tzPkgid);
- pkgmgrinfo_pkginfo_h handle;
-
- LogDebug("StepUpdateManifestFile");
- std::ostringstream manifest_file;
- if (m_context.mode.rootPath == InstallMode::RootPath::RO) {
- manifest_file << "/usr/share/packages/"; //TODO constant with path
- } else {
- manifest_file << "/opt/share/packages/"; //TODO constant with path
- }
- manifest_file << pkgid;
- manifest_file << ".xml";
- LogDebug("manifest file : " << manifest_file.str());
-
- int code = pkgmgr_parser_parse_manifest_for_upgrade(
- manifest_file.str().c_str(), NULL);
-
- if (code != 0) {
- LogError("Manifest parser error: " << code);
- }
-}
-
void TaskInstallOspsvc::StartStep()
{
LogDebug("--------- <TaskInstallOspsvc> : START ----------");
InstallerContext &m_context;
void StepInstallOspService();
- void StepUpdateManifestFile();
void StepAbortInstall();
AddStep(&TaskManifestFile::stepCopyLiveboxFiles);
AddStep(&TaskManifestFile::stepCreateExecFile);
AddStep(&TaskManifestFile::stepGenerateManifest);
- AddStep(&TaskManifestFile::stepParseManifest);
AddAbortStep(&TaskManifestFile::stepAbortIconFiles);
} else {
AddStep(&TaskManifestFile::stepCopyLiveboxFiles);
AddStep(&TaskManifestFile::stepCreateExecFile);
AddStep(&TaskManifestFile::stepGenerateManifest);
- AddStep(&TaskManifestFile::stepParseManifest);
-
- AddAbortStep(&TaskManifestFile::stepAbortParseManifest);
}
}
commit_manifest = destFile.str();
LogDebug("Commiting manifest file : " << commit_manifest);
- m_context.job->UpdateProgress(
- InstallerContext::INSTALL_CREATE_MANIFEST,
- "Widget Manifest Creation Finished");
-}
-
-void TaskManifestFile::stepParseManifest()
-{
- int code = 0;
- char* updateTags[3] = {NULL, };
-
- if (!m_context.mode.removable) {
- updateTags[0] = "preload=false";
- updateTags[1] = "removable=false";
- updateTags[2] = NULL;
-
- }
-
commitManifest();
- if (m_context.isUpdateMode || (
- m_context.mode.rootPath == InstallMode::RootPath::RO
- && m_context.mode.installTime == InstallMode::InstallTime::PRELOAD
- && m_context.mode.extension == InstallMode::ExtensionType::DIR)) {
-
- if (m_context.widgetConfig.packagingType != PKG_TYPE_HYBRID_WEB_APP) {
- code = pkgmgr_parser_parse_manifest_for_upgrade(
- commit_manifest.c_str(), (updateTags[0] == NULL) ? NULL : updateTags);
-
- if (code != 0) {
- LogError("Manifest parser error: " << code);
- ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
- }
- }
- } else {
- code = pkgmgr_parser_parse_manifest_for_installation(
- commit_manifest.c_str(), (updateTags[0] == NULL) ? NULL : updateTags);
-
- if (code != 0) {
- LogError("Manifest parser error: " << code);
- ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
- }
- }
-
m_context.job->UpdateProgress(
- InstallerContext::INSTALL_CREATE_MANIFEST,
- "Widget Manifest Parsing Finished");
- LogDebug("Manifest parsed");
+ InstallerContext::INSTALL_CREATE_MANIFEST,
+ "Widget Manifest Creation Finished");
}
void TaskManifestFile::commitManifest()
}
}
-void TaskManifestFile::stepAbortParseManifest()
-{
- LogError("[Parse Manifest] Abroting....");
-
- int code = pkgmgr_parser_parse_manifest_for_uninstallation(
- DPL::ToUTF8String(manifest_file).c_str(), NULL);
-
- if (0 != code) {
- LogWarning("Manifest parser error: " << code);
- ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
- }
- int ret = unlink(DPL::ToUTF8String(manifest_file).c_str());
- if (0 != ret) {
- LogWarning("No manifest file found: " << manifest_file);
- }
-}
-
void TaskManifestFile::setLiveBoxInfo(Manifest& manifest)
{
FOREACH(it, m_context.widgetConfig.configInfo.m_livebox) {
void stepCopyIconFiles();
void stepCopyLiveboxFiles();
void stepGenerateManifest();
- void stepParseManifest();
- void stepParseUpgradedManifest();
void stepAbortParseManifest();
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * @file task_certificates.cpp
- * @author Leerang Song(leerang.song@samsung.com)
+/**
+ * @file task_pkg_info_update.cpp
+ * @author Soyoung Kim (sy037.kim@samsung.com)
* @version 1.0
- * @brief Implementation file for installer task certificates
+ * @brief Implementation file for installer task information about package
+ * update
*/
-#include <widget_install/task_certificates.h>
-#include <widget_install/widget_install_context.h>
-#include <widget_install/widget_install_errors.h>
-#include <widget_install/job_widget_install.h>
-#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
-#include <pkgmgr_installer.h>
-#include <vcore/CryptoHash.h>
+#include "task_pkg_info_update.h"
+#include <unistd.h>
+#include <string>
+
+#include <fstream>
#include <dpl/log/log.h>
-#include <dlog.h>
-#include <sstream>
+#include <dpl/wrt-dao-ro/global_config.h>
#include <dpl/foreach.h>
#include <dpl/sstream.h>
+#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+#include <pkgmgr_installer.h>
+#include <pkgmgr/pkgmgr_parser.h>
+#include <pkgmgr-info.h>
+#include <vcore/CryptoHash.h>
+
+#include <widget_install/job_widget_install.h>
+#include <widget_install/widget_install_context.h>
+#include <widget_install/widget_install_errors.h>
using namespace WrtDB;
+namespace {
+}
+
namespace Jobs {
namespace WidgetInstall {
-TaskCertificates::TaskCertificates(InstallerContext& context) :
- DPL::TaskDecl<TaskCertificates>(this),
- m_context(context),
- m_pkgHandle(NULL)
+TaskPkgInfoUpdate::TaskPkgInfoUpdate(InstallerContext& context) :
+ DPL::TaskDecl<TaskPkgInfoUpdate>(this),
+ m_context(context)
+{
+ AddStep(&TaskPkgInfoUpdate::StartStep);
+ AddStep(&TaskPkgInfoUpdate::StepPkgInfo);
+ AddStep(&TaskPkgInfoUpdate::StepSetCertiInfo);
+ AddStep(&TaskPkgInfoUpdate::EndStep);
+ AddStep(&TaskPkgInfoUpdate::StepSetEndofInstallation);
+
+ AddAbortStep(&TaskPkgInfoUpdate::StepAbortCertiInfo);
+ AddAbortStep(&TaskPkgInfoUpdate::stepAbortParseManifest);
+}
+
+void TaskPkgInfoUpdate::StepPkgInfo()
{
- AddStep(&TaskCertificates::StartStep);
- AddStep(&TaskCertificates::StepSetCertiInfo);
- AddStep(&TaskCertificates::EndStep);
- AddAbortStep(&TaskCertificates::StepAbortCertiInfo);
+ int code = 0;
+ char* updateTags[3] = {NULL, };
+
+ if (!m_context.mode.removable) {
+ updateTags[0] = "preload=false";
+ updateTags[1] = "removable=false";
+ updateTags[2] = NULL;
+
+ }
+
+ if (m_context.mode.rootPath == InstallMode::RootPath::RO) {
+ m_manifest += "/usr/share/packages/";
+ } else {
+ m_manifest += "/opt/share/packages/";
+ }
+ m_manifest += DPL::ToUTF8String(m_context.widgetConfig.tzPkgid) + ".xml";
+ LogDebug("manifest file : " << m_manifest);
+
+ if (m_context.isUpdateMode || (
+ m_context.mode.rootPath == InstallMode::RootPath::RO
+ && m_context.mode.installTime == InstallMode::InstallTime::PRELOAD
+ && m_context.mode.extension == InstallMode::ExtensionType::DIR)) {
+
+ if (m_context.widgetConfig.packagingType != PKG_TYPE_HYBRID_WEB_APP) {
+ code = pkgmgr_parser_parse_manifest_for_upgrade(
+ m_manifest.c_str(), (updateTags[0] == NULL) ? NULL : updateTags);
+
+ if (code != 0) {
+ LogError("Manifest parser error: " << code);
+ ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
+ }
+ }
+ } else {
+ code = pkgmgr_parser_parse_manifest_for_installation(
+ m_manifest.c_str(), (updateTags[0] == NULL) ? NULL : updateTags);
+
+ if (code != 0) {
+ LogError("Manifest parser error: " << code);
+ ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
+ }
+ }
+
+ m_context.job->UpdateProgress(
+ InstallerContext::INSTALL_PKGINFO_UPDATE,
+ "Manifest Update Finished");
+ LogDebug("Manifest parsed");
}
-void TaskCertificates::StepSetCertiInfo()
+void TaskPkgInfoUpdate::StepSetCertiInfo()
{
LogDebug("StepSetCertiInfo");
}
}
-void TaskCertificates::SetCertiInfo(CertificateSource source)
+void TaskPkgInfoUpdate::SetCertiInfo(int source)
{
LogDebug("Set CertiInfo to pkgmgr : " << source);
CertificateChainList certificateChainList;
- m_context.widgetSecurity.getCertificateChainList(certificateChainList, source);
+ m_context.widgetSecurity.getCertificateChainList(certificateChainList,
+ (CertificateSource)source);
FOREACH(it, certificateChainList)
{
}
}
-void TaskCertificates::StepAbortCertiInfo()
+void TaskPkgInfoUpdate::StepAbortCertiInfo()
{
if ((pkgmgr_installer_delete_certinfo(
const_cast<char*>(DPL::ToUTF8String(
}
}
-void TaskCertificates::StartStep()
+void TaskPkgInfoUpdate::StartStep()
{
- LogDebug("--------- <TaskCertificates> : START ----------");
+ LogDebug("--------- <TaskPkgInfoUpdate> : START ----------");
}
-void TaskCertificates::EndStep()
+void TaskPkgInfoUpdate::EndStep()
{
m_context.job->UpdateProgress(
InstallerContext::INSTALL_SET_CERTINFO,
"Save certinfo to pkgmgr");
- LogDebug("--------- <TaskCertificates> : END ----------");
+ LogDebug("--------- <TaskPkgInfoUpdate> : END ----------");
}
+
+void TaskPkgInfoUpdate::stepAbortParseManifest()
+{
+ LogError("[Parse Manifest] Abroting....");
+
+ int code = pkgmgr_parser_parse_manifest_for_uninstallation(
+ m_manifest.c_str(), NULL);
+
+ if (0 != code) {
+ LogWarning("Manifest parser error: " << code);
+ ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
+ }
+ int ret = unlink(m_manifest.c_str());
+ if (0 != ret) {
+ LogWarning("No manifest file found: " << m_manifest);
+ }
+}
+
+void TaskPkgInfoUpdate::StepSetEndofInstallation()
+{
+ m_context.job->UpdateProgress(
+ InstallerContext::INSTALL_END,
+ "End installation");
+}
+
} //namespace WidgetInstall
} //namespace Jobs
* limitations under the License.
*/
/*
- * @file task_certificates.h
- * @author Leerang Song(leerang.song@samsung.com)
- * @version 1.0
- * @brief Header file for installer task certificates
+ * @file task_pkg_info_update.h
+ * @author soyoung kim (sy037.kim@samsung.com)
+ * @version 1.0
*/
-#ifndef INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_CERTIFICATES_H
-#define INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_CERTIFICATES_H
-#include <dpl/task.h>
-#include <dpl/event/inter_context_delegate.h>
-#include <dpl/foreach.h>
-#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+#ifndef SRC_JOBS_WIDGET_INSTALL_TASK_PKG_INFO_UPDATE_H_
+#define SRC_JOBS_WIDGET_INSTALL_TASK_PKG_INFO_UPDATE_H_
+#include <dpl/task.h>
+#include <string>
#include <pkgmgr_installer.h>
-using namespace WrtDB;
class InstallerContext;
namespace Jobs {
namespace WidgetInstall {
-class TaskCertificates :
- public DPL::TaskDecl<TaskCertificates>,
- public DPL::Event::ICDelegateSupport<TaskCertificates>
+class TaskPkgInfoUpdate : public DPL::TaskDecl<TaskPkgInfoUpdate>
{
private:
- InstallerContext& m_context;
+ // Installation context
+ InstallerContext &m_context;
+ void StepPkgInfo();
void StepSetCertiInfo();
+ void SetCertiInfo(int source);
+ void StepSetEndofInstallation();
+
+ void stepAbortParseManifest();
void StepAbortCertiInfo();
- void SetCertiInfo(CertificateSource source);
void StartStep();
void EndStep();
pkgmgr_instcertinfo_h m_pkgHandle;
+ std::string m_manifest;
public:
- TaskCertificates(InstallerContext& context);
+ explicit TaskPkgInfoUpdate(InstallerContext &installerContext);
};
-} //namespace WidgetInstall
-} //namespace Jobs
-
-#endif /* INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_CERTIFICATES_H */
+} // namespace WidgetInstall
+} // namespace Jobs
+#endif /* SRC_JOBS_WIDGET_INSTALL_TASK_PKG_INFO_UPDATE_H_ */
void TaskSmack::EndStep()
{
- m_context.job->UpdateProgress(
- InstallerContext::INSTALL_END,
- "End installation");
-
LogDebug("--------- <TaskSmack> : END ----------");
}
} //namespace WidgetInstall
INSTALL_CREATE_EXECFILE,
INSTALL_CREATE_MANIFEST,
INSTALL_INSTALL_OSPSVC,
- INSTALL_SET_CERTINFO,
INSTALL_NEW_DB_INSERT,
INSTALL_ACE_PREPARE,
INSTALL_ACE_CHECK,
INSTALL_SMACK_ENABLE,
+ INSTALL_PKGINFO_UPDATE,
+ INSTALL_SET_CERTINFO,
INSTALL_END
} InstallStep;